diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-01-22 20:35:00 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-01-23 22:35:21 -0500 |
commit | 2e9aa5f56cc26a411014a7f788423c670cfb5646 (patch) | |
tree | a4f028fc70a636b18be9a4fe3b8c4757568f3088 /newlib/libm/machine | |
parent | dfa088ab660c80678825ba89f88f9338cfaed3f7 (diff) | |
download | newlib-2e9aa5f56cc26a411014a7f788423c670cfb5646.zip newlib-2e9aa5f56cc26a411014a7f788423c670cfb5646.tar.gz newlib-2e9aa5f56cc26a411014a7f788423c670cfb5646.tar.bz2 |
newlib: update preprocessor configure checks
The nds32 & spu dirs are using compile tests to look for some
preprocessor defines, but we don't need to compile the code,
just preprocess it. So switch to AC_PREPROC_IFELSE.
The sh dir is using a preprocessor test via grep, but let's
switch it to AC_PREPROC_IFELSE too to be consistent.
This should allow us to drop the uncommon AC_NO_EXECUTABLES call.
Diffstat (limited to 'newlib/libm/machine')
-rw-r--r-- | newlib/libm/machine/nds32/Makefile.in | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | newlib/libm/machine/nds32/configure | 270 | ||||
-rw-r--r-- | newlib/libm/machine/nds32/configure.ac | 17 |
3 files changed, 192 insertions, 96 deletions
diff --git a/newlib/libm/machine/nds32/Makefile.in b/newlib/libm/machine/nds32/Makefile.in index ec44823..2bd695e 100644 --- a/newlib/libm/machine/nds32/Makefile.in +++ b/newlib/libm/machine/nds32/Makefile.in @@ -193,6 +193,7 @@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ diff --git a/newlib/libm/machine/nds32/configure b/newlib/libm/machine/nds32/configure index 7c8bb17..8f80c48 100644..100755 --- a/newlib/libm/machine/nds32/configure +++ b/newlib/libm/machine/nds32/configure @@ -582,7 +582,6 @@ PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="Makefile.am" -ac_no_link=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -591,6 +590,7 @@ HAS_NDS32_FPU_DP_FALSE HAS_NDS32_FPU_DP_TRUE HAS_NDS32_FPU_SP_FALSE HAS_NDS32_FPU_SP_TRUE +CPP EXEEXT ac_ct_CC CPPFLAGS @@ -738,7 +738,8 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS' +CPPFLAGS +CPP' # Initialize some variables set by options. @@ -1385,6 +1386,7 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> + CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1503,6 +1505,43 @@ fi as_fn_set_status $ac_retval } # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +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_cpp conftest.$ac_ext") 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; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -3631,7 +3670,6 @@ OBJEXT=${oext} - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3971,29 +4009,6 @@ main () return 0; } _ACEOF -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>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - ac_no_link=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. @@ -4182,59 +4197,6 @@ $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save - -else - rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.o conftest.obj conftest.dSYM - ac_no_link=yes - # Setting cross_compile will disable run tests; it will - # also disable AC_CHECK_FILE but that's generally - # correct if we can't link. - cross_compiling=yes - EXEEXT= - # Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { 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>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { 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_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : @@ -4557,10 +4519,148 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +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 + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if (__NDS32_EXT_FPU_SP__) -warning: Has nds32 FPU SP extension support +# error "Has nds32 FPU SP extension support" #endif int @@ -4571,12 +4671,12 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO"; then : has_nds32_fpu_sp="no" else has_nds32_fpu_sp="yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext if test "$has_nds32_fpu_sp" = "yes"; then HAS_NDS32_FPU_SP_TRUE= HAS_NDS32_FPU_SP_FALSE='#' @@ -4589,7 +4689,7 @@ fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if (__NDS32_EXT_FPU_DP__) -warning: Has nds32 FPU DP extension support +# error "Has nds32 FPU DP extension support" #endif int @@ -4600,12 +4700,12 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO"; then : has_nds32_fpu_dp="no" else has_nds32_fpu_dp="yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext if test "$has_nds32_fpu_dp" = "yes"; then HAS_NDS32_FPU_DP_TRUE= HAS_NDS32_FPU_DP_FALSE='#' diff --git a/newlib/libm/machine/nds32/configure.ac b/newlib/libm/machine/nds32/configure.ac index 7d49c9a..e3589a0 100644 --- a/newlib/libm/machine/nds32/configure.ac +++ b/newlib/libm/machine/nds32/configure.ac @@ -11,23 +11,18 @@ NEWLIB_CONFIGURE(../../..) dnl Use builtin macro to detect if FPU extension support is on. -AC_NO_EXECUTABLES -AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#if (__NDS32_EXT_FPU_SP__) -warning: Has nds32 FPU SP extension support +# error "Has nds32 FPU SP extension support" #endif -]])], - [has_nds32_fpu_sp="no"], - [has_nds32_fpu_sp="yes"]) +]])], [has_nds32_fpu_sp="no"], [has_nds32_fpu_sp="yes"]) AM_CONDITIONAL(HAS_NDS32_FPU_SP, test "$has_nds32_fpu_sp" = "yes") -AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#if (__NDS32_EXT_FPU_DP__) -warning: Has nds32 FPU DP extension support +# error "Has nds32 FPU DP extension support" #endif -]])], - [has_nds32_fpu_dp="no"], - [has_nds32_fpu_dp="yes"]) +]])], [has_nds32_fpu_dp="no"], [has_nds32_fpu_dp="yes"]) AM_CONDITIONAL(HAS_NDS32_FPU_DP, test "$has_nds32_fpu_dp" = "yes") AC_CONFIG_FILES([Makefile]) |