]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 5.6 - patch 20080301
[ncurses.git] / aclocal.m4
index cbb29c50825221729093c0475c13ed766994ab72..dfe38668ac4fbeddfa29b6019f94ed47ae9b7cef 100644 (file)
@@ -28,7 +28,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.429 2007/04/19 20:04:46 tom Exp $
+dnl $Id: aclocal.m4,v 1.442 2007/12/01 20:02:42 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -166,6 +166,99 @@ fi
 
 AC_SUBST(EXTRA_CPPFLAGS)
 
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ADD_INCDIR version: 8 updated: 2007/07/30 19:22:58
+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,
+dnl but old versions (and some misinstalled ones) need that.  To make things
+dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
+dnl the include-path).
+AC_DEFUN([CF_ADD_INCDIR],
+[
+if test -n "$1" ; then
+  for cf_add_incdir in $1
+  do
+       while test $cf_add_incdir != /usr/include
+       do
+         if test -d $cf_add_incdir
+         then
+               cf_have_incdir=no
+               if test -n "$CFLAGS$CPPFLAGS" ; then
+                 # a loop is needed to ensure we can add subdirs of existing dirs
+                 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
+                       if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
+                         cf_have_incdir=yes; break
+                       fi
+                 done
+               fi
+
+               if test "$cf_have_incdir" = no ; then
+          if test "$cf_add_incdir" = /usr/local/include ; then
+                       if test "$GCC" = yes
+                       then
+                         cf_save_CPPFLAGS=$CPPFLAGS
+                         CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+                         AC_TRY_COMPILE([#include <stdio.h>],
+                                 [printf("Hello")],
+                                 [],
+                                 [cf_have_incdir=yes])
+                         CPPFLAGS=$cf_save_CPPFLAGS
+                       fi
+                 fi
+               fi
+
+               if test "$cf_have_incdir" = no ; then
+                 AC_VERBOSE(adding $cf_add_incdir to include-path)
+                 ifelse($2,,CPPFLAGS,$2)="-I$cf_add_incdir $ifelse($2,,CPPFLAGS,[$]$2)"
+
+          cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
+          test "$cf_top_incdir" = "$cf_add_incdir" && break
+          cf_add_incdir="$cf_top_incdir"
+               else
+                 break
+               fi
+         fi
+       done
+  done
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ADD_LIBDIR version: 5 updated: 2007/07/30 19:12:03
+dnl -------------
+dnl    Adds to the library-path
+dnl
+dnl    Some machines have trouble with multiple -L options.
+dnl
+dnl $1 is the (list of) directory(s) to add
+dnl $2 is the optional name of the variable to update (default LDFLAGS)
+dnl
+AC_DEFUN([CF_ADD_LIBDIR],
+[
+if test -n "$1" ; then
+  for cf_add_libdir in $1
+  do
+    if test $cf_add_libdir = /usr/lib ; then
+      :
+    elif test -d $cf_add_libdir
+    then
+      cf_have_libdir=no
+      if test -n "$LDFLAGS$LIBS" ; then
+        # a loop is needed to ensure we can add subdirs of existing dirs
+        for cf_test_libdir in $LDFLAGS $LIBS ; do
+          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
+            cf_have_libdir=yes; break
+          fi
+        done
+      fi
+      if test "$cf_have_libdir" = no ; then
+        AC_VERBOSE(adding $cf_add_libdir to library-path)
+        ifelse($2,,LDFLAGS,$2)="-L$cf_add_libdir $ifelse($2,,LDFLAGS,[$]$2)"
+      fi
+    fi
+  done
+fi
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
@@ -612,6 +705,50 @@ fi
 
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_CHECK_GPM_WGETCH version: 1 updated: 2007/04/28 14:38:06
+dnl -------------------
+dnl Check if GPM is already linked with curses.  If so - and if the linkage
+dnl is not "weak" - warn about this because it can create problems linking
+dnl applications with ncurses.
+AC_DEFUN([CF_CHECK_GPM_WGETCH],[
+AC_CHECK_LIB(gpm,Gpm_Wgetch,[
+
+AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[
+cf_cv_check_gpm_wgetch=unknown
+if test "$cross_compiling" != yes ; then
+
+cat >conftest.$ac_ext <<CF_EOF
+#include <gpm.h>
+int main()
+{
+       Gpm_Wgetch();
+       ${cf_cv_main_return:-return}(0);
+}
+CF_EOF
+
+       cf_save_LIBS="$LIBS"
+       # This only works if we can look at the symbol table.  If a shared
+       # library is stripped for install, we cannot use that.  So we're forced
+       # to rely on the static library, noting that some packagers may not
+       # include it.
+       LIBS="-static -lgpm -dynamic $LIBS"
+       if AC_TRY_EVAL(ac_compile) ; then
+               if AC_TRY_EVAL(ac_link) ; then
+                       cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\<wgetch\>' | egrep '\<[[vVwW]]\>'`
+                       test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
+                       test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no
+               fi
+       fi
+       rm -f conftest*
+       LIBS="$cf_save_LIBS"
+fi
+])
+
+if test "$cf_cv_check_gpm_wgetch" != yes ; then
+       AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
+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
@@ -703,6 +840,38 @@ fi
 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_C_INLINE version: 2 updated: 2007/08/11 14:09:50
+dnl -----------
+dnl Check if the C compiler supports "inline".
+dnl $1 is the name of a shell variable to set if inline is supported
+dnl $2 is the threshold for gcc 4.x's option controlling maximum inline size
+AC_DEFUN([CF_C_INLINE],[
+AC_C_INLINE
+$1=
+if test "$ac_cv_c_inline" != no ; then
+  $1=inline
+  if test "$INTEL_COMPILER" = yes
+  then
+    :
+  elif test "$GCC" = yes
+  then
+    AC_CACHE_CHECK(if gcc supports options to tune inlining,cf_cv_gcc_inline,[
+      cf_save_CFLAGS=$CFLAGS
+      CFLAGS="$CFLAGS --param max-inline-insns-single=$2"
+      AC_TRY_COMPILE([inline int foo(void) { return 1; }],
+      [${cf_cv_main_return:-return} foo()],
+      [cf_cv_gcc_inline=yes],
+      [cf_cv_gcc_inline=no])
+      CFLAGS=$cf_save_CFLAGS
+    ])
+    if test "$cf_cv_gcc_inline" = yes ; then
+        CF_ADD_CFLAGS([--param max-inline-insns-single=$2])
+    fi
+  fi
+fi
+AC_SUBST($1)
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
 dnl ----------
 dnl "dirname" is not portable, so we fake it with a shell script.
@@ -992,7 +1161,7 @@ esac
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
+dnl CF_GCC_ATTRIBUTES version: 11 updated: 2007/07/29 09:55:12
 dnl -----------------
 dnl Test for availability of useful gcc __attribute__ directives to quiet
 dnl compiler warnings.  Though useful, not all are supported -- and contrary
@@ -1019,7 +1188,7 @@ if test "$GCC" = yes
 then
        AC_CHECKING([for $CC __attribute__ directives])
 cat > conftest.$ac_ext <<EOF
-#line __oline__ "configure"
+#line __oline__ "${as_me-configure}"
 #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -1081,7 +1250,7 @@ if test "$GCC" = yes ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
+dnl CF_GCC_WARNINGS version: 22 updated: 2007/07/29 09:55:12
 dnl ---------------
 dnl Check if the compiler supports useful warning options.  There's a few that
 dnl we don't use, simply because they're too noisy:
@@ -1106,7 +1275,7 @@ AC_REQUIRE([CF_GCC_VERSION])
 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
 
 cat > conftest.$ac_ext <<EOF
-#line __oline__ "configure"
+#line __oline__ "${as_me-configure}"
 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
 EOF
 
@@ -1127,7 +1296,7 @@ then
        AC_CHECKING([for $CC warning options])
        cf_save_CFLAGS="$CFLAGS"
        EXTRA_CFLAGS="-Wall"
-       for cf_opt in $1 \
+       for cf_opt in \
                wd1419 \
                wd1682 \
                wd1683 \
@@ -1483,11 +1652,24 @@ AC_LANG_RESTORE
 AC_SUBST(EXTRA_CXXFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_HASHED_DB version: 1 updated: 2006/08/19 09:16:14
+dnl CF_HASHED_DB version: 3 updated: 2007/11/24 17:43:37
 dnl ------------
 dnl Look for an instance of the Berkeley hashed database.
+dnl
+dnl $1 = optional parameter, to specify install-prefix for the database.
 AC_DEFUN([CF_HASHED_DB],
 [
+ifelse([$1],,,[
+case $1 in #(vi
+yes|*able*) #(vi
+    ;;
+*)
+    if test -d "$1" ; then
+        CF_ADD_INCDIR($1/include)
+        CF_ADD_LIBDIR($1/lib)
+    fi
+esac
+])
 AC_CHECK_HEADER(db.h,[
 CF_HASHED_DB_VERSION
 if test "$cf_cv_hashed_db_version" = unknown ; then
@@ -1505,7 +1687,7 @@ fi
 ])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_HASHED_DB_LIBS version: 6 updated: 2006/12/16 12:33:30
+dnl CF_HASHED_DB_LIBS version: 7 updated: 2007/12/01 15:01:37
 dnl -----------------
 dnl Given that we have the header and version for hashed database, find the
 dnl library information.
@@ -1513,7 +1695,7 @@ AC_DEFUN([CF_HASHED_DB_LIBS],
 [
 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
 cf_cv_hashed_db_libs=unknown
-for cf_db_libs in db$cf_cv_hashed_db_version db ''
+for cf_db_libs in db$cf_cv_hashed_db_version db-$cf_cv_hashed_db_version db ''
 do
        cf_save_libs="$LIBS"
        if test -n "$cf_db_libs"; then
@@ -1577,7 +1759,7 @@ done
 ])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_HASHED_DB_VERSION version: 2 updated: 2006/08/19 15:12:49
+dnl CF_HASHED_DB_VERSION version: 3 updated: 2007/12/01 15:01:37
 dnl --------------------
 dnl Given that we have the header file for hashed database, find the version
 dnl information.
@@ -1586,7 +1768,7 @@ AC_DEFUN([CF_HASHED_DB_VERSION],
 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
 cf_cv_hashed_db_version=unknown
 
-for cf_db_version in 1 2 3 4
+for cf_db_version in 1 2 3 4 5
 do
        CF_MSG_LOG(checking for db version $cf_db_version)
        AC_TRY_COMPILE([
@@ -1700,7 +1882,7 @@ AC_MSG_RESULT($cf_cv_have_isascii)
 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LARGEFILE version: 6 updated: 2006/09/23 19:07:52
+dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
 dnl ------------
 dnl Add checks for large file support.
 AC_DEFUN([CF_LARGEFILE],[
@@ -1718,6 +1900,7 @@ ifdef([AC_FUNC_FSEEKO],[
        # the config.h
        test "$ac_cv_sys_large_files"      != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
        test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
+       test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
 
        AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
                AC_TRY_COMPILE([
@@ -1738,6 +1921,48 @@ ifdef([AC_FUNC_FSEEKO],[
 ])
 ])
 dnl ---------------------------------------------------------------------------
+dnl CF_LDFLAGS_STATIC version: 2 updated: 2007/04/28 15:25:27
+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
+dnl ensure that the linker picks up a given library based on its position in
+dnl the list of linker options and libraries.
+AC_DEFUN([CF_LDFLAGS_STATIC],[
+
+if test "$GCC" = yes ; then
+       LDFLAGS_STATIC=-static
+       LDFLAGS_SHARED=-dynamic
+else
+       case $cf_cv_system_name in #(
+       aix[[45]]*)     #( from ld manpage
+               LDFLAGS_STATIC=-bstatic
+               LDFLAGS_SHARED=-bdynamic
+               ;;
+       hpux*)          #( from ld manpage for hpux10.20, hpux11.11
+               # We could also use just "archive" and "shared".
+               LDFLAGS_STATIC=-Wl,-a,archive_shared
+               LDFLAGS_SHARED=-Wl,-a,shared_archive
+               ;;
+       irix*)          #( from ld manpage IRIX64
+               LDFLAGS_STATIC=-Bstatic
+               LDFLAGS_SHARED=-Bdynamic
+               ;;
+       osf[[45]]*)     #( from ld manpage osf4.0d, osf5.1
+               # alternative "-oldstyle_liblookup" (not in cc manpage)
+               LDFLAGS_STATIC=-noso 
+               LDFLAGS_SHARED=-so_archive
+               ;;
+       solaris2*)
+               LDFLAGS_STATIC=-Bstatic
+               LDFLAGS_SHARED=-Bdynamic
+               ;;
+       esac
+fi
+
+AC_SUBST(LDFLAGS_STATIC)
+AC_SUBST(LDFLAGS_SHARED)
+])
+dnl ---------------------------------------------------------------------------
 dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32
 dnl ----------
 dnl Check for libutf8
@@ -3115,12 +3340,12 @@ if test "$cf_cv_func_mkstemp" = yes ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
+dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
 dnl ----------
 dnl Write a debug message to config.log, along with the line number in the
 dnl configure script.
 AC_DEFUN([CF_MSG_LOG],[
-echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
+echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
@@ -3616,6 +3841,59 @@ define([CF_REMOVE_LIB],
 $1=`echo "$2" | sed -e 's/-l$3[[       ]]//g' -e 's/-l$3[$]//'`
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_RPATH_HACK version: 3 updated: 2007/12/01 11:14:13
+dnl -------------
+AC_DEFUN([CF_RPATH_HACK],
+[
+AC_REQUIRE([CF_SHARED_OPTS])
+AC_MSG_CHECKING(for updated LDFLAGS)
+if test -n "$LDFLAGS" ; then
+AC_MSG_RESULT(maybe)
+CF_VERBOSE(...checking LDFLAGS $LDFLAGS)
+CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
+case "$EXTRA_LDFLAGS" in #(vi
+-Wl,-rpath,*) #(vi
+    cf_rpath_hack="-Wl,-rpath,"
+    ;;
+-R\ *)
+    cf_rpath_hack="-R "
+    ;;
+-R*)
+    cf_rpath_hack="-R"
+    ;;
+*)
+    cf_rpath_hack=
+    ;;
+esac
+if test -n "$cf_rpath_hack" ; then
+    cf_rpath_dst=
+    for cf_rpath_src in $LDFLAGS
+    do
+        CF_VERBOSE(Filtering $cf_rpath_src)
+        case $cf_rpath_src in #(vi
+        -L*) #(vi
+            if test "$cf_rpath_hack" = "-R " ; then
+                cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e 's%-L%-R %'`
+            else
+                cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e s%-L%$cf_rpath_hack%`
+            fi
+            CF_VERBOSE(...Filter $cf_rpath_tmp)
+            EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
+            ;;
+        *)
+            cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
+            ;;
+        esac
+    done
+    LDFLAGS=$cf_rpath_dst
+    CF_VERBOSE(...checked LDFLAGS $LDFLAGS)
+    CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
+fi
+else
+AC_MSG_RESULT(no)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_SHARED_OPTS version: 46 updated: 2007/02/24 18:58:09
 dnl --------------
 dnl --------------
@@ -4487,11 +4765,12 @@ AC_DEFUN([CF_UPPER],
 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
+dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
 dnl ----------
 dnl Use AC_VERBOSE w/o the warnings
 AC_DEFUN([CF_VERBOSE],
 [test -n "$verbose" && echo "  $1" 1>&AC_FD_MSG
+CF_MSG_LOG([$1])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
@@ -4757,7 +5036,7 @@ AC_SUBST(LIB_UNINSTALL)
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATH version: 7 updated: 2006/08/03 15:20:08
+dnl CF_WITH_PATH version: 8 updated: 2007/05/13 13:16:35
 dnl ------------
 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 dnl defaulting to yes/no.
@@ -4771,7 +5050,9 @@ dnl
 AC_DEFUN([CF_WITH_PATH],
 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
+if ifelse($5,,true,[test -n "$5"]) ; then
 CF_PATH_SYNTAX(withval)
+fi
 $3="$withval"
 AC_SUBST($3)dnl
 ])dnl