X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=aclocal.m4;h=1d8668553cbc7cdf2d6c76c7a829977b43ea8b68;hp=46a9f1f7f4cf1a359d6e0840b29bd6cb8bb940a5;hb=2ba352d86b57bddd1dd2a6e20892f380c34180b7;hpb=f3ec084eb66ba14feb6357b674fb85dd474933d8 diff --git a/aclocal.m4 b/aclocal.m4 index 46a9f1f7..1d866855 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -29,7 +29,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: aclocal.m4,v 1.904 2020/03/20 00:46:13 tom Exp $ +dnl $Id: aclocal.m4,v 1.931 2020/09/12 22:30:53 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -158,10 +158,11 @@ AC_DEFUN([CF_ADD_ADAFLAGS],[ AC_SUBST(ADAFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40 +dnl CF_ADD_CFLAGS version: 14 updated: 2020/04/04 16:16:13 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS -dnl The second parameter if given makes this macro verbose. +dnl $1 = flags to add +dnl $2 = if given makes this macro verbose. dnl dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily @@ -244,6 +245,23 @@ fi AC_SUBST(EXTRA_CPPFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_CXXFLAGS version: 1 updated: 2020/04/04 16:16:13 +dnl --------------- +dnl Copy non-preprocessor flags to $CXXFLAGS, preprocessor flags to $CPPFLAGS +dnl The second parameter if given makes this macro verbose. +dnl +dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, +dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily +dnl confused by the quotes (which require backslashes to keep them usable). +AC_DEFUN([CF_ADD_CXXFLAGS], +[ +cf_save_CXXFLAGS="$CFLAGS" +CFLAGS="$CXXFLAGS" +CF_ADD_CFLAGS($1 ifelse($2,,,[,$2])) +CXXFLAGS="$CFLAGS" +CFLAGS="$cf_save_CXXFLAGS" ])dnl dnl --------------------------------------------------------------------------- dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13 @@ -442,7 +460,7 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05 +dnl CF_AR_FLAGS version: 7 updated: 2020/04/04 11:37:29 dnl ----------- dnl Check for suitable "ar" (archiver) options for updating an archive. dnl @@ -453,39 +471,55 @@ AC_DEFUN([CF_AR_FLAGS],[ AC_REQUIRE([CF_PROG_AR]) AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[ - cf_cv_ar_flags=unknown - for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv - do + case $cf_cv_system_name in + (*-msvc*) + cf_cv_ar_flags='' + cat >mk_static_lib.sh <<-EOF + #!$SHELL + MSVC_BIN="[$]AR" + out="\[$]1" + shift + exec \[$]MSVC_BIN -out:"\[$]out" \[$]@ + EOF + chmod +x mk_static_lib.sh + AR=`pwd`/mk_static_lib.sh + ;; + (*) + cf_cv_ar_flags=unknown + for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv + do - # check if $ARFLAGS already contains this choice - if test "x$ARFLAGS" != "x" ; then - cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` - if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then - cf_cv_ar_flags= - break + # check if $ARFLAGS already contains this choice + if test "x$ARFLAGS" != "x" ; then + cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` + if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then + cf_cv_ar_flags= + break + fi fi - fi - rm -f conftest.$ac_cv_objext - rm -f conftest.a + rm -f conftest.$ac_cv_objext + rm -f conftest.a - cat >conftest.$ac_ext <conftest.$ac_ext <&AC_FD_CC - $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null - if test -f conftest.a ; then - cf_cv_ar_flags=$cf_ar_flags + if AC_TRY_EVAL(ac_compile) ; then + echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC + $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null + if test -f conftest.a ; then + cf_cv_ar_flags=$cf_ar_flags + break + fi + else + CF_VERBOSE(cannot compile test-program) break fi - else - CF_VERBOSE(cannot compile test-program) - break - fi - done - rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext + done + rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext + ;; + esac ]) if test -n "$ARFLAGS" ; then @@ -1012,6 +1046,28 @@ if test "$cf_cv_have_$1" = yes ; then AC_DEFINE_UNQUOTED($cf_result) fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_FVISIBILITY version: 2 updated: 2020/04/04 16:16:13 +dnl -------------------- +dnl Check whether the compiler understands -fvisibility=hidden +dnl +dnl $1 = compiler +dnl $2 = compiler-flags variable name +dnl $3 = cache variable to set +AC_DEFUN([CF_CHECK_FVISIBILITY],[ +AC_CACHE_CHECK(if $1 -fvisibility=hidden option works,$3,[ + cf_save_cflags="[$]$2" + $2="[$]$2 -fvisibility=hidden" + AC_TRY_LINK([ +__attribute__ ((visibility("default"))) int somefunc() {return 42;} + ],[ + if (somefunc()) return 1; +], + [$3=yes], + [$3=no]) + $2=$cf_save_cflags +]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_GETENV version: 1 updated: 2019/06/23 15:28:15 @@ -1140,13 +1196,13 @@ then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_GNAT_VERSION version: 2 updated: 2019/12/31 08:53:54 +dnl CF_CHECK_GNAT_VERSION version: 3 updated: 2020/05/23 19:39:36 dnl --------------------- AC_DEFUN([CF_CHECK_GNAT_VERSION], [ AC_REQUIRE([CF_GNAT_VERSION]) case $cf_cv_gnat_version in -(3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) +(3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|[[1-9]][[0-9]].[[0-9]]*|20[[0-9]][[0-9]]) cf_cv_prog_gnat_correct=yes ;; (*) @@ -1394,7 +1450,7 @@ main(void) ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 +dnl CF_CLANG_COMPILER version: 3 updated: 2020/08/28 04:10:22 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does @@ -1425,6 +1481,10 @@ cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) fi + +if test "x$CLANG_COMPILER" = "xyes" ; then + CF_APPEND_TEXT(CFLAGS,-Wno-error=implicit-function-declaration) +fi ]) dnl --------------------------------------------------------------------------- dnl CF_CONST_X_STRING version: 4 updated: 2020/03/10 18:53:47 @@ -1933,6 +1993,36 @@ if test "x$with_string_hacks" = "xyes"; then fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_WARNINGS version: 7 updated: 2020/08/29 09:05:21 +dnl ------------------ +dnl Configure-option to enable gcc warnings +dnl +dnl $1 = extra options to add, if supported +dnl $2 = option for checking attributes. By default, this is done when +dnl warnings are enabled. For other values: +dnl yes: always do this, e.g., to use in generated library-headers +dnl no: never do this +AC_DEFUN([CF_ENABLE_WARNINGS],[ +if ( test "$GCC" = yes || test "$GXX" = yes ) +then +CF_FIX_WARNINGS(CFLAGS) +CF_FIX_WARNINGS(CPPFLAGS) +CF_FIX_WARNINGS(LDFLAGS) +AC_MSG_CHECKING(if you want to turn on gcc warnings) +CF_ARG_ENABLE(warnings, + [ --enable-warnings test: turn on gcc compiler warnings], + [with_warnings=yes], + [with_warnings=no]) +AC_MSG_RESULT($with_warnings) +if test "$with_warnings" = "yes" +then + ifelse($2,,[CF_GCC_ATTRIBUTES]) + CF_GCC_WARNINGS($1) +fi +ifelse($2,yes,[CF_GCC_ATTRIBUTES]) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 dnl -------- dnl Check if 'errno' is declared in @@ -2161,6 +2251,40 @@ AC_DEFUN([CF_FIXUP_ADAFLAGS],[ AC_MSG_RESULT($ADAFLAGS) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_FIX_WARNINGS version: 2 updated: 2020/08/28 15:08:28 +dnl --------------- +dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's +dnl "-Werror" flags can interfere with configure-checks. Those go into +dnl EXTRA_CFLAGS. +dnl +dnl $1 = variable name to repair +define([CF_FIX_WARNINGS],[ +if ( test "$GCC" = yes || test "$GXX" = yes ) +then + case [$]$1 in + (*-Werror=*) + CF_VERBOSE(repairing $1: [$]$1) + cf_temp_flags= + for cf_temp_scan in [$]$1 + do + case "x$cf_temp_scan" in + (x-Werror=*) + CF_APPEND_TEXT(EXTRA_CFLAGS,"$cf_temp_scan") + ;; + (*) + CF_APPEND_TEXT(cf_temp_flags,"$cf_temp_scan") + ;; + esac + done + $1="$cf_temp_flags" + CF_VERBOSE(... fixed [$]$1) + CF_VERBOSE(... extra $EXTRA_CFLAGS) + ;; + esac +fi +AC_SUBST(EXTRA_CFLAGS) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_FOPEN_BIN_R version: 2 updated: 2019/12/31 08:53:54 dnl -------------- dnl Check if fopen works when the "b" (binary) flag is added to the mode @@ -2476,14 +2600,14 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_ATTRIBUTES version: 18 updated: 2020/03/10 18:53:47 +dnl CF_GCC_ATTRIBUTES version: 19 updated: 2020/08/29 09:05:21 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], [ -if test "$GCC" = yes +if ( test "$GCC" = yes || test "$GXX" = yes ) then cat > conftest.i <mk_shared_lib.sh <<-CF_EOF #!$SHELL - SHARED_LIB=\$1 - IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$\.dll.a/'\` + SHARED_LIB=\[$]1 + IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.lib/'\` shift - my_ld=\$1 + my_ld=\[$]1 shift cat <<-EOF Linking shared library ** SHARED LIB \$SHARED_LIB ** IMPORT_LIB \$IMPORT_LIB EOF - args=\$(echo \$* | sed -E "s#-l(\w*)#lib\1.a#g" | sed -E "s#-L(\w*)#-LIBPATH:\1#g") + args=\$(echo \[$]* | sed -E "s#-l(\w*)#\1.dll.lib#g" | sed -E "s#-L(\w*)#-LIBPATH:\1#g") exec \$my_ld -DLL -IMPLIB:"\${IMPORT_LIB}" -OUT:"\${SHARED_LIB}" ${LDFLAGS} \$args mv "\${IMPORT_LIB}" "\${IMPORT_LIB}" CF_EOF chmod +x mk_shared_lib.sh + cat >mk_prog.sh <<-CF_EOF + #!$SHELL + shift + # Ignore first argument (compiler) and use LD (link.exe) unconditionally + LD="[$]LD" + clopts=() + ldopts=("/subsystem:console") + libs=() + isdll=0 + while test \[$]# -gt 0; do + case "\[$]1" in + -link) + # ignore -link argument + ;; + -M[[TD]] | -M[[TD]]d) + # ignore runtime-library option + ;; + -dll) + isdll=1 + ;; + -W* | -w*) + # ignore warnings + ;; + -D*) + clopts+=("\[$]1") + ;; + -I*) + clopts+=("\[$]1") + ;; + -l*) + libs+=("\`echo \"\[$]1\" | sed \"s/^-l//\"\`") + ;; + -L*) + ldopts+=("\`echo \"\[$]1\" | sed \"s/^-L/-LIBPATH:/\"\`") + ;; + *.obj | *.o) + ldopts+=("\[$]1") + ;; + -Wl,*) + for linkarg in \`echo '\[$]1' | sed -e 's/-Wl,//' -e 's/,/ /'\`; do + ldopts+=("\[$]{linkarg}") + done + ;; + *.lib) + ldopts+=("\[$]1") + ;; + -o) + shift + ldopts+=("-out:\[$]1") + ;; + *) + clopts+=("\[$]1") + ldopts+=("\[$]1") + ;; + esac + shift + done + if [[ "\$isdll" -ne 0 ]]; then + for lib in \[$]{libs[[*]]}; do + ldopts+=("\[$]lib.dll.lib") + done + else + for lib in \[$]{libs[[*]]}; do + ldopts+=("\[$]lib.lib") + done + fi + cat <<-EOF + Creating program + ** ld options: "\[$]{ldopts[[@]]}" +EOF + exec \[$]LD \[$]{ldopts[[@]]} +CF_EOF + chmod +x mk_prog.sh + LINK_PROGS="$SHELL ${rel_builddir}/mk_prog.sh" + LINK_TESTS="$SHELL ${rel_builddir}/mk_prog.sh" ;; (mingw*) cf_cv_shlib_version=mingw @@ -6852,6 +7092,14 @@ CF_EOF CF_SHARED_SONAME MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' ;; + (nskJ*) + CC_SHARED_OPTS= + MK_SHARED_LIB='${LD} -Wshared -Weld=-export_all -o $[@]' + ;; + (nskL*) + CC_SHARED_OPTS= + MK_SHARED_LIB='${LD} -Wshared -Wxld=-export_all -o $[@]' + ;; (nto-qnx*|openbsd*|freebsd[[12]].*) CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" MK_SHARED_LIB='${LD} ${LDFLAGS} -Bshareable -o $[@]' @@ -6883,7 +7131,7 @@ CF_EOF CF_SHARED_SONAME MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]' else - MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -Wl,-shared -Wl,-Bshareable -o $[@]' + MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -o $[@]' fi ;; (osf*|mls+*)