summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-07-22 20:22:39 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-07-22 20:22:39 +0000
commite38fe7b4d439e370ed7bcd96854c323753832e19 (patch)
tree9ff5baf77242db7e57a31730679a6018d95e05f0
parent93669765697793fabc9566c12a0da41d396eb7ac (diff)
Fix the configure test for symbol visibility support; the current test
tries to check for an old, known to be flawed, ld version, but the in-tree ld causes a false positive.
-rwxr-xr-xgnu/usr.bin/gcc/gcc/configure2
-rw-r--r--gnu/usr.bin/gcc/gcc/configure.in88
2 files changed, 82 insertions, 8 deletions
diff --git a/gnu/usr.bin/gcc/gcc/configure b/gnu/usr.bin/gcc/gcc/configure
index 1eff0613db0..89ce6cae24d 100755
--- a/gnu/usr.bin/gcc/gcc/configure
+++ b/gnu/usr.bin/gcc/gcc/configure
@@ -7274,6 +7274,7 @@ elif test x$gcc_cv_as != x; then
fi
rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+ if false; then
# GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
# This is irritatingly difficult to feature test for. Look for
# the date string after the version number.
@@ -7307,6 +7308,7 @@ elif test x$gcc_cv_as != x; then
# non-GNU linkers don't seem to support .hidden yet
gcc_cv_as_hidden=no
fi
+ fi
fi
if test x"$gcc_cv_as_hidden" = xyes; then
cat >> confdefs.h <<\EOF
diff --git a/gnu/usr.bin/gcc/gcc/configure.in b/gnu/usr.bin/gcc/gcc/configure.in
index 0f64d07bf85..10748de04f0 100644
--- a/gnu/usr.bin/gcc/gcc/configure.in
+++ b/gnu/usr.bin/gcc/gcc/configure.in
@@ -177,6 +177,42 @@ changequote([, ])dnl
fi
fi
+AC_ARG_WITH(sysroot,
+[ --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
+[
+ case ${with_sysroot} in
+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
+ *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
+ esac
+
+ TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
+
+ if test "x$exec_prefix" = xNONE; then
+ if test "x$prefix" = xNONE; then
+ test_prefix=/usr/local
+ else
+ test_prefix=$prefix
+ fi
+ else
+ test_prefix=$exec_prefix
+ fi
+ case ${TARGET_SYSTEM_ROOT} in
+ "${test_prefix}"|"${test_prefix}/"*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
+ t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
+ TARGET_SYSTEM_ROOT_DEFINE="$t"
+ ;;
+ esac
+], [
+ TARGET_SYSTEM_ROOT=
+ TARGET_SYSTEM_ROOT_DEFINE=
+ CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
+])
+AC_SUBST(TARGET_SYSTEM_ROOT)
+AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
+
# Determine the host, build, and target systems
AC_CANONICAL_SYSTEM
@@ -781,6 +817,19 @@ if test $gcc_cv_type_clock_t = yes; then
[Define if <time.h> defines clock_t.])
fi
+AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
+[AC_TRY_COMPILE([
+#include "ansidecl.h"
+#include "system.h"
+],
+[if ((uchar *)0) return 0;
+ if (sizeof(uchar)) return 0;],
+ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
+if test $ac_cv_type_uchar = yes; then
+ AC_DEFINE(HAVE_UCHAR, 1,
+ [Define if <sys/types.h> provides uchar.])
+fi
+
AC_ARG_ENABLE(initfini-array,
[ --enable-initfini-array use .init_array/.fini_array sections],
gcc_cv_initfinit_array=$enableval, [gcc_AC_INITFINI_ARRAY])
@@ -1214,6 +1263,9 @@ then
| powerpc*-*-*,powerpc64*-*-*)
CROSS="$CROSS -DNATIVE_CROSS" ;;
esac
+elif test "x$TARGET_SYSTEM_ROOT" != x; then
+ # This is just $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)
+ SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)'
fi
# If this is a cross-compiler that does not
@@ -1224,12 +1276,9 @@ fi
# This prevents libgcc2 from containing any code which requires libc
# support.
inhibit_libc=
-if [test x$host != x$target] && [test x$with_headers = x]; then
+if { test x$host != x$target && test "x$with_headers" = x &&
+ test "x$with_sysroot" = x ; } || test x$with_newlib = xyes ; then
inhibit_libc=-Dinhibit_libc
-else
- if [test x$with_newlib = xyes]; then
- inhibit_libc=-Dinhibit_libc
- fi
fi
AC_SUBST(inhibit_libc)
@@ -1256,8 +1305,10 @@ then
HOST_CC='$(CC_FOR_BUILD)'
HOST_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)'
- STMP_FIXINC=
- STMP_FIXPROTO=
+ if test "x$TARGET_SYSTEM_ROOT" = x; then
+ STMP_FIXINC=
+ STMP_FIXPROTO=
+ fi
fi
# Expand extra_headers to include complete path.
@@ -1629,6 +1680,7 @@ elif test x$gcc_cv_as != x; then
fi
rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+ if false; then
# GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
# This is irritatingly difficult to feature test for. Look for
# the date string after the version number.
@@ -1664,6 +1716,7 @@ changequote([,])dnl
# non-GNU linkers don't seem to support .hidden yet
gcc_cv_as_hidden=no
fi
+ fi
fi
if test x"$gcc_cv_as_hidden" = xyes; then
AC_DEFINE(HAVE_GAS_HIDDEN, 1,
@@ -2387,6 +2440,24 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
fi
AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
+AC_MSG_CHECKING(linker --as-needed support)
+gcc_cv_ld_as_needed=no
+if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
+ gcc_cv_ld_as_needed=yes
+ fi
+elif test x$gcc_cv_ld != x; then
+ # Check if linker supports --as-needed and --no-as-needed options
+ if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
+ gcc_cv_ld_as_needed=yes
+ fi
+fi
+if test x"$gcc_cv_ld_as_needed" = xyes; then
+ AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
+[Define if your linker supports --as-needed and --no-as-needed options.])
+fi
+AC_MSG_RESULT($gcc_cv_ld_as_needed)
+
# Miscellaneous target-specific checks.
case "$target" in
mips*-*-*)
@@ -2417,7 +2488,8 @@ case "$target" in
;;
esac
-if test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
+if test x$with_sysroot = x && test x$host = x$target \
+ && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
fi