aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-11-21 12:39:21 -0800
committerH.J. Lu <hjl.tools@gmail.com>2012-11-21 12:39:21 -0800
commitc35d2a3a36ce9dc107dfb8ad39b923f413b813ba (patch)
tree17273b548116623b31fd9a33b1f01abb07cfb47e
parent0fc844f8a771cddcad68c9e58b59e065db032cd3 (diff)
downloadtermbaud-hjl/global.tar.gz
termbaud-hjl/global.tar.xz
termbaud-hjl/global.zip
Use LIBC_LINKER_FEATURE to check -z global supporthjl/global
-rwxr-xr-xconfigure35
-rw-r--r--configure.in17
2 files changed, 22 insertions, 30 deletions
diff --git a/configure b/configure
index 4b23722b56d..e5b1e162b7a 100755
--- a/configure
+++ b/configure
@@ -6560,32 +6560,37 @@ fi
$as_echo "$libc_linker_feature" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z global" >&5
-$as_echo_n "checking for -z global... " >&6; }
-if ${libc_cv_z_global+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat > conftest.c <<EOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z global" >&5
+$as_echo_n "checking for linker that supports -z global... " >&6; }
+libc_linker_feature=no
+if test x"$gnu_ld" = x"yes"; then
+ libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z global"`
+ if test -n "$libc_linker_check"; then
+ cat > conftest.c <<EOF
int _start (void) { return 42; }
EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
- -fPIC -shared -o conftest.so conftest.c
- -Wl,-z,global -nostdlib
- 1>&5'
+ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ -Wl,-z,global -nostdlib -nostartfiles
+ -fPIC -shared -o conftest.so conftest.c
+ 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
-then
+ then
+ libc_linker_feature=yes
+ fi
+ rm -f conftest*
+ fi
+fi
+if test $libc_linker_feature = yes; then
libc_cv_z_global=yes
else
libc_cv_z_global=no
fi
-rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_global" >&5
-$as_echo "$libc_cv_z_global" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
+$as_echo "$libc_linker_feature" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fpie" >&5
diff --git a/configure.in b/configure.in
index 2ec07b1e439..55c46ade928 100644
--- a/configure.in
+++ b/configure.in
@@ -1561,21 +1561,8 @@ LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
[libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
AC_SUBST(libc_cv_z_execstack)
-AC_CACHE_CHECK(for -z global,
- libc_cv_z_global, [dnl
-cat > conftest.c <<EOF
-int _start (void) { return 42; }
-EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
- -fPIC -shared -o conftest.so conftest.c
- -Wl,-z,global -nostdlib
- 1>&AS_MESSAGE_LOG_FD])
-then
- libc_cv_z_global=yes
-else
- libc_cv_z_global=no
-fi
-rm -f conftest*])
+LIBC_LINKER_FEATURE([-z global], [-Wl,-z,global],
+ [libc_cv_z_global=yes], [libc_cv_z_global=no])
AC_SUBST(libc_cv_z_global)
AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl