]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 5.9 - patch 20110507
[ncurses.git] / aclocal.m4
index 0eff80b9a4ee974cac7c6cfa24c104dcb0a1c92b..6c7c8ef7198105c34083d54283a4ada446f25e6f 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.555 2011/04/23 21:38:05 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -1104,7 +1104,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 +1112,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],
@@ -1769,10 +1769,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 +1851,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 +1946,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_TRY_LINK version: 2 updated: 2010/08/14 18:25:37
+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: 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 +2017,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 +2029,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 +2044,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 +2060,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 +2083,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
@@ -3386,7 +3527,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 +3544,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`
@@ -4258,7 +4399,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: 6 updated: 2011/04/17 06:36:21
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -4275,7 +4416,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
@@ -4751,7 +4892,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 +4905,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)
@@ -5479,13 +5647,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 +5668,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 +5705,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
@@ -6341,7 +6511,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: 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,
@@ -6360,6 +6530,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"
        ;;