X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=aclocal.m4;h=faba48922c24ca08b3320579fcab6854f4f349df;hp=cbb29c50825221729093c0475c13ed766994ab72;hb=396a05943b7da5039dd15d79c4385c7d2a75d6d4;hpb=7a27c7d49c2e8b4a1ecbe85b4423d647cbc75ea5 diff --git a/aclocal.m4 b/aclocal.m4 index cbb29c50..faba4892 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * +dnl Copyright (c) 1998-2007,2008 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.429 2007/04/19 20:04:46 tom Exp $ +dnl $Id: aclocal.m4,v 1.447 2008/04/12 23:49:55 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: 9 updated: 2008/02/09 13:15:34 +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 ], + [printf("Hello")], + [], + [cf_have_incdir=yes]) + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + CF_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: 6 updated: 2008/02/09 13:15:34 +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 + CF_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 @@ -220,7 +313,7 @@ fi fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44 +dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 dnl --------------- dnl For programs that must use an ANSI compiler, obtain compiler options that dnl will make it recognize prototypes. We'll do preprocessor checks in other @@ -229,7 +322,7 @@ dnl the preprocessor. AC_DEFUN([CF_ANSI_CC_REQD], [AC_REQUIRE([CF_ANSI_CC_CHECK]) if test "$cf_cv_ansi_cc" = "no"; then - AC_ERROR( + AC_MSG_ERROR( [Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options @@ -521,7 +614,7 @@ AC_MSG_RESULT($cf_cv_cgetent) test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31 +dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. @@ -552,7 +645,7 @@ test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) - AC_ERROR("Please remove config.cache and try again.") + AC_MSG_ERROR("Please remove config.cache and try again.") fi ])dnl dnl --------------------------------------------------------------------------- @@ -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 < +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 '\' | 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. @@ -889,6 +1058,34 @@ int main() { test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP) ]) dnl --------------------------------------------------------------------------- +dnl CF_FUNC_OPENPTY version: 2 updated: 2008/04/12 19:49:01 +dnl --------------- +dnl Check for openpty() function, along with header. It may need the +dnl "util" library as well. +AC_DEFUN([CF_FUNC_OPENPTY], +[ +AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no) +AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ + cf_save_LIBS="$LIBS" + test $cf_cv_lib_util = yes && LIBS="-lutil $LIBS" + for cf_header in pty.h libutil.h util.h + do + AC_TRY_LINK([ +#include <$cf_header> +],[ + int x = openpty((int *)0, (int *)0, (char *)0, + (struct termios *)0, (struct winsize *)0); +],[ + cf_cv_func_openpty=$cf_header + break +],[ + cf_cv_func_openpty=no +]) + done + LIBS="$cf_save_LIBS" +]) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30 dnl ------------ dnl See if the poll function really works. Some platforms have poll(), but @@ -992,7 +1189,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 +1216,7 @@ if test "$GCC" = yes then AC_CHECKING([for $CC __attribute__ directives]) cat > conftest.$ac_ext < conftest.$ac_ext <&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 @@ -3220,7 +3473,7 @@ ifelse($1,,,[$1=$PATHSEP]) AC_SUBST(PATHSEP) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46 +dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the @@ -3252,7 +3505,7 @@ case ".[$]$1" in #(vi $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` ;; *) - ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2) + ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) ;; esac ])dnl @@ -3616,7 +3869,60 @@ define([CF_REMOVE_LIB], $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 46 updated: 2007/02/24 18:58:09 +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: 47 updated: 2008/03/23 14:48:54 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -3662,7 +3968,7 @@ AC_DEFUN([CF_SHARED_OPTS], cf_cv_shlib_version=$withval ;; *) - AC_ERROR([option value must be one of: rel, abi, auto or no]) + AC_MSG_ERROR([option value must be one of: rel, abi, auto or no]) ;; esac ],[cf_cv_shlib_version=auto]) @@ -4487,11 +4793,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 @@ -4594,7 +4901,7 @@ if test "$with_dmalloc" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_GPM version: 6 updated: 2006/12/17 11:12:09 +dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54 dnl ----------- dnl dnl The option parameter (if neither yes/no) is assumed to be the name of @@ -4616,7 +4923,7 @@ if test "$with_gpm" != no ; then AC_DEFINE(HAVE_LIBGPM) else AC_CHECK_LIB(gpm,Gpm_Open,[:],[ - AC_ERROR(Cannot link with GPM library) + AC_MSG_ERROR(Cannot link with GPM library) fi with_gpm=yes ]) @@ -4627,7 +4934,7 @@ if test "$with_gpm" != no ; then fi ]) dnl --------------------------------------------------------------------------- -dnl CF_WITH_LIBTOOL version: 18 updated: 2007/04/08 20:02:38 +dnl CF_WITH_LIBTOOL version: 19 updated: 2008/03/29 15:46:43 dnl --------------- dnl Provide a configure option to incorporate libtool. Define several useful dnl symbols for the makefile rules. @@ -4728,6 +5035,7 @@ ifdef([AC_PROG_LIBTOOL],[ case $cf_cv_libtool_version in 1.[[5-9]]*|[[2-9]]*) LIBTOOL_CXX="$LIBTOOL --tag=CXX" + LIBTOOL="$LIBTOOL --tag=CC" ;; *) LIBTOOL_CXX="$LIBTOOL" @@ -4757,7 +5065,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 +5079,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 @@ -4818,6 +5128,32 @@ AC_SUBST($3)dnl ])dnl dnl --------------------------------------------------------------------------- +dnl CF_WITH_PTHREAD version: 1 updated: 2008/03/29 13:42:21 +dnl --------------- +dnl Check for POSIX thread library. +AC_DEFUN([CF_WITH_PTHREAD], +[ +AC_MSG_CHECKING(if you want to link with the pthread library) +AC_ARG_WITH(pthread, + [ --with-pthread use POSIX thread library], + [with_pthread=$withval], + [with_pthread=no]) +AC_MSG_RESULT($with_pthread) + +if test "$with_pthread" != no ; then + AC_CHECK_HEADER(pthread.h,[ + AC_DEFINE(HAVE_PTHREADS_H) + AC_CHECK_LIB(pthread,pthread_create,[ + LIBS="-lpthread $LIBS" + AC_DEFINE(HAVE_LIBPTHREADS) + with_pthread=yes + ],[ + AC_MSG_ERROR(Cannot link with pthread library) + ]) + ]) +fi +]) +dnl --------------------------------------------------------------------------- dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49 dnl ------------------- dnl Allow library's release-version to be overridden. Generally this happens when a