[dpkg] 05/187: build: Clean up compiler and linker automatic flag usage

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository dpkg.

commit 4f8bca211cb06db748f418723af68d64e42aa54a
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Aug 25 00:36:31 2016 +0200

    build: Clean up compiler and linker automatic flag usage
    
    Detect if the flags work at configure time, instead of enabling them
    unconditionally. Amend the description so that the above is clear. And
    rename the options so that downstreams realize about the change.
---
 README              |  4 ++--
 configure.ac        |  4 ++--
 debian/changelog    |  1 +
 m4/dpkg-compiler.m4 | 27 ++++++++++++++-------------
 m4/dpkg-linker.m4   | 26 ++++++++++++++++----------
 5 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/README b/README
index c4ed594..a4cdd4d 100644
--- a/README
+++ b/README
@@ -118,5 +118,5 @@ programs:
 And the following to disable modifications to the build flags:
 
   --disable-compiler-warnings
-  --disable-compiler-optimisations
-  --disable-linker-optimisations
+  --disable-compiler-optimizations
+  --disable-linker-optimizations
diff --git a/configure.ac b/configure.ac
index 3123d0c..7f22d8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,8 +132,8 @@ DPKG_MMAP
 # Checks for the build machinery.
 AC_DEFINE(LIBDPKG_VOLATILE_API, 1, [Acknowledge the volatility of the API.])
 DPKG_COMPILER_WARNINGS
-DPKG_COMPILER_OPTIMISATIONS
-DPKG_LINKER_OPTIMISATIONS
+DPKG_COMPILER_OPTIMIZATIONS
+DPKG_LINKER_OPTIMIZATIONS
 DPKG_ARCHITECTURE
 AC_DEFINE([PACKAGE_RELEASE], [PACKAGE_VERSION " (" ARCHITECTURE ")"],
           [Define the project release information, version and architecture])
diff --git a/debian/changelog b/debian/changelog
index 9d9ecf6..53ea959 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
   [ Guillem Jover ]
   * Build system:
     - Add support for profiling perl modules.
+    - Clean up compiler and linker automatic flag usage in configure.
 
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).
diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4
index b9a278d..15ff569 100644
--- a/m4/dpkg-compiler.m4
+++ b/m4/dpkg-compiler.m4
@@ -1,5 +1,5 @@
 # Copyright © 2004 Scott James Remnant <scott at netsplit.com>
-# Copyright © 2006,2009-2011,2013-2015 Guillem Jover <guillem at debian.org>
+# Copyright © 2006, 2009-2011, 2013-2016 Guillem Jover <guillem at debian.org>
 
 # DPKG_CHECK_COMPILER_FLAG
 # ------------------------
@@ -84,7 +84,7 @@ AC_DEFUN([DPKG_CHECK_COMPILER_WARNINGS], [
 AC_DEFUN([DPKG_COMPILER_WARNINGS], [
   AC_ARG_ENABLE([compiler-warnings],
     AS_HELP_STRING([--disable-compiler-warnings],
-                   [Disable additional compiler warnings]),
+                   [Disable (detected) additional compiler warnings]),
     [],
     [enable_compiler_warnings=yes]
   )
@@ -100,17 +100,18 @@ AC_DEFUN([DPKG_COMPILER_WARNINGS], [
   fi
 ])
 
-# DPKG_COMPILER_OPTIMISATIONS
-# --------------------------
-# Add configure option to disable optimisations.
-AC_DEFUN([DPKG_COMPILER_OPTIMISATIONS],
-[AC_ARG_ENABLE(compiler-optimisations,
-	AS_HELP_STRING([--disable-compiler-optimisations],
-		       [Disable compiler optimisations]),
-	[],
-	[enable_compiler_optimisations=yes])
-
-  AS_IF([test "x$enable_compiler_optimisations" = "xno"], [
+# DPKG_COMPILER_OPTIMIZATIONS
+# ---------------------------
+# Add configure option to disable optimizations.
+AC_DEFUN([DPKG_COMPILER_OPTIMIZATIONS], [
+  AC_ARG_ENABLE(compiler-optimizations,
+    AS_HELP_STRING([--disable-compiler-optimizations],
+                   [Disable (detected) compiler optimizations]),
+    [],
+    [enable_compiler_optimizations=yes]
+  )
+
+  AS_IF([test "x$enable_compiler_optimizations" = "xno"], [
     CFLAGS=$(echo "$CFLAGS" | sed -e "s/ -O[[1-9]]*\b/ -O0/g")
   ])
 ])
diff --git a/m4/dpkg-linker.m4 b/m4/dpkg-linker.m4
index 0bf3978..7438a4c 100644
--- a/m4/dpkg-linker.m4
+++ b/m4/dpkg-linker.m4
@@ -1,20 +1,26 @@
 # Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
-# Copyright © 2010, 2014 Guillem Jover <guillem at debian.org>
+# Copyright © 2010, 2014, 2016 Guillem Jover <guillem at debian.org>
 
-# DPKG_LINKER_OPTIMISATIONS
-# --------------------------
-# Add configure option to disable linker optimisations.
-AC_DEFUN([DPKG_LINKER_OPTIMISATIONS],
-[AC_ARG_ENABLE(linker-optimisations,
-	AS_HELP_STRING([--disable-linker-optimisations],
-		       [Disable linker optimisations]),
+# DPKG_LINKER_OPTIMIZATIONS
+# -------------------------
+# Add configure option to disable linker optimizations.
+AC_DEFUN([DPKG_LINKER_OPTIMIZATIONS],
+[
+  AC_ARG_ENABLE([linker-optimizations],
+    AS_HELP_STRING([--disable-linker-optimizations],
+                   [Disable (detected) linker optimizations]),
     [],
-    [enable_linker_optimisations=yes])
+    [enable_linker_optimizations=yes]
+  )
 
-  AS_IF([test "x$enable_linker_optimisations" = "xno"], [
+  AS_IF([test "x$enable_linker_optimizations" = "xno"], [
     LDFLAGS=$(echo "$LDFLAGS" | sed -e "s/ -Wl,-O[[0-9]]*\b//g")
   ], [
+    save_LDFLAGS=$LDFLAGS
     LDFLAGS="$LDFLAGS -Wl,-O1"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+                   [],
+                   [LDFLAGS="$save_LDFLAGS"])
   ])
 ])
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list