X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Faclocal.m4;h=7438acc170daa1e4474240c0d01a299a9e439667;hp=60c268062ab3a4d6e8444b7300bf1a1837820b04;hb=84cf9f63bf604413fa5714ef91f83076ac8f236b;hpb=5da4544722decdeb2bfd0c7c4581af0ea62148f9 diff --git a/Ada95/aclocal.m4 b/Ada95/aclocal.m4 index 60c26806..7438acc1 100644 --- a/Ada95/aclocal.m4 +++ b/Ada95/aclocal.m4 @@ -1,5 +1,6 @@ dnl*************************************************************************** -dnl Copyright (c) 2010-2017,2018 Free Software Foundation, Inc. * +dnl Copyright 2018-2019,2020 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 * dnl copy of this software and associated documentation files (the * @@ -28,14 +29,16 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey dnl -dnl $Id: aclocal.m4,v 1.133 2018/06/21 00:23:13 tom Exp $ +dnl $Id: aclocal.m4,v 1.153 2020/02/08 21:04:00 tom Exp $ dnl Macros used in NCURSES Ada95 auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on dnl this file applies to the aggregation of macros and does not affect use of dnl these macros in other applications. dnl -dnl See https://invisible-island.net/autoconf/ for additional information. +dnl See these pages for additional information: +dnl https://invisible-island.net/autoconf/ +dnl https://invisible-island.net/autoconf/my-autoconf.html dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- @@ -288,7 +291,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 @@ -297,19 +300,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 @@ -524,7 +527,7 @@ AC_SUBST(BUILD_EXEEXT) AC_SUBST(BUILD_OBJEXT) ])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 @@ -541,11 +544,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))); }'` @@ -660,6 +680,22 @@ if test ".$system_name" != ".$cf_cv_system_name" ; then fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_CHECK_GNAT_VERSION version: 2 updated: 2019/12/31 08:53:54 +dnl --------------------- +AC_DEFUN([CF_CHECK_GNAT_VERSION], +[ +AC_REQUIRE([CF_GNAT_VERSION]) +case $cf_cv_gnat_version in +(3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) + cf_cv_prog_gnat_correct=yes + ;; +(*) + AC_MSG_WARN(Unsupported GNAT version $cf_cv_gnat_version. We require 3.11 or better. Disabling Ada95 binding.) + cf_cv_prog_gnat_correct=no + ;; +esac +]) +dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines @@ -693,6 +729,126 @@ cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" fi ]) dnl --------------------------------------------------------------------------- +dnl CF_CONST_X_STRING version: 3 updated: 2020/01/11 18:39:22 +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_REQUIRE([AC_PATH_XTRA]) + +CF_SAVE_XTRA_FLAGS([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 + ]) +]) + +CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) + +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_CONST_X_STRING version: 3 updated: 2020/01/11 18:39:22 +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_REQUIRE([AC_PATH_XTRA]) + +CF_SAVE_XTRA_FLAGS([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 + ]) +]) + +CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) + +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_HEADER version: 5 updated: 2015/04/23 20:35:30 dnl ---------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common @@ -773,6 +929,28 @@ CF_ARG_DISABLE(gnat-projects, AC_MSG_RESULT($enable_gnat_projects) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_BROKEN_LINKER version: 1 updated: 2020/02/08 15:59:30 +dnl ----------------------- +dnl Some linkers cannot reference a data-only object. Cygwin used to be one. +dnl This usually follows CF_LINK_DATAONLY, but is not required in case we need +dnl an unconditional feature. +AC_DEFUN([CF_ENABLE_BROKEN_LINKER],[ + +AC_MSG_CHECKING(if you want broken-linker support code) +AC_ARG_ENABLE(broken_linker, + [ --enable-broken_linker compile with broken-linker support code], + [with_broken_linker=$enableval], + [with_broken_linker=no]) +AC_MSG_RESULT($with_broken_linker) + +: ${BROKEN_LINKER:=0} +if test "x$with_broken_linker" = xyes ; then + AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules]) + BROKEN_LINKER=1 +fi +AC_SUBST(BROKEN_LINKER) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 dnl --------------- dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We @@ -1083,9 +1261,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 @@ -1095,14 +1274,17 @@ 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: 33 updated: 2018/06/20 20:23:13 +dnl CF_GCC_WARNINGS version: 37 updated: 2020/01/05 20:04:12 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: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) +dnl -Winline (usually not worthwhile) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally). This @@ -1119,14 +1301,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 <&1 | \ +AC_CACHE_CHECK(for ifelse($2,,gnat,$2) version, cf_cv_gnat_version,[ +cf_cv_gnat_version=`ifelse($2,,${cf_ada_make:-gnatmake},$2) --version 2>&1 | \ grep '[[0-9]].[[0-9]][[0-9]]*' |\ sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'` -AC_MSG_RESULT($cf_gnat_version) - -case $cf_gnat_version in -(3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) - cf_cv_prog_gnat_correct=yes - ;; -(*) - AC_MSG_WARN(Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding.) - cf_cv_prog_gnat_correct=no - ;; -esac ]) +test -z "$cf_cv_gnat_version" && cf_cv_gnat_version=no +ifelse($1,,,[eval $1=$cf_cv_gnat_version; unset cf_cv_gnat_version]) +])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNU_SOURCE version: 9 updated: 2018/06/20 20:23:13 +dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 dnl ------------- dnl Check if we must define _GNU_SOURCE to get a reasonable value for dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect @@ -1510,6 +1679,8 @@ AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ AC_TRY_COMPILE([#include ],[ #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; + #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 + return 0; #else # error not GNU C library #endif], @@ -1520,13 +1691,16 @@ AC_TRY_COMPILE([#include ],[ 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... + # 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], @@ -1643,11 +1817,12 @@ test -d "$oldincludedir" && { $1="[$]$1 $cf_header_path_list" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 +dnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54 dnl --------------- dnl Insert text into the help-message, for readability, from AC_ARG_WITH. AC_DEFUN([CF_HELP_MESSAGE], -[AC_DIVERT_HELP([$1])dnl +[CF_ACVERSION_CHECK(2.53,[],[ +AC_DIVERT_HELP($1)])dnl ])dnl dnl --------------------------------------------------------------------------- dnl CF_INCLUDE_DIRS version: 10 updated: 2014/09/19 20:58:42 @@ -1667,12 +1842,13 @@ CPPFLAGS="-I. $CPPFLAGS" AC_SUBST(CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPTS version: 1 updated: 2014/07/21 18:19:51 +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 --------------------------------------------------------------------------- @@ -1703,7 +1879,42 @@ fi AC_SUBST(INSTALL_OPT_O) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPT_S version: 1 updated: 2014/07/21 18:19:51 +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. @@ -1711,7 +1922,7 @@ 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 installed executables], + [ --disable-stripping do not strip (debug info) installed executables], [with_stripping=no], [with_stripping=yes]) AC_MSG_RESULT($with_stripping) @@ -1812,7 +2023,7 @@ ifdef([AC_FUNC_FSEEKO],[ ]) ]) 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. @@ -1821,49 +2032,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 @@ -2000,7 +2214,7 @@ AC_DEFUN([CF_LIB_TYPE], test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LINK_DATAONLY version: 12 updated: 2017/07/23 17:46:07 +dnl CF_LINK_DATAONLY version: 13 updated: 2020/02/08 15:59:30 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 @@ -2060,6 +2274,7 @@ if test "$cf_cv_link_dataonly" = no ; then AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link]) BROKEN_LINKER=1 fi +AC_SUBST(BROKEN_LINKER) ])dnl dnl --------------------------------------------------------------------------- @@ -2811,7 +3026,7 @@ fi AC_SUBST(PKG_CONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_C_SOURCE version: 10 updated: 2018/06/20 20:23:13 +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 @@ -2826,7 +3041,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" @@ -2883,6 +3101,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_PROG_AR version: 1 updated: 2009/01/01 20:15:22 @@ -2901,11 +3148,15 @@ AC_PROG_AWK test -z "$AWK" && AC_MSG_ERROR(No awk program found) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58 +dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 dnl ---------- dnl standard check for CC, plus followup sanity checks dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name AC_DEFUN([CF_PROG_CC],[ +CF_ACVERSION_CHECK(2.53, + [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) + AC_REQUIRE([AC_PROG_CC])], + []) ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) CF_GCC_VERSION CF_ACVERSION_CHECK(2.52, @@ -2995,38 +3246,40 @@ AC_SUBST(PROG_EXT) test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57 -dnl --------------- -dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the -dnl misc/tabset install won't work properly. Usually this happens only when -dnl using the fallback mkinstalldirs script -AC_DEFUN([CF_PROG_INSTALL], -[AC_PROG_INSTALL -case $INSTALL in -(/*) - ;; -(*) - CF_DIRNAME(cf_dir,$INSTALL) - test -z "$cf_dir" && cf_dir=. - INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` - ;; -esac -])dnl -dnl --------------------------------------------------------------------------- -dnl CF_PROG_GNAT version: 6 updated: 2018/01/16 16:45:49 +dnl CF_PROG_GNAT version: 10 updated: 2019/12/31 08:53:54 dnl ------------ -dnl Check for gnatmake, ensure that it is complete. +dnl Check for gnat/gnatmake/etc, ensure that the toolset is complete. AC_DEFUN([CF_PROG_GNAT],[ -cf_ada_make=gnatmake -cf_ada_config="#" -AC_CHECK_PROG(gnatmake_exists, $cf_ada_make, yes, no) -if test "$ac_cv_prog_gnatmake_exists" = no; then +for cf_prog_gnat in gnat gnatmake gprconfig gprbuild +do + CF_UPPER(cf_upper_prog_gnat,${cf_prog_gnat}) + + unset ac_cv_path_cf_TEMP_gnat + unset cf_TEMP_gnat + AC_PATH_PROG(cf_TEMP_gnat,$cf_prog_gnat,no) + eval cf_cv_PATH_$cf_upper_prog_gnat=[$]ac_cv_path_cf_TEMP_gnat + + if test "x$cf_TEMP_gnat" != xno; then + unset cf_cv_gnat_version + unset cf_TEMP_gnat + CF_GNAT_VERSION(cf_TEMP_gnat,$cf_prog_gnat) + fi + eval cf_cv_VERSION_$cf_upper_prog_gnat=[$]cf_TEMP_gnat + + unset cf_TEMP_gnat + unset cf_cv_gnat_version + unset ac_cv_path_cf_TEMP_gnat +done + +if test "x$cf_cv_VERSION_GNATMAKE" = "xno"; then cf_ada_make= cf_cv_prog_gnat_correct=no else - AC_CHECK_PROG(gprconfig_exists, gprconfig, yes, no) - if test "$ac_cv_prog_gprconfig_exists" = yes - then + cf_ada_make=gnatmake + if test "x$cf_cv_VERSION_GPRCONFIG" = "xno"; then + # gprconfig is newer than gnatmake; we can continue... + cf_ada_config="##" + else rm -rf conftest* *~conftest* if mkdir conftest.src then @@ -3035,7 +3288,20 @@ else for cf_gprconfig in Ada C do AC_MSG_CHECKING(for gprconfig name for $cf_gprconfig) - cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` + if test $cf_gprconfig = C + then + for cf_gprconfig_param in \ + $cf_gprconfig,,,,GNATGCC \ + $cf_gprconfig,,,,GCC \ + $cf_gprconfig + do + cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` + test -n "$cf_gprconfig_value" && break + done + else + cf_gprconfig_param=$cf_gprconfig + cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` + fi if test -n "$cf_gprconfig_value" then eval cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value @@ -3049,17 +3315,15 @@ else cd .. rm -rf conftest* *~conftest* fi - else - # gprconfig is newer than gnatmake; we can continue... - cf_ada_config="##" fi if test "x$cf_ada_config" != "x#" then CF_GNAT_VERSION + CF_CHECK_GNAT_VERSION AC_CHECK_PROG(M4_exists, m4, yes, no) if test "$ac_cv_prog_M4_exists" = no; then cf_cv_prog_gnat_correct=no - echo Ada95 binding required program m4 not found. Ada95 binding disabled. + AC_MSG_WARN(Ada95 binding required program m4 not found. Ada95 binding disabled) fi if test "$cf_cv_prog_gnat_correct" = yes; then AC_MSG_CHECKING(if GNAT works) @@ -3071,7 +3335,9 @@ begin Text_IO.Put ("Hello World"); Text_IO.New_Line; GNAT.OS_Lib.OS_Exit (0); -end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no]) +end conftest;], +[cf_cv_prog_gnat_correct=yes], +[cf_cv_prog_gnat_correct=no]) AC_MSG_RESULT($cf_cv_prog_gnat_correct) fi else @@ -3085,6 +3351,24 @@ AC_SUBST(cf_ada_config_Ada) AC_SUBST(cf_ada_config_C) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57 +dnl --------------- +dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the +dnl misc/tabset install won't work properly. Usually this happens only when +dnl using the fallback mkinstalldirs script +AC_DEFUN([CF_PROG_INSTALL], +[AC_PROG_INSTALL +case $INSTALL in +(/*) + ;; +(*) + CF_DIRNAME(cf_dir,$INSTALL) + test -z "$cf_dir" && cf_dir=. + INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37 dnl ------------ dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f" @@ -3137,7 +3421,43 @@ define([CF_REMOVE_LIB], $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 92 updated: 2017/12/30 17:26:05 +dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 +dnl --------------------- +dnl Restore flags saved in CF_SAVE_XTRA_FLAGS +dnl $1 = name of current macro +define([CF_RESTORE_XTRA_FLAGS], +[ +LIBS="$cf_save_LIBS_$1" +CFLAGS="$cf_save_CFLAGS_$1" +CPPFLAGS="$cf_save_CPPFLAGS_$1" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 +dnl ------------------ +dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers +dnl and libraries which do not update those variables. +dnl +dnl $1 = name of current macro +define([CF_SAVE_XTRA_FLAGS], +[ +cf_save_LIBS_$1="$LIBS" +cf_save_CFLAGS_$1="$CFLAGS" +cf_save_CPPFLAGS_$1="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[[IUD]]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SHARED_OPTS version: 93 updated: 2018/08/18 16:36:35 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -3165,6 +3485,7 @@ dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. AC_DEFUN([CF_SHARED_OPTS], [ AC_REQUIRE([CF_LD_RPATH_OPT]) + RM_SHARED_OPTS= LOCAL_LDFLAGS= LOCAL_LDFLAGS2= @@ -3352,7 +3673,7 @@ CF_EOF cf_cv_rm_so_locs=yes ;; (linux*|gnu*|k*bsd*-gnu) - if test "$DFT_LWR_MODEL" = "shared" ; then + if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" fi @@ -3390,7 +3711,7 @@ CF_EOF chmod +x mk_shared_lib.sh ;; (openbsd[[2-9]].*|mirbsd*) - if test "$DFT_LWR_MODEL" = "shared" ; then + if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" fi @@ -3446,7 +3767,7 @@ CF_EOF ;; esac MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]' - if test "$DFT_LWR_MODEL" = "shared" ; then + if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" fi @@ -3818,6 +4139,27 @@ 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 ------------------- +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_ARG_WITH(ada-libname, + [ --with-ada-libname=XXX override default Ada library-name], + ADA_LIBNAME=[$]withval, + ADA_LIBNAME=$1) +case "x$ADA_LIBNAME" in +(x|xyes|xno) + ADA_LIBNAME=$1 + ;; +esac +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 ------------------- dnl Command-line option to specify where Ada objects will install. @@ -3832,11 +4174,12 @@ AC_SUBST(ADA_OBJECTS) AC_MSG_RESULT($ADA_OBJECTS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ADA_SHAREDLIB version: 4 updated: 2014/05/31 21:08:37 +dnl CF_WITH_ADA_SHAREDLIB version: 5 updated: 2018/07/21 19:10:35 dnl --------------------- 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_ARG_WITH(ada-sharedlib, [ --with-ada-sharedlib=soname build shared-library (requires GNAT projects)], @@ -3844,6 +4187,15 @@ AC_ARG_WITH(ada-sharedlib, [with_ada_sharedlib=no]) AC_MSG_RESULT($with_ada_sharedlib) +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 + fi +fi + ADA_SHAREDLIB='lib$(LIB_NAME).so.1' MAKE_ADA_SHAREDLIB="#" @@ -4074,7 +4426,7 @@ AC_ARG_WITH(system-type, ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 53 updated: 2018/06/16 18:58:58 +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, @@ -4085,6 +4437,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]) @@ -4104,7 +4459,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 @@ -4199,4 +4554,5 @@ make an error CF_TRY_XOPEN_SOURCE fi fi +fi # cf_cv_posix_visible ])