BIND 10 trac2356, updated. 18520152ce6097c22024bca864ec53643be3ef84 [2356] try -Wl, -R first to make it safer for build-time failure

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Nov 2 19:57:38 UTC 2012


The branch, trac2356 has been updated
       via  18520152ce6097c22024bca864ec53643be3ef84 (commit)
       via  1f2f8e9d497246e335dcbb9604521eb70ccd4524 (commit)
      from  f2b5789e89f48e5a045f8c921f09b5c3caddea3a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 18520152ce6097c22024bca864ec53643be3ef84
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Nov 2 11:07:55 2012 -0700

    [2356] try -Wl,-R first to make it safer for build-time failure

commit 1f2f8e9d497246e335dcbb9604521eb70ccd4524
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Nov 2 13:58:15 2012 -0400

    [2356] fixed typo: use ISC_RPATH_FLAG instead of hardcoded "-R"

-----------------------------------------------------------------------

Summary of changes:
 examples/m4/ax_isc_bind10.m4 |    2 +-
 examples/m4/ax_isc_rpath.m4  |   35 ++++++++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 12 deletions(-)

-----------------------------------------------------------------------
diff --git a/examples/m4/ax_isc_bind10.m4 b/examples/m4/ax_isc_bind10.m4
index 158f42d..75c37c5 100644
--- a/examples/m4/ax_isc_bind10.m4
+++ b/examples/m4/ax_isc_bind10.m4
@@ -93,7 +93,7 @@ do
 isc::util::OutputBuffer buffer(0);
 ], [BIND10_LDFLAGS="-L${d}"
     if test "x$ISC_RPATH_FLAG" != "x"; then
-       BIND10_RPATH="-R${d}"
+       BIND10_RPATH="${ISC_RPATH_FLAG}${d}"
     fi
     ])
   if test "x$BIND10_LDFLAGS" != "x"; then
diff --git a/examples/m4/ax_isc_rpath.m4 b/examples/m4/ax_isc_rpath.m4
index 253ecdb..91d9b8a 100644
--- a/examples/m4/ax_isc_rpath.m4
+++ b/examples/m4/ax_isc_rpath.m4
@@ -12,22 +12,35 @@ dnl fi
 
 AC_DEFUN([AX_ISC_RPATH], [
 
-# check -R and -Wl,-R rather than gcc specific -rpath to be as portable
-# as possible.
-AC_MSG_CHECKING([whether -R flag is available in linker])
-LDFLAGS_SAVED="$LDFLAGS"
-LDFLAGS="$LDFLAGS -R/usr/lib"
+# We'll tweak both CXXFLAGS and CCFLAGS so this function will work whichever
+# language is used in the main script.  Note also that it's not LDFLAGS;
+# technically this is a linker flag, but we've noticed $LDFLAGS can be placed
+# where the compiler could interpret it as a compiler option, leading to
+# subtle failure mode.  So, in the check below using the compiler flag is
+# safer (in the actual Makefiles the flag should be set in LDFLAGS).
+CXXFLAGS_SAVED="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib"
+CCFLAGS_SAVED="$CCFLAGS"
+CCFLAGS="$CCFLAGS -Wl,-R/usr/lib"
+
+# check -Wl,-R and -R rather than gcc specific -rpath to be as portable
+# as possible.  -Wl,-R seems to be safer, so we try it first.  In some cases
+# -R is not actually recognized but AC_TRY_LINK doesn't fail due to that.
+AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
 AC_TRY_LINK([],[],
     [ AC_MSG_RESULT(yes)
-        ISC_RPATH_FLAG=-R
+        ISC_RPATH_FLAG=-Wl,-R
     ],[ AC_MSG_RESULT(no)
-        AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
-        LDFLAGS="$LDFLAGS_SAVED -Wl,-R"
+        AC_MSG_CHECKING([whether -R flag is available in linker])
+	CXXFLAGS="$CXXFLAGS_SAVED -R"
+	CCFLAGS="$CCFLAGS_SAVED -R"
         AC_TRY_LINK([], [],
-            [ AC_MSG_RESULT(yes)
-                ISC_RPATH_FLAG=-Wl,-R
+            [ AC_MSG_RESULT([yes; note that -R is more sensitive about the position in option arguments])
+                ISC_RPATH_FLAG=-R
             ],[ AC_MSG_RESULT(no) ])
     ])
-LDFLAGS=$LDFLAGS_SAVED
+
+CXXFLAGS=$CXXFLAGS_SAVED
+CCFLAGS=$CCFLAGS_SAVED
 
 ])dnl AX_ISC_RPATH



More information about the bind10-changes mailing list