📄 aclocal.m4
字号:
dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, anddnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses'sdnl programs from a vendor's.AC_DEFUN([CF_CFG_DEFAULTS],[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) prefix=/usr ;; *) prefix=$ac_default_prefix ;; esacfiAC_MSG_RESULT($prefix)if test "x$prefix" = "xNONE" ; thenAC_MSG_CHECKING(for default include-directory)test -n "$verbose" && echo 1>&AC_FD_MSGfor cf_symbol in \ $includedir \ $includedir/ncurses \ $prefix/include \ $prefix/include/ncurses \ /usr/local/include \ /usr/local/include/ncurses \ /usr/include \ /usr/include/ncursesdo cf_dir=`eval echo $cf_symbol` if test -f $cf_dir/curses.h ; then if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then includedir="$cf_symbol" test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG break fi fi test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSGdoneAC_MSG_RESULT($includedir)fi])dnldnl ---------------------------------------------------------------------------dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52dnl ----------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_TRY_LINK([#include <stdlib.h>],[ char temp[128]; char *buf = temp; char *db_array = temp; cgetent(&buf, /* int *, */ &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)])dnldnl ---------------------------------------------------------------------------dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31dnl --------------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.dnldnl If we've packaged config.guess and config.sub, run that (since it does adnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allowdnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEMdnl which is useful in cross-compiles.dnldnl Note: we would use $ac_config_sub, but that is one of the places wherednl autoconf 2.5x broke compatibility with autoconf 2.13AC_DEFUN([CF_CHECK_CACHE],[if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os"else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fifitest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])test -z "$system_name" && system_name="$cf_cv_system_name"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.")fi])dnldnl ---------------------------------------------------------------------------dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23dnl --------------dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare itdnl ourselves.dnldnl $1 = the name to checkAC_DEFUN([CF_CHECK_ERRNO],[AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ AC_TRY_COMPILE([#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#include <stdio.h>#include <sys/types.h>#include <errno.h> ], [long x = (long) $1], [cf_cv_dcl_$1=yes], [cf_cv_dcl_$1=no])])if test "$cf_cv_dcl_$1" = no ; then CF_UPPER(cf_result,decl_$1) AC_DEFINE_UNQUOTED($cf_result)fi# It's possible (for near-UNIX clones) that the data doesn't existCF_CHECK_EXTERN_DATA($1,int)])dnldnl ---------------------------------------------------------------------------dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23dnl --------------------dnl Check for existence of external data in the current set of libraries. Ifdnl we can modify it, it's real enough.dnl $1 = the name to checkdnl $2 = its typeAC_DEFUN([CF_CHECK_EXTERN_DATA],[AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ AC_TRY_LINK([#undef $1extern $2 $1;], [$1 = 2], [cf_cv_have_$1=yes], [cf_cv_have_$1=no])])if test "$cf_cv_have_$1" = yes ; then CF_UPPER(cf_result,have_$1) AC_DEFINE_UNQUOTED($cf_result)fi])dnldnl ---------------------------------------------------------------------------dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18dnl -----------------dnl Check if the C++ compiler accepts duplicate parameter initialization. Thisdnl is a late feature for the standard and is not in some recent compilersdnl (1999/9/11).AC_DEFUN([CF_CPP_PARAM_INIT],[if test -n "$CXX"; thenAC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_RUN([class TEST {private: int value;public: TEST(int x = 1); ~TEST();};TEST::TEST(int x = 1) // some compilers do not like second initializer{ value = x;}void main() { }], [cf_cv_cpp_param_init=yes], [cf_cv_cpp_param_init=no], [cf_cv_cpp_param_init=unknown]) AC_LANG_RESTORE])fitest "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)])dnldnl ---------------------------------------------------------------------------dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43dnl ------------------dnl Check if the C++ compiler accepts static_cast in generics. This appears todnl not be supported in g++ before 3.0AC_DEFUN([CF_CPP_STATIC_CAST],[if test -n "$CXX"; thenAC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([class NCursesPanel{public: NCursesPanel(int nlines, int ncols, int begin_y = 0, int begin_x = 0) { } ~NCursesPanel();};template<class T> class NCursesUserPanel : public NCursesPanel{public: NCursesUserPanel (int nlines, int ncols, int begin_y = 0, int begin_x = 0, const T* p_UserData = static_cast<T*>(0)) : NCursesPanel (nlines, ncols, begin_y, begin_x) { }; NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel() { }; virtual ~NCursesUserPanel() {};};],[ const char* p_UserData = static_cast<char*>(0)], [cf_cv_cpp_static_cast=yes], [cf_cv_cpp_static_cast=no]) AC_LANG_RESTORE])fitest "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)])dnldnl ---------------------------------------------------------------------------dnl CF_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28dnl -----------------dnl Check if the g++ compiler supports vscan function (not a standard feature).AC_DEFUN([CF_CPP_VSCAN_FUNC],[if test -n "$CXX"; thenAC_LANG_SAVEAC_LANG_CPLUSPLUSAC_CHECK_HEADERS(strstream.h)AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[ for cf_vscan_func in strstream strstream_cast stdio do case $cf_vscan_func in #(vi stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;; strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;; esac AC_TRY_LINK([#include <stdio.h>#include <stdarg.h>#define $cf_vscan_defs 1#if defined(USE_STDIO_VSCAN)#elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN)#include <strstream.h>#endifint scanw(const char* fmt, ...){ int result = -1; char buf[BUFSIZ]; va_list args; va_start(args, fmt);#if defined(USE_STDIO_VSCAN) if (::vsscanf(buf, fmt, args) != -1) result = 0;#elif defined(USE_STRSTREAM_VSCAN) strstreambuf ss(buf, sizeof(buf)); if (ss.vscan(fmt, args) != -1) result = 0;#elif defined(USE_STRSTREAM_VSCAN_CAST) strstreambuf ss(buf, sizeof(buf)); if (ss.vscan(fmt, (_IO_va_list)args) != -1) result = 0;#else#error case $cf_vscan_func failed#endif va_end(args); return result;}],[int tmp, foo = scanw("%d", &tmp)], [cf_cv_cpp_vscan_func=$cf_vscan_func; break], [cf_cv_cpp_vscan_func=no]) test "$cf_cv_cpp_vscan_func" != no && break done])AC_LANG_RESTOREficase $cf_cv_cpp_vscan_func in #(vistdio) #(vi AC_DEFINE(CPP_HAS_VSCAN_FUNC) AC_DEFINE(USE_STDIO_VSCAN) ;;strstream) AC_DEFINE(CPP_HAS_VSCAN_FUNC) AC_DEFINE(USE_STRSTREAM_VSCAN) ;;strstream_cast) AC_DEFINE(CPP_HAS_VSCAN_FUNC) AC_DEFINE(USE_STRSTREAM_VSCAN_CAST) ;;esac])dnldnl ---------------------------------------------------------------------------dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52dnl ----------dnl "dirname" is not portable, so we fake it with a shell script.AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnldnl ---------------------------------------------------------------------------dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31dnl ---------------AC_DEFUN([CF_DIRS_TO_MAKE],[DIRS_TO_MAKE="lib"for cf_item in $cf_list_modelsdo CF_OBJ_SUBDIR($cf_item,cf_subdir) for cf_item2 in $DIRS_TO_MAKE do test $cf_item2 = $cf_subdir && break done test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"donefor cf_dir in $DIRS_TO_MAKEdo test ! -d $cf_dir && mkdir $cf_dirdoneAC_SUBST(DIRS_TO_MAKE)])dnldnl ---------------------------------------------------------------------------dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39dnl --------dnl Check if 'errno' is declared in <errno.h>AC_DEFUN([CF_ERRNO],[CF_CHECK_ERRNO(errno)])dnldnl ---------------------------------------------------------------------------dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43dnl ---------------dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., betweendnl math.h and builtin.h, only for ncursesAC_DEFUN([CF_ETIP_DEFINES],[AC_MSG_CHECKING(for special defines needed for etip.h)cf_save_CXXFLAGS="$CXXFLAGS"cf_result="none"for cf_math in "" MATH_Hdofor cf_excp in "" MATH_EXCEPTIONdo CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include" test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"AC_TRY_COMPILE([#include <etip.h.in>],[],[ test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math}) test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp}) cf_result="$cf_math $cf_excp" break],[])donedoneAC_MSG_RESULT($cf_result)CXXFLAGS="$cf_save_CXXFLAGS"])dnl ---------------------------------------------------------------------------dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45dnl -------------dnl Test for dlsym() and related functions, as well as libdl.dnldnl Setsdnl $cf_have_dlsymdnl $cf_have_libdlAC_DEFUN([CF_FUNC_DLSYM],[cf_have_dlsym=noAC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[cf_have_libdl=noAC_CHECK_LIB(dl,dlsym,[ cf_have_dlsym=yes cf_have_libdl=yes])])if test "$cf_have_dlsym" = yes ; then test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS" AC_MSG_CHECKING(whether able to link to dl*() functions) AC_TRY_LINK([#include <dlfcn.h>],[ void *obj; if ((obj = dlopen("filename", 0)) != 0) { if (dlsym(obj, "symbolname") == 0) { dlclose(obj); } }],[ AC_DEFINE(HAVE_LIBDL)],[ AC_MSG_ERROR(Cannot link test program for libdl)]) AC_MSG_RESULT(ok)else AC_MSG_ERROR(Cannot find dlsym function)fi])dnl ---------------------------------------------------------------------------dnl CF_FUNC_MEMMOVE version: 5 updated: 2000/08/12 23:18:52dnl ---------------dnl Check for memmove, or a bcopy that can handle overlapping copy. If neitherdnl is found, add our own version of memmove to the list of objects.AC_DEFUN([CF_FUNC_MEMMOVE],[AC_CHECK_FUNC(memmove,,[AC_CHECK_FUNC(bcopy,[ AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ AC_TRY_RUN([int main() { static char data[] = "abcdefghijklmnopqrstuwwxyz"; char temp[40]; bcopy(data, temp, sizeof(data)); bcopy(temp+10, temp, 15); bcopy(temp+5, temp+15, 10); exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));} ], [cf_cv_good_bcopy=yes], [cf_cv_good_bcopy=no], [cf_cv_good_bcopy=unknown]) ]) ],[cf_cv_good_bcopy=no])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -