]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/aclocal.m4
ncurses 5.9 - patch 20110409
[ncurses.git] / test / aclocal.m4
index 6f8d522e652fea2a9f38c48fee510604bcf5ceff..646244857deb8dfe28512ad13b59be73679f1520 100644 (file)
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 2003-2009,2010 Free Software Foundation, Inc.              *
+dnl Copyright (c) 2003-2010,2011 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.45 2010/11/20 22:07:06 tom Exp $
+dnl $Id: aclocal.m4,v 1.52 2011/04/09 22:22:11 tom Exp $
 dnl
 dnl Author: Thomas E. Dickey
 dnl
@@ -455,22 +455,34 @@ done
 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_CHECK_DATA version: 3 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_CHECK_DATA version: 4 updated: 2011/01/15 16:39:24
 dnl --------------------
 dnl Check if curses.h defines the given data/variable.
 dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG.
 AC_DEFUN([CF_CURSES_CHECK_DATA],
 [
 AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header:-curses.h})
+
 AC_TRY_COMPILE(CF__CURSES_HEAD,[
 void *foo = &($1)
 ],cf_result=yes,cf_result=no)
 AC_MSG_RESULT($cf_result)
+
 if test $cf_result = yes ; then
        CF_UPPER(cf_result,have_curses_data_$1)
        AC_DEFINE_UNQUOTED($cf_result)
 else
        AC_MSG_CHECKING(for data $1 in library)
+       # BSD linkers insist on making weak linkage, but resolve at runtime.
+       AC_TRY_RUN(CF__CURSES_HEAD
+[
+extern char $1;
+int main(void)
+{
+       void *foo = &($1);
+       ${cf_cv_main_return:-return}(foo == 0);
+}],[cf_result=yes],[cf_result=no],[
+       # cross-compiling
        AC_TRY_LINK(CF__CURSES_HEAD
 [extern char $1;],[
        do {
@@ -478,6 +490,7 @@ else
                ${cf_cv_main_return:-return}(foo == 0);
        } while (0)
 ],[cf_result=yes],[cf_result=no])
+])
        AC_MSG_RESULT($cf_result)
        if test $cf_result = yes ; then
                CF_UPPER(cf_result,decl_curses_data_$1)
@@ -520,7 +533,7 @@ CF_NCURSES_VERSION
 CF_CURSES_LIBS
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
+dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
 dnl ------------------
 dnl Look for the curses headers.
 AC_DEFUN([CF_CURSES_CPPFLAGS],[
@@ -529,13 +542,19 @@ AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
 cf_cv_curses_incdir=no
 case $host_os in #(vi
 hpux10.*) #(vi
-       test -d /usr/include/curses_colr && \
-       cf_cv_curses_incdir="-I/usr/include/curses_colr"
+       if test "x$cf_cv_screen" = "xcurses_colr"
+       then
+               test -d /usr/include/curses_colr && \
+               cf_cv_curses_incdir="-I/usr/include/curses_colr"
+       fi
        ;;
 sunos3*|sunos4*)
-       test -d /usr/5lib && \
-       test -d /usr/5include && \
-       cf_cv_curses_incdir="-I/usr/5include"
+       if test "x$cf_cv_screen" = "xcurses_5lib"
+       then
+               test -d /usr/5lib && \
+               test -d /usr/5include && \
+               cf_cv_curses_incdir="-I/usr/5include"
+       fi
        ;;
 esac
 ])
@@ -545,7 +564,7 @@ CF_CURSES_HEADER
 CF_TERM_HEADER
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32
+dnl CF_CURSES_FUNCS version: 16 updated: 2011/04/09 18:19:55
 dnl ---------------
 dnl Curses-functions are a little complicated, since a lot of them are macros.
 AC_DEFUN([CF_CURSES_FUNCS],
@@ -553,6 +572,7 @@ AC_DEFUN([CF_CURSES_FUNCS],
 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 AC_REQUIRE([CF_XOPEN_CURSES])
 AC_REQUIRE([CF_CURSES_TERM_H])
+AC_REQUIRE([CF_CURSES_UNCTRL_H])
 for cf_func in $1
 do
        CF_UPPER(cf_tr_func,$cf_func)
@@ -611,7 +631,7 @@ fi
 AC_CHECK_HEADERS($cf_cv_ncurses_header)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_LIBS version: 31 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_LIBS version: 34 updated: 2011/04/09 14:51:08
 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.
@@ -631,24 +651,46 @@ freebsd*) #(vi
     AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
     ;;
 hpux10.*) #(vi
-    AC_CHECK_LIB(cur_colr,initscr,[
-        CF_ADD_LIBS(-lcur_colr)
-        ac_cv_func_initscr=yes
-        ],[
-    AC_CHECK_LIB(Hcurses,initscr,[
-        # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
-        CF_ADD_LIBS(-lHcurses)
-        CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
-        ac_cv_func_initscr=yes
-        ])])
+       # 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
+       # Hcurses; the subdirectory curses_colr has the headers (curses.h and
+       # term.h) for cur_colr
+       if test "x$cf_cv_screen" = "xcurses_colr"
+       then
+               AC_CHECK_LIB(cur_colr,initscr,[
+                       CF_ADD_LIBS(-lcur_colr)
+                       ac_cv_func_initscr=yes
+                       ],[
+               AC_CHECK_LIB(Hcurses,initscr,[
+                       # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
+                       CF_ADD_LIBS(-lHcurses)
+                       CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
+                       ac_cv_func_initscr=yes
+                       ])])
+       fi
     ;;
-linux*) # Suse Linux does not follow /usr/lib convention
-    CF_ADD_LIBDIR(/lib)
+linux*)
+       case `arch 2>/dev/null` in
+       x86_64)
+               if test -d /lib64
+               then
+                       CF_ADD_LIBDIR(/lib64)
+               else
+                       CF_ADD_LIBDIR(/lib)
+               fi
+               ;;
+       *)
+               CF_ADD_LIBDIR(/lib)
+               ;;
+       esac
     ;;
 sunos3*|sunos4*)
-    if test -d /usr/5lib ; then
-      CF_ADD_LIBDIR(/usr/5lib)
-      CF_ADD_LIBS(-lcurses -ltermcap)
+       if test "x$cf_cv_screen" = "xcurses_5lib"
+       then
+               if test -d /usr/5lib ; then
+                       CF_ADD_LIBDIR(/usr/5lib)
+                       CF_ADD_LIBS(-lcurses -ltermcap)
+               fi
     fi
     ac_cv_func_initscr=yes
     ;;
@@ -713,7 +755,7 @@ fi
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_TERM_H version: 9 updated: 2011/04/09 18:19:55
 dnl ----------------
 dnl SVr4 curses should have term.h as well (where it puts the definitions of
 dnl the low-level interface).  This may not be true in old/broken implementations,
@@ -727,9 +769,17 @@ AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
 
 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
 # for <term.h> if we do not find the variant.
-for cf_header in \
-       `echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \
-       term.h
+
+cf_header_list="term.h ncurses/term.h ncursesw/term.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+       cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
+       cf_header_list="$cf_header_item $cf_header_list"
+       ;;
+esac
+
+for cf_header in $cf_header_list
 do
        AC_TRY_COMPILE([
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -775,25 +825,117 @@ ncursesw/term.h)
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_WACS_MAP version: 4 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_UNCTRL_H version: 1 updated: 2011/04/09 18:19:55
 dnl ------------------
-dnl Check for likely values of wacs_map[]:
+dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
+dnl may put it in a subdirectory (along with ncurses' other headers, of
+dnl course).  Packages which put the headers in inconsistent locations are
+dnl broken).
+AC_DEFUN([CF_CURSES_UNCTRL_H],
+[
+AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
+
+AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
+
+# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
+# for <unctrl.h> if we do not find the variant.
+
+cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+       cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
+       cf_header_list="$cf_header_item $cf_header_list"
+       ;;
+esac
+
+for cf_header in $cf_header_list
+do
+       AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <${cf_header}>],
+       [WINDOW *x],
+       [cf_cv_unctrl_header=$cf_header
+        break],
+       [cf_cv_unctrl_header=no])
+done
+
+case $cf_cv_unctrl_header in #(vi
+no)
+       AC_MSG_WARN(unctrl.h header not found)
+       ;;
+esac
+])
+
+case $cf_cv_unctrl_header in #(vi
+unctrl.h) #(vi
+       AC_DEFINE(HAVE_UNCTRL_H)
+       ;;
+ncurses/unctrl.h) #(vi
+       AC_DEFINE(HAVE_NCURSES_UNCTRL_H)
+       ;;
+ncursesw/unctrl.h)
+       AC_DEFINE(HAVE_NCURSESW_UNCTRL_H)
+       ;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59
+dnl ------------------
+dnl Check for likely values of wacs_map[].
 AC_DEFUN([CF_CURSES_WACS_MAP],
 [
 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
        cf_cv_curses_wacs_map=unknown
-       for name in wacs_map _wacs_map __wacs_map _nc_wacs
+       for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
        do
        AC_TRY_LINK([
 #ifndef _XOPEN_SOURCE_EXTENDED
 #define _XOPEN_SOURCE_EXTENDED
 #endif
 #include <${cf_cv_ncurses_header:-curses.h}>],
-       [$name['k'] = *WACS_PLUS],
+       [void *foo = &($name['k'])],
        [cf_cv_curses_wacs_map=$name
         break])
        done])
+
+test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59
+dnl ----------------------
+dnl Do a check to see if the WACS_xxx constants are defined compatibly with
+dnl X/Open Curses.  In particular, NetBSD's implementation of the WACS_xxx
+dnl constants is broken since those constants do not point to cchar_t's.
+AC_DEFUN([CF_CURSES_WACS_SYMBOLS],
+[
+AC_REQUIRE([CF_CURSES_WACS_MAP])
+
+AC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[
+cf_cv_curses_wacs_symbols=no
+if test "$cf_cv_curses_wacs_map" != unknown
+then
+       AC_TRY_LINK([
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
+#endif
+#include <${cf_cv_ncurses_header:-curses.h}>],
+       [cchar_t *foo = WACS_PLUS;
+        $cf_cv_curses_wacs_map['k'] = *WACS_PLUS],
+       [cf_cv_curses_wacs_symbols=yes])
+else
+       AC_TRY_LINK([
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
+#endif
+#include <${cf_cv_ncurses_header:-curses.h}>],
+       [cchar_t *foo = WACS_PLUS],
+       [cf_cv_curses_wacs_symbols=yes])
+fi
 ])
+
+test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS)
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
 dnl ----------
@@ -1966,6 +2108,45 @@ AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
 AC_SUBST(NCURSES_WRAP_PREFIX)
 ])
 dnl ---------------------------------------------------------------------------
+dnl CF_NETBSD_FORM_H version: 1 updated: 2011/01/15 14:59:18
+dnl ----------------
+dnl Check for NetBSD's form.h, which is incompatible with SVr4 and ncurses.
+dnl Some workarounds are needed in client programs to allow them to compile.
+AC_DEFUN([CF_NETBSD_FORM_H],[
+AC_CACHE_CHECK(for NetBSD form.h,cf_cv_netbsd_form_h,[
+AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <form.h>
+],[
+       FORM *form;
+       int y = current_field(form)->cursor_ypos;
+       int x = current_field(form)->cursor_xpos;
+],[cf_cv_netbsd_form_h=yes
+],[cf_cv_netbsd_form_h=no])
+])
+
+test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_NETBSD_MENU_H version: 1 updated: 2011/01/15 14:59:18
+dnl ----------------
+dnl Check for NetBSD's menu.h, which is incompatible with SVr4 and ncurses.
+dnl Some workarounds are needed in client programs to allow them to compile.
+AC_DEFUN([CF_NETBSD_MENU_H],[
+AC_CACHE_CHECK(for NetBSD menu.h,cf_cv_netbsd_menu_h,[
+AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <menu.h>
+],[
+       MENU *menu;
+       int y = menu->max_item_width;
+],[cf_cv_netbsd_menu_h=yes
+],[cf_cv_netbsd_menu_h=no])
+])
+
+test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H)
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
 dnl ------------------
 dnl see CF_WITH_NO_LEAKS
@@ -2032,7 +2213,7 @@ case ".[$]$1" in #(vi
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PDCURSES_X11 version: 10 updated: 2010/06/20 09:24:28
+dnl CF_PDCURSES_X11 version: 11 updated: 2011/01/15 18:45:38
 dnl ---------------
 dnl Configure for PDCurses' X11 library
 AC_DEFUN([CF_PDCURSES_X11],[
@@ -2069,13 +2250,13 @@ fi
 if test $cf_cv_lib_XCurses = yes ; then
        AC_DEFINE(UNIX)
        AC_DEFINE(XCURSES)
-       AC_DEFINE(HAVE_XCURSES)
+       AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES))
 else
        AC_MSG_ERROR(Cannot link with XCurses)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
+dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -2092,7 +2273,7 @@ no) #(vi
        PKG_CONFIG=none
        ;;
 yes) #(vi
-       AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
+       AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
        ;;
 *)
        PKG_CONFIG=$withval
@@ -2574,7 +2755,7 @@ CF_NO_LEAKS_OPTION(valgrind,
        [USE_VALGRIND])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_CURSES version: 10 updated: 2010/10/23 15:54:49
+dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
 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.
@@ -2589,7 +2770,7 @@ AC_TRY_LINK([
 #include <stdlib.h>
 #include <${cf_cv_ncurses_header:-curses.h}>],[
 #if defined(NCURSES_VERSION_PATCH)
-if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
+#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
        make an error
 #endif
 #endif
@@ -2613,7 +2794,7 @@ if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
+dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37: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,
@@ -2632,6 +2813,9 @@ case $host_os in #(vi
 aix[[456]]*) #(vi
        cf_xopen_source="-D_ALL_SOURCE"
        ;;
+cygwin) #(vi
+       cf_XOPEN_SOURCE=600
+       ;;
 darwin[[0-8]].*) #(vi
        cf_xopen_source="-D_APPLE_C_SOURCE"
        ;;
@@ -2853,7 +3037,7 @@ elif test "$cf_x_athena_inc" != default ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05
+dnl CF_X_ATHENA_LIBS version: 10 updated: 2011/02/13 13:31:33
 dnl ----------------
 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
@@ -2883,7 +3067,11 @@ do
                                CF_ADD_LIBS($cf_lib)
                                AC_MSG_CHECKING(for $cf_test in $cf_lib)
                        fi
-                       AC_TRY_LINK([],[$cf_test()],
+                       AC_TRY_LINK([
+#include <X11/Intrinsic.h>
+#include <X11/$cf_x_athena_root/SimpleMenu.h>
+],[
+$cf_test((XtAppContext) 0)],
                                [cf_result=yes],
                                [cf_result=no])
                        AC_MSG_RESULT($cf_result)