summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rwxr-xr-xconfigure258
-rw-r--r--configure.ac11
-rw-r--r--debug/Makefile5
-rw-r--r--dlfcn/Makefile9
-rw-r--r--nptl/Makefile13
6 files changed, 216 insertions, 92 deletions
diff --git a/ChangeLog b/ChangeLog
index a5b8fb7a3b..d9a53b43bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2015-03-04 Roland McGrath <roland@hack.frob.com>
+
+ * configure.ac (libc_cv_cxx_link_ok): New check.
+ Reset CXX to empty if it fails to link.
+ * configure: Regenerated.
+ * dlfcn/Makefile (tests, modules-names): Add bug-atexit3 and
+ bug-atexit3-lib only if $(CXX) is nonempty.
+ * nptl/Makefile (tests): Likewise for tst-cancel24.
+ (tests, tests-static): Likewise for tst-cancel24-static.
+ * debug/Makefile (tests): Likewise for tst-chk4, tst-chk5, tst-chk6,
+ tst-lfschk4, tst-lfschk5, and tst-lfschk6.
+
2015-03-04 Andreas Schwab <schwab@suse.de>
[BZ #17631]
diff --git a/configure b/configure
index 7337823652..71cc6bb0b2 100755
--- a/configure
+++ b/configure
@@ -677,10 +677,10 @@ hardcoded_path_in_tests
use_default_link
sysheaders
with_fp
-READELF
ac_ct_CXX
CXXFLAGS
CXX
+READELF
CPP
cross_compiling
BUILD_CC
@@ -1627,6 +1627,52 @@ fi
} # ac_fn_cxx_try_compile
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -2985,6 +3031,99 @@ if test -z "$CPP"; then
CPP="$CC -E"
fi
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
+set dummy ${ac_tool_prefix}readelf; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_READELF+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$READELF"; then
+ ac_cv_prog_READELF="$READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_READELF="${ac_tool_prefix}readelf"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+READELF=$ac_cv_prog_READELF
+if test -n "$READELF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
+$as_echo "$READELF" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_READELF"; then
+ ac_ct_READELF=$READELF
+ # Extract the first word of "readelf", so it can be a program name with args.
+set dummy readelf; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_READELF+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_READELF"; then
+ ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_READELF="readelf"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
+if test -n "$ac_ct_READELF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
+$as_echo "$ac_ct_READELF" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_READELF" = x; then
+ READELF="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ READELF=$ac_ct_READELF
+ fi
+else
+ READELF="$ac_cv_prog_READELF"
+fi
+
+
# We need the C++ compiler only for testing.
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
@@ -3243,98 +3382,49 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
-set dummy ${ac_tool_prefix}readelf; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_READELF+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$READELF"; then
- ac_cv_prog_READELF="$READELF" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_READELF="${ac_tool_prefix}readelf"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
+# It's useless to us if it can't link programs (e.g. missing -lstdc++).
-fi
-fi
-READELF=$ac_cv_prog_READELF
-if test -n "$READELF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
-$as_echo "$READELF" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX can link programs" >&5
+$as_echo_n "checking whether $CXX can link programs... " >&6; }
+if ${libc_cv_cxx_link_ok+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-fi
-if test -z "$ac_cv_prog_READELF"; then
- ac_ct_READELF=$READELF
- # Extract the first word of "readelf", so it can be a program name with args.
-set dummy readelf; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_READELF+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_READELF"; then
- ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_READELF="readelf"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
+int
+main ()
+{
-fi
-fi
-ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
-if test -n "$ac_ct_READELF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
-$as_echo "$ac_ct_READELF" >&6; }
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ libc_cv_cxx_link_ok=yes
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ libc_cv_cxx_link_ok=no
fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
- if test "x$ac_ct_READELF" = x; then
- READELF="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- READELF=$ac_ct_READELF
- fi
-else
- READELF="$ac_cv_prog_READELF"
fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cxx_link_ok" >&5
+$as_echo "$libc_cv_cxx_link_ok" >&6; }
+if test $libc_cv_cxx_link_ok != yes; then :
+ CXX=
+fi
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index 8043a27c3f..678c7399ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,9 +50,18 @@ if test $host != $build; then
fi
AC_SUBST(cross_compiling)
AC_PROG_CPP
+AC_CHECK_TOOL(READELF, readelf, false)
+
# We need the C++ compiler only for testing.
AC_PROG_CXX
-AC_CHECK_TOOL(READELF, readelf, false)
+# It's useless to us if it can't link programs (e.g. missing -lstdc++).
+AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
+AC_LANG_PUSH([C++])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [libc_cv_cxx_link_ok=yes],
+ [libc_cv_cxx_link_ok=no])
+AC_LANG_POP([C++])])
+AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
AC_MSG_ERROR([you must configure in a separate build directory])
diff --git a/debug/Makefile b/debug/Makefile
index 2db5e202ae..c775223ef2 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -133,10 +133,13 @@ LDFLAGS-tst-backtrace6 = -rdynamic
tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
- tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
tst-backtrace5 tst-backtrace6
+ifneq (,$(CXX))
+tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
+endif
+
extra-libs = libSegFault libpcprofile
extra-libs-others = $(extra-libs)
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index 363278aced..34b1b5d450 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -36,12 +36,12 @@ endif
ifeq (yes,$(build-shared))
tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
- bug-atexit3 tstatexit bug-dl-leaf tst-rec-dlopen
+ tstatexit bug-dl-leaf tst-rec-dlopen
endif
modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
defaultmod2 errmsg1mod modatexit modcxaatexit \
bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
- bug-atexit2-lib bug-atexit3-lib bug-dl-leaf-lib \
+ bug-atexit2-lib bug-dl-leaf-lib \
bug-dl-leaf-lib-cb moddummy1 moddummy2
failtestmod.so-no-z-defs = yes
@@ -57,6 +57,11 @@ tststatic2-ENV = $(tststatic-ENV)
tststatic3-ENV = $(tststatic-ENV)
tststatic4-ENV = $(tststatic-ENV)
tststatic5-ENV = $(tststatic-ENV)
+
+ifneq (,$(CXX))
+tests += bug-atexit3
+modules-names += bug-atexit3-lib
+endif
endif
extra-test-objs += $(modules-names:=.os)
diff --git a/nptl/Makefile b/nptl/Makefile
index 89fdc8b9b4..00d13cf859 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -245,8 +245,8 @@ tests = tst-typesizes \
tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
- tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
- tst-cancel-self tst-cancel-self-cancelstate \
+ tst-cancel21 tst-cancel22 tst-cancel23 $(if $(CXX),tst-cancel24) \
+ tst-cancel25 tst-cancel-self tst-cancel-self-cancelstate \
tst-cancel-self-canceltype tst-cancel-self-testcancel \
tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
tst-flock1 tst-flock2 \
@@ -364,14 +364,19 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
$(common-objpfx)libc.a
tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
- tst-cancel21-static tst-cancel24-static tst-cond8-static \
+ tst-cancel21-static tst-cond8-static \
tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
tst-sem12-static
-tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
+tests += tst-stackguard1-static tst-cancel21-static \
tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
tst-sem11-static tst-sem12-static
xtests-static += tst-setuid1-static
+ifneq (,$(CXX))
+tests += tst-cancel24-static
+tests-static += tst-cancel24-static
+endif
+
# These tests are linked with libc before libpthread
tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x