📄 programs.m4
字号:
# This file is part of Autoconf. -*- Autoconf -*-# Checking for programs.# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 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.## ----------------------------- #### Generic checks for programs. #### ----------------------------- ### _AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],# [PATH], [REJECT])# -----------------------------------------------------AC_DEFUN([_AC_CHECK_PROG],[# Extract the first word of "$2", so it can be a program name with args.set dummy $2; ac_word=$[2]AC_MSG_CHECKING([for $ac_word])AC_CACHE_VAL(ac_cv_prog_$1,[if test -n "$$1"; then ac_cv_prog_$1="$$1" # Let the user override the test.elsem4_ifvaln([$6],[ ac_prog_rejected=no])dnl_AS_PATH_WALK([$5],[for ac_exec_ext in '' $ac_executable_extensions; do if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); thenm4_ifvaln([$6],[ if test "$as_dir/$ac_word$ac_exec_ext" = "$6"; then ac_prog_rejected=yes continue fi])dnl ac_cv_prog_$1="$3" _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext]) break 2 fidone])m4_ifvaln([$6],[if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_$1 shift if test $[@%:@] != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set $1 to just the basename; use the full file name. shift ac_cv_prog_$1="$as_dir/$ac_word${1+' '}$[@]"m4_if([$2], [$4],[ else # Default is a loser. AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnlm4_default([$5], [\$PATH])])])dnl fifi])dnldnl If no 4th arg is given, leave the cache variable unset,dnl so AC_CHECK_PROGS will keep looking.m4_ifvaln([$4],[ test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnlfi])dnl$1=$ac_cv_prog_$1if test -n "$$1"; then AC_MSG_RESULT([$$1])else AC_MSG_RESULT([no])fi])# _AC_CHECK_PROG# AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],# [PATH], [REJECT])# -----------------------------------------------------AC_DEFUN([AC_CHECK_PROG],[_AC_CHECK_PROG($@)AC_SUBST([$1])dnl])# AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],# [PATH])# ------------------------------------------------------------------AC_DEFUN([AC_CHECK_PROGS],[for ac_prog in $2do AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4]) test -n "$$1" && breakdonem4_ifvaln([$3], [test -n "$$1" || $1="$3"])])# _AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])# ------------------------------------------------------------------------AC_DEFUN([_AC_PATH_PROG],[# Extract the first word of "$2", so it can be a program name with args.set dummy $2; ac_word=$[2]AC_MSG_CHECKING([for $ac_word])AC_CACHE_VAL([ac_cv_path_$1],[case $$1 in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="$$1" # Let the user override the test with a path. ;; *) _AS_PATH_WALK([$4],[for ac_exec_ext in '' $ac_executable_extensions; do if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then ac_cv_path_$1="$as_dir/$ac_word$ac_exec_ext" _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext]) break 2 fidone])dnl If no 3rd arg is given, leave the cache variable unset,dnl so AC_PATH_PROGS will keep looking.m4_ifvaln([$3],[ test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl ;;esac])dnl$1=$ac_cv_path_$1if test -n "$$1"; then AC_MSG_RESULT([$$1])else AC_MSG_RESULT([no])fi])# _AC_PATH_PROG# AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])# -----------------------------------------------------------------------AC_DEFUN([AC_PATH_PROG],[_AC_PATH_PROG($@)AC_SUBST([$1])dnl])# AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],# [PATH])# -----------------------------------------------------------------AC_DEFUN([AC_PATH_PROGS],[for ac_prog in $2do AC_PATH_PROG([$1], [$ac_prog], , [$4]) test -n "$$1" && breakdonem4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl])## -------------------------- #### Generic checks for tools. #### -------------------------- ### AC_CHECK_TOOL_PREFIX# --------------------AU_DEFUN([AC_CHECK_TOOL_PREFIX])# _AC_TOOL_WARN# -------------AC_DEFUN([_AC_TOOL_WARN],[case $cross_compiling:$ac_tool_warned inyes:)AC_MSG_WARN([In the future, Autoconf will not detect cross-toolswhose name does not start with the host triplet. If you think thisconfiguration is useful to you, please write to autoconf@gnu.org.])ac_tool_warned=yes ;;esac])# AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])# -----------------------------------------------------------------------# (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)AC_DEFUN([AC_PATH_TOOL],[if test -n "$ac_tool_prefix"; then AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])fiif test -z "$ac_cv_path_$1"; then ac_pt_$1=$$1 _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4]) if test "x$ac_pt_$1" = x; then $1="$3" else _AC_TOOL_WARN $1=$ac_pt_$1 fielse $1="$ac_cv_path_$1"fi])# AC_PATH_TOOL# AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])# ------------------------------------------------------------------------# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)AC_DEFUN([AC_CHECK_TOOL],[if test -n "$ac_tool_prefix"; then AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4])fiif test -z "$ac_cv_prog_$1"; then ac_ct_$1=$$1 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4]) if test "x$ac_ct_$1" = x; then $1="$3" else _AC_TOOL_WARN $1=$ac_ct_$1 fielse $1="$ac_cv_prog_$1"fi])# AC_CHECK_TOOL# AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],# [PATH])# ------------------------------------------------------------------# Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If# none can be found with a cross prefix, then use the first one that# was found without the cross prefix.AC_DEFUN([AC_CHECK_TOOLS],[if test -n "$ac_tool_prefix"; then for ac_prog in $2 do AC_CHECK_PROG([$1], [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],, [$4]) test -n "$$1" && break donefiif test -z "$$1"; then ac_ct_$1=$$1 AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4]) if test "x$ac_ct_$1" = x; then $1="$3" else _AC_TOOL_WARN $1=$ac_ct_$1 fifi])# AC_CHECK_TOOLS# AC_PATH_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])# -----------------------------------------------------------------------# (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)AC_DEFUN([AC_PATH_TARGET_TOOL],[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnlAC_PATH_PROG([$1], [$target_alias-$2], , [$4])if test -z "$ac_cv_path_$1"; then if test "$build" = "$target"; then ac_pt_$1=$$1 _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4]) $1=$ac_pt_$1 else $1="$3" fielse $1="$ac_cv_path_$1"fi])# AC_PATH_TARGET_TOOL# AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])# ------------------------------------------------------------------------# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)AC_DEFUN([AC_CHECK_TARGET_TOOL],[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnlAC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])if test -z "$ac_cv_prog_$1"; then if test "$build" = "$target"; then ac_ct_$1=$$1 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4]) $1=ac_ct_$1 else $1="$3" fielse $1="$ac_cv_prog_$1"fi])# AC_CHECK_TARGET_TOOL# AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],# [PATH])# ------------------------------------------------------------------# Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If# none can be found with a cross prefix, then use the first one that# was found without the cross prefix.AC_DEFUN([AC_CHECK_TARGET_TOOLS],[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnlfor ac_prog in $2do AC_CHECK_PROG([$1], [$target_alias-$ac_prog], [$target_alias-$ac_prog],, [$4]) test -n "$$1" && breakdoneif test -z "$$1"; then if test "$build" = "$target"; then ac_ct_$1=$$1 AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4]) $1=$ac_ct_$1 else $1="$3" fifi])# AC_CHECK_TARGET_TOOLS## ---------------- #### Specific tests. #### ---------------- ### Please, keep this section sorted.# (But of course when keeping related things together).# Check for gawk first since it's generally better.AN_MAKEVAR([AWK], [AC_PROG_AWK])AN_PROGRAM([awk], [AC_PROG_AWK])AN_PROGRAM([gawk], [AC_PROG_AWK])AN_PROGRAM([mawk], [AC_PROG_AWK])AN_PROGRAM([nawk], [AC_PROG_AWK])AC_DEFUN([AC_PROG_AWK],[AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])# AC_PROG_EGREP# -------------AC_DEFUN([AC_PROG_EGREP],[AC_REQUIRE([AC_PROG_GREP])dnlAC_CACHE_CHECK([for egrep], ac_cv_path_EGREP, [if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else _AC_PROG_GREP(EGREP, egrep, ['EGREP$']) fi]) EGREP="$ac_cv_path_EGREP" AC_SUBST([EGREP])])# AC_PROG_EGREP# AC_PROG_FGREP# -------------AC_DEFUN([AC_PROG_FGREP],[AC_REQUIRE([AC_PROG_GREP])dnlAC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP, [if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else _AC_PROG_GREP(FGREP, fgrep, [FGREP]) fi]) FGREP="$ac_cv_path_FGREP" AC_SUBST([FGREP])])# AC_PROG_FGREP# AC_PROG_GREP# ------------# Check for a fully functional grep program that handles# the longest lines possible and which respects multiple -e options.# Prefer GNU grep if found.AC_DEFUN([AC_PROG_GREP],[AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP, [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])]) GREP="$ac_cv_path_GREP" AC_SUBST([GREP])])# _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS)# ------------------------------------------------------# Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e.# AIX silently truncates long lines before matching.# NeXT understands only one -e and truncates long lines.m4_define([_AC_PROG_GREP],[_AC_PATH_PROG_FEATURE_CHECK([$1], [$2], [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1], ["$ac_path_$1" $3], [$1])], [$PATH$PATH_SEPARATOR/usr/xpg4/bin])])# _AC_PATH_PROG_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, FEATURE-TEST, [PATH])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -