X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=aclocal.m4;h=b1e5ab64bf01d3c352767274538030f056d027e7;hp=30127c5ed43ca4476024fa08dba886e917df7e7b;hb=22b110664918b4fba48ae4237bafb81621bc5f5b;hpb=e506fcb22913defb36b205cd5e84257c915d0e5e diff --git a/aclocal.m4 b/aclocal.m4 index 30127c5e..b1e5ab64 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright 2018-2020,2021 Thomas E. Dickey * +dnl Copyright 2018-2021,2022 Thomas E. Dickey * dnl Copyright 1998-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 1995-on dnl -dnl $Id: aclocal.m4,v 1.960 2021/05/01 21:51:55 tom Exp $ +dnl $Id: aclocal.m4,v 1.1001 2022/01/23 00:15:35 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -65,37 +65,55 @@ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ABI_DEFAULTS version: 2 updated: 2015/06/06 13:49:58 +dnl CF_ABI_DEFAULTS version: 3 updated: 2022/01/22 19:13:38 dnl --------------- dnl Provide configure-script defaults for different ncurses ABIs. AC_DEFUN([CF_ABI_DEFAULTS],[ AC_REQUIRE([CF_NCURSES_WITH_ABI_VERSION]) + +# ABI 5 defaults: +cf_dft_ccharw_max=5 +cf_dft_chtype=auto +cf_dft_ext_colors=no +cf_dft_ext_const=no +cf_dft_ext_mouse=no +cf_dft_ext_putwin=no +cf_dft_ext_spfuncs=no +cf_dft_filter_syms=no +cf_dft_interop=no +cf_dft_mmask_t=auto +cf_dft_opaque_curses=no +cf_dft_ordinate_type=short +cf_dft_signed_char=no +cf_dft_tparm_arg=long +cf_dft_with_lp64=no + +# ABI 6 defaults: case x$cf_cv_abi_version in (x[[6789]]) + cf_dft_chtype=uint32_t cf_dft_ext_colors=yes cf_dft_ext_const=yes cf_dft_ext_mouse=yes cf_dft_ext_putwin=yes cf_dft_ext_spfuncs=yes cf_dft_filter_syms=yes - cf_dft_chtype=uint32_t - cf_dft_mmask_t=uint32_t cf_dft_interop=yes + cf_dft_mmask_t=uint32_t cf_dft_tparm_arg=intptr_t cf_dft_with_lp64=yes ;; -(*) - cf_dft_ext_colors=no - cf_dft_ext_const=no - cf_dft_ext_mouse=no - cf_dft_ext_putwin=no - cf_dft_ext_spfuncs=no - cf_dft_filter_syms=no - cf_dft_chtype=auto - cf_dft_mmask_t=auto - cf_dft_interop=no - cf_dft_tparm_arg=long - cf_dft_with_lp64=no +esac + +# ABI 7 defaults: +case x$cf_cv_abi_version in +(x[[789]]) + cf_dft_ccharw_max=6 + cf_dft_mmask_t=uint64_t + cf_dft_opaque_curses=yes + cf_dft_ordinate_type=int + cf_dft_signed_char=yes + # also: remove the wgetch-events feature in ABI 7 ;; esac ])dnl @@ -264,9 +282,9 @@ CXXFLAGS="$CFLAGS" CFLAGS="$cf_save_CXXFLAGS" ])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 @@ -415,6 +433,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 @@ -604,10 +641,10 @@ else AC_MSG_RESULT(no) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_BOOL_SIZE version: 17 updated: 2020/10/24 19:48:55 +dnl CF_BOOL_SIZE version: 18 updated: 2021/09/04 06:35:04 dnl ------------ dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). -dnl Don't bother looking for bool.h, since it's been deprecated. +dnl Don't bother looking for bool.h, since it has been deprecated. dnl dnl If the current compiler is C rather than C++, we get the bool definition dnl from . @@ -1093,10 +1130,10 @@ fi CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57 +dnl CF_CHECK_EXTERN_DATA version: 5 updated: 2021/09/04 06:35:04 dnl -------------------- dnl Check for existence of external data in the current set of libraries. If -dnl we can modify it, it's real enough. +dnl we can modify it, it is real enough. dnl $1 = the name to check dnl $2 = its type AC_DEFUN([CF_CHECK_EXTERN_DATA], @@ -1328,6 +1365,37 @@ if test "$cf_cv_check_gpm_wgetch" != yes ; then fi ])])dnl dnl --------------------------------------------------------------------------- +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_CHECK_LIBTOOL_VERSION version: 2 updated: 2021/05/01 16:24:34 dnl ------------------------ dnl Show the version of libtool @@ -1603,7 +1671,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: 7 updated: 2021/06/07 17:39:17 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. @@ -1633,7 +1701,7 @@ 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( @@ -1864,9 +1932,9 @@ done AC_SUBST(DIRS_TO_MAKE) ])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: @@ -2022,7 +2090,7 @@ fi AC_SUBST(BROKEN_LINKER) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ENABLE_PC_FILES version: 13 updated: 2015/11/01 05:27:39 +dnl CF_ENABLE_PC_FILES version: 16 updated: 2021/11/20 12:48:37 dnl ------------------ dnl This is the "--enable-pc-files" option, which is available if there is a dnl pkg-config configuration on the local machine. @@ -2047,11 +2115,12 @@ if test "x$enable_pc_files" != xno then MAKE_PC_FILES= case "x$PKG_CONFIG_LIBDIR" in - (xno|xyes) + (xno|xnone|xyes|x) AC_MSG_WARN(no PKG_CONFIG_LIBDIR was found) ;; (*) - CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR) + cf_pkg_config_libdir="$PKG_CONFIG_LIBDIR" + CF_PATH_SYNTAX(cf_pkg_config_libdir) ;; esac else @@ -2372,7 +2441,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 @@ -2384,11 +2453,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) ;; @@ -2397,9 +2468,13 @@ 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 @@ -2493,6 +2568,61 @@ else fi ]) dnl --------------------------------------------------------------------------- +dnl CF_FUNC_GETTTYNAM version: 1 updated: 2021/12/04 18:29:47 +dnl ----------------- +dnl Check if the 4.3BSD function getttyname exists, as well as if +dnl defines the _PATH_TTYS symbol. If the corresponding file exists, but the +dnl other checks fail, just define HAVE_PATH_TTYS. +AC_DEFUN([CF_FUNC_GETTTYNAM],[ +AC_CACHE_CHECK(if _PATH_TTYS is defined in ttyent.h,cf_cv_PATH_TTYS,[ +AC_TRY_COMPILE([ +#include +#include ],[ +FILE *fp = fopen(_PATH_TTYS, "r"); (void)fp], + [cf_cv_PATH_TTYS=yes], + [cf_cv_PATH_TTYS=no])]) + +if test $cf_cv_PATH_TTYS = no +then + for cf_ttys in /etc/ttytype /etc/ttys + do + if test -f $cf_ttys + then + cf_cv_PATH_TTYS=maybe + AC_DEFINE(_PATH_TTYS,$cf_ttys,[define to pathname of file containing mapping from tty name to terminal type]) + break + fi + done +fi + +if test $cf_cv_PATH_TTYS != no +then + AC_CACHE_CHECK(if _PATH_TTYS file exists,cf_cv_have_PATH_TTYS,[ + AC_TRY_RUN([ +#include +#include +int main(void) { + FILE *fp = fopen(_PATH_TTYS, "r"); + ${cf_cv_main_return:-return} (fp == 0); +}], + [cf_cv_have_PATH_TTYS=yes], + [cf_cv_have_PATH_TTYS=no], + [cf_cv_have_PATH_TTYS=unknown])]) + test "$cf_cv_have_PATH_TTYS" = no && cf_cv_PATH_TTYS=no +fi + +if test $cf_cv_PATH_TTYS != no +then + AC_DEFINE(HAVE_PATH_TTYS,1,[define to 1 if system can map tty name to terminal type]) + AC_CACHE_CHECK(for getttynam,cf_cv_func_getttynam,[ + AC_TRY_LINK([#include ], + [struct ttyent *fp = getttynam("/dev/tty"); (void)fp], + [cf_cv_func_getttynam=yes], + [cf_cv_func_getttynam=no])]) + test "$cf_cv_func_getttynam" = yes && AC_DEFINE(HAVE_GETTTYNAM) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25 dnl --------------- dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither @@ -2964,7 +3094,7 @@ rm -rf ./conftest* AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GETOPT_HEADER version: 7 updated: 2021/01/01 13:31:04 +dnl CF_GETOPT_HEADER version: 8 updated: 2021/06/19 19:16:16 dnl ---------------- dnl Check for getopt's variables which are commonly defined in stdlib.h, dnl unistd.h or (nonstandard) in getopt.h @@ -2977,7 +3107,7 @@ for cf_header in stdio.h stdlib.h unistd.h getopt.h do AC_TRY_COMPILE([ #include <$cf_header>], -[int x = optind; char *y = optarg], +[int x = optind; char *y = optarg; (void)x; (void)y], [cf_cv_getopt_header=$cf_header break]) done @@ -4302,7 +4432,7 @@ ifelse($1,,,[$1=$LIB_PREFIX]) AC_SUBST(LIB_PREFIX) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_RULES version: 95 updated: 2021/03/20 12:00:25 +dnl CF_LIB_RULES version: 97 updated: 2021/07/17 13:10:54 dnl ------------ dnl Append definitions and rules for the given models to the subdirectory dnl Makefiles, and the recursion rule for the top-level Makefile. If the @@ -4319,6 +4449,7 @@ dnl dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable. AC_DEFUN([CF_LIB_RULES], [AC_REQUIRE([AC_PROG_FGREP])dnl +AC_REQUIRE([CF_MAKE_PHONY])dnl cf_prefix=$LIB_PREFIX AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) @@ -4639,6 +4770,9 @@ CF_EOF traces=$LIB_TRACING \ MODEL=$cf_ITEM \ CXX_MODEL=$CXX_MODEL \ + LIB_SUFFIX=$LIB_SUFFIX \ + USE_LIB_SUFFIX=$USE_LIB_SUFFIX \ + make_phony="${cf_cv_make_PHONY:-no}" \ model=$cf_subdir \ prefix=$cf_prefix \ suffix=$cf_suffix \ @@ -4686,6 +4820,21 @@ CF_EOF echo ' ( cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@ )' >>Makefile done +echo >> Makefile +echo '# generated by CF_LIB_RULES' >> Makefile + +if test "x$cf_cv_make_PHONY" = xyes ; then + cat >> Makefile <<-CF_EOF + + .PHONY : libs + .PHONY : lintlib + .PHONY : install.includes + .PHONY : uninstall.includes + .PHONY : install.libs + .PHONY : uninstall.libs +CF_EOF +fi + for cf_dir in $SRC_SUBDIRS do if test ! -d "$srcdir/$cf_dir" ; then @@ -4704,6 +4853,15 @@ do fi if test -f "$srcdir/$cf_dir/modules" ; then + + if test "x$cf_cv_make_PHONY" = xyes ; then + cat >> Makefile <<-CF_EOF + + .PHONY : install.$cf_dir + .PHONY : uninstall.$cf_dir +CF_EOF + fi + echo >> Makefile if test -f "$srcdir/$cf_dir/headers" ; then cat >> Makefile <> Makefile - cat >> Makefile <> Makefile <<-CF_EOF + + .PHONY : install.data + .PHONY : uninstall.data +CF_EOF +fi + if test "x$cf_with_db_install" = xyes; then cat >> Makefile <> Makefile <<-CF_EOF + + .PHONY : install.man + .PHONY : uninstall.man +CF_EOF +fi + cat >> Makefile <> $cf_dir/Makefile <<-CF_EOF + + .PHONY : depend +CF_EOF + fi + cat >>$cf_dir/Makefile <<"CF_EOF" depend : ${AUTO_SRC} makedepend -- ${CPPFLAGS} -- ${C_SRC} @@ -5178,10 +5359,10 @@ int main(void) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MAKEFLAGS version: 20 updated: 2021/01/03 19:29:49 +dnl CF_MAKEFLAGS version: 21 updated: 2021/09/04 06:47:34 dnl ------------ dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' -dnl options to lower-levels. It's very useful for "make -n" -- if we have it. +dnl options to lower-levels. It is very useful for "make -n" -- if we have it. dnl (GNU 'make' does both, something POSIX 'make', which happens to make the dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) AC_DEFUN([CF_MAKEFLAGS], @@ -5221,6 +5402,89 @@ CF_EOF AC_SUBST(cf_cv_makeflags) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_MAKE_PHONY version: 3 updated: 2021/01/08 16:08:21 +dnl ------------- +dnl Check if the make-program handles a ".PHONY" target, e.g,. a target which +dnl acts as a placeholder. +dnl +dnl The ".PHONY" feature was proposed in 2011 here +dnl https://www.austingroupbugs.net/view.php?id=523 +dnl and is scheduled for release in P1003.1 Issue 8 (late 2022). +dnl +dnl This is not supported by SVr4 make (or SunOS 4, 4.3SD, etc), but works with +dnl a few others (i.e., GNU make and the non-POSIX "BSD" make): +dnl +dnl + This is a GNU make feature (since April 1988, but in turn from binutils, +dnl date unspecified). +dnl +dnl + It was adopted in NetBSD make in June 1995. +dnl +dnl + The other BSD make programs are derived from the NetBSD make (and for +dnl that reason are not actually different "implementations"). +dnl +dnl + Some features of NetBSD make were actually adapted from pmake, which +dnl began as a modified GNU make starting in 1993. +dnl +dnl + Version 3.8 of the dmake program in January 1992 also implemented this +dnl GNU make extension, but is less well known than the BSD make. +AC_DEFUN([CF_MAKE_PHONY],[ +AC_CACHE_CHECK(for \".PHONY\" make-support, cf_cv_make_PHONY,[ + rm -rf conftest* + ( + mkdir conftest || exit 1 + cd conftest + cat >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 @@ -5258,7 +5522,7 @@ AC_SUBST(MAKE_UPPER_TAGS) AC_SUBST(MAKE_LOWER_TAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_FORMAT version: 14 updated: 2021/01/02 17:09:14 +dnl CF_MANPAGE_FORMAT version: 15 updated: 2021/09/04 06:35:04 dnl ----------------- dnl Option to allow user to override automatic configuration of manpage format. dnl There are several special cases: @@ -5294,7 +5558,7 @@ case "$MANPAGE_FORMAT" in MANPATH="/usr/man:/usr/share/man" fi - # look for the 'date' man-page (it's most likely to be installed!) + # look for the 'date' man-page (it is most likely to be installed!) MANPAGE_FORMAT= cf_preform="no" cf_catonly="yes" @@ -5986,19 +6250,29 @@ then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NO_LEAKS_OPTION version: 8 updated: 2021/01/05 20:05:09 +dnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41 dnl ------------------ dnl see CF_WITH_NO_LEAKS +dnl +dnl $1 = option/name +dnl $2 = help-text +dnl $3 = symbol to define if the option is set +dnl $4 = additional actions to take if the option is set AC_DEFUN([CF_NO_LEAKS_OPTION],[ AC_MSG_CHECKING(if you want to use $1 for testing) AC_ARG_WITH($1, [$2], - [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ + [case "x$withval" in + (x|xno) ;; + (*) + : "${with_cflags:=-g}" + : "${enable_leaks:=no}" + with_$1=yes + AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ $4 ]) - : "${with_cflags:=-g}" - : "${enable_leaks:=no}" - with_$1=yes], + ;; + esac], [with_$1=]) AC_MSG_RESULT(${with_$1:-no}) @@ -6152,9 +6426,11 @@ case ".[$]$1" in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PKG_CONFIG version: 11 updated: 2021/01/01 13:31:04 +dnl CF_PKG_CONFIG version: 12 updated: 2021/10/10 20:18:09 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) @@ -6699,6 +6975,24 @@ case "$cf_cv_regex_hdrs" in esac ])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 @@ -6883,7 +7177,7 @@ do done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 105 updated: 2021/01/02 17:09:14 +dnl CF_SHARED_OPTS version: 107 updated: 2021/09/04 06:47:34 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -6907,7 +7201,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]) @@ -7054,6 +7348,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 @@ -7553,7 +7851,7 @@ AC_MSG_RESULT($cf_cv_sig_atomic_t) test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIZECHANGE version: 17 updated: 2021/01/01 13:31:04 +dnl CF_SIZECHANGE version: 18 updated: 2021/09/04 06:35:04 dnl ------------- dnl Check for definitions & structures needed for window size-changing dnl @@ -7584,7 +7882,7 @@ do #ifdef NEED_PTEM_H /* This is a workaround for SCO: they neglected to define struct winsize in - * termios.h -- it's only in termio.h and ptem.h + * termios.h -- it is only in termio.h and ptem.h */ #include #include @@ -8010,7 +8308,7 @@ else fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 +dnl CF_TRY_XOPEN_SOURCE version: 3 updated: 2021/08/28 15:20:37 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. @@ -8045,7 +8343,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 --------------------------------------------------------------------------- @@ -8141,15 +8439,21 @@ AC_DEFUN([CF_UPPER], $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 +dnl CF_UTF8_LIB version: 9 updated: 2021/05/19 19:35:25 dnl ----------- dnl Check for multibyte support, and if not found, utf8 compatibility library AC_DEFUN([CF_UTF8_LIB], [ +AC_HAVE_HEADERS(wchar.h) AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ cf_save_LIBS="$LIBS" AC_TRY_LINK([ -#include ],[putwc(0,0);], +#include +#include +#ifdef HAVE_WCHAR_H +#include +#endif +],[putwc(0,0);], [cf_cv_utf8_lib=yes], [CF_FIND_LINKAGE([ #include ],[putwc(0,0);],utf8, @@ -8868,7 +9172,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. @@ -8877,7 +9181,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])),, @@ -8889,7 +9193,7 @@ eval $3="$withval" AC_SUBST($3)dnl ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PATHLIST version: 12 updated: 2021/01/01 13:31:04 +dnl CF_WITH_PATHLIST version: 13 updated: 2021/09/04 06:35:04 dnl ---------------- dnl Process an option specifying a list of colon-separated paths. dnl @@ -8897,7 +9201,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 $6 = flag to tell if we want to define or substitute dnl AC_DEFUN([CF_WITH_PATHLIST],[ @@ -8967,7 +9271,7 @@ AC_ARG_WITH($2-path, ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_WITH_PCRE2 version: 5 updated: 2021/01/26 18:45:12 +dnl CF_WITH_PCRE2 version: 6 updated: 2021/08/11 20:35:34 dnl ------------- dnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is dnl available and the user requests it. Assume the application will otherwise @@ -9009,12 +9313,22 @@ if test "x$with_pcre2" != xno ; then # either way, check for the library header files AC_CHECK_HEADERS(pcre2posix.h pcreposix.h) + AC_CHECK_FUNCS(PCRE2regcomp) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PKG_CONFIG_LIBDIR version: 11 updated: 2021/01/01 16:16:30 +dnl CF_WITH_PKG_CONFIG_LIBDIR version: 19 updated: 2021/11/20 14:57:36 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. AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[ case "$PKG_CONFIG" in @@ -9026,68 +9340,110 @@ case "$PKG_CONFIG" in ;; esac -PKG_CONFIG_LIBDIR=no +# if $PKG_CONFIG_LIBDIR is set, try to use that +cf_search_path=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/:/ /g' -e 's,^[[ ]]*,,'` + +# 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]) + [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="$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) @@ -9443,7 +9799,7 @@ fi AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 58 updated: 2021/05/01 17:49:36 +dnl CF_XOPEN_SOURCE version: 59 updated: 2021/08/28 15:20:37 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, @@ -9548,7 +9904,7 @@ case "$host_os" in 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