X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Faclocal.m4;h=d81405d440917a88f991531b3936bf734c8791fd;hp=bf7cca0feedf41b76ebbd274f12038c1ac002e3e;hb=HEAD;hpb=265e45e43e9917e8b9ecc2bf9d23867a3ede2ecd diff --git a/Ada95/aclocal.m4 b/Ada95/aclocal.m4 index bf7cca0f..6fe1f946 100644 --- a/Ada95/aclocal.m4 +++ b/Ada95/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright 2018-2020,2021 Thomas E. Dickey * +dnl Copyright 2018-2023,2024 Thomas E. Dickey * dnl Copyright 2010-2017,2018 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,7 +29,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey dnl -dnl $Id: aclocal.m4,v 1.175 2021/05/19 23:35:25 tom Exp $ +dnl $Id: aclocal.m4,v 1.210 2024/03/30 22:17:13 tom Exp $ dnl Macros used in NCURSES Ada95 auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -189,9 +189,9 @@ AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 16 updated: 2020/12/31 20:19:42 +dnl CF_ADD_INCDIR version: 17 updated: 2021/09/04 06:35:04 dnl ------------- -dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's +dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it is dnl redundant. We don't normally need to add -I/usr/local/include for gcc, dnl but old versions (and some misinstalled ones) need that. To make things dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to @@ -340,6 +340,25 @@ ifelse([$5],NONE,,[{ test -z "$5" || test "x$5" = xNONE || test "x$4" != "x$5"; } ])dnl dnl --------------------------------------------------------------------------- +dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 +dnl ---------------- +dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. +dnl $1 = flags to add +dnl $2 = if given makes this macro verbose. +define([CF_APPEND_CFLAGS], +[ +for cf_add_cflags in $1 +do + case "x$cf_add_cflags" in + (x-[[DU]]*) + CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) + CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) + ;; + esac + CF_ADD_CFLAGS([$cf_add_cflags],[$2]) +done +])dnl +dnl --------------------------------------------------------------------------- dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 dnl -------------- dnl use this macro for appending text without introducing an extra blank at @@ -458,7 +477,7 @@ fi AC_SUBST(ARFLAGS) ]) dnl --------------------------------------------------------------------------- -dnl CF_BUILD_CC version: 9 updated: 2021/01/02 09:31:20 +dnl CF_BUILD_CC version: 11 updated: 2022/12/04 15:40:08 dnl ----------- dnl If we're cross-compiling, allow the user to override the tools and their dnl options. The configure script is oriented toward identifying the host @@ -524,7 +543,32 @@ if test "$cross_compiling" = yes ; then : ${BUILD_CC:='${CC}'} - if { test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}'; } ; then + AC_MSG_CHECKING(if the build-compiler "$BUILD_CC" works) + + cf_save_crossed=$cross_compiling + cf_save_ac_link=$ac_link + cross_compiling=no + cf_build_cppflags=$BUILD_CPPFLAGS + test "$cf_build_cppflags" = "#" && cf_build_cppflags= + ac_link='$BUILD_CC -o "conftest$ac_exeext" $BUILD_CFLAGS $cf_build_cppflags $BUILD_LDFLAGS "conftest.$ac_ext" $BUILD_LIBS >&AS_MESSAGE_LOG_FD' + + AC_TRY_RUN([#include + int main(int argc, char *argv[]) + { + ${cf_cv_main_return:-return}(argc < 0 || argv == 0 || argv[0] == 0); + } + ], + cf_ok_build_cc=yes, + cf_ok_build_cc=no, + cf_ok_build_cc=unknown) + + cross_compiling=$cf_save_crossed + ac_link=$cf_save_ac_link + + AC_MSG_RESULT($cf_ok_build_cc) + + if test "$cf_ok_build_cc" != yes + then AC_MSG_ERROR([Cross-build requires two compilers. Use --with-build-cc to specify the native compiler.]) fi @@ -550,7 +594,7 @@ AC_SUBST(BUILD_EXEEXT) AC_SUBST(BUILD_OBJEXT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_C11_NORETURN version: 3 updated: 2021/03/28 11:36:23 +dnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 dnl --------------- AC_DEFUN([CF_C11_NORETURN], [ @@ -564,8 +608,7 @@ AC_MSG_RESULT($enable_stdnoreturn) if test $enable_stdnoreturn = yes; then AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, [AC_TRY_COMPILE([ -#include -#include +$ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } ], @@ -589,7 +632,7 @@ AC_SUBST(HAVE_STDNORETURN_H) AC_SUBST(STDC_NORETURN) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20 +dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 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 @@ -630,7 +673,7 @@ case "$CC" in 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))); }'` + cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` CC="$cf_prog" for cf_arg in $cf_flags do @@ -759,7 +802,38 @@ case "$cf_cv_gnat_version" in esac ]) dnl --------------------------------------------------------------------------- -dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04 +dnl CF_CHECK_LIBSSP version: 1 updated: 2021/10/30 10:40:19 +dnl --------------- +dnl Check if libssp is needed, e.g., to work around misconfigured libraries +dnl used in cross-compiling to MinGW. +AC_DEFUN([CF_CHECK_LIBSSP],[ +AC_CACHE_CHECK(if ssp library is needed,cf_cv_need_libssp,[ +AC_TRY_LINK([ +#include +#include +],[ + DIR *dp = opendir("."); +],cf_cv_need_libssp=no,[ + cf_save_LIBS="$LIBS" + LIBS="$LIBS -lssp" + AC_TRY_LINK([ +#include +#include + ],[ + DIR *dp = opendir("."); + ],cf_cv_need_libssp=yes, + cf_cv_need_libssp=maybe) + LIBS="$cf_save_LIBS" +])dnl +]) + +if test "x$cf_cv_need_libssp" = xyes +then + CF_ADD_LIB(ssp) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 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 @@ -781,7 +855,7 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_TRY_COMPILE([],[ #ifdef __clang__ #else -make an error +#error __clang__ is not defined #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes ],[]) @@ -827,7 +901,7 @@ if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then fi ]) dnl --------------------------------------------------------------------------- -dnl CF_CONST_X_STRING version: 6 updated: 2021/01/01 13:31:04 +dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. @@ -857,11 +931,12 @@ AC_TRY_COMPILE( #include #include ], -[String foo = malloc(1); (void)foo],[ +[String foo = malloc(1); free((void*)foo)],[ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ AC_TRY_COMPILE( [ +#undef _CONST_X_STRING #define _CONST_X_STRING /* X11R7.8 (perhaps) */ #undef XTSTRINGDEFINES /* X11R5 and later */ #include @@ -887,7 +962,7 @@ esac ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CONST_X_STRING version: 6 updated: 2021/01/01 13:31:04 +dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. @@ -917,11 +992,12 @@ AC_TRY_COMPILE( #include #include ], -[String foo = malloc(1); (void)foo],[ +[String foo = malloc(1); free((void*)foo)],[ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ AC_TRY_COMPILE( [ +#undef _CONST_X_STRING #define _CONST_X_STRING /* X11R7.8 (perhaps) */ #undef XTSTRINGDEFINES /* X11R5 and later */ #include @@ -947,7 +1023,7 @@ esac ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 +dnl CF_CURSES_HEADER version: 6 updated: 2022/12/02 20:06:52 dnl ---------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. @@ -961,7 +1037,7 @@ for cf_header in \ curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) do AC_TRY_COMPILE([#include <${cf_header}>], - [initscr(); tgoto("?", 0,0)], + [initscr(); endwin()], [cf_cv_ncurses_header=$cf_header; break],[]) done ]) @@ -979,9 +1055,9 @@ dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. AC_DEFUN([CF_DIRNAME],[$1=`echo "$2" | sed -e 's%/[[^/]]*$%%'`])dnl dnl --------------------------------------------------------------------------- -dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 +dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 dnl --------------- -dnl You can always use "make -n" to see the actual options, but it's hard to +dnl You can always use "make -n" to see the actual options, but it is hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: @@ -1279,7 +1355,7 @@ AC_DEFUN([CF_FIXUP_ADAFLAGS],[ AC_MSG_RESULT($ADAFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIX_WARNINGS version: 3 updated: 2020/12/31 18:40:20 +dnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 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 @@ -1291,11 +1367,13 @@ 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=format*) + CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) + ;; (x-Werror=*) CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) ;; @@ -1304,15 +1382,46 @@ then ;; esac done - $1="$cf_temp_flags" - CF_VERBOSE(... fixed [$]$1) - CF_VERBOSE(... extra $EXTRA_CFLAGS) + if test "x[$]$1" != "x$cf_temp_flags" + then + CF_VERBOSE(repairing $1: [$]$1) + $1="$cf_temp_flags" + CF_VERBOSE(... fixed [$]$1) + CF_VERBOSE(... extra $EXTRA_CFLAGS) + fi ;; esac fi AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_FUNC_GETTIME version: 2 updated: 2023/02/25 08:45:56 +dnl --------------- +dnl Check for gettimeofday or clock_gettime. In 2023, the former is still more +dnl widely supported, but "deprecated" (2008), so we will use the latter if it +dnl is available, to reduce compiler warnings. +AC_DEFUN([CF_FUNC_GETTIME],[ +AC_CACHE_CHECK(for clock_gettime,cf_cv_func_clock_gettime,[ + AC_TRY_LINK([#include ], + [struct timespec ts; + int rc = clock_gettime(CLOCK_REALTIME, &ts); (void) rc; (void)ts], + [cf_cv_func_clock_gettime=yes], + [cf_cv_func_clock_gettime=no]) +]) + +if test "$cf_cv_func_clock_gettime" = yes +then + AC_DEFINE(HAVE_CLOCK_GETTIME,1,[Define to 1 if we have clock_gettime function]) +else +AC_CHECK_FUNC(gettimeofday, + AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[ + +AC_CHECK_LIB(bsd, gettimeofday, + AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]) + CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet @@ -1343,6 +1452,7 @@ then AC_CHECKING([for $CC __attribute__ directives]) cat > "conftest.$ac_ext" < #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -1425,7 +1535,7 @@ rm -rf ./conftest* fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 +dnl CF_GCC_VERSION version: 9 updated: 2023/03/05 14:30:13 dnl -------------- 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. @@ -1434,7 +1544,7 @@ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none if test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) - GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^[[^(]]*([[^)]][[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi @@ -2018,7 +2128,7 @@ CPPFLAGS="-I. $CPPFLAGS" AC_SUBST(CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21 +dnl CF_INSTALL_OPTS version: 3 updated: 2023/06/03 15:17:30 dnl --------------- dnl prompt for/fill-in useful install-program options AC_DEFUN([CF_INSTALL_OPTS], @@ -2026,6 +2136,7 @@ AC_DEFUN([CF_INSTALL_OPTS], CF_INSTALL_OPT_S CF_INSTALL_OPT_P CF_INSTALL_OPT_O +CF_INSTALL_OPT_STRIP_PROG ])dnl dnl --------------------------------------------------------------------------- dnl CF_INSTALL_OPT_O version: 3 updated: 2020/12/31 20:19:42 @@ -2112,7 +2223,73 @@ fi AC_SUBST(INSTALL_OPT_S) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59 +dnl CF_INSTALL_OPT_STRIP_PROG version: 1 updated: 2023/06/03 15:17:30 +dnl ------------------------- +dnl Provide an option for overriding the strip program used in install "-s" +dnl +dnl coreutils install provides a --strip-program option +dnl FreeBSD uses STRIPBIN environment variable, while NetBSD and OpenBSD use +dnl STRIP environment variable. Other versions of install do not support this. +AC_DEFUN([CF_INSTALL_OPT_STRIP_PROG], +[ +AC_REQUIRE([CF_INSTALL_OPT_S]) +if test -n "$INSTALL_OPT_S" +then + AC_MSG_CHECKING(if you want to specify strip-program) + AC_ARG_WITH(strip-program, + [ --with-strip-program=XX specify program to use when stripping in install], + [with_strip_program=$withval], + [with_strip_program=no]) + AC_MSG_RESULT($with_strip_program) + if test "$with_strip_program" != no + then + AC_MSG_CHECKING(if strip-program is supported with this installer) + cf_install_program=`echo "$INSTALL" | sed -e 's%[[ ]]*[[ ]]-.%%'` + check_install_strip=no + if test -f "$cf_install_program" + then + check_install_version=`"$cf_install_program" --version 2>/dev/null | head -n 1 | grep coreutils` + if test -n "$check_install_version" + then + check_install_strip="option" + else + for check_strip_variable in STRIPBIN STRIP + do + if strings "$cf_install_program" | grep "^$check_strip_variable[$]" >/dev/null + then + check_install_strip="environ" + break + fi + done + fi + fi + AC_MSG_RESULT($check_install_strip) + case "$check_install_strip" in + (no) + AC_MSG_WARN($cf_install_program does not support strip program option) + with_strip_program=no + ;; + (environ) + cat >install.tmp <<-CF_EOF + #! $SHELL + STRIPBIN="$with_strip_program" \\ + STRIP="$with_strip_program" \\ + $INSTALL "[$]@" + CF_EOF + INSTALL="`pwd`/install.tmp" + chmod +x "$INSTALL" + CF_VERBOSE(created $INSTALL) + ;; + (option) + INSTALL_OPT_S="$INSTALL_OPT_S --strip-program=\"$with_strip_program\"" + ;; + esac + fi +fi +AC_SUBST(INSTALL_OPT_S) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch @@ -2138,7 +2315,7 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_TRY_COMPILE([],[ #ifdef __INTEL_COMPILER #else -make an error +#error __INTEL_COMPILER is not defined #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -2150,7 +2327,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147" fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LARGEFILE version: 12 updated: 2020/03/19 20:23:48 +dnl CF_LARGEFILE version: 13 updated: 2023/12/03 19:09:59 dnl ------------ dnl Add checks for large file support. AC_DEFUN([CF_LARGEFILE],[ @@ -2184,11 +2361,15 @@ ifdef([AC_FUNC_FSEEKO],[ #pragma GCC diagnostic error "-Wincompatible-pointer-types" #include #include + +#ifndef __REDIRECT +/* if transitional largefile support is setup, this is true */ +extern struct dirent64 * readdir(DIR *); +#endif ],[ - /* if transitional largefile support is setup, this is true */ - extern struct dirent64 * readdir(DIR *); - struct dirent64 *x = readdir((DIR *)0); - struct dirent *y = readdir((DIR *)0); + DIR *dp = opendir("."); + struct dirent64 *x = readdir(dp); + struct dirent *y = readdir(dp); int z = x - y; (void)z; ], @@ -2419,7 +2600,7 @@ AC_DEFUN([CF_LIB_TYPE], test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LINK_DATAONLY version: 13 updated: 2020/02/08 15:59:30 +dnl CF_LINK_DATAONLY version: 15 updated: 2023/12/03 10:03:10 dnl ---------------- dnl Some systems have a non-ANSI linker that doesn't pull in modules that have dnl only data (i.e., no functions), for example NeXT. On those systems we'll @@ -2441,17 +2622,21 @@ EOF rm -f conftest.$ac_ext data.o cat >conftest.$ac_ext <makefile <<'CF_EOF' +.PHONY: always +DATA=0 +always: always.out + @echo "** making [$]@ [$](DATA)" +once: once.out + @echo "** making [$]@ [$](DATA)" +always.out: + @echo "** making [$]@ [$](DATA)" + echo [$](DATA) > [$]@ +once.out: + @echo "** making [$]@ [$](DATA)" + echo [$](DATA) > [$]@ +CF_EOF + for cf_data in 1 2 3 + do + ${MAKE:-make} always DATA=$cf_data + ${MAKE:-make} once DATA=$cf_data + ${MAKE:-make} -t always once + if test -f always ; then + echo "no (case 1)" > ../conftest.tmp + elif test ! -f always.out ; then + echo "no (case 2)" > ../conftest.tmp + elif test ! -f once.out ; then + echo "no (case 3)" > ../conftest.tmp + elif ! cmp -s always.out once.out ; then + echo "no (case 4)" > ../conftest.tmp + diff always.out once.out + else + cf_check="`cat always.out`" + if test "x$cf_check" != "x$cf_data" ; then + echo "no (case 5)" > ../conftest.tmp + else + echo yes > ../conftest.tmp + rm -f ./*.out + continue + fi + fi + break + done + ) >&AC_FD_CC 2>&1 + cf_cv_make_PHONY="`cat conftest.tmp`" + rm -rf conftest* +]) +MAKE_NO_PHONY="#" +MAKE_PHONY="#" +test "x$cf_cv_make_PHONY" = xyes && MAKE_PHONY= +test "x$cf_cv_make_PHONY" != xyes && MAKE_NO_PHONY= +AC_SUBST(MAKE_NO_PHONY) +AC_SUBST(MAKE_PHONY) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 dnl ------------ dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have @@ -2593,7 +2861,7 @@ fi test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MKSTEMP version: 11 updated: 2021/01/01 13:31:04 +dnl CF_MKSTEMP version: 13 updated: 2023/12/01 17:22:50 dnl ---------- dnl Check for a working mkstemp. This creates two files, checks that they are dnl successfully created and distinct (AmigaOS apparently fails on the last). @@ -2604,17 +2872,11 @@ unistd.h \ AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ rm -rf ./conftest* AC_TRY_RUN([ -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include -#include -#include +$ac_includes_default + int main(void) { - char *tmpl = "conftestXXXXXX"; + static char tmpl[] = "conftestXXXXXX"; char name[2][80]; int n; int result = 0; @@ -2749,7 +3011,7 @@ AC_SUBST(cf_cv_type_of_bool)dnl ]) dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CC_CHECK version: 5 updated: 2020/12/31 20:19:42 +dnl CF_NCURSES_CC_CHECK version: 6 updated: 2023/02/18 17:47:58 dnl ------------------- dnl Check if we can compile with ncurses' header file dnl $1 is the cache variable to set @@ -2766,7 +3028,7 @@ AC_DEFUN([CF_NCURSES_CC_CHECK],[ #ifdef NCURSES_VERSION ]ifelse($3,ncursesw,[ #ifndef WACS_BSSB - make an error + #error WACS_BSSB is not defined #endif ])[ printf("%s\\n", NCURSES_VERSION); @@ -2774,7 +3036,7 @@ printf("%s\\n", NCURSES_VERSION); #ifdef __NCURSES_H printf("old\\n"); #else - make an error + #error __NCURSES_H is not defined #endif #endif ] @@ -2782,7 +3044,7 @@ printf("old\\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 27 updated: 2021/05/19 19:35:25 +dnl CF_NCURSES_CONFIG version: 28 updated: 2021/08/28 15:20:37 dnl ----------------- dnl Tie together the configure-script macros for ncurses, preferring these in dnl order: @@ -2843,7 +3105,7 @@ if test "x${PKG_CONFIG:=none}" != xnone; then ;; esac - CF_ADD_CFLAGS($cf_pkg_cflags) + CF_APPEND_CFLAGS($cf_pkg_cflags) CF_ADD_LIBS($cf_pkg_libs) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], @@ -2885,7 +3147,7 @@ if test "x$cf_have_ncuconfig" = "xno"; then if test "$NCURSES_CONFIG" != none ; then - CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`) + CF_APPEND_CFLAGS(`$NCURSES_CONFIG --cflags`) CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) # even with config script, some packages use no-override for curses.h @@ -3029,7 +3291,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_LIBS version: 20 updated: 2021/01/03 08:05:37 +dnl CF_NCURSES_LIBS version: 21 updated: 2021/09/04 06:37:12 dnl --------------- dnl Look for the ncurses library. This is a little complicated on Linux, dnl because it may be linked with the gpm (general purpose mouse) library. @@ -3058,7 +3320,7 @@ AC_CHECK_LIB(gpm,Gpm_Open, case "$host_os" in (freebsd*) # This is only necessary if you are linking against an obsolete - # version of ncurses (but it should do no harm, since it's static). + # version of ncurses (but it should do no harm, since it is static). if test "$cf_nculib_root" = ncurses ; then AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) fi @@ -3097,7 +3359,7 @@ CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) AC_DEFINE_UNQUOTED($cf_nculib_ROOT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_VERSION version: 16 updated: 2020/12/31 20:19:42 +dnl CF_NCURSES_VERSION version: 18 updated: 2024/01/07 06:34:16 dnl ------------------ dnl Check for the version of ncurses, to aid in reporting bugs, etc. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use @@ -3110,8 +3372,10 @@ AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ cf_tempfile=out$$ rm -f "$cf_tempfile" AC_TRY_RUN([ +$ac_includes_default + #include <${cf_cv_ncurses_header:-curses.h}> -#include + int main(void) { FILE *fp = fopen("$cf_tempfile", "w"); @@ -3125,7 +3389,7 @@ int main(void) # ifdef __NCURSES_H fprintf(fp, "old\\n"); # else - make an error + #error expected ncurses header to define __NCURSES_H # endif #endif ${cf_cv_main_return:-return}(0); @@ -3232,14 +3496,16 @@ case ".[$]$1" in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PKG_CONFIG version: 11 updated: 2021/01/01 13:31:04 +dnl CF_PKG_CONFIG version: 13 updated: 2023/10/28 11:59:01 dnl ------------- dnl Check for the package-config program, unless disabled by command-line. +dnl +dnl Sets $PKG_CONFIG to the pathname of the pkg-config program. AC_DEFUN([CF_PKG_CONFIG], [ AC_MSG_CHECKING(if you want to use pkg-config) AC_ARG_WITH(pkg-config, - [ --with-pkg-config{=path} enable/disable use of pkg-config], + [[ --with-pkg-config[=CMD] enable/disable use of pkg-config and its name CMD]], [cf_pkg_config=$withval], [cf_pkg_config=yes]) AC_MSG_RESULT($cf_pkg_config) @@ -3268,7 +3534,7 @@ fi AC_SUBST(PKG_CONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 +dnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl @@ -3299,7 +3565,7 @@ AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ CF_MSG_LOG(if the symbol is already defined go no further) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE -make an error +#error _POSIX_C_SOURCE is not defined #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no @@ -3318,7 +3584,7 @@ make an error if test "$cf_want_posix_source" = yes ; then AC_TRY_COMPILE([#include ],[ #ifdef _POSIX_SOURCE -make an error +#error _POSIX_SOURCE is defined #endif],[], cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") fi @@ -3329,7 +3595,7 @@ make an error CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE -make an error +#error _POSIX_C_SOURCE is not defined #endif],, [cf_cv_posix_c_source=no]) CFLAGS="$cf_save_CFLAGS" @@ -3633,6 +3899,24 @@ AC_MSG_RESULT($cf_prog_ln_sf) test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" ])dnl dnl --------------------------------------------------------------------------- +dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 +dnl ---------------- +dnl Remove a given option from CFLAGS/CPPFLAGS +dnl $1 = option to remove +dnl $2 = variable to update +dnl $3 = nonempty to allow verbose message +define([CF_REMOVE_CFLAGS], +[ +cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` +while true +do + cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` + test "[$]$2" != "$cf_old_cflag" || break + ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) + $2="$cf_old_cflag" +done +])dnl +dnl --------------------------------------------------------------------------- dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 dnl ---------------- dnl Remove all -U and -D options that refer to the given symbol from a list @@ -3699,7 +3983,7 @@ do done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 105 updated: 2021/01/02 17:09:14 +dnl CF_SHARED_OPTS version: 111 updated: 2024/03/29 20:08:49 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -3723,7 +4007,7 @@ dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library dnl version numbers are infix (ex: libncurses..dylib) or postfix dnl (ex: libncurses.so.). dnl -dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. +dnl Some loaders leave 'so_locations' lying around. It is nice to clean up. AC_DEFUN([CF_SHARED_OPTS], [ AC_REQUIRE([CF_LD_RPATH_OPT]) @@ -3745,9 +4029,9 @@ AC_DEFUN([CF_SHARED_OPTS], cf_ld_rpath_opt= test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT" - AC_MSG_CHECKING(if release/abi version should be used for shared libs) + AC_MSG_CHECKING(whether to use release or ABI version in shared library file names) AC_ARG_WITH(shlib-version, - [ --with-shlib-version=X Specify rel or abi version for shared libs], + [[ --with-shlib-version[={rel|abi}] use release or ABI version in shared library file names]], [test -z "$withval" && withval=auto case "$withval" in (yes) @@ -3789,7 +4073,7 @@ AC_DEFUN([CF_SHARED_OPTS], for CC_SHARED_OPTS in -fPIC -fpic '' do CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" - AC_TRY_COMPILE([#include ],[int x = 1],[break],[]) + AC_TRY_COMPILE([#include ],[int x = 1; (void)x],[break],[]) done AC_MSG_RESULT($CC_SHARED_OPTS) CFLAGS="$cf_save_CFLAGS" @@ -3870,6 +4154,10 @@ CF_EOF LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi ;; + (haiku*) + CF_SHARED_SONAME + MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' + ;; (hpux[[7-8]]*) # HP-UX 8.07 ld lacks "+b" option used for libdir search-list if test "$GCC" != yes; then @@ -4155,11 +4443,11 @@ CF_EOF # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3 if test "$DFT_LWR_MODEL" = "shared" ; then - LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}" + LOCAL_LDFLAGS="-R\$(LOCAL_LIBDIR):\${libdir}" LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" fi if test "$cf_cv_enable_rpath" = yes ; then - EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS" + EXTRA_LDFLAGS="-R\${libdir} $EXTRA_LDFLAGS" fi CF_SHARED_SONAME if test "$GCC" != yes; then @@ -4171,9 +4459,9 @@ CF_EOF done CFLAGS="$cf_save_CFLAGS" CC_SHARED_OPTS=$cf_shared_opts - MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dy -G -h '$cf_cv_shared_soname' -o $[@]' + MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dy -G -Wl,-h,'$cf_cv_shared_soname' -o $[@]' else - MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]' + MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -dy -G -Wl,-h,'$cf_cv_shared_soname' -o $[@]' fi ;; (sysv5uw7*|unix_sv*) @@ -4360,34 +4648,20 @@ top_builddir=ifelse($1,,`pwd`,$1) AC_SUBST(top_builddir) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 +dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ - AC_TRY_COMPILE([ -#include -#include -#include -],[ -#ifndef _XOPEN_SOURCE -make an error -#endif], + AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) - AC_TRY_COMPILE([ -#include -#include -#include -],[ -#ifdef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_xopen_source=no], - [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) - CPPFLAGS="$cf_save" + AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, + [cf_cv_xopen_source=no], + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) + CPPFLAGS="$cf_save" ]) ]) @@ -4395,7 +4669,7 @@ if test "$cf_cv_xopen_source" != no ; then CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - CF_ADD_CFLAGS($cf_temp_xopen_source) + CF_APPEND_CFLAGS($cf_temp_xopen_source) fi ]) dnl --------------------------------------------------------------------------- @@ -4408,7 +4682,7 @@ AC_DEFUN([CF_UPPER], $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_UTF8_LIB version: 9 updated: 2021/05/19 19:35:25 +dnl CF_UTF8_LIB version: 10 updated: 2023/01/11 04:05:23 dnl ----------- dnl Check for multibyte support, and if not found, utf8 compatibility library AC_DEFUN([CF_UTF8_LIB], @@ -4417,8 +4691,7 @@ AC_HAVE_HEADERS(wchar.h) AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ cf_save_LIBS="$LIBS" AC_TRY_LINK([ -#include -#include +$ac_includes_default #ifdef HAVE_WCHAR_H #include #endif @@ -4474,26 +4747,26 @@ weak_symbol(fopen); ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ADA_COMPILER version: 2 updated: 2010/06/26 17:35:58 +dnl CF_WITH_ADA_COMPILER version: 3 updated: 2023/10/28 11:59:01 dnl -------------------- dnl Command-line option to specify the Ada95 compiler. AC_DEFUN([CF_WITH_ADA_COMPILER],[ -AC_MSG_CHECKING(for ada-compiler) +AC_MSG_CHECKING(for Ada95 compiler) AC_ARG_WITH(ada-compiler, - [ --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)], + [[ --with-ada-compiler[=CMD] use CMD as Ada95 compiler (default: gnatmake)]], [cf_ada_compiler=$withval], [cf_ada_compiler=gnatmake]) AC_SUBST(cf_ada_compiler) AC_MSG_RESULT($cf_ada_compiler) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ADA_INCLUDE version: 2 updated: 2010/06/26 17:35:58 +dnl CF_WITH_ADA_INCLUDE version: 3 updated: 2023/10/28 11:59:01 dnl ------------------- dnl Command-line option to specify where Ada includes will install. AC_DEFUN([CF_WITH_ADA_INCLUDE],[ -AC_MSG_CHECKING(for ada-include) +AC_MSG_CHECKING(for Ada95 include directory) CF_WITH_PATH(ada-include, - [ --with-ada-include=DIR Ada includes are in DIR], + [ --with-ada-include=DIR find Ada95 includes in DIR], ADA_INCLUDE, PREFIX/share/ada/adainclude, [$]prefix/share/ada/adainclude) @@ -4501,16 +4774,16 @@ AC_SUBST(ADA_INCLUDE) AC_MSG_RESULT($ADA_INCLUDE) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ADA_LIBNAME version: 1 updated: 2019/09/07 18:59:41 +dnl CF_WITH_ADA_LIBNAME version: 3 updated: 2023/11/22 20:48:30 dnl ------------------- dnl CF_WITH_ADA_LIBNAME dnl ------------------- dnl Command-line option to specify how to name the resulting Ada library. dnl $1 = default value AC_DEFUN([CF_WITH_ADA_LIBNAME],[ -AC_MSG_CHECKING(for ada-libname) +AC_MSG_CHECKING(for Ada95 curses library name) AC_ARG_WITH(ada-libname, - [ --with-ada-libname=XXX override default Ada library-name], + [[ --with-ada-libname[=XXX] use XXX as Ada95 library name]], ADA_LIBNAME=[$]withval, ADA_LIBNAME=$1) case "x$ADA_LIBNAME" in @@ -4522,13 +4795,13 @@ AC_SUBST(ADA_LIBNAME) AC_MSG_RESULT($ADA_LIBNAME) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ADA_OBJECTS version: 2 updated: 2010/06/26 17:35:58 +dnl CF_WITH_ADA_OBJECTS version: 3 updated: 2023/10/28 11:59:01 dnl ------------------- dnl Command-line option to specify where Ada objects will install. AC_DEFUN([CF_WITH_ADA_OBJECTS],[ -AC_MSG_CHECKING(for ada-objects) +AC_MSG_CHECKING(for Ada95 object directory) CF_WITH_PATH(ada-objects, - [ --with-ada-objects=DIR Ada objects are in DIR], + [ --with-ada-objects=DIR find Ada95 objects in DIR], ADA_OBJECTS, PREFIX/lib/ada/adalib, [$]prefix/lib/ada/adalib) @@ -4536,28 +4809,34 @@ AC_SUBST(ADA_OBJECTS) AC_MSG_RESULT($ADA_OBJECTS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ADA_SHAREDLIB version: 5 updated: 2018/07/21 19:10:35 +dnl CF_WITH_ADA_SHAREDLIB version: 6 updated: 2023/10/28 11:59:01 dnl --------------------- -dnl Command-line option to specify if an Ada95 shared-library should be built, +dnl Command-line option to specify if an Ada95 shared library should be built, dnl and optionally what its soname should be. AC_DEFUN([CF_WITH_ADA_SHAREDLIB],[ AC_REQUIRE([CF_GNAT_PROJECTS]) -AC_MSG_CHECKING(if an Ada95 shared-library should be built) +AC_MSG_CHECKING(whether to build an Ada95 shared library) AC_ARG_WITH(ada-sharedlib, - [ --with-ada-sharedlib=soname build shared-library (requires GNAT projects)], + [ --with-ada-sharedlib build Ada95 shared library; requires GNAT project support], [with_ada_sharedlib=$withval], [with_ada_sharedlib=no]) -AC_MSG_RESULT($with_ada_sharedlib) +cf_ada_sharedlib_warn=no if test "x$with_ada_sharedlib" != xno then if test "x$cf_gnat_projects" != xyes then - AC_MSG_WARN(disabling shared-library since GNAT projects are not supported) with_ada_sharedlib=no + cf_ada_sharedlib_warn=yes fi fi +AC_MSG_RESULT($with_ada_sharedlib) +if test "x$cf_ada_sharedlib_warn" != xno +then + AC_MSG_WARN(disabling Ada95 shared library since GNAT projects are not supported) +fi + ADA_SHAREDLIB='lib$(LIB_NAME).so.1' MAKE_ADA_SHAREDLIB="#" @@ -4624,7 +4903,7 @@ else fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19 +dnl CF_WITH_PATH version: 12 updated: 2021/09/04 06:35:04 dnl ------------ dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just dnl defaulting to yes/no. @@ -4633,7 +4912,7 @@ dnl $1 = option name dnl $2 = help-text dnl $3 = environment variable to set dnl $4 = default value, shown in the help-message, must be a constant -dnl $5 = default value, if it's an expression & cannot be in the help-message +dnl $5 = default value, if it is an expression & cannot be in the help-message dnl AC_DEFUN([CF_WITH_PATH], [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),, @@ -4645,9 +4924,19 @@ eval $3="$withval" AC_SUBST($3)dnl ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PKG_CONFIG_LIBDIR version: 11 updated: 2021/01/01 16:16:30 +dnl CF_WITH_PKG_CONFIG_LIBDIR version: 23 updated: 2023/11/22 20:48:30 dnl ------------------------- dnl Allow the choice of the pkg-config library directory to be overridden. +dnl +dnl pkg-config uses a search-list built from these colon-separated lists of +dnl directories: +dnl a) $PKG_CONFIG_PATH (tested first, added if set) +dnl b) $PKG_CONFIG_LIBDIR (tested second, added if set) +dnl c) builtin-list (added if $PKG_CONFIG_LIBDIR is not set) +dnl +dnl pkgconf (used with some systems such as FreeBSD in place of pkg-config) +dnl optionally ignores $PKG_CONFIG_LIBDIR. Very old versions of pkg-config, +dnl e.g., Solaris 10 also do not recognize $PKG_CONFIG_LIBDIR. AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[ case "$PKG_CONFIG" in @@ -4659,68 +4948,119 @@ case "$PKG_CONFIG" in ;; esac -PKG_CONFIG_LIBDIR=no +# if $PKG_CONFIG_LIBDIR is set, try to use that +if test -n "$PKG_CONFIG_PATH"; then + cf_search_path=`echo "$PKG_CONFIG_PATH" | sed -e 's/:/ /g' -e 's,^[[ ]]*,,' -e 's,[[ ]]*$,,'` +elif test -n "$PKG_CONFIG_LIBDIR"; then + cf_search_path=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/:/ /g' -e 's,^[[ ]]*,,' -e 's,[[ ]]*$,,'` +else + cf_search_path=auto +fi + +# if the option is used, let that override. otherwise default to "libdir" AC_ARG_WITH(pkg-config-libdir, - [ --with-pkg-config-libdir=XXX use given directory for installing pc-files], - [PKG_CONFIG_LIBDIR=$withval], - [test "x$PKG_CONFIG" != xnone && PKG_CONFIG_LIBDIR=yes]) + [[ --with-pkg-config-libdir[=XXX] use given directory for installing pc-files]], + [cf_search_path=$withval], + [test "x$PKG_CONFIG" != xnone && test -z "$cf_search_path" && cf_search_path=libdir]) -case x$PKG_CONFIG_LIBDIR in +case "x$cf_search_path" in +(xlibdir) + PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' + AC_MSG_RESULT($PKG_CONFIG_LIBDIR) + cf_search_path= + ;; +(x) + ;; +(x/*\ *) + PKG_CONFIG_LIBDIR= + ;; (x/*) + PKG_CONFIG_LIBDIR="$cf_search_path" + AC_MSG_RESULT($PKG_CONFIG_LIBDIR) + cf_search_path= ;; -(xyes) +(xyes|xauto) + AC_MSG_RESULT(auto) + cf_search_path= # Look for the library directory using the same prefix as the executable - if test "x$PKG_CONFIG" = xnone + AC_MSG_CHECKING(for search-list) + if test "x$PKG_CONFIG" != xnone then - cf_path=$prefix - else - cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'` + # works for pkg-config since version 0.24 (2009) + # works for pkgconf since version 0.8.3 (2012) + for cf_pkg_program in \ + `echo "$PKG_CONFIG" | sed -e 's,^.*/,,'` \ + pkg-config \ + pkgconf + do + cf_search_path=`"$PKG_CONFIG" --variable=pc_path "$cf_pkg_program" 2>/dev/null | tr : ' '` + test -n "$cf_search_path" && break + done + + # works for pkg-config since import in 2005 of original 2001 HP code. + test -z "$cf_search_path" && \ + cf_search_path=` + "$PKG_CONFIG" --debug --exists no-such-package 2>&1 | $AWK "\ +/^Scanning directory (#[1-9][0-9]* )?'.*'$/{ \ + sub(\"^[[^']]*'\",\"\"); \ + sub(\"'.*\",\"\"); \ + printf \" %s\", \\[$]0; } \ +{ next; } \ +"` fi - # If you don't like using the default architecture, you have to specify the - # intended library directory and corresponding compiler/linker options. - # - # This case allows for Debian's 2014-flavor of multiarch, along with the - # most common variations before that point. Some other variants spell the - # directory differently, e.g., "pkg-config", and put it in unusual places. - # pkg-config has always been poorly standardized, which is ironic... - case x`(arch) 2>/dev/null` in - (*64) - cf_search_path="\ - $cf_path/lib/*64-linux-gnu \ - $cf_path/share \ - $cf_path/lib64 \ - $cf_path/lib32 \ - $cf_path/lib" - ;; - (*) - cf_search_path="\ - $cf_path/lib/*-linux-gnu \ - $cf_path/share \ - $cf_path/lib32 \ - $cf_path/lib \ - $cf_path/libdata" - ;; - esac + AC_MSG_RESULT($cf_search_path) + ;; +(*) + AC_MSG_ERROR(Unexpected option value: $cf_search_path) + ;; +esac - CF_VERBOSE(list...) +if test -n "$cf_search_path" +then + AC_MSG_CHECKING(for first directory) + cf_pkg_config_path=none for cf_config in $cf_search_path do - CF_VERBOSE(checking $cf_config/pkgconfig) - if test -d "$cf_config/pkgconfig" + if test -d "$cf_config" then - PKG_CONFIG_LIBDIR=$cf_config/pkgconfig - AC_MSG_CHECKING(done) + cf_pkg_config_path=$cf_config break fi done - ;; -(*) - ;; -esac + AC_MSG_RESULT($cf_pkg_config_path) -if test "x$PKG_CONFIG_LIBDIR" != xno ; then - AC_MSG_RESULT($PKG_CONFIG_LIBDIR) + if test "x$cf_pkg_config_path" != xnone ; then + # limit this to the first directory found + PKG_CONFIG_LIBDIR="$cf_pkg_config_path" + fi + + if test -z "$PKG_CONFIG_LIBDIR" && test -n "$cf_search_path" + then + AC_MSG_CHECKING(for workaround) + if test "$prefix" = "NONE" ; then + cf_prefix="$ac_default_prefix" + else + cf_prefix="$prefix" + fi + eval cf_libdir=$libdir + cf_libdir=`echo "$cf_libdir" | sed -e "s,^NONE,$cf_prefix,"` + cf_backup= + for cf_config in $cf_search_path + do + case $cf_config in + $cf_libdir/pkgconfig) + PKG_CONFIG_LIBDIR=$cf_libdir/pkgconfig + break + ;; + *) + test -z "$cf_backup" && cf_backup=$cf_config + ;; + esac + done + test -z "$PKG_CONFIG_LIBDIR" && PKG_CONFIG_LIBDIR=$cf_backup + AC_MSG_RESULT($PKG_CONFIG_LIBDIR) + fi fi AC_SUBST(PKG_CONFIG_LIBDIR) @@ -4788,7 +5128,7 @@ AC_ARG_WITH(system-type, ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 58 updated: 2021/05/01 17:49:36 +dnl CF_XOPEN_SOURCE version: 67 updated: 2023/09/06 18:55:27 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, @@ -4797,6 +5137,18 @@ dnl dnl Parameters: dnl $1 is the nominal value for _XOPEN_SOURCE dnl $2 is the nominal value for _POSIX_C_SOURCE +dnl +dnl The default case prefers _XOPEN_SOURCE over _POSIX_C_SOURCE if the +dnl implementation predefines it, because X/Open and most implementations agree +dnl that the latter is a legacy or "aligned" value. +dnl +dnl Because _XOPEN_SOURCE is preferred, if defining _POSIX_C_SOURCE turns +dnl that off, then refrain from setting _POSIX_C_SOURCE explicitly. +dnl +dnl References: +dnl https://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html +dnl https://docs.oracle.com/cd/E19253-01/816-5175/standards-5/index.html +dnl https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html AC_DEFUN([CF_XOPEN_SOURCE],[ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([CF_POSIX_VISIBLE]) @@ -4811,9 +5163,6 @@ case "$host_os" in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; -(msys) - cf_XOPEN_SOURCE=600 - ;; (darwin[[0-8]].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; @@ -4839,7 +5188,7 @@ case "$host_os" in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) +(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) CF_GNU_SOURCE($cf_XOPEN_SOURCE) ;; (minix*) @@ -4888,12 +5237,20 @@ case "$host_os" in ;; (*) CF_TRY_XOPEN_SOURCE + cf_save_xopen_cppflags="$CPPFLAGS" CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + # Some of these niche implementations use copy/paste, double-check... + if test "$cf_cv_xopen_source" = no ; then + CF_VERBOSE(checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE) + AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ + AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) + CPPFLAGS="$cf_save_xopen_cppflags"]) + fi ;; esac if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source,true) + CF_APPEND_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting @@ -4903,7 +5260,7 @@ if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE -make an error +#error _XOPEN_SOURCE is not defined #endif], [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) @@ -4912,7 +5269,7 @@ make an error then AC_TRY_COMPILE([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -make an error +#error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #endif], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) @@ -4932,3 +5289,21 @@ dnl ------------------ dnl Trim something using sed, then trim extra whitespace dnl $1 = extra parameters, e.g., in CF_STRIP_G_OPT define([CF__SED_TRIMBLANKS],[sed ifelse($1,,,[$1] )-e 's%[[ ]]% %g' -e 's% [[ ]]*% %g' -e 's%^ %%' -e 's% [$]%%'])dnl +dnl --------------------------------------------------------------------------- +dnl CF__XOPEN_SOURCE_BODY version: 2 updated: 2023/02/18 17:41:25 +dnl --------------------- +dnl body of test when test-compiling for _XOPEN_SOURCE check +define([CF__XOPEN_SOURCE_BODY], +[ +#ifndef _XOPEN_SOURCE +#error _XOPEN_SOURCE is not defined +#endif +]) +dnl --------------------------------------------------------------------------- +dnl CF__XOPEN_SOURCE_HEAD version: 2 updated: 2023/02/18 17:41:25 +dnl --------------------- +dnl headers to include when test-compiling for _XOPEN_SOURCE check +define([CF__XOPEN_SOURCE_HEAD], +[ +$ac_includes_default +])