📄 aclocal.m4
字号:
dnl $Id: aclocal.m4,v 1.6 2003/10/19 00:09:23 tom Exp $dnl ---------------------------------------------------------------------------dnl ---------------------------------------------------------------------------dnl CF_ADD_INCDIR version: 4 updated: 2002/12/21 14:25:52dnl -------------dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it'sdnl 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 thingsdnl worse, gcc 3.x gives error messages if -I/usr/local/include is added todnl the include-path).AC_DEFUN([CF_ADD_INCDIR],[for cf_add_incdir in $1do while true do case $cf_add_incdir in /usr/include) # (vi ;; /usr/local/include) # (vi if test "$GCC" = yes then cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" AC_TRY_COMPILE([#include <stdio.h>], [printf("Hello")], [], [CPPFLAGS="$cf_save_CPPFLAGS"]) fi ;; *) # (vi CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" ;; esac 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" donedone])dnldnl ---------------------------------------------------------------------------dnl CF_CHECK_CACHE version: 7 updated: 2001/12/19 00:50:10dnl --------------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.AC_DEFUN([CF_CHECK_CACHE],[if test -f $srcdir/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_CURSES_ACS_MAP version: 3 updated: 2003/05/17 22:19:02dnl -----------------dnl Check for likely values of acs_map[]:AC_DEFUN([CF_CURSES_ACS_MAP],[AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[cf_cv_curses_acs_map=unknownfor name in acs_map _acs_map __acs_map _nc_acs_mapdoAC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],[$name['k'] = ACS_PLUS],[cf_cv_curses_acs_map=$name; break])done])test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)])dnl ---------------------------------------------------------------------------dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33dnl --------------------dnl Check if curses.h defines the given typeAC_DEFUN([CF_CURSES_CHECK_TYPE],[AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})AC_TRY_COMPILE([#ifndef _XOPEN_SOURCE_EXTENDED#define _XOPEN_SOURCE_EXTENDED#endif#include <${cf_cv_ncurses_header-curses.h}>],[$1 foo],cf_result=yes,cf_result=no)AC_MSG_RESULT($cf_result)if test $cf_result = yes ; then CF_UPPER(cf_result,have_type_$1) AC_DEFINE_UNQUOTED($cf_result)else AC_DEFINE_UNQUOTED($1,$2)fi])dnldnl ---------------------------------------------------------------------------dnl CF_CURSES_CPPFLAGS version: 7 updated: 2003/06/06 00:48:41dnl ------------------dnl Look for the curses headers.AC_DEFUN([CF_CURSES_CPPFLAGS],[AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[cf_cv_curses_incdir=nocase $host_os in #(vihpux10.*|hpux11.*) #(vi test -d /usr/include/curses_colr && \ cf_cv_curses_incdir="-I/usr/include/curses_colr" ;;sunos3*|sunos4*) test -d /usr/5lib && \ test -d /usr/5include && \ cf_cv_curses_incdir="-I/usr/5include" ;;esac])test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[cf_cv_ncurses_header=nonefor cf_header in \ curses.h \ ncurses.h \ ncurses/curses.h \ ncurses/ncurses.hdoAC_TRY_COMPILE([#include <${cf_header}>], [initscr(); tgoto("?", 0,0)], [cf_cv_ncurses_header=$cf_header; break],[])done])if test "$cf_cv_ncurses_header" = none ; then AC_MSG_ERROR(No curses header-files found)fi# cheat, to get the right #define's for HAVE_NCURSES_H, etc.AC_CHECK_HEADERS($cf_cv_ncurses_header)])dnldnl ---------------------------------------------------------------------------dnl CF_CURSES_LIBS version: 22 updated: 2002/10/27 18:21:42dnl --------------dnl Look for the curses libraries. Older curses implementations may requirednl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.AC_DEFUN([CF_CURSES_LIBS],[AC_MSG_CHECKING(if we have identified curses libraries)AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); tgoto("?", 0,0)], cf_result=yes, cf_result=no)AC_MSG_RESULT($cf_result)if test "$cf_result" = no ; thencase $host_os in #(vifreebsd*) #(vi AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"]) ;;hpux10.*|hpux11.*) #(vi AC_CHECK_LIB(cur_colr,initscr,[ LIBS="-lcur_colr $LIBS" ac_cv_func_initscr=yes ],[ AC_CHECK_LIB(Hcurses,initscr,[ # HP's header uses __HP_CURSES, but user claims _HP_CURSES. LIBS="-lHcurses $LIBS" CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS" ac_cv_func_initscr=yes ])]) ;;linux*) # Suse Linux does not follow /usr/lib convention LIBS="$LIBS -L/lib" ;;sunos3*|sunos4*) test -d /usr/5lib && \ LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap" ac_cv_func_initscr=yes ;;esacif test ".$ac_cv_func_initscr" != .yes ; then cf_save_LIBS="$LIBS" cf_term_lib="" cf_curs_lib="" if test ".${cf_cv_ncurses_version-no}" != .no then cf_check_list="ncurses curses cursesX" else cf_check_list="cursesX curses ncurses" fi # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ for cf_term_lib in $cf_check_list termcap termlib unknown do AC_CHECK_LIB($cf_term_lib,tgoto,[break]) done ]) # Check for library containing initscr test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" for cf_curs_lib in $cf_check_list xcurses jcurses unknown do AC_CHECK_LIB($cf_curs_lib,initscr,[break]) done test $cf_curs_lib = unknown && AC_ERROR(no curses library found) LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then AC_MSG_CHECKING(if we can link with $cf_curs_lib library) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], [cf_result=yes], [cf_result=no]) AC_MSG_RESULT($cf_result) test $cf_result = no && AC_ERROR(Cannot link curses library) elif test "$cf_curs_lib" = "$cf_term_lib" ; then : elif test "$cf_term_lib" != predefined ; then AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); tgoto((char *)0, 0, 0);], [cf_result=no], [ LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr()], [cf_result=yes], [cf_result=error]) ]) AC_MSG_RESULT($cf_result) fififi])dnldnl ---------------------------------------------------------------------------dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02dnl ------------------dnl Check for likely values of wacs_map[]:AC_DEFUN([CF_CURSES_WACS_MAP],[AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[ cf_cv_curses_wacs_map=unknown for name in wacs_map _wacs_map __wacs_map _nc_wacs do AC_TRY_LINK([#ifndef _XOPEN_SOURCE_EXTENDED#define _XOPEN_SOURCE_EXTENDED#endif#include <${cf_cv_ncurses_header-curses.h}>], [$name['k'] = *WACS_PLUS], [cf_cv_curses_wacs_map=$name break]) done])])dnl ---------------------------------------------------------------------------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_FIND_LIBRARY version: 7 updated: 2000/04/13 21:38:04dnl ---------------dnl Look for a non-standard library, given parameters for AC_TRY_LINK. Wednl prefer a standard location, and use -L options only if we do not find thednl library in the standard library location(s).dnl $1 = library namednl $2 = library class, usually the same as library namednl $3 = includesdnl $4 = code fragment to compile/linkdnl $5 = corresponding function-namednl $6 = flag, nonnull if failure causes an error-exitdnldnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we haddnl to use a -L option.AC_DEFUN([CF_FIND_LIBRARY],[ eval 'cf_cv_have_lib_'$1'=no' cf_libdir="" AC_CHECK_FUNC($5, eval 'cf_cv_have_lib_'$1'=yes',[ cf_save_LIBS="$LIBS" AC_MSG_CHECKING(for $5 in -l$1) LIBS="-l$1 $LIBS" AC_TRY_LINK([$3],[$4], [AC_MSG_RESULT(yes) eval 'cf_cv_have_lib_'$1'=yes' ], [AC_MSG_RESULT(no) CF_LIBRARY_PATH(cf_search,$2) for cf_libdir in $cf_search do AC_MSG_CHECKING(for -l$1 in $cf_libdir) LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" AC_TRY_LINK([$3],[$4], [AC_MSG_RESULT(yes) eval 'cf_cv_have_lib_'$1'=yes' break], [AC_MSG_RESULT(no) LIBS="$cf_save_LIBS"]) done ]) ])eval 'cf_found_library=[$]cf_cv_have_lib_'$1ifelse($6,,[if test $cf_found_library = no ; then AC_ERROR(Cannot link $1 library)fi])])dnldnl ---------------------------------------------------------------------------dnl CF_FUNC_CURSES_VERSION version: 3 updated: 2003/05/17 22:19:02dnl ----------------------dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.dnl It's a character string "SVR4", not documented.AC_DEFUN([CF_FUNC_CURSES_VERSION],[AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[AC_TRY_RUN([#include <${cf_cv_ncurses_header-curses.h}>int main(){ char temp[1024]; sprintf(temp, "%s\n", curses_version()); exit(0);}],[cf_cv_func_curses_version=yes],[cf_cv_func_curses_version=no],[cf_cv_func_curses_version=unknown])rm -f core])test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)])dnl ---------------------------------------------------------------------------dnl CF_GNU_SOURCE version: 3 updated: 2000/10/29 23:30:53dnl -------------dnl Check if we must define _GNU_SOURCE to get a reasonable value fordnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defectdnl (or misfeature) of glibc2, which breaks portability of many applications,dnl since it is interwoven with GNU extensions.dnldnl Well, yes we could work around it...AC_DEFUN([CF_GNU_SOURCE],[AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[AC_TRY_COMPILE([#include <sys/types.h>],[#ifndef _XOPEN_SOURCEmake an error#endif], [cf_cv_gnu_source=no], [cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" AC_TRY_COMPILE([#include <sys/types.h>],[#ifdef _XOPEN_SOURCEmake an error#endif], [cf_cv_gnu_source=no], [cf_cv_gnu_source=yes]) CPPFLAGS="$cf_save" ])])test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"])dnldnl ---------------------------------------------------------------------------dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59dnl --------------dnl Construct a search-list for a nonstandard header-fileAC_DEFUN([CF_HEADER_PATH],[CF_SUBDIR_PATH($1,$2,include)test "$includedir" != NONE && \test "$includedir" != "/usr/include" && \test -d "$includedir" && { test -d $includedir && $1="[$]$1 $includedir" test -d $includedir/$2 && $1="[$]$1 $includedir/$2"}test "$oldincludedir" != NONE && \test "$oldincludedir" != "/usr/include" && \test -d "$oldincludedir" && { test -d $oldincludedir && $1="[$]$1 $oldincludedir" test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"}])dnldnl ---------------------------------------------------------------------------dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42dnl -----------------dnl If we do not have a given script, look for it in the parent directory.AC_DEFUN([CF_INHERIT_SCRIPT],[test -f $1 || ( test -f ../$1 && cp ../$1 ./ )])dnldnl ---------------------------------------------------------------------------dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59dnl ---------------dnl Construct a search-list for a nonstandard library-fileAC_DEFUN([CF_LIBRARY_PATH],[CF_SUBDIR_PATH($1,$2,lib)])dnldnl ---------------------------------------------------------------------------dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28dnl -------------------dnl Check if we can compile with ncurses' header filednl $1 is the cache variable to setdnl $2 is the header-file to includednl $3 is the root name (ncurses or ncursesw)AC_DEFUN([CF_NCURSES_CC_CHECK],[ AC_TRY_COMPILE([]ifelse($3,ncursesw,[#define _XOPEN_SOURCE_EXTENDED#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */])[#include <$2>],[#ifdef NCURSES_VERSION]ifelse($3,ncursesw,[#ifndef WACS_BSSB make an error
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -