From 959d85b3414d56fc49fc111eb0338cd8fd8dd971 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 22 Dec 2016 14:50:00 -0500 Subject: This is an attempt to fix the problem described here: https://sourceware.org/ml/newlib/2016/msg01139.html https://gcc.gnu.org/ml/gcc/2016-12/msg00010.html There is no change if libtool is used. Some run-time support libraries provided by GCC (e.g. libgomp) use configure checks to detect certain features, e.g. availability of thread-local storage. The configure script generates a test program and tries to compile and link it. It should use target libraries and startfiles of the build tree if available and not random ones from the installation prefix for this procedure. The search directories specified by -B are a bit special, see for_each_path() in gcc.c of the GCC sources. First a search is performed on all search paths with the multilib directory appended (if desired), then a second search is performed on demand with the base directory only. For each multilib there is a "newlib" subdirectory. This directory is specified by a -B option for the support libraries. In order to find the newlib artifacts (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib subdirectory withing the build directory. Signed-off-by: Sebastian Huber --- newlib/configure | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'newlib/configure') diff --git a/newlib/configure b/newlib/configure index 30e1d5766..24f41e0a2 100755 --- a/newlib/configure +++ b/newlib/configure @@ -632,7 +632,11 @@ CRT1_DIR CRT1 CRT0_DIR CRT0 +HAVE_CRT0_FALSE +HAVE_CRT0_TRUE EXTRA_DIRS +HAVE_MULTISUBDIR_FALSE +HAVE_MULTISUBDIR_TRUE HAVE_DOC_FALSE HAVE_DOC_TRUE subdirs @@ -11776,7 +11780,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11779 "configure" +#line 11783 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11882,7 +11886,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11885 "configure" +#line 11889 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12157,13 +12161,13 @@ subdirs="$subdirs libm" if test -z "${with_multisubdir}"; then + have_multisubdir=no subdirs="$subdirs doc" - have_doc=yes else - have_doc= + have_multisubdir=yes fi - if test x$have_doc = xyes; then + if test x$have_multisubdir = xno; then HAVE_DOC_TRUE= HAVE_DOC_FALSE='#' else @@ -12172,6 +12176,28 @@ else fi +# Some run-time support libraries provided by GCC (e.g. libgomp) use configure +# checks to detect certain features, e.g. availability of thread-local storage. +# The configure script generates a test program and tries to compile and link +# it. It should use target libraries and startfiles of the build tree if +# available and not random ones from the installation prefix for this +# procedure. The search directories specified by -B are a bit special, see +# for_each_path() in gcc.c of the GCC sources. First a search is performed on +# all search paths with the multilib directory appended (if desired), then a +# second search is performed on demand with the base directory only. For each +# multilib there is a "newlib" subdirectory. This directory is specified by a +# -B option for the support libraries. In order to find the newlib artifacts +# (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib +# subdirectory withing the build directory. + if test x$have_multisubdir = xyes; then + HAVE_MULTISUBDIR_TRUE= + HAVE_MULTISUBDIR_FALSE='#' +else + HAVE_MULTISUBDIR_TRUE='#' + HAVE_MULTISUBDIR_FALSE= +fi + + EXTRA_DIRS= case $host in i[34567]86-pc-linux-*) @@ -12188,6 +12214,14 @@ if test "x${have_crt0}" = "xyes"; then CRT0=crt0.o CRT0_DIR=libc/ fi + if test x$have_crt0 = xyes; then + HAVE_CRT0_TRUE= + HAVE_CRT0_FALSE='#' +else + HAVE_CRT0_TRUE='#' + HAVE_CRT0_FALSE= +fi + @@ -12827,6 +12861,14 @@ if test -z "${HAVE_DOC_TRUE}" && test -z "${HAVE_DOC_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_MULTISUBDIR_TRUE}" && test -z "${HAVE_MULTISUBDIR_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MULTISUBDIR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CRT0_TRUE}" && test -z "${HAVE_CRT0_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CRT0\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_LONG_DOUBLE_TRUE}" && test -z "${HAVE_LONG_DOUBLE_FALSE}"; then as_fn_error $? "conditional \"HAVE_LONG_DOUBLE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 -- cgit v1.2.3