📄 functions.m4
字号:
# This file is part of Autoconf. -*- Autoconf -*-# Checking for functions.# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software# Foundation, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA# 02110-1301, USA.## As a special exception, the Free Software Foundation gives unlimited# permission to copy, distribute and modify the configure scripts that# are the output of Autoconf. You need not follow the terms of the GNU# General Public License when using or distributing such scripts, even# though portions of the text of Autoconf appear in them. The GNU# General Public License (GPL) does govern all other use of the material# that constitutes the Autoconf program.## Certain portions of the Autoconf source text are designed to be copied# (in certain cases, depending on the input) into the output of# Autoconf. We call these the "data" portions. The rest of the Autoconf# source text consists of comments plus executable code that decides which# of the data portions to output in any given case. We call these# comments and executable code the "non-data" portions. Autoconf never# copies any of the non-data portions into its output.## This special exception to the GPL applies to versions of Autoconf# released by the Free Software Foundation. When you make and# distribute a modified version of Autoconf, you may extend this special# exception to the GPL to apply to your modified version as well, *unless*# your modified version has the potential to copy into its output some# of the text that was the non-data portion of the version that you started# with. (In other words, unless your change moves or copies text from# the non-data portions to the data portions.) If your modification has# such potential, you must delete any notice of this special exception# to the GPL from your modified version.## Written by David MacKenzie, with help from# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,# Roland McGrath, Noah Friedman, david d zuhn, and many others.# Table of contents## 1. Generic tests for functions.# 2. Functions to check with AC_CHECK_FUNCS# 3. Tests for specific functions.## -------------------------------- #### 1. Generic tests for functions. #### -------------------------------- ### AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])# -----------------------------------------------------------------AC_DEFUN([AC_CHECK_FUNC],[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnlAC_CACHE_CHECK([for $1], ac_var,[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])], [AS_VAR_SET(ac_var, yes)], [AS_VAR_SET(ac_var, no)])])AS_IF([test AS_VAR_GET(ac_var) = yes], [$2], [$3])dnlAS_VAR_POPDEF([ac_var])dnl])# AC_CHECK_FUNC# _AH_CHECK_FUNCS(FUNCTION...)# ----------------------------m4_define([_AH_CHECK_FUNCS],[m4_foreach_w([AC_Func], [$1], [AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([AC_Func])), [Define to 1 if you have the `]m4_defn([AC_Func])[' function.])])])# AC_CHECK_FUNCS(FUNCTION..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])# ---------------------------------------------------------------------AC_DEFUN([AC_CHECK_FUNCS],[_AH_CHECK_FUNCS([$1])dnlfor ac_func in $1doAC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2], [$3])dnldone])# AC_CHECK_FUNCS_ONCE(FUNCTION...)# --------------------------------AC_DEFUN([AC_CHECK_FUNCS_ONCE],[ _AH_CHECK_FUNCS([$1]) m4_foreach_w([AC_Func], [$1], [AC_DEFUN([_AC_Func_]m4_defn([AC_Func]), [m4_divert_text([INIT_PREPARE], [ac_func_list="$ac_func_list AC_Func"]) _AC_FUNCS_EXPANSION]) AC_REQUIRE([_AC_Func_]m4_defn([AC_Func]))])])m4_define([_AC_FUNCS_EXPANSION],[ m4_divert_text([DEFAULTS], [ac_func_list=]) AC_CHECK_FUNCS([$ac_func_list]) m4_define([_AC_FUNCS_EXPANSION], [])])# AC_REPLACE_FUNCS(FUNCTION...)# -----------------------------AC_DEFUN([AC_REPLACE_FUNCS],[m4_foreach_w([AC_Func], [$1], [AC_LIBSOURCE(AC_Func.c)])dnlAC_CHECK_FUNCS([$1], , [_AC_LIBOBJ($ac_func)])])# AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)# ------------------------------------------------------------# Try to link a program that calls FUNC, handling GCC builtins. If# the link succeeds, execute ACTION-IF-FOUND; otherwise, execute# ACTION-IF-NOT-FOUND.AC_DEFUN([AC_TRY_LINK_FUNC],[AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], [$2], [$3])])# AU::AC_FUNC_CHECK# -----------------AU_ALIAS([AC_FUNC_CHECK], [AC_CHECK_FUNC])# AU::AC_HAVE_FUNCS# -----------------AU_ALIAS([AC_HAVE_FUNCS], [AC_CHECK_FUNCS])## ------------------------------------------- #### 2. Functions to check with AC_CHECK_FUNCS. #### ------------------------------------------- ##AN_FUNCTION([__argz_count], [AC_CHECK_FUNCS])AN_FUNCTION([__argz_next], [AC_CHECK_FUNCS])AN_FUNCTION([__argz_stringify], [AC_CHECK_FUNCS])AN_FUNCTION([__fpending], [AC_CHECK_FUNCS])AN_FUNCTION([acl], [AC_CHECK_FUNCS])AN_FUNCTION([alarm], [AC_CHECK_FUNCS])AN_FUNCTION([atexit], [AC_CHECK_FUNCS])AN_FUNCTION([btowc], [AC_CHECK_FUNCS])AN_FUNCTION([bzero], [AC_CHECK_FUNCS])AN_FUNCTION([clock_gettime], [AC_CHECK_FUNCS])AN_FUNCTION([doprnt], [AC_CHECK_FUNCS])AN_FUNCTION([dup2], [AC_CHECK_FUNCS])AN_FUNCTION([endgrent], [AC_CHECK_FUNCS])AN_FUNCTION([endpwent], [AC_CHECK_FUNCS])AN_FUNCTION([euidaccess], [AC_CHECK_FUNCS])AN_FUNCTION([fchdir], [AC_CHECK_FUNCS])AN_FUNCTION([fdatasync], [AC_CHECK_FUNCS])AN_FUNCTION([fesetround], [AC_CHECK_FUNCS])AN_FUNCTION([floor], [AC_CHECK_FUNCS])AN_FUNCTION([fs_stat_dev], [AC_CHECK_FUNCS])AN_FUNCTION([ftime], [AC_CHECK_FUNCS])AN_FUNCTION([ftruncate], [AC_CHECK_FUNCS])AN_FUNCTION([getcwd], [AC_CHECK_FUNCS])AN_FUNCTION([getdelim], [AC_CHECK_FUNCS])AN_FUNCTION([gethostbyaddr], [AC_CHECK_FUNCS])AN_FUNCTION([gethostbyname], [AC_CHECK_FUNCS])AN_FUNCTION([gethostname], [AC_CHECK_FUNCS])AN_FUNCTION([gethrtime], [AC_CHECK_FUNCS])AN_FUNCTION([getmntent], [AC_CHECK_FUNCS])AN_FUNCTION([getmntinfo], [AC_CHECK_FUNCS])AN_FUNCTION([getpagesize], [AC_CHECK_FUNCS])AN_FUNCTION([getpass], [AC_CHECK_FUNCS])AN_FUNCTION([getspnam], [AC_CHECK_FUNCS])AN_FUNCTION([gettimeofday], [AC_CHECK_FUNCS])AN_FUNCTION([getusershell], [AC_CHECK_FUNCS])AN_FUNCTION([hasmntopt], [AC_CHECK_FUNCS])AN_FUNCTION([inet_ntoa], [AC_CHECK_FUNCS])AN_FUNCTION([isascii], [AC_CHECK_FUNCS])AN_FUNCTION([iswprint], [AC_CHECK_FUNCS])AN_FUNCTION([lchown], [AC_CHECK_FUNCS])AN_FUNCTION([listmntent], [AC_CHECK_FUNCS])AN_FUNCTION([localeconv], [AC_CHECK_FUNCS])AN_FUNCTION([localtime_r], [AC_CHECK_FUNCS])AN_FUNCTION([mblen], [AC_CHECK_FUNCS])AN_FUNCTION([mbrlen], [AC_CHECK_FUNCS])AN_FUNCTION([memchr], [AC_CHECK_FUNCS])AN_FUNCTION([memmove], [AC_CHECK_FUNCS])AN_FUNCTION([mempcpy], [AC_CHECK_FUNCS])AN_FUNCTION([memset], [AC_CHECK_FUNCS])AN_FUNCTION([mkdir], [AC_CHECK_FUNCS])AN_FUNCTION([mkfifo], [AC_CHECK_FUNCS])AN_FUNCTION([modf], [AC_CHECK_FUNCS])AN_FUNCTION([munmap], [AC_CHECK_FUNCS])AN_FUNCTION([next_dev], [AC_CHECK_FUNCS])AN_FUNCTION([nl_langinfo], [AC_CHECK_FUNCS])AN_FUNCTION([pathconf], [AC_CHECK_FUNCS])AN_FUNCTION([pow], [AC_CHECK_FUNCS])AN_FUNCTION([pstat_getdynamic], [AC_CHECK_FUNCS])AN_FUNCTION([putenv], [AC_CHECK_FUNCS])AN_FUNCTION([re_comp], [AC_CHECK_FUNCS])AN_FUNCTION([realpath], [AC_CHECK_FUNCS])AN_FUNCTION([regcmp], [AC_CHECK_FUNCS])AN_FUNCTION([regcomp], [AC_CHECK_FUNCS])AN_FUNCTION([resolvepath], [AC_CHECK_FUNCS])AN_FUNCTION([rint], [AC_CHECK_FUNCS])AN_FUNCTION([rmdir], [AC_CHECK_FUNCS])AN_FUNCTION([rpmatch], [AC_CHECK_FUNCS])AN_FUNCTION([select], [AC_CHECK_FUNCS])AN_FUNCTION([setenv], [AC_CHECK_FUNCS])AN_FUNCTION([sethostname], [AC_CHECK_FUNCS])AN_FUNCTION([setlocale], [AC_CHECK_FUNCS])AN_FUNCTION([socket], [AC_CHECK_FUNCS])AN_FUNCTION([sqrt], [AC_CHECK_FUNCS])AN_FUNCTION([stime], [AC_CHECK_FUNCS])AN_FUNCTION([stpcpy], [AC_CHECK_FUNCS])AN_FUNCTION([strcasecmp], [AC_CHECK_FUNCS])AN_FUNCTION([strchr], [AC_CHECK_FUNCS])AN_FUNCTION([strcspn], [AC_CHECK_FUNCS])AN_FUNCTION([strdup], [AC_CHECK_FUNCS])AN_FUNCTION([strerror], [AC_CHECK_FUNCS])AN_FUNCTION([strncasecmp], [AC_CHECK_FUNCS])AN_FUNCTION([strndup], [AC_CHECK_FUNCS])AN_FUNCTION([strpbrk], [AC_CHECK_FUNCS])AN_FUNCTION([strrchr], [AC_CHECK_FUNCS])AN_FUNCTION([strspn], [AC_CHECK_FUNCS])AN_FUNCTION([strstr], [AC_CHECK_FUNCS])AN_FUNCTION([strtol], [AC_CHECK_FUNCS])AN_FUNCTION([strtoul], [AC_CHECK_FUNCS])AN_FUNCTION([strtoull], [AC_CHECK_FUNCS])AN_FUNCTION([strtoumax], [AC_CHECK_FUNCS])AN_FUNCTION([strverscmp], [AC_CHECK_FUNCS])AN_FUNCTION([sysinfo], [AC_CHECK_FUNCS])AN_FUNCTION([tzset], [AC_CHECK_FUNCS])AN_FUNCTION([uname], [AC_CHECK_FUNCS])AN_FUNCTION([utime], [AC_CHECK_FUNCS])AN_FUNCTION([utmpname], [AC_CHECK_FUNCS])AN_FUNCTION([utmpxname], [AC_CHECK_FUNCS])AN_FUNCTION([wcwidth], [AC_CHECK_FUNCS])AN_FUNCTION([dcgettext], [AM_GNU_GETTEXT])AN_FUNCTION([getwd], [warn: getwd is deprecated, use getcwd instead])## --------------------------------- #### 3. Tests for specific functions. #### --------------------------------- ### The macros are sorted:## 1. AC_FUNC_* macros are sorted by alphabetical order.## 2. Helping macros such as _AC_LIBOBJ_* are before the macro that# uses it.## 3. Obsolete macros are right after the modern macro.# _AC_LIBOBJ_ALLOCA# -----------------# Set up the LIBOBJ replacement of `alloca'. Well, not exactly# AC_LIBOBJ since we actually set the output variable `ALLOCA'.# Nevertheless, for Automake, AC_LIBSOURCES it.m4_define([_AC_LIBOBJ_ALLOCA],[# The SVR3 libPW and SVR4 libucb both contain incompatible functions# that cause trouble. Some versions do not even contain alloca or# contain a buggy version. If you still want to use their alloca,# use ar to extract alloca.o from them instead of compiling alloca.c.AC_LIBSOURCES(alloca.c)AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnlAC_DEFINE(C_ALLOCA, 1, [Define to 1 if using `alloca.c'.])AC_CACHE_CHECK(whether `alloca.c' needs Cray hooks, ac_cv_os_cray,[AC_EGREP_CPP(webecray,[#if defined CRAY && ! defined CRAY2webecray#elsewenotbecray#endif], ac_cv_os_cray=yes, ac_cv_os_cray=no)])if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, [Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems.]) break]) donefiAC_CACHE_CHECK([stack direction for C alloca], [ac_cv_c_stack_direction],[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULTintfind_stack_direction (){ static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1;}intmain (){ return find_stack_direction () < 0;}])], [ac_cv_c_stack_direction=1], [ac_cv_c_stack_direction=-1], [ac_cv_c_stack_direction=0])])AH_VERBATIM([STACK_DIRECTION],[/* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */@%:@undef STACK_DIRECTION])dnlAC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)])# _AC_LIBOBJ_ALLOCA# AC_FUNC_ALLOCA# --------------AN_FUNCTION([alloca], [AC_FUNC_ALLOCA])AN_HEADER([alloca.h], [AC_FUNC_ALLOCA])AC_DEFUN([AC_FUNC_ALLOCA],[# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works# for constant arguments. Useless!AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,[AC_LINK_IFELSE( [AC_LANG_PROGRAM([[@%:@include <alloca.h>]], [[char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0;]])], [ac_cv_working_alloca_h=yes], [ac_cv_working_alloca_h=no])])if test $ac_cv_working_alloca_h = yes; then AC_DEFINE(HAVE_ALLOCA_H, 1, [Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).])fiAC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef __GNUC__# define alloca __builtin_alloca#else# ifdef _MSC_VER# include <malloc.h># define alloca _alloca# else# if HAVE_ALLOCA_H# include <alloca.h># else# ifdef _AIX #pragma alloca# else# ifndef alloca /* predefined by HP cc +Olibcalls */char *alloca ();# endif# endif# endif# endif#endif]], [[char *p = (char *) alloca (1); if (p) return 0;]])], [ac_cv_func_alloca_works=yes], [ac_cv_func_alloca_works=no])])if test $ac_cv_func_alloca_works = yes; then AC_DEFINE(HAVE_ALLOCA, 1, [Define to 1 if you have `alloca', as a function or macro.])else _AC_LIBOBJ_ALLOCAfi])# AC_FUNC_ALLOCA# AU::AC_ALLOCA# -------------AU_ALIAS([AC_ALLOCA], [AC_FUNC_ALLOCA])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -