]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/aclocal.m4
ncurses 6.0 - patch 20160903
[ncurses.git] / test / aclocal.m4
index 316035077bb6a18a4fe1ccbcc284a9220c14a5ea..93fdbaf3f81d2fd6e027dbf8a3b4b77d7f7b6cb9 100644 (file)
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 2003-2014,2015 Free Software Foundation, Inc.              *
+dnl Copyright (c) 2003-2015,2016 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written       *
 dnl authorization.                                                           *
 dnl***************************************************************************
 dnl
-dnl $Id: aclocal.m4,v 1.121 2015/10/10 20:30:48 tom Exp $
+dnl $Id: aclocal.m4,v 1.134 2016/09/04 00:10:41 tom Exp $
 dnl
 dnl Author: Thomas E. Dickey
 dnl
@@ -40,6 +40,29 @@ dnl See http://invisible-island.net/autoconf/ for additional information.
 dnl
 dnl ---------------------------------------------------------------------------
 dnl ---------------------------------------------------------------------------
+dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57
+dnl -------------------
+dnl Inserted as requested by gettext 0.10.40
+dnl File from /usr/share/aclocal
+dnl codeset.m4
+dnl ====================
+dnl serial AM1
+dnl
+dnl From Bruno Haible.
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
+       [AC_TRY_LINK([#include <langinfo.h>],
+       [char* cs = nl_langinfo(CODESET);],
+       am_cv_langinfo_codeset=yes,
+       am_cv_langinfo_codeset=no)
+       ])
+       if test $am_cv_langinfo_codeset = yes; then
+               AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
+               [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+       fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
 dnl ------------------
 dnl Conditionally generate script according to whether we're using a given autoconf.
@@ -353,11 +376,18 @@ ifelse([$3],,[    :]dnl
 ])dnl
 ])])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CC_ENV_FLAGS version: 2 updated: 2015/04/12 15:39:00
+dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00
 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 with
-dnl options, but eliminates a more common category of user confusion.
+dnl into CC.  This will not help with broken scripts that wrap the compiler
+dnl with options, but eliminates a more common category of user confusion.
+dnl
+dnl In particular, it addresses the problem of being able to run the C
+dnl preprocessor in a consistent manner.
+dnl
+dnl Caveat: this also disallows blanks in the pathname for the compiler, but
+dnl the nuisance of having inconsistent settings for compiler and preprocessor
+dnl outweighs that limitation.
 AC_DEFUN([CF_CC_ENV_FLAGS],
 [
 # This should have been defined by AC_PROG_CC
@@ -365,13 +395,26 @@ AC_DEFUN([CF_CC_ENV_FLAGS],
 
 AC_MSG_CHECKING(\$CC variable)
 case "$CC" in
-(*[[\ \        ]]-[[IUD]]*)
+(*[[\ \        ]]-*)
        AC_MSG_RESULT(broken)
        AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
        # humor him...
-       cf_flags=`echo "$CC" | sed -e 's/^[[^   ]]*[[   ]]//'`
-       CC=`echo "$CC" | sed -e 's/[[   ]].*//'`
-       CF_ADD_CFLAGS($cf_flags)
+       cf_flags=`echo "$CC" | sed -e 's/^.*[[  ]]\(-[[^        ]]\)/\1/'`
+       CC=`echo "$CC " | sed -e 's/[[  ]]-[[^  ]].*$//' -e 's/[[       ]]*$//'`
+       for cf_arg in $cf_flags
+       do
+               case "x$cf_arg" in
+               (x-[[IUDfgOW]]*)
+                       CF_ADD_CFLAGS($cf_flags)
+                       ;;
+               (*)
+                       CC="$CC $cf_arg"
+                       ;;
+               esac
+       done
+       CF_VERBOSE(resulting CC: '$CC')
+       CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
+       CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
        ;;
 (*)
        AC_MSG_RESULT(ok)
@@ -1596,7 +1639,7 @@ if test $cf_cv_getopt_header = getopt.h ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
+dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37
 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
@@ -1623,7 +1666,20 @@ make an error
        CPPFLAGS="$cf_save"
        ])
 ])
-test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+
+if test "$cf_cv_gnu_source" = yes
+then
+AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
+CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+       AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifdef _DEFAULT_SOURCE
+make an error
+#endif],
+               [cf_cv_default_source=no],
+               [cf_cv_default_source=yes])
+       ])
+test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE"
+fi
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
@@ -1725,7 +1781,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147"
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LD_RPATH_OPT version: 6 updated: 2015/04/12 15:39:00
+dnl CF_LD_RPATH_OPT version: 7 updated: 2016/02/20 18:01:19
 dnl ---------------
 dnl For the given system and compiler, find the compiler flags to pass to the
 dnl loader to use the "rpath" feature.
@@ -1743,13 +1799,13 @@ case $cf_cv_system_name in
                LD_RPATH_OPT="-rpath "
        fi
        ;;
-(linux*|gnu*|k*bsd*-gnu)
+(linux*|gnu*|k*bsd*-gnu|freebsd*)
        LD_RPATH_OPT="-Wl,-rpath,"
        ;;
 (openbsd[[2-9]].*|mirbsd*)
        LD_RPATH_OPT="-Wl,-rpath,"
        ;;
-(dragonfly*|freebsd*)
+(dragonfly*)
        LD_RPATH_OPT="-rpath "
        ;;
 (netbsd*)
@@ -2253,6 +2309,21 @@ CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_NCURSES_PTHREADS version: 2 updated: 2016/04/22 05:07:41
+dnl -------------------
+dnl Use this followup check to ensure that we link with pthreads if ncurses
+dnl uses it.
+AC_DEFUN([CF_NCURSES_PTHREADS],[
+: ${cf_nculib_root:=ifelse($1,,ncurses,$1)}
+AC_CHECK_LIB($cf_nculib_root,_nc_init_pthreads,
+       cf_cv_ncurses_pthreads=yes,
+       cf_cv_ncurses_pthreads=no)
+if test "$cf_cv_ncurses_pthreads" = yes
+then
+       CF_ADD_LIBS(-lpthread)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
 dnl ------------------
 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
@@ -2645,11 +2716,11 @@ case $INSTALL in
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
+dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54
 dnl ------------
 AC_DEFUN([CF_PROG_LINT],
 [
-AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
+AC_CHECK_PROGS(LINT, lint cppcheck splint)
 AC_SUBST(LINT_OPTS)
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -2787,6 +2858,65 @@ CF_VERBOSE(...checked $1 [$]$1)
 AC_SUBST(EXTRA_LDFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
+dnl -----------
+dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
+dnl programs need this test).
+dnl
+dnl This is really a MacOS X 10.4.3 workaround.  Defining _POSIX_C_SOURCE
+dnl forces SIGWINCH to be undefined (breaks xterm, ncurses).  Oddly, the struct
+dnl winsize declaration is left alone - we may revisit this if Apple choose to
+dnl break that part of the interface as well.
+AC_DEFUN([CF_SIGWINCH],
+[
+AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
+       AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/signal.h>
+],[int x = SIGWINCH],
+       [cf_cv_define_sigwinch=yes],
+       [AC_TRY_COMPILE([
+#undef _XOPEN_SOURCE
+#undef _POSIX_SOURCE
+#undef _POSIX_C_SOURCE
+#include <sys/types.h>
+#include <sys/signal.h>
+],[int x = SIGWINCH],
+       [cf_cv_define_sigwinch=maybe],
+       [cf_cv_define_sigwinch=no])
+])
+])
+
+if test "$cf_cv_define_sigwinch" = maybe ; then
+AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
+cf_cv_fixup_sigwinch=unknown
+cf_sigwinch=32
+while test $cf_sigwinch != 1
+do
+       AC_TRY_COMPILE([
+#undef _XOPEN_SOURCE
+#undef _POSIX_SOURCE
+#undef _POSIX_C_SOURCE
+#include <sys/types.h>
+#include <sys/signal.h>
+],[
+#if SIGWINCH != $cf_sigwinch
+make an error
+#endif
+int x = SIGWINCH],
+       [cf_cv_fixup_sigwinch=$cf_sigwinch
+        break])
+
+cf_sigwinch=`expr $cf_sigwinch - 1`
+done
+])
+
+       if test "$cf_cv_fixup_sigwinch" != unknown ; then
+               CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
+       fi
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
 dnl ---------------
 dnl signal handler, but there are some gcc depedencies in that recommendation.
@@ -3198,7 +3328,7 @@ if test "$with_dmalloc" = yes ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_NCURSES_ETC version: 4 updated: 2015/04/25 20:53:11
+dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20
 dnl -------------------
 dnl Use this macro for programs which use any variant of "curses", e.g.,
 dnl "ncurses", and "PDCurses".  Programs that can use curses and some unrelated
@@ -3257,6 +3387,8 @@ case $cf_cv_screen in
        ;;
 esac
 
+CF_NCURSES_PTHREADS($cf_cv_screen)
+
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
@@ -3267,7 +3399,7 @@ CF_NO_LEAKS_OPTION(valgrind,
        [USE_VALGRIND])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
+dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52
 dnl ---------------
 dnl Test if we should define X/Open source for curses, needed on Digital Unix
 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
@@ -3277,7 +3409,8 @@ dnl as getbegy().  The latter is better design, but the former is standard.
 AC_DEFUN([CF_XOPEN_CURSES],
 [
 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
-AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
+AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[
+cf_cv_need_xopen_extension=unknown
 AC_TRY_LINK([
 #include <stdlib.h>
 #include <${cf_cv_ncurses_header:-curses.h}>],[
@@ -3286,14 +3419,6 @@ AC_TRY_LINK([
        make an error
 #endif
 #endif
-       long x = winnstr(stdscr, "", 0);
-       int x1, y1;
-       getbegyx(stdscr, y1, x1)],
-       [cf_cv_need_xopen_extension=no],
-       [AC_TRY_LINK([
-#define _XOPEN_SOURCE_EXTENDED
-#include <stdlib.h>
-#include <${cf_cv_ncurses_header:-curses.h}>],[
 #ifdef NCURSES_VERSION
        cchar_t check;
        int check2 = curs_set((int)sizeof(check));
@@ -3301,12 +3426,35 @@ AC_TRY_LINK([
        long x = winnstr(stdscr, "", 0);
        int x1, y1;
        getbegyx(stdscr, y1, x1)],
-       [cf_cv_need_xopen_extension=yes],
-       [cf_cv_need_xopen_extension=unknown])])])
-test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
+       [cf_cv_need_xopen_extension=none],
+       [
+       for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR
+       do
+               AC_TRY_LINK([
+#define $cf_try_xopen_extension 1
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header:-curses.h}>],[
+#ifdef NCURSES_VERSION
+               cchar_t check;
+               int check2 = curs_set((int)sizeof(check));
+#endif
+               long x = winnstr(stdscr, "", 0);
+               int x1, y1;
+               getbegyx(stdscr, y1, x1)],
+               [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break])
+       done
+       ])
+])
+
+case $cf_cv_need_xopen_extension in
+(*_*)
+       CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension"
+       ;;
+esac
+
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 49 updated: 2015/04/12 15:39:00
+dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42
 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,
@@ -3326,7 +3474,7 @@ case $host_os in
 (aix[[4-7]]*)
        cf_xopen_source="-D_ALL_SOURCE"
        ;;
-(cygwin|msys)
+(msys)
        cf_XOPEN_SOURCE=600
        ;;
 (darwin[[0-8]].*)
@@ -3354,7 +3502,7 @@ case $host_os in
        cf_xopen_source="-D_SGI_SOURCE"
        cf_XOPEN_SOURCE=
        ;;
-(linux*|gnu*|mint*|k*bsd*-gnu)
+(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
        CF_GNU_SOURCE
        ;;
 (minix*)