📄 aclocal.m4
字号:
if test "$cf_cv_good_bcopy" = yes ; then AC_DEFINE(USE_OK_BCOPY) else AC_DEFINE(USE_MY_MEMMOVE) fi])])dnldnl ---------------------------------------------------------------------------dnl CF_FUNC_NANOSLEEP version: 1 updated: 2005/07/02 15:38:12dnl -----------------dnl Check for existence of workable nanosleep() function. Some systems, e.g.,dnl AIX 4.x, provide a non-working version.AC_DEFUN([CF_FUNC_NANOSLEEP],[AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[AC_TRY_RUN([#include <stdio.h>#include <errno.h>#include <time.h>#ifdef HAVE_SYS_TIME_H#include <sys/time.h>#endifint main() { struct timespec ts1, ts2; int code; ts1.tv_sec = 0; ts1.tv_nsec = 750000000; ts2.tv_sec = 0; ts2.tv_nsec = 0; errno = 0; code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */ exit(code != 0);}], [cf_cv_func_nanosleep=yes], [cf_cv_func_nanosleep=no], [cf_cv_func_nanosleep=unknown])])test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)])dnl ---------------------------------------------------------------------------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: 10 updated: 2005/05/28 13:16:28dnl -----------------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: 4 updated: 2005/08/27 09:53:42dnl --------------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/^.*(GCC) //' -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: 20 updated: 2005/08/06 18:37:29dnl ---------------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 -pedanticdnldnl Parameter:dnl $1 is an optional list of gcc warning flags that a particulardnl application might want to use, e.g., "no-unused" fordnl -Wno-unuseddnl Special:dnl If $with_ext_const is "yes", add a check for -Wwrite-stringsdnlAC_DEFUN([CF_GCC_WARNINGS],[AC_REQUIRE([CF_GCC_VERSION])CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)cat > conftest.$ac_ext <<EOF#line __oline__ "configure"int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }EOFif test "$INTEL_COMPILER" = yesthen# The "-wdXXX" options suppress warnings:# remark #1419: external declaration in primary source file# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)# remark #193: zero used for undefined preprocessing identifier# remark #593: variable "curs_sb_left_arrow" was set but never used# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits# remark #869: parameter "tw" was never referenced# remark #981: operands are evaluated in unspecified order# warning #269: invalid format string conversion AC_CHECKING([for $CC warning options]) cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" for cf_opt in $1 \ wd1419 \ wd1682 \ wd1683 \ wd1684 \ wd193 \ wd279 \ wd593 \ wd810 \ wd869 \ wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if AC_TRY_EVAL(ac_compile); then test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS"elif test "$GCC" = yesthen 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 $1 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 CFLAGS="$cf_save_CFLAGS"firm -f conftest*AC_SUBST(EXTRA_CFLAGS)])dnldnl ---------------------------------------------------------------------------dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08dnl ----------------dnl Verify that a test program compiles/links with GNAT.dnl $cf_ada_make is set to the program that compiles/linksdnl $ADAFLAGS may be set to the GNAT flags.dnldnl $1 is the text of the specdnl $2 is the text of the bodydnl $3 is the shell command to execute if successfuldnl $4 is the shell command to execute if not successfulAC_DEFUN([CF_GNAT_TRY_LINK],[rm -f conftest*cat >>conftest.ads <<CF_EOF$1CF_EOFcat >>conftest.adb <<CF_EOF$2CF_EOFif ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; thenifelse($3,, :,[ $3])ifelse($4,,,[else $4])firm -f conftest*])dnldnl ---------------------------------------------------------------------------dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08dnl ---------------dnl Verify that a test program compiles and runs with GNATdnl $cf_ada_make is set to the program that compiles/linksdnl $ADAFLAGS may be set to the GNAT flags.dnldnl $1 is the text of the specdnl $2 is the text of the bodydnl $3 is the shell command to execute if successfuldnl $4 is the shell command to execute if not successfulAC_DEFUN([CF_GNAT_TRY_RUN],[rm -f conftest*cat >>conftest.ads <<CF_EOF$1CF_EOFcat >>conftest.adb <<CF_EOF$2CF_EOFif ( $cf_ada_make $ADAFLAGS 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 ---------------------------------------------------------------------------dnl CF_GNAT_VERSION version: 11 updated: 2003/09/06 19:42:09dnl ---------------dnl Verify version of GNAT.AC_DEFUN([CF_GNAT_VERSION],[AC_MSG_CHECKING(for gnat version)cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\ sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`AC_MSG_RESULT($cf_gnat_version)case $cf_gnat_version in 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) cf_cv_prog_gnat_correct=yes ;; *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding. cf_cv_prog_gnat_correct=no ;;esaccase $cf_gnat_version in 3.[[1-9]]*|[[4-9]].*) cf_compile_generics=generics cf_generic_objects="\$(GENOBJS)" ;; *) cf_compile_generics= cf_generic_objects= ;;esac])dnl ---------------------------------------------------------------------------dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07dnl -------------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_SOURCE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -