]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 5.7 - patch 20100417
[ncurses.git] / aclocal.m4
index 95a0ba46449bcb84c60d85522c6e104ef4830b73..9c132daf94ac0277fdaf5a90226f6ce741a10992 100644 (file)
@@ -28,7 +28,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.499 2010/03/28 00:14:25 tom Exp $
+dnl $Id: aclocal.m4,v 1.513 2010/04/17 20:33:27 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -359,6 +359,35 @@ You have the following choices:
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
+dnl --------------
+dnl Allow user to disable a normally-on option.
+AC_DEFUN([CF_ARG_DISABLE],
+[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
+dnl -------------
+dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
+dnl values.
+dnl
+dnl Parameters:
+dnl $1 = option name
+dnl $2 = help-string
+dnl $3 = action to perform if option is not default
+dnl $4 = action if perform if option is default
+dnl $5 = default option value (either 'yes' or 'no')
+AC_DEFUN([CF_ARG_OPTION],
+[AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
+  if test "$enableval" != "$5" ; then
+ifelse($3,,[    :]dnl
+,[    $3]) ifelse($4,,,[
+  else
+    $4])
+  fi],[enableval=$5 ifelse($4,,,[
+  $4
+])dnl
+  ])])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_AR_FLAGS version: 4 updated: 2009/02/07 13:42:23
 dnl -----------
 dnl Check for suitable "ar" (archiver) options for updating an archive.
@@ -1007,6 +1036,25 @@ if test "$with_no_leaks" = yes ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00
+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
+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)
+CF_ARG_DISABLE(rpath-hack,
+       [  --disable-rpath-hack    don't add rpath options for additional libraries],
+       [cf_disable_rpath_hack=yes],
+       [cf_disable_rpath_hack=no])
+AC_MSG_RESULT($cf_disable_rpath_hack)
+if test "$cf_disable_rpath_hack" = no ; then
+       CF_RPATH_HACK
+fi
+])
+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
@@ -1059,7 +1107,7 @@ AC_MSG_RESULT($cf_result)
 CXXFLAGS="$cf_save_CXXFLAGS"
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_FIND_LINKAGE version: 14 updated: 2010/03/21 14:34:38
+dnl CF_FIND_LINKAGE version: 15 updated: 2010/04/03 18:35:33
 dnl ---------------
 dnl Find a library (specifically the linkage used in the code fragment),
 dnl searching for it if it is not already in the library path.
@@ -1097,6 +1145,7 @@ LIBS="-l$3 $7 $cf_save_LIBS"
 
 AC_TRY_LINK([$1],[$2],[
        cf_cv_find_linkage_$3=yes
+       cf_cv_library_file_$3="-l$3"
 ],[
     cf_cv_find_linkage_$3=no
        LIBS="$cf_save_LIBS"
@@ -2353,7 +2402,7 @@ x-R*)
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LIBRARY_PATH version: 8 updated: 2008/12/07 19:38:31
+dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
 dnl ---------------
 dnl Construct a search-list of directories for a nonstandard library-file
 dnl
@@ -2362,6 +2411,7 @@ dnl       $1 = the variable to return as result
 dnl    $2 = the package name
 AC_DEFUN([CF_LIBRARY_PATH],
 [
+$1=
 cf_library_path_list=""
 if test -n "${LDFLAGS}${LIBS}" ; then
        for cf_library_path in $LDFLAGS $LIBS
@@ -3124,16 +3174,20 @@ CF_EOF
 AC_SUBST(cf_cv_makeflags)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
+dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32
 dnl ------------
 dnl Generate tags/TAGS targets for makefiles.  Do not generate TAGS if we have
 dnl a monocase filesystem.
 AC_DEFUN([CF_MAKE_TAGS],[
 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
-AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
+
+AC_CHECK_PROGS(CTAGS, exctags ctags)
+AC_CHECK_PROGS(ETAGS, exetags etags)
+
+AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no)
 
 if test "$cf_cv_mixedcase" = yes ; then
-       AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
+       AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no)
 else
        MAKE_UPPER_TAGS=no
 fi
@@ -3143,13 +3197,17 @@ if test "$MAKE_UPPER_TAGS" = yes ; then
 else
        MAKE_UPPER_TAGS="#"
 fi
-AC_SUBST(MAKE_UPPER_TAGS)
 
 if test "$MAKE_LOWER_TAGS" = yes ; then
        MAKE_LOWER_TAGS=
 else
        MAKE_LOWER_TAGS="#"
 fi
+
+AC_SUBST(CTAGS)
+AC_SUBST(ETAGS)
+
+AC_SUBST(MAKE_UPPER_TAGS)
 AC_SUBST(MAKE_LOWER_TAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -4365,16 +4423,24 @@ define([CF_REMOVE_LIB],
 $1=`echo "$2" | sed -e 's/-l$3[[       ]]//g' -e 's/-l$3[$]//'`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_RPATH_HACK version: 5 updated: 2010/03/27 18:39:42
+dnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58
 dnl -------------
 AC_DEFUN([CF_RPATH_HACK],
 [
 AC_REQUIRE([CF_LD_RPATH_OPT])
-AC_REQUIRE([CF_SHARED_OPTS])
 AC_MSG_CHECKING(for updated LDFLAGS)
 if test -n "$LD_RPATH_OPT" ; then
        AC_MSG_RESULT(maybe)
 
+       AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
+       cf_rpath_list="/usr/lib /lib"
+       if test "$cf_ldd_prog" != no
+       then
+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`])
+       fi
+
        CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
 
        CF_RPATH_HACK_2(LDFLAGS)
@@ -4382,13 +4448,16 @@ if test -n "$LD_RPATH_OPT" ; then
 
        CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
 fi
+AC_SUBST(EXTRA_LDFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_RPATH_HACK_2 version: 1 updated: 2010/03/27 18:39:42
+dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
 dnl ---------------
 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
 dnl EXTRA_LDFLAGS for each -L option found.
 dnl
+dnl $cf_rpath_list contains a list of directories to ignore.
+dnl
 dnl $1 = variable name to update.  The LDFLAGS variable should be the only one,
 dnl      but LIBS often has misplaced -L options.
 AC_DEFUN([CF_RPATH_HACK_2],
@@ -4398,16 +4467,40 @@ CF_VERBOSE(...checking $1 [$]$1)
 cf_rpath_dst=
 for cf_rpath_src in [$]$1
 do
-       CF_VERBOSE(Filtering $cf_rpath_src)
        case $cf_rpath_src in #(vi
        -L*) #(vi
-               if test "$LD_RPATH_OPT" = "-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%$LD_RPATH_OPT%`
+
+               # check if this refers to a directory which we will ignore
+               cf_rpath_skip=no
+               if test -n "$cf_rpath_list"
+               then
+                       for cf_rpath_item in $cf_rpath_list
+                       do
+                               if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
+                               then
+                                       cf_rpath_skip=yes
+                                       break
+                               fi
+                       done
+               fi
+
+               if test "$cf_rpath_skip" = no
+               then
+                       # transform the option
+                       if test "$LD_RPATH_OPT" = "-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%$LD_RPATH_OPT%"`
+                       fi
+
+                       # if we have not already added this, add it now
+                       cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
+                       if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
+                       then
+                               CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
+                               EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
+                       fi
                fi
-               CF_VERBOSE(...Filter $cf_rpath_tmp)
-               EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
                ;;
        esac
        cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
@@ -4415,9 +4508,10 @@ done
 $1=$cf_rpath_dst
 
 CF_VERBOSE(...checked $1 [$]$1)
+AC_SUBST(EXTRA_LDFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SHARED_OPTS version: 61 updated: 2010/03/27 20:13:59
+dnl CF_SHARED_OPTS version: 62 updated: 2010/03/28 16:12:30
 dnl --------------
 dnl --------------
 dnl Attempt to determine the appropriate CC/LD options for creating a shared
@@ -4665,7 +4759,7 @@ CF_EOF
                        LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
                fi
                if test "$cf_cv_enable_rpath" = yes ; then
-                       EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
+                       EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
                fi
                CF_SHARED_SONAME
                if test "$GCC" != yes; then
@@ -5843,7 +5937,7 @@ CF_NO_LEAKS_OPTION(valgrind,
        [USE_VALGRIND])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 32 updated: 2010/01/09 11:05:50
+dnl CF_XOPEN_SOURCE version: 33 updated: 2010/03/28 15:35:52
 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,
@@ -5906,7 +6000,10 @@ nto-qnx*) #(vi
 sco*) #(vi
        # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
        ;;
-solaris*) #(vi
+solaris2.1[[0-9]]) #(vi
+       cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+       ;;
+solaris2.[[1-9]]) #(vi
        cf_xopen_source="-D__EXTENSIONS__"
        ;;
 *)