[Xfce4-commits] <xfce4-dev-tools:master> add XDT_FEATURE_LINKER_OPTS

Brian J. Tarricone noreply at xfce.org
Sat Sep 19 02:20:01 CEST 2009


Updating branch refs/heads/master
         to 1e8476b13f74bc2792a4b8af09d523cb726dffa0 (commit)
       from 104a024b94ae87ee87aedefd21b140505220a2c4 (commit)

commit 1e8476b13f74bc2792a4b8af09d523cb726dffa0
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Fri Sep 18 17:20:18 2009 -0700

    add XDT_FEATURE_LINKER_OPTS

 NEWS                     |    3 +++
 m4macros/xdt-features.m4 |   36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index a4018b3..420a3ad 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@
 - Also support the newer AC_CONFIG_HEADERS macro.
 - Add XDT_FEATURE_VISIBILITY to check for and enable symbol visibility
   support (only useful for building libraries).
+- Add XDT_FEATURE_LINKER_OPTS that checks for and enables useful linker
+  optimizations if supported.  This currently only checks for
+  --as-needed and -O1, but more may be added in the future.
 
 4.7.0
 =====
diff --git a/m4macros/xdt-features.m4 b/m4macros/xdt-features.m4
index c2d2cd5..aacc54c 100644
--- a/m4macros/xdt-features.m4
+++ b/m4macros/xdt-features.m4
@@ -120,7 +120,7 @@ AC_DEFUN([XDT_FEATURE_VISIBILITY],
   AC_ARG_ENABLE([visibility],
                 AC_HELP_STRING([--disable-visibility],
                                [Don't use ELF visibility attributes]),
-                               [], [enable_visibility=yes])
+                [], [enable_visibility=yes])
   have_gnuc_visibility=no
   if test "x$enable_visibility" != "xno"; then
     XDT_SUPPORTED_FLAGS([xdt_vis_test_cflags], [-Wall -Werror -Wno-unused-parameter])
@@ -160,6 +160,40 @@ AC_DEFUN([XDT_FEATURE_VISIBILITY],
   AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test "x$have_gnuc_visibility" = "xyes"])
 ])
 
+dnl XDT_FEATURE_LINKER_OPTS
+dnl
+dnl Checks for and enables any special linker optimizations.
+dnl
+AC_DEFUN([XDT_FEATURE_LINKER_OPTS],
+[
+  AC_ARG_ENABLE([linker-opts],
+                AC_HELP_STRING([--disable-linker-opts],
+                               [Disable linker optimizations])
+                [], [enable_linker_opts=yes])
+
+  if test "x$enable_linker_opts" != "xno"; then
+    AC_MSG_CHECKING([whether $LD accepts --as-needed])
+    case `$LD --as-needed -v 2>&1 </dev/null` in
+    *GNU* | *'with BFD'*)
+      LDFLAGS="$LDFLAGS -Wl,--as-needed"
+      AC_MSG_RESULT([yes])
+      ;;
+    *)
+      AC_MSG_RESULT([no])
+      ;;
+    esac
+    AC_MSG_CHECKING([whether $LD accepts -O1])
+    case `$LD -O1 -v 2>&1 </dev/null` in
+    *GNU* | *'with BFD'*)
+      LDFLAGS="$LDFLAGS -Wl,-O1"
+      AC_MSG_RESULT([yes])
+      ;;
+    *)
+      AC_MSG_RESULT([no])
+      ;;
+    esac
+  fi
+])
 
 dnl BM_DEBUG_SUPPORT()
 dnl



More information about the Xfce4-commits mailing list