📄 aclocal.m4
字号:
};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_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_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]) if test "$cf_cv_good_bcopy" = yes ; then AC_DEFINE(USE_OK_BCOPY) else AC_DEFINE(USE_MY_MEMMOVE) fi])])dnldnl ---------------------------------------------------------------------------dnl CF_FUNC_POLL version: 2 updated: 2000/02/06 01:38:04dnl ------------dnl See if the poll function really works. Some platforms have poll(), butdnl it does not work for terminals or files.AC_DEFUN([CF_FUNC_POLL],[AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[AC_TRY_RUN([#include <stdio.h>#ifdef HAVE_POLL_H#include <poll.h>#else#include <sys/poll.h>#endifint main() { struct pollfd myfds; int ret; myfds.fd = 0; myfds.events = POLLIN; ret = poll(&myfds, 1, 100); exit(ret != 0);}], [cf_cv_working_poll=yes], [cf_cv_working_poll=no], [cf_cv_working_poll=unknown])])test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)])dnldnl ---------------------------------------------------------------------------dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24dnl ---------------dnl Some old/broken variations define tcgetattr() only as a macro indnl termio(s).hAC_DEFUN([CF_FUNC_TERMIOS],[AC_REQUIRE([CF_STRUCT_TERMIOS])AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[AC_TRY_LINK([#include <sys/types.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#ifdef HAVE_TERMIOS_H#include <termios.h>#define TTY struct termios#else#ifdef HAVE_TERMIO_H#include <termio.h>#define TTY struct termio#endif#endif],[TTY foo;tcgetattr(1, &foo);],[cf_cv_have_tcgetattr=yes],[cf_cv_have_tcgetattr=no])])test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)])dnldnl ---------------------------------------------------------------------------dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10dnl ---------------dnl Check for vsscanf() function, which is in c9x but generally not in earlierdnl versions of C. It is in the GNU C library, and can often be simulated bydnl other functions.AC_DEFUN([CF_FUNC_VSSCANF],[AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[AC_TRY_LINK([#include <stdarg.h>#include <stdio.h>],[ va_list ap; vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[AC_TRY_LINK([#include <stdarg.h>#include <stdio.h>],[ FILE strbuf; char *str = "from"; strbuf._flag = _IOREAD; strbuf._ptr = strbuf._base = (unsigned char *) str; strbuf._cnt = strlen(str); strbuf._file = _NFILE; return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[AC_TRY_LINK([#include <stdarg.h>#include <stdio.h>],[ FILE strbuf; char *str = "from"; strbuf._flag = _IOREAD; strbuf._ptr = strbuf._base = (unsigned char *) str; strbuf._cnt = strlen(str); strbuf._file = _NFILE; return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[cf_cv_func_vsscanf=no])])])])case $cf_cv_func_vsscanf in #(vivsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vivfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi_doscan) AC_DEFINE(HAVE__DOSCAN);;esac])dnldnl ---------------------------------------------------------------------------dnl CF_GCC_ATTRIBUTES version: 9 updated: 2002/12/21 19:25:52dnl -----------------dnl Test for availability of useful gcc __attribute__ directives to quietdnl compiler warnings. Though useful, not all are supported -- and contrarydnl to documentation, unrecognized directives cause older compilers to barf.AC_DEFUN([CF_GCC_ATTRIBUTES],[if test "$GCC" = yesthencat > conftest.i <<EOF#ifndef GCC_PRINTF#define GCC_PRINTF 0#endif#ifndef GCC_SCANF#define GCC_SCANF 0#endif#ifndef GCC_NORETURN#define GCC_NORETURN /* nothing */#endif#ifndef GCC_UNUSED#define GCC_UNUSED /* nothing */#endifEOFif test "$GCC" = yesthen AC_CHECKING([for $CC __attribute__ directives])cat > conftest.$ac_ext <<EOF#line __oline__ "configure"#include "confdefs.h"#include "conftest.h"#include "conftest.i"#if GCC_PRINTF#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))#else#define GCC_PRINTFLIKE(fmt,var) /*nothing*/#endif#if GCC_SCANF#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))#else#define GCC_SCANFLIKE(fmt,var) /*nothing*/#endifextern void wow(char *,...) GCC_SCANFLIKE(1,2);extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;extern void foo(void) GCC_NORETURN;int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }EOF for cf_attribute in scanf printf unused noreturn do CF_UPPER(CF_ATTRIBUTE,$cf_attribute) cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&AC_FD_CC case $cf_attribute in scanf|printf) cat >conftest.h <<EOF#define GCC_$CF_ATTRIBUTE 1EOF ;; *) cat >conftest.h <<EOF#define GCC_$CF_ATTRIBUTE $cf_directiveEOF ;; esac if AC_TRY_EVAL(ac_compile); then test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) cat conftest.h >>confdefs.h fi doneelse fgrep define conftest.i >>confdefs.hfirm -rf conftest*fi])dnldnl ---------------------------------------------------------------------------dnl CF_GCC_VERSION version: 3 updated: 2003/09/06 19:16:57dnl --------------dnl Find version of gccAC_DEFUN([CF_GCC_VERSION],[AC_REQUIRE([AC_PROG_CC])GCC_VERSION=noneif test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) GCC_VERSION="`${CC} --version|sed -e '2,$d' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION)fi])dnldnl ---------------------------------------------------------------------------dnl CF_GCC_WARNINGS version: 15 updated: 2003/07/05 18:42:30dnl ---------------dnl Check if the compiler supports useful warning options. There's a few thatdnl we don't use, simply because they're too noisy:dnldnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)dnl -Wredundant-decls (system headers make this too noisy)dnl -Wtraditional (combines too many unrelated messages, only a few useful)dnl -Wwrite-strings (too noisy, but should review occasionally). Thisdnl is enabled for ncurses using "--enable-const".dnl -pedanticdnlAC_DEFUN([CF_GCC_WARNINGS],[AC_REQUIRE([CF_GCC_VERSION])if test "$GCC" = yesthen cat > conftest.$ac_ext <<EOF#line __oline__ "configure"int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }EOF AC_CHECKING([for $CC warning options]) cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" for cf_opt in \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ Wnested-externs \ Wpointer-arith \ Wshadow \ Wstrict-prototypes \ Wundef $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if AC_TRY_EVAL(ac_compile); then test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) case $cf_opt in #(vi Wcast-qual) #(vi CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" ;; Winline) #(vi case $GCC_VERSION in 3.3*) CF_VERBOSE(feature is broken in gcc $GCC_VERSION) continue;; esac ;; esac EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done rm -f conftest* CFLAGS="$cf_save_CFLAGS"fiAC_SUBST(EXTRA_CFLAGS)])dnldnl ---------------------------------------------------------------------------dnl CF_GNAT_TRY_RUN version: 2 updated: 1998/07/19 00:25:18dnl ---------------dnl Verify that a test program compiles and runs with GNATdnl $cf_ada_make is set to the program that compiles/linksAC_DEFUN([CF_GNAT_TRY_RUN],[rm -f conftest*cat >>conftest.ads <<CF_EOF$1CF_EOFcat >>conftest.adb <<CF_EOF$2CF_EOFif ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; thenifelse($3,, :,[ $3])ifelse($4,,,[ else $4]) fiifelse($4,,,[else $4])firm -f conftest*])dnldnl ---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -