X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=546baa71c584b497f7e2a533c71e064b33bbfc5d;hp=7c1f93100aa256594cb879359e5bf834e4c3fd99;hb=4b1d778499db088254fdf97fa7dc271c82c36622;hpb=0819b56c3096ed77dd36312b0c4e8f37e7d46c88 diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 7c1f9310..546baa71 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -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.107 2015/04/18 13:06:59 tom Exp $ +dnl $Id: aclocal.m4,v 1.124 2015/12/13 02:14:52 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -154,7 +154,7 @@ AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57 +dnl CF_ADD_INCDIR version: 14 updated: 2015/05/25 20:53:04 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. We don't normally need to add -I/usr/local/include for gcc, @@ -205,6 +205,8 @@ if test -n "$1" ; then else break fi + else + break fi done done @@ -328,7 +330,7 @@ dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- -dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 +dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. @@ -341,15 +343,15 @@ dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) - if test "$enableval" != "$5" ; then + if test "$enableval" != "$5" ; then ifelse([$3],,[ :]dnl ,[ $3]) ifelse([$4],,,[ - else - $4]) - fi],[enableval=$5 ifelse([$4],,,[ - $4 + else + $4]) + fi],[enableval=$5 ifelse([$4],,,[ + $4 ])dnl - ])])dnl +])])dnl dnl --------------------------------------------------------------------------- dnl CF_CC_ENV_FLAGS version: 2 updated: 2015/04/12 15:39:00 dnl --------------- @@ -434,6 +436,19 @@ AC_TRY_LINK([#include ],[printf("Hello world");],, fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CURSES_LIB version: 1 updated: 2015/04/25 20:53:11 +dnl ------------------- +dnl $1 = nominal library name, used also for header lookup +dnl $2 = suffix to append to library name +dnl $3 = function to check for using AC_CHECK_LIB +AC_DEFUN([CF_CHECK_CURSES_LIB], +[ +AC_CHECK_LIB($1$2,$3,[ +CF_UPPER(cf_upper,have_lib$1) +CF_ADD_LIBS(-l$1$2) +AC_DEFINE_UNQUOTED($cf_upper,1)]) +])dnl +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 @@ -639,7 +654,7 @@ if (foo + 1234 > 5678) done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_HEADER version: 4 updated: 2015/04/18 09:03:58 +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 dnl variations of ncurses' installs. @@ -648,11 +663,9 @@ dnl $1 = ncurses when looking for ncurses, or is empty AC_DEFUN([CF_CURSES_HEADER],[ AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ cf_cv_ncurses_header=none -for cf_header in ifelse($1,,,[ \ - $1/ncurses.h \ - $1/curses.h]) \ - ncurses.h \ - curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) +for cf_header in \ + ncurses.h ifelse($1,,,[$1/ncurses.h]) \ + 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)], @@ -668,7 +681,7 @@ fi AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 38 updated: 2015/04/15 19:08:48 +dnl CF_CURSES_LIBS version: 39 updated: 2015/05/10 19:52:14 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. @@ -677,16 +690,16 @@ AC_DEFUN([CF_CURSES_LIBS],[ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_MSG_CHECKING(if we have identified curses libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr(); tgoto("?", 0,0)], - cf_result=yes, - cf_result=no) + [initscr(); tgoto("?", 0,0)], + cf_result=yes, + cf_result=no) AC_MSG_RESULT($cf_result) if test "$cf_result" = no ; then case $host_os in (freebsd*) - AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) - ;; + AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) + ;; (hpux10.*) # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr # next (1998), and xcurses "newer" (2000). There is no header file for @@ -728,9 +741,9 @@ case $host_os in CF_ADD_LIBDIR(/usr/5lib) CF_ADD_LIBS(-lcurses -ltermcap) fi - fi - ac_cv_func_initscr=yes - ;; + fi + ac_cv_func_initscr=yes + ;; esac if test ".$ac_cv_func_initscr" != .yes ; then @@ -1284,6 +1297,34 @@ rm -f core]) test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 if we have curses_version function]) ]) dnl --------------------------------------------------------------------------- +dnl CF_FUNC_OPENPTY version: 5 updated: 2015/09/12 14:46:50 +dnl --------------- +dnl Check for openpty() function, along with header. It may need the +dnl "util" library as well. +AC_DEFUN([CF_FUNC_OPENPTY], +[ +AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no) +AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ + cf_save_LIBS="$LIBS" + test $cf_cv_lib_util = yes && { CF_ADD_LIB(util) } + for cf_header in pty.h libutil.h util.h + do + AC_TRY_LINK([ +#include <$cf_header> +],[ + int x = openpty((int *)0, (int *)0, (char *)0, + (struct termios *)0, (struct winsize *)0); +],[ + cf_cv_func_openpty=$cf_header + break +],[ + cf_cv_func_openpty=no +]) + done + LIBS="$cf_save_LIBS" +]) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet @@ -1899,46 +1940,96 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51 +dnl CF_NCURSES_CONFIG version: 17 updated: 2015/07/07 04:22:07 dnl ----------------- -dnl Tie together the configure-script macros for ncurses. -dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. -dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable. +dnl Tie together the configure-script macros for ncurses, preferring these in +dnl order: +dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG +dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG +dnl c) just plain libraries dnl dnl $1 is the root library name (default: "ncurses") -AC_DEFUN([CF_NCURSES_CONFIG], -[ +AC_DEFUN([CF_NCURSES_CONFIG],[ +AC_REQUIRE([CF_PKG_CONFIG]) cf_ncuconfig_root=ifelse($1,,ncurses,$1) +cf_have_ncuconfig=no -echo "Looking for ${cf_ncuconfig_root}-config" +if test "x${PKG_CONFIG:=none}" != xnone; then + AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + AC_MSG_RESULT(yes) -CF_ACVERSION_CHECK(2.52, - [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], - [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) + AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) + cf_have_ncuconfig=unknown -if test "$NCURSES_CONFIG" != none ; then + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" -CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) + CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" + CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) -# even with config script, some packages use no-override for curses.h -CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], + [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); }], + [cf_have_ncuconfig=yes], + [cf_have_ncuconfig=no], + [cf_have_ncuconfig=maybe])], + [cf_have_ncuconfig=no]) + AC_MSG_RESULT($cf_have_ncuconfig) + test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + NCURSES_CONFIG_PKG=none + else + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + NCURSES_CONFIG_PKG=$cf_ncuconfig_root + fi -dnl like CF_NCURSES_CPPFLAGS -AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + else + AC_MSG_RESULT(no) + NCURSES_CONFIG_PKG=none + fi +else + NCURSES_CONFIG_PKG=none +fi -dnl like CF_NCURSES_LIBS -CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) -AC_DEFINE_UNQUOTED($cf_nculib_ROOT) +if test "x$cf_have_ncuconfig" = "xno"; then + echo "Looking for ${cf_ncuconfig_root}-config" -dnl like CF_NCURSES_VERSION -cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + CF_ACVERSION_CHECK(2.52, + [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], + [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) -else + if test "$NCURSES_CONFIG" != none ; then + + CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" + CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) + + # even with config script, some packages use no-override for curses.h + CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) + + dnl like CF_NCURSES_CPPFLAGS + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + + dnl like CF_NCURSES_LIBS + CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) + AC_DEFINE_UNQUOTED($cf_nculib_ROOT) + + dnl like CF_NCURSES_VERSION + cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + + else -CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) -CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) + CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + fi +else + NCURSES_CONFIG=none fi ])dnl dnl --------------------------------------------------------------------------- @@ -2390,7 +2481,7 @@ else fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PKG_CONFIG version: 9 updated: 2015/04/12 15:39:00 +dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 dnl ------------- dnl Check for the package-config program, unless disabled by command-line. AC_DEFUN([CF_PKG_CONFIG], @@ -2419,7 +2510,7 @@ esac test -z "$PKG_CONFIG" && PKG_CONFIG=none if test "$PKG_CONFIG" != none ; then CF_PATH_SYNTAX(PKG_CONFIG) -else +elif test "x$cf_pkg_config" != xno ; then AC_MSG_WARN(pkg-config is not installed) fi @@ -3107,7 +3198,7 @@ if test "$with_dmalloc" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_NCURSES_ETC version: 3 updated: 2015/04/17 21:26:14 +dnl CF_WITH_NCURSES_ETC version: 4 updated: 2015/04/25 20:53:11 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 @@ -3121,6 +3212,10 @@ CF_WITH_CURSES_DIR cf_cv_screen=curses AC_MSG_CHECKING(for specified curses library type) +AC_ARG_WITH(screen, + [ --with-screen=XXX use specified curses-libraries], + [cf_cv_screen=$withval],[ + AC_ARG_WITH(ncursesw, [ --with-ncursesw use wide ncurses-libraries], [cf_cv_screen=ncursesw],[ @@ -3139,7 +3234,7 @@ AC_ARG_WITH(curses-colr, AC_ARG_WITH(curses-5lib, [ --with-curses-5lib compile/link with SunOS 5lib curses], - [cf_cv_screen=curses_5lib])])])])]) + [cf_cv_screen=curses_5lib])])])])])]) AC_MSG_RESULT($cf_cv_screen) @@ -3147,16 +3242,19 @@ case $cf_cv_screen in (curses|curses_*) CF_CURSES_CONFIG ;; -(ncurses) - CF_NCURSES_CONFIG - ;; -(ncursesw) +(ncursesw*) CF_UTF8_LIB - CF_NCURSES_CONFIG(ncursesw) + CF_NCURSES_CONFIG($cf_cv_screen) + ;; +(ncurses*) + CF_NCURSES_CONFIG($cf_cv_screen) ;; (pdcurses) CF_PDCURSES_X11 ;; +(*) + AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen) + ;; esac ])dnl @@ -3169,7 +3267,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. @@ -3179,7 +3277,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 #include <${cf_cv_ncurses_header:-curses.h}>],[ @@ -3188,14 +3287,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 -#include <${cf_cv_ncurses_header:-curses.h}>],[ #ifdef NCURSES_VERSION cchar_t check; int check2 = curs_set((int)sizeof(check)); @@ -3203,12 +3294,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 +#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: 50 updated: 2015/10/17 19:03:33 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, @@ -3278,6 +3392,9 @@ case $host_os in (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; +(os2*) + cf_XOPEN_SOURCE= + ;; (osf[[45]]*) cf_xopen_source="-D_OSF_SOURCE" ;;