]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 5.9 - patch 20111126
[ncurses.git] / aclocal.m4
index 0eff80b9a4ee974cac7c6cfa24c104dcb0a1c92b..212d27f8f8ae43e3589161f907ed39f88440ca11 100644 (file)
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+dnl Copyright (c) 1998-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            *
@@ -28,7 +28,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.547 2010/11/13 19:17:50 tom Exp $
+dnl $Id: aclocal.m4,v 1.588 2011/11/26 21:41:37 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -62,6 +62,31 @@ AC_DEFUN([AM_LANGINFO_CODESET],
   fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_CHECK version: 2 updated: 2011/05/08 11:22:03
+dnl ------------------
+dnl Conditionally generate script according to whether we're using a given autoconf.
+dnl
+dnl $1 = version to compare against
+dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
+dnl $3 = code to use if AC_ACVERSION is older than $1.
+define(CF_ACVERSION_CHECK,
+[
+ifdef([m4_version_compare],
+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
+[CF_ACVERSION_COMPARE(
+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_COMPARE version: 2 updated: 2011/04/14 20:56:50
+dnl --------------------
+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
+dnl                      MAJOR2, MINOR2, TERNARY2,
+dnl                      PRINTABLE2, not FOUND, FOUND)
+define(CF_ACVERSION_COMPARE,
+[ifelse(builtin([eval], [$2 < $5]), 1,
+[ifelse([$8], , ,[$8])],
+[ifelse([$9], , ,[$9])])])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
 dnl -------------------
 dnl Construct the list of include-options for the C programs in the Ada95
@@ -313,12 +338,33 @@ ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
 }
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
+dnl CF_ANSI_CC_CHECK version: 11 updated: 2011/07/01 19:47:45
 dnl ----------------
-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
-dnl in the sharutils 4.2 distribution.
+dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
+dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
 AC_DEFUN([CF_ANSI_CC_CHECK],
 [
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+# Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
+# into CC.  This will not help with broken scripts that wrap the compiler with
+# options, but eliminates a more common category of user confusion.
+AC_MSG_CHECKING(\$CC variable)
+case "$CC" in #(vi
+*[[\ \ ]]-[[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)
+       ;;
+*)
+       AC_MSG_RESULT(ok)
+       ;;
+esac
+
 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
 cf_cv_ansi_cc=no
 cf_save_CFLAGS="$CFLAGS"
@@ -465,7 +511,7 @@ fi
 AC_SUBST(ARFLAGS)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03
+dnl CF_AWK_BIG_PRINTF version: 4 updated: 2011/10/30 17:09:50
 dnl -----------------
 dnl Check if awk can handle big strings using printf.  Some older versions of
 dnl awk choke on large strings passed via "%s".
@@ -479,8 +525,8 @@ AC_DEFUN([CF_AWK_BIG_PRINTF],
                eval $2=no
                ;;
        *) #(vi
-               if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \
-                       | $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
+               if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
+                       | $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
                        eval $2=yes
                else
                        eval $2=no
@@ -695,7 +741,7 @@ AC_SUBST(BUILD_EXEEXT)
 AC_SUBST(BUILD_OBJEXT)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
+dnl CF_CFG_DEFAULTS version: 8 updated: 2011/06/04 20:09:13
 dnl ---------------
 dnl Determine the default configuration into which we'll install ncurses.  This
 dnl can be overridden by the user's command-line options.  There's two items to
@@ -713,7 +759,7 @@ AC_MSG_CHECKING(for prefix)
 if test "x$prefix" = "xNONE" ; then
        case "$cf_cv_system_name" in
                # non-vendor systems don't have a conflict
-       openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
+       openbsd*|freebsd*|mirbsd*|linux*|cygwin*|k*bsd*-gnu)
                prefix=/usr
                ;;
        *)      prefix=$ac_default_prefix
@@ -749,27 +795,48 @@ AC_MSG_RESULT($includedir)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
+dnl CF_CGETENT version: 4 updated: 2011/08/07 14:54:41
 dnl ----------
 dnl Check if the terminal-capability database functions are available.  If not,
 dnl ncurses has a much-reduced version.
 AC_DEFUN([CF_CGETENT],[
-AC_MSG_CHECKING(for terminal-capability database functions)
-AC_CACHE_VAL(cf_cv_cgetent,[
+AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
 AC_TRY_LINK([
 #include <stdlib.h>],[
        char temp[128];
        char *buf = temp;
        char *db_array = temp;
-       cgetent(&buf, /* int *, */ &db_array, "vt100");
+       cgetent(&buf, &db_array, "vt100");
        cgetcap(buf, "tc", '=');
        cgetmatch(buf, "tc");
        ],
        [cf_cv_cgetent=yes],
        [cf_cv_cgetent=no])
 ])
-AC_MSG_RESULT($cf_cv_cgetent)
-test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
+
+if test "$cf_cv_cgetent" = yes
+then
+       AC_DEFINE(HAVE_BSD_CGETENT)
+AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[
+AC_TRY_LINK([
+#include <stdlib.h>],[
+       char temp[128];
+       char *buf = temp;
+#ifndef _NETBSD_SOURCE                 /* given, since April 2004 in stdlib.h */
+       const char *db_array = temp;
+       cgetent(&buf, &db_array, "vt100");
+#endif
+       cgetcap(buf, "tc", '=');
+       cgetmatch(buf, "tc");
+       ],
+       [cf_cv_cgetent_const=yes],
+       [cf_cv_cgetent_const=no])
+])
+       if test "$cf_cv_cgetent_const" = yes
+       then
+               AC_DEFINE_UNQUOTED(CGETENT_CONST,const)
+       fi
+fi
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
@@ -908,6 +975,27 @@ if test "$cf_cv_check_gpm_wgetch" != yes ; then
 fi
 ])])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_CHECK_WCHAR_H version: 1 updated: 2011/10/29 15:01:05
+dnl ----------------
+dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED
+AC_DEFUN([CF_CHECK_WCHAR_H],[
+AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[
+AC_TRY_COMPILE(
+[
+#include <stdlib.h>
+#include <wchar.h>
+],[
+       wint_t foo = 0;
+       int bar = iswpunct(foo)],
+       [cf_cv_wchar_h_okay=yes],
+       [cf_cv_wchar_h_okay=no])])
+
+if test $cf_cv_wchar_h_okay = no
+then
+       CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
 dnl -----------------
 dnl Check if the C++ compiler accepts duplicate parameter initialization.  This
@@ -999,6 +1087,54 @@ fi
 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_CXX_AR_FLAGS version: 1 updated: 2011/10/29 08:35:34
+dnl ---------------
+dnl Setup special archiver flags for given compilers.
+AC_DEFUN([CF_CXX_AR_FLAGS],[
+       CXX_AR='$(AR)'
+       CXX_ARFLAGS='$(ARFLAGS)'
+       case $cf_cv_system_name in #(vi
+       irix*) #(vi
+           if test "$GXX" != yes ; then
+               CXX_AR='$(CXX)'
+               CXX_ARFLAGS='-ar -o'
+           fi
+           ;;
+       sco3.2v5*) #(vi
+           CXXLDFLAGS="-u main"
+           ;;
+       solaris2*)
+           if test "$GXX" != yes ; then
+               CXX_AR='$(CXX)'
+               CXX_ARFLAGS='-xar -o'
+           fi
+           ;;
+       esac
+       AC_SUBST(CXXLDFLAGS)
+       AC_SUBST(CXX_AR)
+       AC_SUBST(CXX_ARFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CXX_IOSTREAM_NAMESPACE version: 1 updated: 2011/10/29 08:35:34
+dnl -------------------------
+dnl For c++, check if iostream uses "std::" namespace.
+AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[
+AC_CHECK_HEADERS(iostream)
+if test x"$ac_cv_header_iostream" = xyes ; then
+       AC_MSG_CHECKING(if iostream uses std-namespace)
+       AC_TRY_COMPILE([
+#include <iostream>
+using std::endl;
+using std::cerr;],[
+cerr << "testing" << endl;
+],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
+       AC_MSG_RESULT($cf_iostream_namespace)
+       if test "$cf_iostream_namespace" = yes ; then
+               AC_DEFINE(IOSTREAM_NAMESPACE)
+       fi
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_C_INLINE version: 3 updated: 2010/05/01 15:14:41
 dnl -----------
 dnl Check if the C compiler supports "inline".
@@ -1104,7 +1240,7 @@ fi
 AC_SUBST(LIBTOOL_VERSION)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00
+dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
 dnl ---------------------
 dnl The rpath-hack makes it simpler to build programs, particularly with the
 dnl *BSD ports which may have essential libraries in unusual places.  But it
@@ -1112,7 +1248,7 @@ dnl can interfere with building an executable for the base system.  Use this
 dnl option in that case.
 AC_DEFUN([CF_DISABLE_RPATH_HACK],
 [
-AC_MSG_CHECKING(if rpath should be not be set)
+AC_MSG_CHECKING(if rpath-hack should be disabled)
 CF_ARG_DISABLE(rpath-hack,
        [  --disable-rpath-hack    don't add rpath options for additional libraries],
        [cf_disable_rpath_hack=yes],
@@ -1123,6 +1259,31 @@ if test "$cf_disable_rpath_hack" = no ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
+dnl CF_ENABLE_PC_FILES version: 6 updated: 2011/09/10 16:31:04
+dnl ------------------
+dnl This is the "--enable-pc-files" option, which is available if there is a
+dnl pkg-config configuration on the local machine.
+AC_DEFUN([CF_ENABLE_PC_FILES],[
+AC_REQUIRE([CF_PKG_CONFIG])
+AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
+
+if test "$PKG_CONFIG" != no ; then
+       if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then
+               AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
+               AC_ARG_ENABLE(pc-files,
+                       [  --enable-pc-files       generate and install .pc files for pkg-config],
+                       [enable_pc_files=$enableval],
+                       [enable_pc_files=no])
+               AC_MSG_RESULT($enable_pc_files)
+       elif test -z "$PKG_CONFIG_LIBDIR" || test "$PKG_CONFIG_LIBDIR" != no; then
+               enable_pc_files=no
+               AC_MSG_WARN(did not find $PKG_CONFIG library)
+       fi
+else
+       enable_pc_files=no
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
 dnl ---------------
 dnl Check if the rpath option should be used, setting cache variable
@@ -1769,10 +1930,35 @@ rm -rf conftest*
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_GENERICS version: 1 updated: 2010/11/13 14:15:18
+dnl CF_GETOPT_HEADER version: 4 updated: 2009/08/31 20:07:52
+dnl ----------------
+dnl Check for getopt's variables which are commonly defined in stdlib.h,
+dnl unistd.h or (nonstandard) in getopt.h
+AC_DEFUN([CF_GETOPT_HEADER],
+[
+AC_HAVE_HEADERS(unistd.h getopt.h)
+AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
+cf_cv_getopt_header=none
+for cf_header in stdio.h stdlib.h unistd.h getopt.h
+do
+AC_TRY_COMPILE([
+#include <$cf_header>],
+[int x = optind; char *y = optarg],
+[cf_cv_getopt_header=$cf_header
+ break])
+done
+])
+if test $cf_cv_getopt_header != none ; then
+       AC_DEFINE(HAVE_GETOPT_HEADER)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_GNAT_GENERICS version: 2 updated: 2011/03/23 20:24:41
 dnl ----------------
 AC_DEFUN([CF_GNAT_GENERICS],
 [
+AC_REQUIRE([CF_GNAT_VERSION])
+
 AC_MSG_CHECKING(if GNAT supports generics)
 case $cf_gnat_version in #(vi
 3.[[1-9]]*|[[4-9]].*) #(vi
@@ -1826,28 +2012,92 @@ fi
 AC_SUBST(PRAGMA_UNREF)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_PROJECTS version: 1 updated: 2010/11/13 14:15:18
+dnl CF_GNAT_PROJECTS version: 2 updated: 2011/03/23 20:24:41
 dnl ----------------
+dnl GNAT projects are configured with ".gpr" project files.
+dnl GNAT libraries are a further development, using the project feature.
 AC_DEFUN([CF_GNAT_PROJECTS],
 [
+AC_REQUIRE([CF_GNAT_VERSION])
+
+cf_gnat_libraries=no
+cf_gnat_projects=no
+
 AC_MSG_CHECKING(if GNAT supports project files)
 case $cf_gnat_version in #(vi
 3.[[0-9]]*) #(vi
-       cf_gnat_projects=no
        ;;
 *)
        case $cf_cv_system_name in #(vi
        cygwin*) #(vi
-               cf_gnat_projects=no
                ;;
        *)
-               cf_gnat_projects=yes
+               mkdir conftest.src conftest.bin conftest.lib
+               cd conftest.src
+               rm -rf conftest* *~conftest*
+               cat >>library.gpr <<CF_EOF
+project Library is
+  Kind := External ("LIB_KIND");
+  for Library_Name use "ConfTest";
+  for Object_Dir use ".";
+  for Library_ALI_Dir use External("LIBRARY_DIR");
+  for Library_Version use External ("SONAME");
+  for Library_Kind use Kind;
+  for Library_Dir use External("BUILD_DIR");
+  Source_Dir := External ("SOURCE_DIR");
+  for Source_Dirs use (Source_Dir);
+  package Compiler is
+     for Default_Switches ("Ada") use
+       ("-g",
+        "-O2",
+        "-gnatafno",
+        "-gnatVa",   -- All validity checks
+        "-gnatwa");  -- Activate all optional errors
+  end Compiler;
+end Library;
+CF_EOF
+               cat >>confpackage.ads <<CF_EOF
+package ConfPackage is
+   procedure conftest;
+end ConfPackage;
+CF_EOF
+               cat >>confpackage.adb <<CF_EOF
+with Text_IO;
+package body ConfPackage is
+   procedure conftest is
+   begin
+      Text_IO.Put ("Hello World");
+      Text_IO.New_Line;
+   end conftest;
+end ConfPackage;
+CF_EOF
+               if ( $cf_ada_make $ADAFLAGS \
+                               -Plibrary.gpr \
+                               -XBUILD_DIR=`cd ../conftest.bin;pwd` \
+                               -XLIBRARY_DIR=`cd ../conftest.lib;pwd` \
+                               -XSOURCE_DIR=`pwd` \
+                               -XSONAME=libConfTest.so.1 \
+                               -XLIB_KIND=static 1>&AC_FD_CC 2>&1 ) ; then
+                       cf_gnat_projects=yes
+               fi
+               cd ..
+               if test -f conftest.lib/confpackage.ali
+               then
+                       cf_gnat_libraries=yes
+               fi
+               rm -rf conftest* *~conftest*
                ;;
        esac
        ;;
 esac
 AC_MSG_RESULT($cf_gnat_projects)
 
+if test $cf_gnat_projects = yes
+then
+       AC_MSG_CHECKING(if GNAT supports libraries)
+       AC_MSG_RESULT($cf_gnat_libraries)
+fi
+
 if test "$cf_gnat_projects" = yes
 then
        USE_OLD_MAKERULES="#"
@@ -1857,11 +2107,66 @@ else
        USE_GNAT_PROJECTS="#"
 fi
 
+if test "$cf_gnat_libraries" = yes
+then
+       USE_GNAT_LIBRARIES=""
+else
+       USE_GNAT_LIBRARIES="#"
+fi
+
 AC_SUBST(USE_OLD_MAKERULES)
 AC_SUBST(USE_GNAT_PROJECTS)
+AC_SUBST(USE_GNAT_LIBRARIES)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59
+dnl --------------
+dnl Check if gnat supports SIGINT, and presumably tasking.  For the latter, it
+dnl is noted that gnat may compile a tasking unit even for configurations which
+dnl fail at runtime.
+AC_DEFUN([CF_GNAT_SIGINT],[
+AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
+CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
+
+package ConfTest is
+
+   pragma Warnings (Off);  --  the next pragma exists since 3.11p
+   pragma Unreserve_All_Interrupts;
+   pragma Warnings (On);
+
+   protected Process is
+      procedure Stop;
+      function Continue return Boolean;
+      pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
+   private
+      Done : Boolean := False;
+   end Process;
+
+end ConfTest;],
+[package body ConfTest is
+   protected body Process is
+      procedure Stop is
+      begin
+         Done := True;
+      end Stop;
+      function Continue return Boolean is
+      begin
+         return not Done;
+      end Continue;
+   end Process;
+end ConfTest;],
+       [cf_cv_gnat_sigint=yes],
+       [cf_cv_gnat_sigint=no])])
+
+if test $cf_cv_gnat_sigint = yes ; then
+       USE_GNAT_SIGINT=""
+else
+       USE_GNAT_SIGINT="#"
+fi
+AC_SUBST(USE_GNAT_SIGINT)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_TRY_LINK version: 2 updated: 2010/08/14 18:25:37
+dnl CF_GNAT_TRY_LINK version: 3 updated: 2011/03/19 14:47:45
 dnl ----------------
 dnl Verify that a test program compiles/links with GNAT.
 dnl $cf_ada_make is set to the program that compiles/links
@@ -1873,7 +2178,7 @@ dnl $3 is the shell command to execute if successful
 dnl $4 is the shell command to execute if not successful
 AC_DEFUN([CF_GNAT_TRY_LINK],
 [
-rm -rf conftest*
+rm -rf conftest* *~conftest*
 cat >>conftest.ads <<CF_EOF
 $1
 CF_EOF
@@ -1885,10 +2190,10 @@ ifelse($3,,      :,[      $3])
 ifelse($4,,,[else
    $4])
 fi
-rm -rf conftest*
+rm -rf conftest* *~conftest*
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_TRY_RUN version: 4 updated: 2010/08/14 18:25:37
+dnl CF_GNAT_TRY_RUN version: 5 updated: 2011/03/19 14:47:45
 dnl ---------------
 dnl Verify that a test program compiles and runs with GNAT
 dnl $cf_ada_make is set to the program that compiles/links
@@ -1900,7 +2205,7 @@ dnl $3 is the shell command to execute if successful
 dnl $4 is the shell command to execute if not successful
 AC_DEFUN([CF_GNAT_TRY_RUN],
 [
-rm -rf conftest*
+rm -rf conftest* *~conftest*
 cat >>conftest.ads <<CF_EOF
 $1
 CF_EOF
@@ -1916,10 +2221,10 @@ ifelse($4,,,[   else
 ifelse($4,,,[else
    $4])
 fi
-rm -rf conftest*
+rm -rf conftest* *~conftest*
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_VERSION version: 16 updated: 2010/11/13 14:15:18
+dnl CF_GNAT_VERSION version: 17 updated: 2011/03/23 20:24:41
 dnl ---------------
 dnl Verify version of GNAT.
 AC_DEFUN([CF_GNAT_VERSION],
@@ -1939,9 +2244,6 @@ case $cf_gnat_version in #(vi
        cf_cv_prog_gnat_correct=no
        ;;
 esac
-
-CF_GNAT_GENERICS
-CF_GNAT_PROJECTS
 ])
 dnl ---------------------------------------------------------------------------
 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
@@ -2463,7 +2765,7 @@ ifdef([AC_FUNC_FSEEKO],[
 ])
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LDFLAGS_STATIC version: 8 updated: 2010/10/23 14:39:56
+dnl CF_LDFLAGS_STATIC version: 10 updated: 2011/09/24 12:51:48
 dnl -----------------
 dnl Check for compiler/linker flags used to temporarily force usage of static
 dnl libraries.  This depends on the compiler and platform.  Use this to help
@@ -2484,7 +2786,7 @@ if test "$GCC" = yes ; then
     esac
 else
        case $cf_cv_system_name in #(
-       aix[[456]]*)    #( from ld manpage
+       aix[[4-7]]*)    #( from ld manpage
                LDFLAGS_STATIC=-bstatic
                LDFLAGS_SHARED=-bdynamic
                ;;
@@ -2534,7 +2836,17 @@ EOF
 int cf_ldflags_static(FILE *fp);
 ],[
        return cf_ldflags_static(stdin);
-],[cf_ldflags_static=yes],[cf_ldflags_static=no])
+],[
+       # some linkers simply ignore the -dynamic
+       case x`file conftest$ac_exeext 2>/dev/null` in #(vi
+       *static*) # (vi
+               cf_ldflags_static=no
+               ;;
+       *)
+               cf_ldflags_static=yes
+               ;;
+       esac
+],[cf_ldflags_static=no])
 
        rm -f libconftest.*
        LIBS="$cf_save_LIBS"
@@ -2555,7 +2867,7 @@ AC_SUBST(LDFLAGS_STATIC)
 AC_SUBST(LDFLAGS_SHARED)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
 dnl ---------------
 dnl For the given system and compiler, find the compiler flags to pass to the
 dnl loader to use the "rpath" feature.
@@ -2576,10 +2888,10 @@ irix*) #(vi
 linux*|gnu*|k*bsd*-gnu) #(vi
        LD_RPATH_OPT="-Wl,-rpath,"
        ;;
-openbsd[[2-9]].*) #(vi
+openbsd[[2-9]].*|mirbsd*) #(vi
        LD_RPATH_OPT="-Wl,-rpath,"
        ;;
-freebsd*) #(vi
+dragonfly*|freebsd*) #(vi
        LD_RPATH_OPT="-rpath "
        ;;
 netbsd*) #(vi
@@ -3174,7 +3486,7 @@ fi
 ])
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03
+dnl CF_LIB_SUFFIX version: 17 updated: 2011/07/02 15:36:04
 dnl -------------
 dnl Compute the library file-suffix from the given model name
 dnl $1 = model name
@@ -3203,7 +3515,7 @@ AC_DEFUN([CF_LIB_SUFFIX],
                ;;
        shared) #(vi
                case $cf_cv_system_name in
-               aix[[56]]*) #(vi
+               aix[[5-7]]*) #(vi
                        $2='.a'
                        $3=[$]$2
                        ;;
@@ -3386,7 +3698,7 @@ AC_DEFUN([CF_MAIN_RETURN],
 cf_cv_main_return=return
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MAKEFLAGS version: 13 updated: 2010/10/23 15:52:32
+dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
 dnl ------------
 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
 dnl options to lower-levels.  It's very useful for "make -n" -- if we have it.
@@ -3403,7 +3715,7 @@ SHELL = /bin/sh
 all :
        @ echo '.$cf_option'
 CF_EOF
-               cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[      ]]*$,,'`
+               cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[   ]]*$,,'`
                case "$cf_result" in
                .*k)
                        cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
@@ -3681,7 +3993,7 @@ AC_ARG_WITH(manpage-tbl,
 AC_MSG_RESULT($MANPAGE_TBL)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MAN_PAGES version: 39 updated: 2010/10/23 15:44:18
+dnl CF_MAN_PAGES version: 40 updated: 2011/09/10 16:20:21
 dnl ------------
 dnl Try to determine if the man-pages on the system are compressed, and if
 dnl so, what format is used.  Use this information to construct a script that
@@ -3831,7 +4143,9 @@ CF_EOF
 
 if test "$MANPAGE_ALIASES" != no ; then
 cat >>$cf_edit_man <<CF_EOF
-       aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
+       nCurses=ignore.3x
+       test $with_curses_h = yes && nCurses=ncurses.3x
+       aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u; test \$inalias = \$nCurses && echo curses\`
 CF_EOF
 fi
 
@@ -3877,6 +4191,13 @@ if test \$cf_tables = yes ; then
 fi
 CF_EOF
 
+if test $with_overwrite != yes ; then
+cat >>$cf_edit_man <<CF_EOF
+       sed -e "/\#[    ]*include/s,<curses.h,<ncurses$LIB_SUFFIX/curses.h," < \$TMP >\$TMP.out
+       mv \$TMP.out \$TMP
+CF_EOF
+fi
+
 if test $with_curses_h != yes ; then
 cat >>$cf_edit_man <<CF_EOF
        sed -e "/\#[    ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
@@ -4258,7 +4579,7 @@ case ".[$]$1" in #(vi
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -4275,7 +4596,9 @@ no) #(vi
        PKG_CONFIG=none
        ;;
 yes) #(vi
-       AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
+       CF_ACVERSION_CHECK(2.52,
+               [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
+               [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
        ;;
 *)
        PKG_CONFIG=$withval
@@ -4540,7 +4863,7 @@ AC_SUBST(PROG_EXT)
 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18
+dnl CF_PROG_GNAT version: 2 updated: 2011/10/22 14:01:47
 dnl ------------
 dnl Check for gnatmake, ensure that it is complete.
 AC_DEFUN([CF_PROG_GNAT],[
@@ -4548,6 +4871,7 @@ cf_ada_make=gnatmake
 AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
 if test "$ac_cv_prog_gnat_exists" = no; then
    cf_ada_make=
+   cf_cv_prog_gnat_correct=no
 else
    CF_GNAT_VERSION
    AC_CHECK_PROG(M4_exists, m4, yes, no)
@@ -4591,7 +4915,7 @@ case $INSTALL in
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_LDCONFIG version: 2 updated: 2008/12/13 14:08:40
+dnl CF_PROG_LDCONFIG version: 3 updated: 2011/06/04 20:09:13
 dnl ----------------
 dnl Check for ldconfig, needed to fixup shared libraries that would be built
 dnl and then used in the install.
@@ -4600,7 +4924,7 @@ if test "$cross_compiling" = yes ; then
   LDCONFIG=:
 else
 case "$cf_cv_system_name" in #(vi
-dragonfly*|freebsd*) #(vi
+dragonfly*|mirbsd*|freebsd*) #(vi
   test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
   ;;
 *) LDPATH=$PATH:/sbin:/usr/sbin
@@ -4751,7 +5075,7 @@ define([CF_REMOVE_LIB],
 $1=`echo "$2" | sed -e 's/-l$3[[       ]]//g' -e 's/-l$3[$]//'`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58
+dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33
 dnl -------------
 AC_DEFUN([CF_RPATH_HACK],
 [
@@ -4764,9 +5088,36 @@ if test -n "$LD_RPATH_OPT" ; then
        cf_rpath_list="/usr/lib /lib"
        if test "$cf_ldd_prog" != no
        then
+               cf_rpath_oops=
+
 AC_TRY_LINK([#include <stdio.h>],
                [printf("Hello");],
-               [cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[     ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
+               [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
+                cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[     ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
+
+               # If we passed the link-test, but get a "not found" on a given library,
+               # this could be due to inept reconfiguration of gcc to make it only
+               # partly honor /usr/local/lib (or whatever).  Sometimes this behavior
+               # is intentional, e.g., installing gcc in /usr/bin and suppressing the
+               # /usr/local libraries.
+               if test -n "$cf_rpath_oops"
+               then
+                       for cf_rpath_src in $cf_rpath_oops
+                       do
+                               for cf_rpath_dir in \
+                                       /usr/local \
+                                       /usr/pkg \
+                                       /opt/sfw
+                               do
+                                       if test -f $cf_rpath_dir/lib/$cf_rpath_src
+                                       then
+                                               CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
+                                               LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
+                                               break
+                                       fi
+                               done
+                       done
+               fi
        fi
 
        CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
@@ -4839,7 +5190,7 @@ CF_VERBOSE(...checked $1 [$]$1)
 AC_SUBST(EXTRA_LDFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16
+dnl CF_SHARED_OPTS version: 69 updated: 2011/07/30 19:31:39
 dnl --------------
 dnl --------------
 dnl Attempt to determine the appropriate CC/LD options for creating a shared
@@ -4914,10 +5265,14 @@ AC_DEFUN([CF_SHARED_OPTS],
        cf_cv_shlib_version_infix=no
 
        case $cf_cv_system_name in #(vi
-       aix[[56]]*) #(vi
+       aix4.[3-9]*|aix[[5-7]]*) #(vi
                if test "$GCC" = yes; then
                        CC_SHARED_OPTS=
-                       MK_SHARED_LIB='$(CC) -shared'
+                       MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
+               else
+                       # CC_SHARED_OPTS='-qpic=large -G'
+                       # perhaps "-bM:SRE -bnoentry -bexpall"
+                       MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
                fi
                ;;
        beos*) #(vi
@@ -4970,9 +5325,19 @@ CF_EOF
                # readonly to exploit a quirk in the memory manager.
                INSTALL_LIB="-m 555"
                ;;
+       interix*)
+               test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
+               if test "$cf_cv_shlib_version" = rel; then
+                       cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}'
+               else
+                       cf_shared_soname='`basename $@`'
+               fi
+               CC_SHARED_OPTS=
+               MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
+               ;;
        irix*) #(vi
                if test "$cf_cv_enable_rpath" = yes ; then
-                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
                fi
                # tested with IRIX 5.2 and 'cc'.
                if test "$GCC" != yes; then
@@ -4989,18 +5354,18 @@ CF_EOF
                        LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
                fi
                if test "$cf_cv_enable_rpath" = yes ; then
-                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
                fi
                CF_SHARED_SONAME
                MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
                ;;
-       openbsd[[2-9]].*) #(vi
+       openbsd[[2-9]].*|mirbsd*) #(vi
                if test "$DFT_LWR_MODEL" = "shared" ; then
                        LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
                        LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
                fi
                if test "$cf_cv_enable_rpath" = yes ; then
-                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
                fi
                CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
                CF_SHARED_SONAME
@@ -5011,12 +5376,12 @@ CF_EOF
                MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
                test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
                ;;
-       freebsd*) #(vi
+       dragonfly*|freebsd*) #(vi
                CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
                if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
                        LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
-                       LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
-                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+                       LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
+                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
                fi
                CF_SHARED_SONAME
                MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
@@ -5026,7 +5391,7 @@ CF_EOF
                if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
                        LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
                        LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
-                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+                       EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
                        if test "$cf_cv_shlib_version" = auto; then
                        if test -f /usr/libexec/ld.elf_so; then
                                cf_cv_shlib_version=abi
@@ -5131,9 +5496,9 @@ CF_EOF
                ;;
        esac
 
-       if test -n "$cf_ld_rpath_opt" ; then
-               MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
-       fi
+       # RPATH_LIST is a colon-separated list of directories
+       test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
+       test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
 
        AC_SUBST(CC_SHARED_OPTS)
        AC_SUBST(LD_RPATH_OPT)
@@ -5145,6 +5510,7 @@ CF_EOF
        AC_SUBST(LOCAL_LDFLAGS)
        AC_SUBST(LOCAL_LDFLAGS2)
        AC_SUBST(INSTALL_LIB)
+       AC_SUBST(RPATH_LIST)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
@@ -5329,7 +5695,7 @@ if test "$cf_cv_sizechange" != no ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SRC_MODULES version: 21 updated: 2010/09/04 17:37:40
+dnl CF_SRC_MODULES version: 23 updated: 2011/11/26 16:35:15
 dnl --------------
 dnl For each parameter, test if the source-directory exists, and if it contains
 dnl a 'modules' file.  If so, add to the list $cf_cv_src_modules which we'll
@@ -5352,6 +5718,7 @@ else
        TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
 fi
 
+PC_MODULES_TO_MAKE="ncurses"
 cf_cv_src_modules=
 for cf_dir in $1
 do
@@ -5390,6 +5757,7 @@ do
                                TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
                                TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
                        fi
+                       PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}"
                fi
        fi
 done
@@ -5417,10 +5785,15 @@ if test "x$cf_with_tests" != "xno" ; then
        SRC_SUBDIRS="$SRC_SUBDIRS test"
 fi
 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
-test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
+if test "$cf_with_cxx_binding" != no; then
+       PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++"
+       SRC_SUBDIRS="$SRC_SUBDIRS c++"
+fi
+
+AC_SUBST(PC_MODULES_TO_MAKE)
 
 ADA_SUBDIRS=
-if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then
        SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
        ADA_SUBDIRS="gen src"
        if test "x$cf_with_tests" != "xno" ; then
@@ -5479,13 +5852,13 @@ dnl     Remove "-g" option from the compiler options
 AC_DEFUN([CF_STRIP_G_OPT],
 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
+dnl CF_STRUCT_SIGACTION version: 4 updated: 2011/04/16 11:52:53
 dnl -------------------
 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction.  We'll only
 dnl do this if we've found the sigaction function.
-dnl
-dnl If needed, define SVR4_ACTION.
 AC_DEFUN([CF_STRUCT_SIGACTION],[
+AC_REQUIRE([CF_XOPEN_SOURCE])
+
 if test "$ac_cv_func_sigaction" = yes; then
 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
 AC_TRY_COMPILE([
@@ -5500,22 +5873,24 @@ AC_TRY_COMPILE([
 #include <signal.h>],
        [struct sigaction act],
        [sigact_bad=yes
-        AC_DEFINE(SVR4_ACTION)],
+        AC_DEFINE(_POSIX_SOURCE)],
         [sigact_bad=unknown])])
 AC_MSG_RESULT($sigact_bad)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
+dnl CF_STRUCT_TERMIOS version: 6 updated: 2011/04/16 11:52:53
 dnl -----------------
 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
-dnl If so, define SVR4_TERMIO
 AC_DEFUN([CF_STRUCT_TERMIOS],[
+AC_REQUIRE([CF_XOPEN_SOURCE])
+
 AC_CHECK_HEADERS( \
 termio.h \
 termios.h \
 unistd.h \
 )
+
 if test "$ISC" = yes ; then
        AC_CHECK_HEADERS( sys/termio.h )
 fi
@@ -5535,7 +5910,7 @@ if test "$ac_cv_header_termios_h" = yes ; then
 #include <termios.h>],
                        [struct termios foo; int x = foo.c_iflag],
                        termios_bad=unknown,
-                       termios_bad=yes AC_DEFINE(SVR4_TERMIO))
+                       termios_bad=yes AC_DEFINE(_POSIX_SOURCE))
                        ])
        AC_MSG_RESULT($termios_bad)
        fi
@@ -5653,6 +6028,45 @@ top_builddir=`pwd`
 AC_SUBST(top_builddir)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
+dnl -------------------
+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
+dnl can define it successfully.
+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+       AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+       [cf_cv_xopen_source=no],
+       [cf_save="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+        AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+       [cf_cv_xopen_source=no],
+       [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+       CPPFLAGS="$cf_save"
+       ])
+])
+
+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)
+fi
+])
+dnl ---------------------------------------------------------------------------
 dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
 dnl ----------------
 dnl Determine the type we should use for chtype (and attr_t, which is treated
@@ -6037,7 +6451,7 @@ if test "$with_gpm" != no ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24
+dnl CF_WITH_LIBTOOL version: 28 updated: 2011/07/02 15:40:32
 dnl ---------------
 dnl Provide a configure option to incorporate libtool.  Define several useful
 dnl symbols for the makefile rules.
@@ -6113,7 +6527,7 @@ ifdef([AC_PROG_LIBTOOL],[
                AC_MSG_ERROR(Cannot find libtool)
        fi
 ])dnl
-       LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o'
+       LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
        LIB_OBJECT='${OBJECTS:.o=.lo}'
        LIB_SUFFIX=.la
        LIB_CLEAN='${LIBTOOL} --mode=clean'
@@ -6138,7 +6552,7 @@ ifdef([AC_PROG_LIBTOOL],[
        # special hack to add -no-undefined (which libtool should do for itself)
        LT_UNDEF=
        case "$cf_cv_system_name" in #(vi
-       cygwin*|mingw32*|uwin*|aix[[456]]) #(vi
+       cygwin*|mingw32*|uwin*|aix[[4-7]]) #(vi
                LT_UNDEF=-no-undefined
                ;;
        esac
@@ -6241,7 +6655,50 @@ AC_SUBST($3)dnl
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02
+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 1 updated: 2011/09/10 16:20:21
+dnl -------------------------
+dnl Allow the choice of the pkg-config library directory to be overridden.
+AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
+if test "$PKG_CONFIG" != no ; then
+       AC_MSG_CHECKING(for $PKG_CONFIG library directory)
+       AC_ARG_WITH(pkg-config-libdir,
+               [  --with-pkg-config-libdir=XXX use given directory for installing pc-files],
+               [PKG_CONFIG_LIBDIR=$withval],
+               [PKG_CONFIG_LIBDIR=yes])
+
+       case x$PKG_CONFIG_LIBDIR in #(vi
+       x/*) #(vi
+               ;;
+       xyes) #(vi
+               # look for the library directory using the same prefix as the executable
+               cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
+               case x`(arch) 2>/dev/null` in #(vi
+               *64) #(vi
+                       for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib
+                       do
+                               if test -d $cf_config/pkgconfig
+                               then
+                                       PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
+                                       break
+                               fi
+                       done
+                       ;;
+               *)
+                       PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig
+                       ;;
+               esac
+               ;;
+       *)
+               ;;
+       esac
+
+       AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
+fi
+
+AC_SUBST(PKG_CONFIG_LIBDIR)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PTHREAD version: 4 updated: 2011/11/12 21:08:44
 dnl ---------------
 dnl Check for POSIX thread library.
 AC_DEFUN([CF_WITH_PTHREAD],
@@ -6257,23 +6714,27 @@ if test "$with_pthread" != no ; then
     AC_CHECK_HEADER(pthread.h,[
         AC_DEFINE(HAVE_PTHREADS_H)
 
-        AC_MSG_CHECKING(if we can link with the pthread library)
-        cf_save_LIBS="$LIBS"
-        CF_ADD_LIB(pthread)
-        AC_TRY_LINK([
+       for cf_lib_pthread in pthread c_r
+       do
+           AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
+           cf_save_LIBS="$LIBS"
+           CF_ADD_LIB($cf_lib_pthread)
+           AC_TRY_LINK([
 #include <pthread.h>
 ],[
-        int rc = pthread_create(0,0,0,0);
+           int rc = pthread_create(0,0,0,0);
 ],[with_pthread=yes],[with_pthread=no])
-        LIBS="$cf_save_LIBS"
-        AC_MSG_RESULT($with_pthread)
-
-        if test "$with_pthread" = yes ; then
-            CF_ADD_LIB(pthread)
-            AC_DEFINE(HAVE_LIBPTHREADS)
-        else
-            AC_MSG_ERROR(Cannot link with pthread library)
-        fi
+           LIBS="$cf_save_LIBS"
+           AC_MSG_RESULT($with_pthread)
+           test "$with_pthread" = yes && break
+       done
+
+       if test "$with_pthread" = yes ; then
+           CF_ADD_LIB($cf_lib_pthread)
+           AC_DEFINE(HAVE_LIBPTHREADS)
+       else
+           AC_MSG_ERROR(Cannot link with pthread library)
+       fi
     ])
 fi
 ])
@@ -6341,7 +6802,7 @@ CF_NO_LEAKS_OPTION(valgrind,
        [USE_VALGRIND])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
+dnl CF_XOPEN_SOURCE version: 40 updated: 2011/11/12 21:08:44
 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,
@@ -6357,9 +6818,12 @@ cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[[456]]*) #(vi
+aix[[4-7]]*) #(vi
        cf_xopen_source="-D_ALL_SOURCE"
        ;;
+cygwin) #(vi
+       cf_XOPEN_SOURCE=600
+       ;;
 darwin[[0-8]].*) #(vi
        cf_xopen_source="-D_APPLE_C_SOURCE"
        ;;
@@ -6387,10 +6851,16 @@ linux*|gnu*|mint*|k*bsd*-gnu) #(vi
        CF_GNU_SOURCE
        ;;
 mirbsd*) #(vi
-       # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+       # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+       cf_XOPEN_SOURCE=
+       CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
        ;;
 netbsd*) #(vi
-       # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+       cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+       ;;
+openbsd[[4-9]]*) #(vi
+       # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+       cf_XOPEN_SOURCE=600
        ;;
 openbsd*) #(vi
        # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
@@ -6404,36 +6874,11 @@ nto-qnx*) #(vi
 sco*) #(vi
        # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
        ;;
-solaris2.1[[0-9]]) #(vi
-       cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-       ;;
-solaris2.[[1-9]]) #(vi
+solaris2.*) #(vi
        cf_xopen_source="-D__EXTENSIONS__"
        ;;
 *)
-       AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
-       AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifndef _XOPEN_SOURCE
-make an error
-#endif],
-       [cf_cv_xopen_source=no],
-       [cf_save="$CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-        AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifdef _XOPEN_SOURCE
-make an error
-#endif],
-       [cf_cv_xopen_source=no],
-       [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
-       CPPFLAGS="$cf_save"
-       ])
-])
-       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)
-       fi
+       CF_TRY_XOPEN_SOURCE
        CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
        ;;
 esac
@@ -6441,4 +6886,33 @@ esac
 if test -n "$cf_xopen_source" ; then
        CF_ADD_CFLAGS($cf_xopen_source)
 fi
+
+dnl In anything but the default case, we may have system-specific setting
+dnl which is still not guaranteed to provide all of the entrypoints that
+dnl _XOPEN_SOURCE would yield.
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+       AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
+       AC_TRY_COMPILE([#include <stdlib.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+       [cf_XOPEN_SOURCE_set=yes],
+       [cf_XOPEN_SOURCE_set=no])
+       AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
+       if test $cf_XOPEN_SOURCE_set = yes
+       then
+               AC_TRY_COMPILE([#include <stdlib.h>],[
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif],
+               [cf_XOPEN_SOURCE_set_ok=yes],
+               [cf_XOPEN_SOURCE_set_ok=no])
+               if test $cf_XOPEN_SOURCE_set_ok = no
+               then
+                       AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
+               fi
+       else
+               CF_TRY_XOPEN_SOURCE
+       fi
+fi
 ])