1# This file is part of Autoconf. -*- Autoconf -*- 2# Checking for programs. 3 4# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. 5 6# This file is part of Autoconf. This program is free 7# software; you can redistribute it and/or modify it under the 8# terms of the GNU General Public License as published by the 9# Free Software Foundation, either version 3 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# Under Section 7 of GPL version 3, you are granted additional 18# permissions described in the Autoconf Configure Script Exception, 19# version 3.0, as published by the Free Software Foundation. 20# 21# You should have received a copy of the GNU General Public License 22# and a copy of the Autoconf Configure Script Exception along with 23# this program; see the files COPYINGv3 and COPYING.EXCEPTION 24# respectively. If not, see <http://www.gnu.org/licenses/>. 25 26# Written by David MacKenzie, with help from 27# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, 28# Roland McGrath, Noah Friedman, david d zuhn, and many others. 29 30 31## ----------------------------- ## 32## Generic checks for programs. ## 33## ----------------------------- ## 34 35 36# _AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, 37# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND], 38# [PATH], [REJECT]) 39# ----------------------------------------------------- 40AC_DEFUN([_AC_CHECK_PROG], 41[# Extract the first word of "$2", so it can be a program name with args. 42set dummy $2; ac_word=$[2] 43AC_MSG_CHECKING([for $ac_word]) 44AC_CACHE_VAL(ac_cv_prog_$1, 45[if test -n "$$1"; then 46 ac_cv_prog_$1="$$1" # Let the user override the test. 47else 48m4_ifvaln([$6], 49[ ac_prog_rejected=no])dnl 50_AS_PATH_WALK([$5], 51[for ac_exec_ext in '' $ac_executable_extensions; do 52 if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then 53m4_ifvaln([$6], 54[ if test "$as_dir/$ac_word$ac_exec_ext" = "$6"; then 55 ac_prog_rejected=yes 56 continue 57 fi])dnl 58 ac_cv_prog_$1="$3" 59 _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext]) 60 break 2 61 fi 62done]) 63m4_ifvaln([$6], 64[if test $ac_prog_rejected = yes; then 65 # We found a bogon in the path, so make sure we never use it. 66 set dummy $ac_cv_prog_$1 67 shift 68 if test $[@%:@] != 0; then 69 # We chose a different compiler from the bogus one. 70 # However, it has the same basename, so the bogon will be chosen 71 # first if we set $1 to just the basename; use the full file name. 72 shift 73 ac_cv_prog_$1="$as_dir/$ac_word${1+' '}$[@]" 74m4_if([$2], [$4], 75[ else 76 # Default is a loser. 77 AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl 78m4_default([$5], [\$PATH])]) 79])dnl 80 fi 81fi])dnl 82dnl If no 4th arg is given, leave the cache variable unset, 83dnl so AC_CHECK_PROGS will keep looking. 84m4_ifvaln([$4], 85[ test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl 86fi])dnl 87$1=$ac_cv_prog_$1 88if test -n "$$1"; then 89 AC_MSG_RESULT([$$1]) 90else 91 AC_MSG_RESULT([no]) 92fi 93])# _AC_CHECK_PROG 94 95 96# AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, 97# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND], 98# [PATH], [REJECT]) 99# ----------------------------------------------------- 100AC_DEFUN([AC_CHECK_PROG], 101[_AC_CHECK_PROG($@) 102AC_SUBST([$1])dnl 103]) 104 105 106# AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], 107# [PATH]) 108# ------------------------------------------------------------------ 109AC_DEFUN([AC_CHECK_PROGS], 110[for ac_prog in $2 111do 112 AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4]) 113 test -n "$$1" && break 114done 115m4_ifvaln([$3], [test -n "$$1" || $1="$3"])]) 116 117 118# _AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) 119# ------------------------------------------------------------------------ 120AC_DEFUN([_AC_PATH_PROG], 121[# Extract the first word of "$2", so it can be a program name with args. 122set dummy $2; ac_word=$[2] 123AC_MSG_CHECKING([for $ac_word]) 124AC_CACHE_VAL([ac_cv_path_$1], 125[case $$1 in 126 [[\\/]]* | ?:[[\\/]]*) 127 ac_cv_path_$1="$$1" # Let the user override the test with a path. 128 ;; 129 *) 130 _AS_PATH_WALK([$4], 131[for ac_exec_ext in '' $ac_executable_extensions; do 132 if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then 133 ac_cv_path_$1="$as_dir/$ac_word$ac_exec_ext" 134 _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext]) 135 break 2 136 fi 137done]) 138dnl If no 3rd arg is given, leave the cache variable unset, 139dnl so AC_PATH_PROGS will keep looking. 140m4_ifvaln([$3], 141[ test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl 142 ;; 143esac])dnl 144$1=$ac_cv_path_$1 145if test -n "$$1"; then 146 AC_MSG_RESULT([$$1]) 147else 148 AC_MSG_RESULT([no]) 149fi 150])# _AC_PATH_PROG 151 152 153# AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) 154# ----------------------------------------------------------------------- 155AC_DEFUN([AC_PATH_PROG], 156[_AC_PATH_PROG($@) 157AC_SUBST([$1])dnl 158]) 159 160 161# AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], 162# [PATH]) 163# ----------------------------------------------------------------- 164AC_DEFUN([AC_PATH_PROGS], 165[for ac_prog in $2 166do 167 AC_PATH_PROG([$1], [$ac_prog], , [$4]) 168 test -n "$$1" && break 169done 170m4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl 171]) 172 173 174 175 176## -------------------------- ## 177## Generic checks for tools. ## 178## -------------------------- ## 179 180 181# AC_CHECK_TOOL_PREFIX 182# -------------------- 183AU_DEFUN([AC_CHECK_TOOL_PREFIX]) 184 185 186# _AC_TOOL_WARN 187# ------------- 188AC_DEFUN([_AC_TOOL_WARN], 189[case $cross_compiling:$ac_tool_warned in 190yes:) 191AC_MSG_WARN([using cross tools not prefixed with host triplet]) 192ac_tool_warned=yes ;; 193esac]) 194 195# AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) 196# ----------------------------------------------------------------------- 197# (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.) 198AC_DEFUN([AC_PATH_TOOL], 199[if test -n "$ac_tool_prefix"; then 200 AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4]) 201fi 202if test -z "$ac_cv_path_$1"; then 203 ac_pt_$1=$$1 204 _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4]) 205 if test "x$ac_pt_$1" = x; then 206 $1="$3" 207 else 208 _AC_TOOL_WARN 209 $1=$ac_pt_$1 210 fi 211else 212 $1="$ac_cv_path_$1" 213fi 214])# AC_PATH_TOOL 215 216 217# AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) 218# ------------------------------------------------------------------------ 219# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.) 220AC_DEFUN([AC_CHECK_TOOL], 221[if test -n "$ac_tool_prefix"; then 222 AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4]) 223fi 224if test -z "$ac_cv_prog_$1"; then 225 ac_ct_$1=$$1 226 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4]) 227 if test "x$ac_ct_$1" = x; then 228 $1="$3" 229 else 230 _AC_TOOL_WARN 231 $1=$ac_ct_$1 232 fi 233else 234 $1="$ac_cv_prog_$1" 235fi 236])# AC_CHECK_TOOL 237 238 239# AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], 240# [PATH]) 241# ------------------------------------------------------------------ 242# Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If 243# none can be found with a cross prefix, then use the first one that 244# was found without the cross prefix. 245AC_DEFUN([AC_CHECK_TOOLS], 246[if test -n "$ac_tool_prefix"; then 247 for ac_prog in $2 248 do 249 AC_CHECK_PROG([$1], 250 [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],, 251 [$4]) 252 test -n "$$1" && break 253 done 254fi 255if test -z "$$1"; then 256 ac_ct_$1=$$1 257 AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4]) 258 if test "x$ac_ct_$1" = x; then 259 $1="$3" 260 else 261 _AC_TOOL_WARN 262 $1=$ac_ct_$1 263 fi 264fi 265])# AC_CHECK_TOOLS 266 267 268# AC_PATH_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) 269# ------------------------------------------------------------------------------ 270# (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.) 271AC_DEFUN([AC_PATH_TARGET_TOOL], 272[AC_REQUIRE([AC_CANONICAL_TARGET])dnl 273AC_PATH_PROG([$1], [$target_alias-$2], , [$4]) 274if test -z "$ac_cv_path_$1"; then 275 if test "$build" = "$target"; then 276 ac_pt_$1=$$1 277 _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4]) 278 $1=$ac_pt_$1 279 else 280 $1="$3" 281 fi 282else 283 $1="$ac_cv_path_$1" 284fi 285])# AC_PATH_TARGET_TOOL 286 287 288# AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) 289# ------------------------------------------------------------------------------- 290# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.) 291AC_DEFUN([AC_CHECK_TARGET_TOOL], 292[AC_REQUIRE([AC_CANONICAL_TARGET])dnl 293AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4]) 294if test -z "$ac_cv_prog_$1"; then 295 if test "$build" = "$target"; then 296 ac_ct_$1=$$1 297 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4]) 298 $1=$ac_ct_$1 299 else 300 $1="$3" 301 fi 302else 303 $1="$ac_cv_prog_$1" 304fi 305])# AC_CHECK_TARGET_TOOL 306 307 308# AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], 309# [PATH]) 310# ------------------------------------------------------------------------- 311# Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If 312# none can be found with a cross prefix, then use the first one that 313# was found without the cross prefix. 314AC_DEFUN([AC_CHECK_TARGET_TOOLS], 315[AC_REQUIRE([AC_CANONICAL_TARGET])dnl 316for ac_prog in $2 317do 318 AC_CHECK_PROG([$1], 319 [$target_alias-$ac_prog], [$target_alias-$ac_prog],, 320 [$4]) 321 test -n "$$1" && break 322done 323if test -z "$$1"; then 324 if test "$build" = "$target"; then 325 ac_ct_$1=$$1 326 AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4]) 327 $1=$ac_ct_$1 328 else 329 $1="$3" 330 fi 331fi 332])# AC_CHECK_TARGET_TOOLS 333 334 335 336## ---------------- ## 337## Specific tests. ## 338## ---------------- ## 339 340# Please, keep this section sorted. 341# (But of course when keeping related things together). 342 343# Check for gawk first since it's generally better. 344AN_MAKEVAR([AWK], [AC_PROG_AWK]) 345AN_PROGRAM([awk], [AC_PROG_AWK]) 346AN_PROGRAM([gawk], [AC_PROG_AWK]) 347AN_PROGRAM([mawk], [AC_PROG_AWK]) 348AN_PROGRAM([nawk], [AC_PROG_AWK]) 349AC_DEFUN([AC_PROG_AWK], 350[AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )]) 351 352 353# AC_PROG_EGREP 354# ------------- 355AC_DEFUN([AC_PROG_EGREP], 356[AC_REQUIRE([AC_PROG_GREP])dnl 357AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP, 358 [if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 359 then ac_cv_path_EGREP="$GREP -E" 360 else 361 _AC_PROG_GREP(EGREP, egrep, ['EGREP$']) 362 fi]) 363 EGREP="$ac_cv_path_EGREP" 364 AC_SUBST([EGREP]) 365])# AC_PROG_EGREP 366 367 368# AC_PROG_FGREP 369# ------------- 370AC_DEFUN([AC_PROG_FGREP], 371[AC_REQUIRE([AC_PROG_GREP])dnl 372AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP, 373 [if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 374 then ac_cv_path_FGREP="$GREP -F" 375 else 376 _AC_PROG_GREP(FGREP, fgrep, [FGREP]) 377 fi]) 378 FGREP="$ac_cv_path_FGREP" 379 AC_SUBST([FGREP]) 380])# AC_PROG_FGREP 381 382 383# AC_PROG_GREP 384# ------------ 385# Check for a fully functional grep program that handles 386# the longest lines possible and which respects multiple -e options. 387# Prefer GNU grep if found. 388AC_DEFUN([AC_PROG_GREP], 389[AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP, 390 [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])]) 391 GREP="$ac_cv_path_GREP" 392 AC_SUBST([GREP]) 393]) 394 395 396# _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS) 397# ------------------------------------------------------ 398# Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e. 399# AIX silently truncates long lines before matching. 400# NeXT understands only one -e and truncates long lines. 401m4_define([_AC_PROG_GREP], 402[_AC_PATH_PROGS_FEATURE_CHECK([$1], [$2], 403 [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1], 404 ["$ac_path_$1" $3], [$1])], [], 405 [$PATH$PATH_SEPARATOR/usr/xpg4/bin])dnl 406]) 407 408 409# _AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, FEATURE-TEST, 410# [ACTION-IF-NOT-FOUND], [PATH=$PATH]) 411# ------------------------------------------------------------------- 412# FEATURE-TEST is called repeatedly with $ac_path_VARIABLE set to the 413# name of a program in PROGNAME-LIST found in PATH. FEATURE-TEST must set 414# $ac_cv_path_VARIABLE to the path of an acceptable program, or else 415# ACTION-IF-NOT-FOUND is executed; the default action (for internal use 416# only) issues a fatal error message. If a suitable $ac_path_VARIABLE is 417# found in the FEATURE-TEST macro, it can set $ac_path_VARIABLE_found=':' 418# to accept that value without any further checks. 419m4_define([_AC_PATH_PROGS_FEATURE_CHECK], 420[if test -z "$$1"; then 421 ac_path_$1_found=false 422 # Loop through the user's path and test for each of PROGNAME-LIST 423 _AS_PATH_WALK([$5], 424 [for ac_prog in $2; do 425 for ac_exec_ext in '' $ac_executable_extensions; do 426 ac_path_$1="$as_dir/$ac_prog$ac_exec_ext" 427 AS_EXECUTABLE_P(["$ac_path_$1"]) || continue 428$3 429 $ac_path_$1_found && break 3 430 done 431 done])dnl 432 if test -z "$ac_cv_path_$1"; then 433 m4_default([$4], 434 [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl 435found in m4_default([$5], [\$PATH])])]) 436 fi 437else 438 ac_cv_path_$1=$$1 439fi 440]) 441 442 443# AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, 444# FEATURE-TEST, [ACTION-IF-NOT-FOUND=:], 445# [PATH=$PATH]) 446# ------------------------------------------------------------------ 447# Designed to be used inside AC_CACHE_VAL. It is recommended, 448# but not required, that the user also use AC_ARG_VAR([VARIABLE]). 449# If VARIABLE is not empty, set the cache variable 450# $ac_cv_path_VARIABLE to VARIABLE without any further tests. 451# Otherwise, call FEATURE_TEST repeatedly with $ac_path_VARIABLE 452# set to the name of a program in PROGNAME-LIST found in PATH. If 453# no invocation of FEATURE-TEST sets $ac_cv_path_VARIABLE to the 454# path of an acceptable program, ACTION-IF-NOT-FOUND is executed. 455# FEATURE-TEST is invoked even when $ac_cv_path_VARIABLE is set, 456# in case a better candidate occurs later in PATH; to accept the 457# current setting and bypass further checks, FEATURE-TEST can set 458# $ac_path_VARIABLE_found=':'. Note that, unlike AC_CHECK_PROGS, 459# this macro does not have any side effect on the current value 460# of VARIABLE. 461m4_define([AC_PATH_PROGS_FEATURE_CHECK], 462[_$0([$1], [$2], [$3], m4_default([$4], [:]), [$5])dnl 463]) 464 465 466# _AC_FEATURE_CHECK_LENGTH(PROGPATH, CACHE-VAR, CHECK-CMD, [MATCH-STRING]) 467# ------------------------------------------------------------------------ 468# For use as the FEATURE-TEST argument to _AC_PATH_PROGS_FEATURE_TEST. 469# On each iteration run CHECK-CMD on an input file, storing the value 470# of PROGPATH in CACHE-VAR if the CHECK-CMD succeeds. The input file 471# is always one line, starting with only 10 characters, and doubling 472# in length at each iteration until approx 10000 characters or the 473# feature check succeeds. The feature check is called at each 474# iteration by appending (optionally, MATCH-STRING and) a newline 475# to the file, and using the result as input to CHECK-CMD. 476m4_define([_AC_FEATURE_CHECK_LENGTH], 477[# Check for GNU $1 and select it if it is found. 478 _AC_PATH_PROG_FLAVOR_GNU([$$1], 479 [$2="$$1" $1_found=:], 480 [ac_count=0 481 AS_ECHO_N([0123456789]) >"conftest.in" 482 while : 483 do 484 cat "conftest.in" "conftest.in" >"conftest.tmp" 485 mv "conftest.tmp" "conftest.in" 486 cp "conftest.in" "conftest.nl" 487 AS_ECHO(['$4']) >> "conftest.nl" 488 $3 < "conftest.nl" >"conftest.out" 2>/dev/null || break 489 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 490 AS_VAR_ARITH([ac_count], [$ac_count + 1]) 491 if test $ac_count -gt ${$1_max-0}; then 492 # Best one so far, save it but keep looking for a better one 493 $2="$$1" 494dnl # Using $1_max so that each tool feature checked gets its 495dnl # own variable. Don't reset it otherwise the implied search 496dnl # for best performing tool in a list breaks down. 497 $1_max=$ac_count 498 fi 499 # 10*(2^10) chars as input seems more than enough 500 test $ac_count -gt 10 && break 501 done 502 rm -f conftest.in conftest.tmp conftest.nl conftest.out])dnl 503]) 504 505 506# _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE]) 507# ---------------------------------------------------------------- 508m4_define([_AC_PATH_PROG_FLAVOR_GNU], 509[# Check for GNU $1 510case `"$1" --version 2>&1` in 511*GNU*) 512 $2;; 513m4_ifval([$3], 514[*) 515 $3;; 516])esac 517])# _AC_PATH_PROG_FLAVOR_GNU 518 519 520# AC_PROG_INSTALL 521# --------------- 522AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL]) 523AN_PROGRAM([install], [AC_PROG_INSTALL]) 524AC_DEFUN_ONCE([AC_PROG_INSTALL], 525[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 526AC_REQUIRE_AUX_FILE([install-sh])dnl 527# Find a good install program. We prefer a C program (faster), 528# so one script is as good as another. But avoid the broken or 529# incompatible versions: 530# SysV /etc/install, /usr/sbin/install 531# SunOS /usr/etc/install 532# IRIX /sbin/install 533# AIX /bin/install 534# AmigaOS /C/install, which installs bootblocks on floppy discs 535# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag 536# AFS /usr/afsws/bin/install, which mishandles nonexistent args 537# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" 538# OS/2's system install, which has a completely different semantic 539# ./install, which can be erroneously created by make from ./install.sh. 540# Reject install programs that cannot install multiple files. 541AC_MSG_CHECKING([for a BSD-compatible install]) 542if test -z "$INSTALL"; then 543AC_CACHE_VAL(ac_cv_path_install, 544[_AS_PATH_WALK([$PATH], 545[[# Account for people who put trailing slashes in PATH elements. 546case $as_dir/ in @%:@(( 547 ./ | .// | /[cC]/* | \ 548 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ 549 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ 550 /usr/ucb/* ) ;; 551 *)] 552 # OSF1 and SCO ODT 3.0 have their own names for install. 553 # Don't use installbsd from OSF since it installs stuff as root 554 # by default. 555 for ac_prog in ginstall scoinst install; do 556 for ac_exec_ext in '' $ac_executable_extensions; do 557 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then 558 if test $ac_prog = install && 559 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then 560 # AIX install. It has an incompatible calling convention. 561 : 562 elif test $ac_prog = install && 563 grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then 564 # program-specific install script used by HP pwplus--don't use. 565 : 566 else 567 rm -rf conftest.one conftest.two conftest.dir 568 echo one > conftest.one 569 echo two > conftest.two 570 mkdir conftest.dir 571 if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && 572 test -s conftest.one && test -s conftest.two && 573 test -s conftest.dir/conftest.one && 574 test -s conftest.dir/conftest.two 575 then 576 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" 577 break 3 578 fi 579 fi 580 fi 581 done 582 done 583 ;; 584esac 585]) 586rm -rf conftest.one conftest.two conftest.dir 587])dnl 588 if test "${ac_cv_path_install+set}" = set; then 589 INSTALL=$ac_cv_path_install 590 else 591 # As a last resort, use the slow shell script. Don't cache a 592 # value for INSTALL within a source directory, because that will 593 # break other packages using the cache if that directory is 594 # removed, or if the value is a relative name. 595 INSTALL=$ac_install_sh 596 fi 597fi 598dnl Do special magic for INSTALL instead of AC_SUBST, to get 599dnl relative names right. 600AC_MSG_RESULT([$INSTALL]) 601 602# Use test -z because SunOS4 sh mishandles braces in ${var-val}. 603# It thinks the first close brace ends the variable substitution. 604test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' 605AC_SUBST(INSTALL_PROGRAM)dnl 606 607test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' 608AC_SUBST(INSTALL_SCRIPT)dnl 609 610test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' 611AC_SUBST(INSTALL_DATA)dnl 612])# AC_PROG_INSTALL 613 614 615# AC_PROG_MKDIR_P 616# --------------- 617# Check whether `mkdir -p' is known to be thread-safe, and fall back to 618# install-sh -d otherwise. 619# 620# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories 621# created by `make install' are always world readable, even if the 622# installer happens to have an overly restrictive umask (e.g. 077). 623# This was a mistake. There are at least two reasons why we must not 624# use `-m 0755': 625# - it causes special bits like SGID to be ignored, 626# - it may be too restrictive (some setups expect 775 directories). 627# 628# Do not use -m 0755 and let people choose whatever they expect by 629# setting umask. 630# 631# We cannot accept any implementation of `mkdir' that recognizes `-p'. 632# Some implementations (such as Solaris 8's) are vulnerable to race conditions: 633# if a parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' 634# concurrently, both version can detect that a/ is missing, but only 635# one can create it and the other will error out. Consequently we 636# restrict ourselves to known race-free implementations. 637# 638# Automake used to define mkdir_p as `mkdir -p .', in order to 639# allow $(mkdir_p) to be used without argument. As in 640# $(mkdir_p) $(somedir) 641# where $(somedir) is conditionally defined. However we don't do 642# that for MKDIR_P. 643# 1. before we restricted the check to GNU mkdir, `mkdir -p .' was 644# reported to fail in read-only directories. The system where this 645# happened has been forgotten. 646# 2. in practice we call $(MKDIR_P) on directories such as 647# $(MKDIR_P) "$(DESTDIR)$(somedir)" 648# and we don't want to create $(DESTDIR) if $(somedir) is empty. 649# To support the latter case, we have to write 650# test -z "$(somedir)" || $(MKDIR_P) "$(DESTDIR)$(somedir)" 651# so $(MKDIR_P) always has an argument. 652# We will have better chances of detecting a missing test if 653# $(MKDIR_P) complains about missing arguments. 654# 3. $(MKDIR_P) is named after `mkdir -p' and we don't expect this 655# to accept no argument. 656# 4. having something like `mkdir .' in the output is unsightly. 657# 658# On NextStep and OpenStep, the `mkdir' command does not 659# recognize any option. It will interpret all options as 660# directories to create. 661AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P]) 662AC_DEFUN_ONCE([AC_PROG_MKDIR_P], 663[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 664AC_REQUIRE_AUX_FILE([install-sh])dnl 665AC_MSG_CHECKING([for a thread-safe mkdir -p]) 666if test -z "$MKDIR_P"; then 667 AC_CACHE_VAL([ac_cv_path_mkdir], 668 [_AS_PATH_WALK([$PATH$PATH_SEPARATOR/opt/sfw/bin], 669 [for ac_prog in mkdir gmkdir; do 670 for ac_exec_ext in '' $ac_executable_extensions; do 671 AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]) || continue 672 case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 673 'mkdir (GNU coreutils) '* | \ 674 'mkdir (coreutils) '* | \ 675 'mkdir (fileutils) '4.1*) 676 ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext 677 break 3;; 678 esac 679 done 680 done])]) 681 test -d ./--version && rmdir ./--version 682 if test "${ac_cv_path_mkdir+set}" = set; then 683 MKDIR_P="$ac_cv_path_mkdir -p" 684 else 685 # As a last resort, use the slow shell script. Don't cache a 686 # value for MKDIR_P within a source directory, because that will 687 # break other packages using the cache if that directory is 688 # removed, or if the value is a relative name. 689 MKDIR_P="$ac_install_sh -d" 690 fi 691fi 692dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST, 693dnl to get relative names right. However, also AC_SUBST here so 694dnl that Automake versions before 1.10 will pick it up (they do not 695dnl trace AC_SUBST_TRACE). 696dnl FIXME: Remove this once we drop support for Automake < 1.10. 697AC_SUBST([MKDIR_P])dnl 698AC_MSG_RESULT([$MKDIR_P]) 699])# AC_PROG_MKDIR_P 700 701 702# AC_PROG_LEX 703# ----------- 704# Look for flex or lex. Set its associated library to LEXLIB. 705# Check if lex declares yytext as a char * by default, not a char[]. 706AN_MAKEVAR([LEX], [AC_PROG_LEX]) 707AN_PROGRAM([lex], [AC_PROG_LEX]) 708AN_PROGRAM([flex], [AC_PROG_LEX]) 709AC_DEFUN_ONCE([AC_PROG_LEX], 710[AC_CHECK_PROGS(LEX, flex lex, :) 711if test "x$LEX" != "x:"; then 712 _AC_PROG_LEX_YYTEXT_DECL 713fi]) 714 715 716# _AC_PROG_LEX_YYTEXT_DECL 717# ------------------------ 718# Check for the Lex output root, the Lex library, and whether Lex 719# declares yytext as a char * by default. 720m4_define([_AC_PROG_LEX_YYTEXT_DECL], 721[cat >conftest.l <<_ACEOF[ 722%% 723a { ECHO; } 724b { REJECT; } 725c { yymore (); } 726d { yyless (1); } 727e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ 728 yyless ((input () != 0)); } 729f { unput (yytext[0]); } 730. { BEGIN INITIAL; } 731%% 732#ifdef YYTEXT_POINTER 733extern char *yytext; 734#endif 735int 736main (void) 737{ 738 return ! yylex () + ! yywrap (); 739} 740]_ACEOF 741_AC_DO_VAR(LEX conftest.l) 742AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [ 743if test -f lex.yy.c; then 744 ac_cv_prog_lex_root=lex.yy 745elif test -f lexyy.c; then 746 ac_cv_prog_lex_root=lexyy 747else 748 AC_MSG_ERROR([cannot find output from $LEX; giving up]) 749fi]) 750AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl 751 752if test -z "${LEXLIB+set}"; then 753 AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [ 754 ac_save_LIBS=$LIBS 755 ac_cv_lib_lex='none needed' 756 for ac_lib in '' -lfl -ll; do 757 LIBS="$ac_lib $ac_save_LIBS" 758 AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]], 759 [ac_cv_lib_lex=$ac_lib]) 760 test "$ac_cv_lib_lex" != 'none needed' && break 761 done 762 LIBS=$ac_save_LIBS 763 ]) 764 test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex 765fi 766AC_SUBST(LEXLIB) 767 768AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer, 769[# POSIX says lex can declare yytext either as a pointer or an array; the 770# default is implementation-dependent. Figure out which it is, since 771# not all implementations provide the %pointer and %array declarations. 772ac_cv_prog_lex_yytext_pointer=no 773ac_save_LIBS=$LIBS 774LIBS="$LEXLIB $ac_save_LIBS" 775AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED 776 [#define YYTEXT_POINTER 1 777`cat $LEX_OUTPUT_ROOT.c`]], 778 [ac_cv_prog_lex_yytext_pointer=yes]) 779LIBS=$ac_save_LIBS 780]) 781dnl 782if test $ac_cv_prog_lex_yytext_pointer = yes; then 783 AC_DEFINE(YYTEXT_POINTER, 1, 784 [Define to 1 if `lex' declares `yytext' as a `char *' by default, 785 not a `char[]'.]) 786fi 787rm -f conftest.l $LEX_OUTPUT_ROOT.c 788])# _AC_PROG_LEX_YYTEXT_DECL 789 790 791# Require AC_PROG_LEX in case some people were just calling this macro. 792AU_DEFUN([AC_DECL_YYTEXT], [AC_PROG_LEX]) 793 794 795# AC_PROG_LN_S 796# ------------ 797AN_MAKEVAR([LN], [AC_PROG_LN_S]) 798AN_PROGRAM([ln], [AC_PROG_LN_S]) 799AC_DEFUN([AC_PROG_LN_S], 800[AC_MSG_CHECKING([whether ln -s works]) 801AC_SUBST([LN_S], [$as_ln_s])dnl 802if test "$LN_S" = "ln -s"; then 803 AC_MSG_RESULT([yes]) 804else 805 AC_MSG_RESULT([no, using $LN_S]) 806fi 807])# AC_PROG_LN_S 808 809 810# AC_PROG_MAKE_SET 811# ---------------- 812# Define SET_MAKE to set ${MAKE} if Make does not do so automatically. If Make 813# does not run the test Makefile, we assume that the Make program the user will 814# invoke does set $(MAKE). This is typical, and emitting `MAKE=foomake' is 815# always wrong if `foomake' is not available or does not work. 816AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET]) 817AN_PROGRAM([make], [AC_PROG_MAKE_SET]) 818AC_DEFUN([AC_PROG_MAKE_SET], 819[AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)]) 820set x ${MAKE-make} 821ac_make=`AS_ECHO(["$[2]"]) | sed 's/+/p/g; s/[[^a-zA-Z0-9_]]/_/g'` 822AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set, 823[cat >conftest.make <<\_ACEOF 824SHELL = /bin/sh 825all: 826 @echo '@@@%%%=$(MAKE)=@@@%%%' 827_ACEOF 828# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. 829case `${MAKE-make} -f conftest.make 2>/dev/null` in 830 *@@@%%%=?*=@@@%%%*) 831 eval ac_cv_prog_make_${ac_make}_set=yes;; 832 *) 833 eval ac_cv_prog_make_${ac_make}_set=no;; 834esac 835rm -f conftest.make])dnl 836if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then 837 AC_MSG_RESULT([yes]) 838 SET_MAKE= 839else 840 AC_MSG_RESULT([no]) 841 SET_MAKE="MAKE=${MAKE-make}" 842fi 843AC_SUBST([SET_MAKE])dnl 844])# AC_PROG_MAKE_SET 845 846 847# AC_PROG_RANLIB 848# -------------- 849AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB]) 850AN_PROGRAM([ranlib], [AC_PROG_RANLIB]) 851AC_DEFUN([AC_PROG_RANLIB], 852[AC_CHECK_TOOL(RANLIB, ranlib, :)]) 853 854 855# AC_RSH 856# ------ 857# I don't know what it used to do, but it no longer does. 858AU_DEFUN([AC_RSH], [], 859[$0 is no longer supported. Remove this warning when you 860adjust the code.]) 861 862 863# AC_PROG_SED 864# ----------- 865# Check for a fully functional sed program that truncates 866# as few characters as possible. Prefer GNU sed if found. 867AC_DEFUN([AC_PROG_SED], 868[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED, 869 [dnl ac_script should not contain more than 99 commands (for HP-UX sed), 870 dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed. 871 ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ 872 for ac_i in 1 2 3 4 5 6 7; do 873 ac_script="$ac_script$as_nl$ac_script" 874 done 875 echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed 876 AS_UNSET([ac_script]) 877 _AC_PATH_PROGS_FEATURE_CHECK(SED, [sed gsed], 878 [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED], 879 ["$ac_path_SED" -f conftest.sed])])]) 880 SED="$ac_cv_path_SED" 881 AC_SUBST([SED])dnl 882 rm -f conftest.sed 883])# AC_PROG_SED 884 885 886# AC_PROG_YACC 887# ------------ 888AN_MAKEVAR([BISON], [AC_PROG_YACC]) 889AN_MAKEVAR([YACC], [AC_PROG_YACC]) 890AN_MAKEVAR([YFLAGS], [AC_PROG_YACC]) 891AN_PROGRAM([yacc], [AC_PROG_YACC]) 892AN_PROGRAM([byacc], [AC_PROG_YACC]) 893AN_PROGRAM([bison], [AC_PROG_YACC]) 894AC_DEFUN([AC_PROG_YACC], 895[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)dnl 896AC_ARG_VAR(YACC, 897[The `Yet Another Compiler Compiler' implementation to use. Defaults to 898the first program found out of: `bison -y', `byacc', `yacc'.])dnl 899AC_ARG_VAR(YFLAGS, 900[The list of arguments that will be passed by default to $YACC. This script 901will default YFLAGS to the empty string to avoid a default value of `-d' given 902by some make applications.])]) 903