X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=64288acf9658a982759f9482a8b40248603bee95;hp=1a710ab271339bc789b9f52de12ef9bdaef11292;hb=02f1dee48fe8af6ce054388fba739aa4f975004e;hpb=b0bdfbb1c78346047c54d8e516a104fcff586e52;ds=sidebyside diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 1a710ab2..64288acf 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 2003-2016,2017 Free Software Foundation, Inc. * +dnl Copyright (c) 2003-2018,2019 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl $Id: aclocal.m4,v 1.149 2017/12/26 22:17:17 tom Exp $ +dnl $Id: aclocal.m4,v 1.166 2019/11/02 20:55:33 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -177,7 +177,7 @@ AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 14 updated: 2015/05/25 20:53:04 +dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. We don't normally need to add -I/usr/local/include for gcc, @@ -208,7 +208,7 @@ if test -n "$1" ; then if test "$GCC" = yes then cf_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir) AC_TRY_COMPILE([#include ], [printf("Hello")], [], @@ -280,7 +280,7 @@ if test -n "$1" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27 +dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33 dnl ----------- dnl Add one or more libraries, used to enforce consistency. Libraries are dnl prepended to an existing list, since their dependencies are assumed to @@ -289,19 +289,19 @@ dnl dnl $1 = libraries to add, with the "-l", etc. dnl $2 = variable to update (default $LIBS) AC_DEFUN([CF_ADD_LIBS],[ -cf_add_libs="$1" -# Filter out duplicates - this happens with badly-designed ".pc" files... -for cf_add_1lib in [$]ifelse($2,,LIBS,[$2]) -do - for cf_add_2lib in $cf_add_libs - do - if test "x$cf_add_1lib" = "x$cf_add_2lib" - then +cf_add_libs="[$]ifelse($2,,LIBS,[$2])" +# reverse order +cf_add_0lib= +for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then cf_add_1lib= break fi done - test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" done ifelse($2,,LIBS,[$2])="$cf_add_libs" ])dnl @@ -386,7 +386,7 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 8 updated: 2017/09/23 08:50:24 +dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler @@ -403,11 +403,28 @@ AC_DEFUN([CF_CC_ENV_FLAGS], # This should have been defined by AC_PROG_CC : ${CC:=cc} +AC_MSG_CHECKING(\$CFLAGS variable) +case "x$CFLAGS" in +(*-[[IUD]]*) + AC_MSG_RESULT(broken) + AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) + cf_flags="$CFLAGS" + CFLAGS= + for cf_arg in $cf_flags + do + CF_ADD_CFLAGS($cf_arg) + done + ;; +(*) + AC_MSG_RESULT(ok) + ;; +esac + AC_MSG_CHECKING(\$CC variable) case "$CC" in (*[[\ \ ]]-*) AC_MSG_RESULT(broken) - AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) + AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` @@ -490,17 +507,61 @@ AC_TRY_LINK([#include ],[printf("Hello world");],, fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CURSES_LIB version: 1 updated: 2015/04/25 20:53:11 +dnl CF_CHECK_CURSES_LIB version: 2 updated: 2018/01/03 04:47:33 dnl ------------------- dnl $1 = nominal library name, used also for header lookup dnl $2 = suffix to append to library name dnl $3 = function to check for using AC_CHECK_LIB +dnl $4 = optional parameter list for $3 AC_DEFUN([CF_CHECK_CURSES_LIB], [ -AC_CHECK_LIB($1$2,$3,[ -CF_UPPER(cf_upper,have_lib$1) -CF_ADD_LIBS(-l$1$2) -AC_DEFINE_UNQUOTED($cf_upper,1)]) +AC_REQUIRE([CF_PKG_CONFIG]) + +cf_have_curses_lib=no + +: ${NCURSES_CONFIG_PKG:=none} +if test "x${NCURSES_CONFIG_PKG}" = xnone; then + : +elif test "x${PKG_CONFIG:=none}" != xnone; then + AC_MSG_CHECKING(pkg-config for $1$2) + if "$PKG_CONFIG" --exists $1$2 ; then + AC_MSG_RESULT(yes) + + AC_MSG_CHECKING(if the $1$2 package files work) + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $1$2`) + CF_ADD_LIBS(`$PKG_CONFIG --libs $1$2`) + + AC_TRY_LINK([#include <$1.h>], + [(void) $3 ( ]ifelse([$4],,,[[$4]])[ );], + [AC_TRY_RUN([#include <$1.h> + int main(void) + { (void) $3 ( ]ifelse([$4],,,[[$4]])[ ); return 0; }], + [cf_have_curses_lib=yes], + [cf_have_curses_lib=no], + [cf_have_curses_lib=maybe])], + [cf_have_curses_lib=no]) + AC_MSG_RESULT($cf_have_curses_lib) + test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes + if test "$cf_have_curses_lib" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + else + CF_UPPER(cf_upper,have_lib$1) + AC_DEFINE_UNQUOTED($cf_upper,1) + fi + fi +fi +if test "$cf_have_curses_lib" = no; then + AC_CHECK_LIB($1$2,$3,[ + CF_UPPER(cf_upper,have_lib$1) + CF_ADD_LIBS(-l$1$2) + AC_DEFINE_UNQUOTED($cf_upper,1)]) +fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 @@ -536,6 +597,60 @@ cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" fi ]) dnl --------------------------------------------------------------------------- +dnl CF_CONST_X_STRING version: 1 updated: 2019/04/08 17:50:29 +dnl ----------------- +dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most +dnl character-strings. +dnl +dnl It is ambiguous because the specification accommodated the pre-ANSI +dnl compilers bundled by more than one vendor in lieu of providing a standard C +dnl compiler other than by costly add-ons. Because of this, the specification +dnl did not take into account the use of const for telling the compiler that +dnl string literals would be in readonly memory. +dnl +dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to +dnl let the compiler decide how to represent Xt's strings which were #define'd. +dnl That does not solve the problem of using the block of Xt's strings which +dnl are compiled into the library (and is less efficient than one might want). +dnl +dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both +dnl when compiling the library and compiling using the library, to tell the +dnl compiler that String is const. +AC_DEFUN([CF_CONST_X_STRING], +[ +AC_TRY_COMPILE( +[ +#include +#include +], +[String foo = malloc(1)],[ + +AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ + AC_TRY_COMPILE( + [ +#define _CONST_X_STRING /* X11R7.8 (perhaps) */ +#undef XTSTRINGDEFINES /* X11R5 and later */ +#include +#include + ],[String foo = malloc(1); *foo = 0],[ + cf_cv_const_x_string=no + ],[ + cf_cv_const_x_string=yes + ]) +]) + +case $cf_cv_const_x_string in +(no) + CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) + ;; +(*) + CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) + ;; +esac + +]) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_CURSES_ACS_MAP version: 7 updated: 2012/10/06 16:39:58 dnl ----------------- dnl Check for likely values of acs_map[]: @@ -557,7 +672,7 @@ done test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map,[Define as needed to override ncurses prefix _nc_]) ]) dnl --------------------------------------------------------------------------- -dnl CF_CURSES_CHECK_DATA version: 6 updated: 2017/07/28 19:05:31 +dnl CF_CURSES_CHECK_DATA version: 7 updated: 2018/01/03 04:47:33 dnl -------------------- dnl Check if curses.h defines the given data/variable. dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG. @@ -589,7 +704,7 @@ extern char $cf_data; int main(void) { void *foo = &($cf_data); - fprintf(stderr, "testing linkage of $cf_data:%p\n", foo); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); }],[cf_result=yes ],[cf_result=no],[ @@ -598,7 +713,7 @@ int main(void) [extern char $cf_data;],[ do { void *foo = &($cf_data); - fprintf(stderr, "testing linkage of $cf_data:%p\n", foo); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); } while (0) ],[cf_result=yes],[cf_result=no]) @@ -647,7 +762,7 @@ CF_NCURSES_VERSION CF_CURSES_LIBS ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_CPPFLAGS version: 12 updated: 2015/04/15 19:08:48 +dnl CF_CURSES_CPPFLAGS version: 13 updated: 2018/06/20 20:23:13 dnl ------------------ dnl Look for the curses headers. AC_DEFUN([CF_CURSES_CPPFLAGS],[ @@ -672,13 +787,16 @@ case $host_os in ;; esac ]) -test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" +if test "$cf_cv_curses_incdir" != no +then + CF_APPEND_TEXT(CPPFLAGS,$cf_cv_curses_incdir) +fi CF_CURSES_HEADER CF_TERM_HEADER ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_FUNCS version: 18 updated: 2014/07/19 18:44:41 +dnl CF_CURSES_FUNCS version: 19 updated: 2018/01/03 04:47:33 dnl --------------- dnl Curses-functions are a little complicated, since a lot of them are macros. AC_DEFUN([CF_CURSES_FUNCS], @@ -699,9 +817,9 @@ do [ #ifndef ${cf_func} long foo = (long)(&${cf_func}); -fprintf(stderr, "testing linkage of $cf_func:%p\n", foo); -if (foo + 1234 > 5678) - ${cf_cv_main_return:-return}(foo); +fprintf(stderr, "testing linkage of $cf_func:%p\n", (void *)foo); +if (foo + 1234L > 5678L) + ${cf_cv_main_return:-return}(foo != 0); #endif ], [cf_result=yes], @@ -745,7 +863,7 @@ fi AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 40 updated: 2017/09/07 17:06:24 +dnl CF_CURSES_LIBS version: 42 updated: 2018/06/20 20:23:13 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. @@ -778,7 +896,7 @@ case $host_os in AC_CHECK_LIB(Hcurses,initscr,[ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. CF_ADD_LIBS(-lHcurses) - CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" + CF_APPEND_TEXT(CPPFLAGS,-D__HP_CURSES -D_HP_CURSES) ac_cv_func_initscr=yes ])]) fi @@ -827,7 +945,10 @@ if test ".$ac_cv_func_initscr" != .yes ; then AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown do - AC_CHECK_LIB($cf_term_lib,tgoto,[break]) + AC_CHECK_LIB($cf_term_lib,tgoto,[ + : ${cf_nculib_root:=$cf_term_lib} + break + ]) done ]) fi @@ -1248,7 +1369,7 @@ fi ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIND_LINKAGE version: 20 updated: 2015/04/18 08:56:57 +dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13 dnl --------------- dnl Find a library (specifically the linkage used in the code fragment), dnl searching for it if it is not already in the library path. @@ -1307,7 +1428,8 @@ AC_TRY_LINK([$1],[$2],[ do if test -d $cf_cv_header_path_$3 ; then CF_VERBOSE(... testing $cf_cv_header_path_$3) - CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" + CPPFLAGS="$cf_save_CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3) AC_TRY_COMPILE([$1],[$2],[ CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) cf_cv_find_linkage_$3=maybe @@ -1538,9 +1660,10 @@ rm -rf conftest* fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 +dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 dnl -------------- -dnl Find version of gcc +dnl Find version of gcc, and (because icc/clang pretend to be gcc without being +dnl compatible), attempt to determine if icc/clang is actually used. AC_DEFUN([CF_GCC_VERSION],[ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none @@ -1550,9 +1673,11 @@ if test "$GCC" = yes ; then test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi +CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) +CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39:00 +dnl CF_GCC_WARNINGS version: 36 updated: 2019/09/07 13:38:36 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: @@ -1574,14 +1699,11 @@ dnl AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) -CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) -CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) - +if test "x$have_x" = xyes; then CF_CONST_X_STRING fi cat > conftest.$ac_ext <],[ -#ifndef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_gnu_source=no], - [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - AC_TRY_COMPILE([#include ],[ -#ifdef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_gnu_source=no], - [cf_cv_gnu_source=yes]) - CPPFLAGS="$cf_save" - ]) + #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 + return 0; + #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 + return 0; + #else + # error not GNU C library + #endif], + [cf_cv_gnu_library=yes], + [cf_cv_gnu_library=no]) ]) -if test "$cf_cv_gnu_source" = yes -then -AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ -CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - AC_TRY_COMPILE([#include ],[ -#ifdef _DEFAULT_SOURCE -make an error -#endif], - [cf_cv_default_source=no], - [cf_cv_default_source=yes]) +if test x$cf_cv_gnu_library = xyes; then + + # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE + # was changed to help a little. newlib incorporated the change about 4 + # years later. + AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ + cf_save="$CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) + AC_TRY_COMPILE([#include ],[ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) + return 0; + #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) + return 0; + #else + # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old + #endif], + [cf_cv_gnu_library_219=yes], + [cf_cv_gnu_library_219=no]) + CPPFLAGS="$cf_save" ]) -test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" + + if test "x$cf_cv_gnu_library_219" = xyes; then + cf_save="$CPPFLAGS" + AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ + CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) + AC_TRY_COMPILE([ + #include + #include + ],[ + #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) + return 0; + #else + # error GNU C library is too old + #endif], + [cf_cv_gnu_dftsrc_219=yes], + [cf_cv_gnu_dftsrc_219=no]) + ]) + test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" + else + cf_cv_gnu_dftsrc_219=maybe + fi + + if test "x$cf_cv_gnu_dftsrc_219" != xyes; then + + AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ + AC_TRY_COMPILE([#include ],[ + #ifndef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be defined + #endif], + [cf_cv_gnu_source=no], + [cf_save="$CPPFLAGS" + CF_ADD_CFLAGS(-D_GNU_SOURCE) + AC_TRY_COMPILE([#include ],[ + #ifdef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be undefined + #endif], + [cf_cv_gnu_source=no], + [cf_cv_gnu_source=yes]) + CPPFLAGS="$cf_save" + ]) + ]) + + if test "$cf_cv_gnu_source" = yes + then + AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ + CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) + AC_TRY_COMPILE([#include ],[ + #ifdef _DEFAULT_SOURCE + #error expected _DEFAULT_SOURCE to be undefined + #endif], + [cf_cv_default_source=no], + [cf_cv_default_source=yes]) + ]) + if test "$cf_cv_default_source" = yes + then + CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) + fi + fi + fi + fi ])dnl dnl --------------------------------------------------------------------------- @@ -1803,6 +1989,100 @@ AC_DEFUN([CF_INHERIT_SCRIPT], test -f $1 || ( test -f ../$1 && cp ../$1 ./ ) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21 +dnl --------------- +dnl prompt for/fill-in useful install-program options +AC_DEFUN([CF_INSTALL_OPTS], +[ +CF_INSTALL_OPT_S +CF_INSTALL_OPT_P +CF_INSTALL_OPT_O +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPT_O version: 2 updated: 2015/05/15 19:45:35 +dnl ---------------- +dnl Almost all "install" programs default to the current user's ownership. +dnl Almost - MINIX is an exception. +AC_DEFUN([CF_INSTALL_OPT_O], +[ +AC_MSG_CHECKING(if install needs to be told about ownership) +case `$ac_config_guess` in +(*minix) + with_install_o=yes + ;; +(*) + with_install_o=no + ;; +esac + +AC_MSG_RESULT($with_install_o) +if test "x$with_install_o" = xyes +then + INSTALL_OPT_O=`id root|sed -e 's/uid=[[0-9]]*(/ -o /' -e 's/gid=[[0-9]]*(/ -g /' -e 's/ [[^=[:space:]]][[^=[:space:]]]*=.*/ /' -e 's/)//g'` +else + INSTALL_OPT_O= +fi + +AC_SUBST(INSTALL_OPT_O) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPT_P version: 1 updated: 2018/08/18 12:19:21 +dnl ---------------- +dnl Some install-programs accept a "-p" option to preserve file modification +dnl timestamps. That can be useful as an install option, as well as a way to +dnl avoid the need for ranlib after copying a static archive. +AC_DEFUN([CF_INSTALL_OPT_P], +[ +: ${INSTALL:=install} +AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[ + rm -rf conftest* + date >conftest.in + mkdir conftest.out + sleep 3 + if $INSTALL -p conftest.in conftest.out 2>/dev/null + then + if test -f conftest.out/conftest.in + then + test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \ + test conftest.out/conftest.in -nt conftest.in 2>conftest.err + if test -s conftest.err + then + cf_cv_install_p=no + else + cf_cv_install_p=yes + fi + else + cf_cv_install_p=no + fi + else + cf_cv_install_p=no + fi + rm -rf conftest* +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INSTALL_OPT_S version: 2 updated: 2018/08/18 12:19:21 +dnl ---------------- +dnl By default, we should strip executables which are installed, but leave the +dnl ability to suppress that for unit-testing. +AC_DEFUN([CF_INSTALL_OPT_S], +[ +AC_MSG_CHECKING(if you want to install stripped executables) +CF_ARG_DISABLE(stripping, + [ --disable-stripping do not strip (debug info) installed executables], + [with_stripping=no], + [with_stripping=yes]) +AC_MSG_RESULT($with_stripping) + +if test "$with_stripping" = yes +then + INSTALL_OPT_S="-s" +else + INSTALL_OPT_S= +fi +AC_SUBST(INSTALL_OPT_S) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It @@ -1841,7 +2121,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147" fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 7 updated: 2016/02/20 18:01:19 +dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -1850,49 +2130,52 @@ AC_DEFUN([CF_LD_RPATH_OPT], AC_REQUIRE([CF_CHECK_CACHE]) LD_RPATH_OPT= -AC_MSG_CHECKING(for an rpath option) -case $cf_cv_system_name in -(irix*) - if test "$GCC" = yes; then +if test "x$cf_cv_enable_rpath" != xno +then + AC_MSG_CHECKING(for an rpath option) + case $cf_cv_system_name in + (irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; + (linux*|gnu*|k*bsd*-gnu|freebsd*) LD_RPATH_OPT="-Wl,-rpath," - else + ;; + (openbsd[[2-9]].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (dragonfly*) LD_RPATH_OPT="-rpath " - fi - ;; -(linux*|gnu*|k*bsd*-gnu|freebsd*) - LD_RPATH_OPT="-Wl,-rpath," - ;; -(openbsd[[2-9]].*|mirbsd*) - LD_RPATH_OPT="-Wl,-rpath," - ;; -(dragonfly*) - LD_RPATH_OPT="-rpath " - ;; -(netbsd*) - LD_RPATH_OPT="-Wl,-rpath," - ;; -(osf*|mls+*) - LD_RPATH_OPT="-rpath " - ;; -(solaris2*) - LD_RPATH_OPT="-R" - ;; -(*) - ;; -esac -AC_MSG_RESULT($LD_RPATH_OPT) + ;; + (netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; + (solaris2*) + LD_RPATH_OPT="-R" + ;; + (*) + ;; + esac + AC_MSG_RESULT($LD_RPATH_OPT) -case "x$LD_RPATH_OPT" in -(x-R*) - AC_MSG_CHECKING(if we need a space after rpath option) - cf_save_LIBS="$LIBS" - CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) - AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) - LIBS="$cf_save_LIBS" - AC_MSG_RESULT($cf_rpath_space) - test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " - ;; -esac + case "x$LD_RPATH_OPT" in + (x-R*) + AC_MSG_CHECKING(if we need a space after rpath option) + cf_save_LIBS="$LIBS" + CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) + AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + LIBS="$cf_save_LIBS" + AC_MSG_RESULT($cf_rpath_space) + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; + esac +fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 @@ -2057,7 +2340,7 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 18 updated: 2017/07/23 18:30:00 +dnl CF_NCURSES_CONFIG version: 21 updated: 2018/06/20 20:23:13 dnl ----------------- dnl Tie together the configure-script macros for ncurses, preferring these in dnl order: @@ -2082,7 +2365,7 @@ if test "x${PKG_CONFIG:=none}" != xnone; then cf_save_CPPFLAGS="$CPPFLAGS" cf_save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" + CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $cf_ncuconfig_root`) CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], @@ -2104,8 +2387,8 @@ if test "x${PKG_CONFIG:=none}" != xnone; then else AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) NCURSES_CONFIG_PKG=$cf_ncuconfig_root + CF_TERM_HEADER fi - CF_TERM_HEADER else AC_MSG_RESULT(no) @@ -2124,7 +2407,7 @@ if test "x$cf_have_ncuconfig" = "xno"; then if test "$NCURSES_CONFIG" != none ; then - CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" + CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`) CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) # even with config script, some packages use no-override for curses.h @@ -2569,7 +2852,7 @@ case ".[$]$1" in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58 +dnl CF_PDCURSES_X11 version: 14 updated: 2018/06/20 20:23:13 dnl --------------- dnl Configure for PDCurses' X11 library AC_DEFUN([CF_PDCURSES_X11],[ @@ -2581,7 +2864,7 @@ CF_ACVERSION_CHECK(2.52, if test "$XCURSES_CONFIG" != none ; then -CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" +CF_ADD_CFLAGS(`$XCURSES_CONFIG --cflags`) CF_ADD_LIBS(`$XCURSES_CONFIG --libs`) cf_cv_lib_XCurses=yes @@ -2650,7 +2933,7 @@ fi AC_SUBST(PKG_CONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00 +dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl @@ -2665,7 +2948,10 @@ dnl dnl Parameters: dnl $1 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_POSIX_C_SOURCE], -[ +[AC_REQUIRE([CF_POSIX_VISIBLE])dnl + +if test "$cf_cv_posix_visible" = no; then + cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) cf_save_CFLAGS="$CFLAGS" @@ -2703,7 +2989,8 @@ make an error fi CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + CPPFLAGS="$cf_trim_CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE @@ -2721,6 +3008,35 @@ if test "$cf_cv_posix_c_source" != no ; then CF_ADD_CFLAGS($cf_cv_posix_c_source) fi +fi # cf_cv_posix_visible + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 +dnl ---------------- +dnl POSIX documents test-macros which an application may set before any system +dnl headers are included to make features available. +dnl +dnl Some BSD platforms (originally FreeBSD, but copied by a few others) +dnl diverged from POSIX in 2002 by setting symbols which make all of the most +dnl recent features visible in the system header files unless the application +dnl overrides the corresponding test-macros. Doing that introduces portability +dnl problems. +dnl +dnl This macro makes a special check for the symbols used for this, to avoid a +dnl conflicting definition. +AC_DEFUN([CF_POSIX_VISIBLE], +[ +AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ +AC_TRY_COMPILE([#include ],[ +#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ + && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ + && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ + && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) +#error conflicting symbols found +#endif +],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) +]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08 @@ -2920,12 +3236,12 @@ CF_VERBOSE(...checked $1 [$]$1) AC_SUBST(EXTRA_LDFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 +dnl CF_SIGWINCH version: 2 updated: 2019/03/23 19:54:44 dnl ----------- dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all dnl programs need this test). dnl -dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE +dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct dnl winsize declaration is left alone - we may revisit this if Apple choose to dnl break that part of the interface as well. @@ -3204,7 +3520,7 @@ else fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 +dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. @@ -3220,7 +3536,7 @@ make an error #endif], [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) AC_TRY_COMPILE([ #include #include @@ -3547,7 +3863,7 @@ fi AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52 +dnl CF_XOPEN_CURSES version: 14 updated: 2018/06/20 20:23:13 dnl --------------- dnl Test if we should define X/Open source for curses, needed on Digital Unix dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. @@ -3596,13 +3912,13 @@ AC_TRY_LINK([ case $cf_cv_need_xopen_extension in (*_*) - CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension" + CF_APPEND_TEXT(CPPFLAGS,-D$cf_cv_need_xopen_extension) ;; esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42 +dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -3613,6 +3929,9 @@ dnl $1 is the nominal value for _XOPEN_SOURCE dnl $2 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_XOPEN_SOURCE],[ AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([CF_POSIX_VISIBLE]) + +if test "$cf_cv_posix_visible" = no; then cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) @@ -3632,7 +3951,7 @@ case $host_os in cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; -(freebsd*|dragonfly*) +(freebsd*|dragonfly*|midnightbsd*) # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L @@ -3651,7 +3970,7 @@ case $host_os in cf_XOPEN_SOURCE= ;; (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) - CF_GNU_SOURCE + CF_GNU_SOURCE($cf_XOPEN_SOURCE) ;; (minix*) cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... @@ -3727,6 +4046,7 @@ make an error CF_TRY_XOPEN_SOURCE fi fi +fi # cf_cv_posix_visible ]) dnl --------------------------------------------------------------------------- dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00 @@ -3841,7 +4161,7 @@ if test -z "$cf_x_athena_lib" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 +dnl CF_X_ATHENA_CPPFLAGS version: 6 updated: 2018/06/20 20:23:13 dnl -------------------- dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. @@ -3860,7 +4180,8 @@ do cf_save="$CPPFLAGS" cf_test=X11/$cf_x_athena_root/SimpleMenu.h if test $cf_path != default ; then - CPPFLAGS="$cf_save -I$cf_path/include" + CPPFLAGS="$cf_save" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include) AC_MSG_CHECKING(for $cf_test in $cf_path) else AC_MSG_CHECKING(for $cf_test) @@ -3884,7 +4205,7 @@ if test -z "$cf_x_athena_inc" ; then AC_MSG_WARN( [Unable to successfully find Athena header files with test program]) elif test "$cf_x_athena_inc" != default ; then - CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" + CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc) fi ]) dnl --------------------------------------------------------------------------- @@ -3959,7 +4280,7 @@ CF_TRY_PKG_CONFIG(Xext,,[ [CF_ADD_LIB(Xext)])]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_X_TOOLKIT version: 23 updated: 2015/04/12 15:39:00 +dnl CF_X_TOOLKIT version: 24 updated: 2019/03/23 19:54:44 dnl ------------ dnl Check for X Toolkit libraries AC_DEFUN([CF_X_TOOLKIT], @@ -3967,7 +4288,7 @@ AC_DEFUN([CF_X_TOOLKIT], AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([CF_CHECK_CACHE]) -# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and # in some cases has installed dummy files in the former, other cases replaced # it with a link to the new location). This complicates the configure script. # Check for that pitfall, and recover using pkg-config