]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/aclocal.m4
ncurses 6.2 - patch 20210828
[ncurses.git] / Ada95 / aclocal.m4
index 3d88bed5d517acd8f739d3a3fb0e3e778ae45c86..eac4de9118a218f956ed06e8c9e8665fbaa01b99 100644 (file)
@@ -29,7 +29,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey
 dnl
-dnl $Id: aclocal.m4,v 1.178 2021/08/07 20:59:57 tom Exp $
+dnl $Id: aclocal.m4,v 1.179 2021/08/28 20:29:28 tom Exp $
 dnl Macros used in NCURSES Ada95 auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -340,6 +340,21 @@ ifelse([$5],NONE,,[{ test -z "$5" || test "x$5" = xNONE || test "x$4" != "x$5";
 }
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_APPEND_CFLAGS version: 1 updated: 2021/08/28 15:20:37
+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
+       CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2])
+       CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2])
+done
+CF_ADD_CFLAGS([$1],[$2])
+])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
@@ -2865,7 +2880,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:
@@ -2926,7 +2941,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}>],
@@ -2968,7 +2983,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
@@ -3716,6 +3731,36 @@ 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: 1 updated: 2021/08/28 15:20:37
+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/=.*//'`
+cf_old_cflag="[$]$2"
+
+case "[$]$2" in
+(*$1=*)
+       cf_old_cflag=`echo "x$cf_old_cflag" | sed -e 's/^.//' -e "s%$cf_tmp_cflag=[[^   ]]*%%g"`
+       ;;
+(*$1\ *)
+       cf_old_cflag=`echo "x$cf_old_cflag" | sed -e 's/^.//' -e "s%${cf_tmp_cflag}.%%"`
+       ;;
+(*$1)
+       cf_old_cflag=`echo "x$cf_old_cflag" | sed -e 's/^.//' -e "s%$cf_tmp_cflag%%"`
+       ;;
+esac
+
+if test "[$]$2" != "$cf_old_cflag" ;
+then
+       ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)])
+       $2="$cf_new_cflag"
+fi
+])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
@@ -4447,7 +4492,7 @@ 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: 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.
@@ -4482,7 +4527,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 ---------------------------------------------------------------------------
@@ -4875,7 +4920,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: 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,
@@ -4980,7 +5025,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