1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Checking for programs.
4 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5 # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
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.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 # As a special exception, the Free Software Foundation gives unlimited
23 # permission to copy, distribute and modify the configure scripts that
24 # are the output of Autoconf. You need not follow the terms of the GNU
25 # General Public License when using or distributing such scripts, even
26 # though portions of the text of Autoconf appear in them. The GNU
27 # General Public License (GPL) does govern all other use of the material
28 # that constitutes the Autoconf program.
30 # Certain portions of the Autoconf source text are designed to be copied
31 # (in certain cases, depending on the input) into the output of
32 # Autoconf. We call these the "data" portions. The rest of the Autoconf
33 # source text consists of comments plus executable code that decides which
34 # of the data portions to output in any given case. We call these
35 # comments and executable code the "non-data" portions. Autoconf never
36 # copies any of the non-data portions into its output.
38 # This special exception to the GPL applies to versions of Autoconf
39 # released by the Free Software Foundation. When you make and
40 # distribute a modified version of Autoconf, you may extend this special
41 # exception to the GPL to apply to your modified version as well, *unless*
42 # your modified version has the potential to copy into its output some
43 # of the text that was the non-data portion of the version that you started
44 # with. (In other words, unless your change moves or copies text from
45 # the non-data portions to the data portions.) If your modification has
46 # such potential, you must delete any notice of this special exception
47 # to the GPL from your modified version.
49 # Written by David MacKenzie, with help from
50 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
51 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
54 ## ----------------------------- ##
55 ## Generic checks for programs. ##
56 ## ----------------------------- ##
59 # _AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
60 # [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
62 # -----------------------------------------------------
63 AC_DEFUN([_AC_CHECK_PROG],
64 [# Extract the first word of "$2", so it can be a program name with args.
65 set dummy $2; ac_word=$[2]
66 AC_MSG_CHECKING([for $ac_word])
67 AC_CACHE_VAL(ac_cv_prog_$1,
68 [if test -n "$$1"; then
69 ac_cv_prog_$1="$$1" # Let the user override the test.
72 [ ac_prog_rejected=no])dnl
74 [for ac_exec_ext in '' $ac_executable_extensions; do
75 if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then
77 [ if test "$as_dir/$ac_word$ac_exec_ext" = "$6"; then
82 _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext])
87 [if test $ac_prog_rejected = yes; then
88 # We found a bogon in the path, so make sure we never use it.
89 set dummy $ac_cv_prog_$1
91 if test $[@%:@] != 0; then
92 # We chose a different compiler from the bogus one.
93 # However, it has the same basename, so the bogon will be chosen
94 # first if we set $1 to just the basename; use the full file name.
96 ac_cv_prog_$1="$as_dir/$ac_word${1+' '}$[@]"
100 AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
101 m4_default([$5], [\$PATH])])
105 dnl If no 4th arg is given, leave the cache variable unset,
106 dnl so AC_CHECK_PROGS will keep looking.
108 [ test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl
111 if test -n "$$1"; then
119 # AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
120 # [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
122 # -----------------------------------------------------
123 AC_DEFUN([AC_CHECK_PROG],
129 # AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
131 # ------------------------------------------------------------------
132 AC_DEFUN([AC_CHECK_PROGS],
135 AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4])
136 test -n "$$1" && break
138 m4_ifvaln([$3], [test -n "$$1" || $1="$3"])])
141 # _AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
142 # ------------------------------------------------------------------------
143 AC_DEFUN([_AC_PATH_PROG],
144 [# Extract the first word of "$2", so it can be a program name with args.
145 set dummy $2; ac_word=$[2]
146 AC_MSG_CHECKING([for $ac_word])
147 AC_CACHE_VAL([ac_cv_path_$1],
149 [[\\/]]* | ?:[[\\/]]*)
150 ac_cv_path_$1="$$1" # Let the user override the test with a path.
154 [for ac_exec_ext in '' $ac_executable_extensions; do
155 if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then
156 ac_cv_path_$1="$as_dir/$ac_word$ac_exec_ext"
157 _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext])
161 dnl If no 3rd arg is given, leave the cache variable unset,
162 dnl so AC_PATH_PROGS will keep looking.
164 [ test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl
168 if test -n "$$1"; then
176 # AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
177 # -----------------------------------------------------------------------
178 AC_DEFUN([AC_PATH_PROG],
184 # AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
186 # -----------------------------------------------------------------
187 AC_DEFUN([AC_PATH_PROGS],
190 AC_PATH_PROG([$1], [$ac_prog], , [$4])
191 test -n "$$1" && break
193 m4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl
199 ## -------------------------- ##
200 ## Generic checks for tools. ##
201 ## -------------------------- ##
204 # AC_CHECK_TOOL_PREFIX
205 # --------------------
206 AU_DEFUN([AC_CHECK_TOOL_PREFIX])
211 AC_DEFUN([_AC_TOOL_WARN],
212 [case $cross_compiling:$ac_tool_warned in
214 AC_MSG_WARN([using cross tools not prefixed with host triplet])
215 ac_tool_warned=yes ;;
218 # AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
219 # -----------------------------------------------------------------------
220 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
221 AC_DEFUN([AC_PATH_TOOL],
222 [if test -n "$ac_tool_prefix"; then
223 AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])
225 if test -z "$ac_cv_path_$1"; then
227 _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
228 if test "x$ac_pt_$1" = x; then
240 # AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
241 # ------------------------------------------------------------------------
242 # (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
243 AC_DEFUN([AC_CHECK_TOOL],
244 [if test -n "$ac_tool_prefix"; then
245 AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4])
247 if test -z "$ac_cv_prog_$1"; then
249 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
250 if test "x$ac_ct_$1" = x; then
262 # AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
264 # ------------------------------------------------------------------
265 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
266 # none can be found with a cross prefix, then use the first one that
267 # was found without the cross prefix.
268 AC_DEFUN([AC_CHECK_TOOLS],
269 [if test -n "$ac_tool_prefix"; then
273 [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],,
275 test -n "$$1" && break
278 if test -z "$$1"; then
280 AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
281 if test "x$ac_ct_$1" = x; then
291 # AC_PATH_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
292 # ------------------------------------------------------------------------------
293 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
294 AC_DEFUN([AC_PATH_TARGET_TOOL],
295 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
296 AC_PATH_PROG([$1], [$target_alias-$2], , [$4])
297 if test -z "$ac_cv_path_$1"; then
298 if test "$build" = "$target"; then
300 _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
308 ])# AC_PATH_TARGET_TOOL
311 # AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
312 # -------------------------------------------------------------------------------
313 # (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
314 AC_DEFUN([AC_CHECK_TARGET_TOOL],
315 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
316 AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])
317 if test -z "$ac_cv_prog_$1"; then
318 if test "$build" = "$target"; then
320 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
328 ])# AC_CHECK_TARGET_TOOL
331 # AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
333 # -------------------------------------------------------------------------
334 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
335 # none can be found with a cross prefix, then use the first one that
336 # was found without the cross prefix.
337 AC_DEFUN([AC_CHECK_TARGET_TOOLS],
338 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
342 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
344 test -n "$$1" && break
346 if test -z "$$1"; then
347 if test "$build" = "$target"; then
349 AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
355 ])# AC_CHECK_TARGET_TOOLS
359 ## ---------------- ##
360 ## Specific tests. ##
361 ## ---------------- ##
363 # Please, keep this section sorted.
364 # (But of course when keeping related things together).
366 # Check for gawk first since it's generally better.
367 AN_MAKEVAR([AWK], [AC_PROG_AWK])
368 AN_PROGRAM([awk], [AC_PROG_AWK])
369 AN_PROGRAM([gawk], [AC_PROG_AWK])
370 AN_PROGRAM([mawk], [AC_PROG_AWK])
371 AN_PROGRAM([nawk], [AC_PROG_AWK])
372 AC_DEFUN([AC_PROG_AWK],
373 [AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])
378 AC_DEFUN([AC_PROG_EGREP],
379 [AC_REQUIRE([AC_PROG_GREP])dnl
380 AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP,
381 [if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
382 then ac_cv_path_EGREP="$GREP -E"
384 _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
386 EGREP="$ac_cv_path_EGREP"
393 AC_DEFUN([AC_PROG_FGREP],
394 [AC_REQUIRE([AC_PROG_GREP])dnl
395 AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP,
396 [if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
397 then ac_cv_path_FGREP="$GREP -F"
399 _AC_PROG_GREP(FGREP, fgrep, [FGREP])
401 FGREP="$ac_cv_path_FGREP"
408 # Check for a fully functional grep program that handles
409 # the longest lines possible and which respects multiple -e options.
410 # Prefer GNU grep if found.
411 AC_DEFUN([AC_PROG_GREP],
412 [AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP,
413 [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])])
414 GREP="$ac_cv_path_GREP"
419 # _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS)
420 # ------------------------------------------------------
421 # Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e.
422 # AIX silently truncates long lines before matching.
423 # NeXT understands only one -e and truncates long lines.
424 m4_define([_AC_PROG_GREP],
425 [_AC_PATH_PROGS_FEATURE_CHECK([$1], [$2],
426 [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1],
427 ["$ac_path_$1" $3], [$1])], [],
428 [$PATH$PATH_SEPARATOR/usr/xpg4/bin])dnl
432 # _AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, FEATURE-TEST,
433 # [ACTION-IF-NOT-FOUND], [PATH=$PATH])
434 # -------------------------------------------------------------------
435 # FEATURE-TEST is called repeatedly with $ac_path_VARIABLE set to the
436 # name of a program in PROGNAME-LIST found in PATH. FEATURE-TEST must set
437 # $ac_cv_path_VARIABLE to the path of an acceptable program, or else
438 # ACTION-IF-NOT-FOUND is executed; the default action (for internal use
439 # only) issues a fatal error message. If a suitable $ac_path_VARIABLE is
440 # found in the FEATURE-TEST macro, it can set $ac_path_VARIABLE_found=':'
441 # to accept that value without any further checks.
442 m4_define([_AC_PATH_PROGS_FEATURE_CHECK],
443 [if test -z "$$1"; then
444 ac_path_$1_found=false
445 # Loop through the user's path and test for each of PROGNAME-LIST
447 [for ac_prog in $2; do
448 for ac_exec_ext in '' $ac_executable_extensions; do
449 ac_path_$1="$as_dir/$ac_prog$ac_exec_ext"
450 AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
452 $ac_path_$1_found && break 3
455 if test -z "$ac_cv_path_$1"; then
457 [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl
458 found in m4_default([$5], [\$PATH])])])
466 # AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST,
467 # FEATURE-TEST, [ACTION-IF-NOT-FOUND=:],
469 # ----------------------------------------------------------------
470 # Designed to be used inside AC_CACHE_VAL. It is recommended,
471 # but not required, that the user also use AC_ARG_VAR([VARIABLE]).
472 # If VARIABLE is not empty, set the cache variable
473 # $ac_cv_path_VARIABLE to VARIABLE without any further tests.
474 # Otherwise, call FEATURE_TEST repeatedly with $ac_path_VARIABLE
475 # set to the name of a program in PROGNAME-LIST found in PATH. If
476 # no invocation of FEATURE-TEST sets $ac_cv_path_VARIABLE to the
477 # path of an acceptable program, ACTION-IF-NOT-FOUND is executed.
478 # FEATURE-TEST is invoked even when $ac_cv_path_VARIABLE is set,
479 # in case a better candidate occurs later in PATH; to accept the
480 # current setting and bypass further checks, FEATURE-TEST can set
481 # $ac_path_VARIABLE_found=':'. Note that, unlike AC_CHECK_PROGS,
482 # this macro does not have any side effect on the current value
484 m4_define([AC_PATH_PROGS_FEATURE_CHECK],
485 [_$0([$1], [$2], [$3], m4_default([$4], [:]), [$5])dnl
489 # _AC_FEATURE_CHECK_LENGTH(PROGPATH, CACHE-VAR, CHECK-CMD, [MATCH-STRING])
490 # ------------------------------------------------------------------------
491 # For use as the FEATURE-TEST argument to _AC_PATH_PROGS_FEATURE_TEST.
492 # On each iteration run CHECK-CMD on an input file, storing the value
493 # of PROGPATH in CACHE-VAR if the CHECK-CMD succeeds. The input file
494 # is always one line, starting with only 10 characters, and doubling
495 # in length at each iteration until approx 10000 characters or the
496 # feature check succeeds. The feature check is called at each
497 # iteration by appending (optionally, MATCH-STRING and) a newline
498 # to the file, and using the result as input to CHECK-CMD.
499 m4_define([_AC_FEATURE_CHECK_LENGTH],
500 [# Check for GNU $1 and select it if it is found.
501 _AC_PATH_PROG_FLAVOR_GNU([$$1],
502 [$2="$$1" $1_found=:],
504 AS_ECHO_N([0123456789]) >"conftest.in"
507 cat "conftest.in" "conftest.in" >"conftest.tmp"
508 mv "conftest.tmp" "conftest.in"
509 cp "conftest.in" "conftest.nl"
510 AS_ECHO(['$4']) >> "conftest.nl"
511 $3 < "conftest.nl" >"conftest.out" 2>/dev/null || break
512 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
513 ac_count=`expr $ac_count + 1`
514 if test $ac_count -gt ${$1_max-0}; then
515 # Best one so far, save it but keep looking for a better one
517 dnl # Using $1_max so that each tool feature checked gets its
518 dnl # own variable. Don't reset it otherwise the implied search
519 dnl # for best performing tool in a list breaks down.
522 # 10*(2^10) chars as input seems more than enough
523 test $ac_count -gt 10 && break
525 rm -f conftest.in conftest.tmp conftest.nl conftest.out])dnl
529 # _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
530 # ----------------------------------------------------------------
531 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
533 case `"$1" --version 2>&1` in
540 ])# _AC_PATH_PROG_FLAVOR_GNU
545 AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
546 AN_PROGRAM([install], [AC_PROG_INSTALL])
547 AC_DEFUN([AC_PROG_INSTALL],
548 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
549 AC_REQUIRE_AUX_FILE([install-sh])dnl
550 # Find a good install program. We prefer a C program (faster),
551 # so one script is as good as another. But avoid the broken or
552 # incompatible versions:
553 # SysV /etc/install, /usr/sbin/install
554 # SunOS /usr/etc/install
557 # AmigaOS /C/install, which installs bootblocks on floppy discs
558 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
559 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
560 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
561 # OS/2's system install, which has a completely different semantic
562 # ./install, which can be erroneously created by make from ./install.sh.
563 # Reject install programs that cannot install multiple files.
564 AC_MSG_CHECKING([for a BSD-compatible install])
565 if test -z "$INSTALL"; then
566 AC_CACHE_VAL(ac_cv_path_install,
567 [_AS_PATH_WALK([$PATH],
568 [# Account for people who put trailing slashes in PATH elements.
570 ./ | .// | /[cC]/* | \
571 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
572 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
575 # OSF1 and SCO ODT 3.0 have their own names for install.
576 # Don't use installbsd from OSF since it installs stuff as root
578 for ac_prog in ginstall scoinst install; do
579 for ac_exec_ext in '' $ac_executable_extensions; do
580 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then
581 if test $ac_prog = install &&
582 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
583 # AIX install. It has an incompatible calling convention.
585 elif test $ac_prog = install &&
586 grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
587 # program-specific install script used by HP pwplus--don't use.
590 rm -rf conftest.one conftest.two conftest.dir
591 echo one > conftest.one
592 echo two > conftest.two
594 if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
595 test -s conftest.one && test -s conftest.two &&
596 test -s conftest.dir/conftest.one &&
597 test -s conftest.dir/conftest.two
599 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
609 rm -rf conftest.one conftest.two conftest.dir
611 if test "${ac_cv_path_install+set}" = set; then
612 INSTALL=$ac_cv_path_install
614 # As a last resort, use the slow shell script. Don't cache a
615 # value for INSTALL within a source directory, because that will
616 # break other packages using the cache if that directory is
617 # removed, or if the value is a relative name.
618 INSTALL=$ac_install_sh
621 dnl Do special magic for INSTALL instead of AC_SUBST, to get
622 dnl relative names right.
623 AC_MSG_RESULT([$INSTALL])
625 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
626 # It thinks the first close brace ends the variable substitution.
627 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
628 AC_SUBST(INSTALL_PROGRAM)dnl
630 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
631 AC_SUBST(INSTALL_SCRIPT)dnl
633 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
634 AC_SUBST(INSTALL_DATA)dnl
640 # Check whether `mkdir -p' is known to be thread-safe, and fall back to
641 # install-sh -d otherwise.
643 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
644 # created by `make install' are always world readable, even if the
645 # installer happens to have an overly restrictive umask (e.g. 077).
646 # This was a mistake. There are at least two reasons why we must not
648 # - it causes special bits like SGID to be ignored,
649 # - it may be too restrictive (some setups expect 775 directories).
651 # Do not use -m 0755 and let people choose whatever they expect by
654 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
655 # Some implementations (such as Solaris 8's) are vulnerable to race conditions:
656 # if a parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
657 # concurrently, both version can detect that a/ is missing, but only
658 # one can create it and the other will error out. Consequently we
659 # restrict ourselves to known race-free implementations.
661 # Automake used to define mkdir_p as `mkdir -p .', in order to
662 # allow $(mkdir_p) to be used without argument. As in
663 # $(mkdir_p) $(somedir)
664 # where $(somedir) is conditionally defined. However we don't do
666 # 1. before we restricted the check to GNU mkdir, `mkdir -p .' was
667 # reported to fail in read-only directories. The system where this
668 # happened has been forgotten.
669 # 2. in practice we call $(MKDIR_P) on directories such as
670 # $(MKDIR_P) "$(DESTDIR)$(somedir)"
671 # and we don't want to create $(DESTDIR) if $(somedir) is empty.
672 # To support the latter case, we have to write
673 # test -z "$(somedir)" || $(MKDIR_P) "$(DESTDIR)$(somedir)"
674 # so $(MKDIR_P) always has an argument.
675 # We will have better chances of detecting a missing test if
676 # $(MKDIR_P) complains about missing arguments.
677 # 3. $(MKDIR_P) is named after `mkdir -p' and we don't expect this
678 # to accept no argument.
679 # 4. having something like `mkdir .' in the output is unsightly.
681 # On NextStep and OpenStep, the `mkdir' command does not
682 # recognize any option. It will interpret all options as
683 # directories to create.
684 AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
685 AC_DEFUN([AC_PROG_MKDIR_P],
686 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
687 AC_REQUIRE_AUX_FILE([install-sh])dnl
688 AC_MSG_CHECKING([for a thread-safe mkdir -p])
689 if test -z "$MKDIR_P"; then
690 AC_CACHE_VAL([ac_cv_path_mkdir],
691 [_AS_PATH_WALK([$PATH$PATH_SEPARATOR/opt/sfw/bin],
692 [for ac_prog in mkdir gmkdir; do
693 for ac_exec_ext in '' $ac_executable_extensions; do
694 AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]) || continue
695 case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
696 'mkdir (GNU coreutils) '* | \
697 'mkdir (coreutils) '* | \
698 'mkdir (fileutils) '4.1*)
699 ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
704 if test "${ac_cv_path_mkdir+set}" = set; then
705 MKDIR_P="$ac_cv_path_mkdir -p"
707 # As a last resort, use the slow shell script. Don't cache a
708 # value for MKDIR_P within a source directory, because that will
709 # break other packages using the cache if that directory is
710 # removed, or if the value is a relative name.
711 test -d ./--version && rmdir ./--version
712 MKDIR_P="$ac_install_sh -d"
715 dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST,
716 dnl to get relative names right. However, also AC_SUBST here so
717 dnl that Automake versions before 1.10 will pick it up (they do not
718 dnl trace AC_SUBST_TRACE).
719 dnl FIXME: Remove this once we drop support for Automake < 1.10.
720 AC_SUBST([MKDIR_P])dnl
721 AC_MSG_RESULT([$MKDIR_P])
727 # Look for flex or lex. Set its associated library to LEXLIB.
728 # Check if lex declares yytext as a char * by default, not a char[].
729 AN_MAKEVAR([LEX], [AC_PROG_LEX])
730 AN_PROGRAM([lex], [AC_PROG_LEX])
731 AN_PROGRAM([flex], [AC_PROG_LEX])
732 AC_DEFUN_ONCE([AC_PROG_LEX],
733 [AC_CHECK_PROGS(LEX, flex lex, :)
734 if test "x$LEX" != "x:"; then
735 _AC_PROG_LEX_YYTEXT_DECL
739 # _AC_PROG_LEX_YYTEXT_DECL
740 # ------------------------
741 # Check for the Lex output root, the Lex library, and whether Lex
742 # declares yytext as a char * by default.
743 m4_define([_AC_PROG_LEX_YYTEXT_DECL],
744 [cat >conftest.l <<_ACEOF[
750 e { yyless (input () != 0); }
751 f { unput (yytext[0]); }
754 #ifdef YYTEXT_POINTER
760 return ! yylex () + ! yywrap ();
763 _AC_DO_VAR(LEX conftest.l)
764 AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
765 if test -f lex.yy.c; then
766 ac_cv_prog_lex_root=lex.yy
767 elif test -f lexyy.c; then
768 ac_cv_prog_lex_root=lexyy
770 AC_MSG_ERROR([cannot find output from $LEX; giving up])
772 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
774 if test -z "${LEXLIB+set}"; then
775 AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
777 ac_cv_lib_lex='none needed'
778 for ac_lib in '' -lfl -ll; do
779 LIBS="$ac_lib $ac_save_LIBS"
780 AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], [ac_cv_lib_lex=$ac_lib])
781 test "$ac_cv_lib_lex" != 'none needed' && break
785 test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
789 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
790 [# POSIX says lex can declare yytext either as a pointer or an array; the
791 # default is implementation-dependent. Figure out which it is, since
792 # not all implementations provide the %pointer and %array declarations.
793 ac_cv_prog_lex_yytext_pointer=no
795 LIBS="$LEXLIB $ac_save_LIBS"
797 [#define YYTEXT_POINTER 1
798 `cat $LEX_OUTPUT_ROOT.c`],
799 [ac_cv_prog_lex_yytext_pointer=yes])
803 if test $ac_cv_prog_lex_yytext_pointer = yes; then
804 AC_DEFINE(YYTEXT_POINTER, 1,
805 [Define to 1 if `lex' declares `yytext' as a `char *' by default,
808 rm -f conftest.l $LEX_OUTPUT_ROOT.c
809 ])# _AC_PROG_LEX_YYTEXT_DECL
812 # Require AC_PROG_LEX in case some people were just calling this macro.
813 AU_DEFUN([AC_DECL_YYTEXT], [AC_PROG_LEX])
818 AN_MAKEVAR([LN], [AC_PROG_LN_S])
819 AN_PROGRAM([ln], [AC_PROG_LN_S])
820 AC_DEFUN([AC_PROG_LN_S],
821 [AC_MSG_CHECKING([whether ln -s works])
822 AC_SUBST([LN_S], [$as_ln_s])dnl
823 if test "$LN_S" = "ln -s"; then
826 AC_MSG_RESULT([no, using $LN_S])
833 # Define SET_MAKE to set ${MAKE} if Make does not do so automatically. If Make
834 # does not run the test Makefile, we assume that the Make program the user will
835 # invoke does set $(MAKE). This is typical, and emitting `MAKE=foomake' is
836 # always wrong if `foomake' is not available or does not work.
837 AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET])
838 AN_PROGRAM([make], [AC_PROG_MAKE_SET])
839 AC_DEFUN([AC_PROG_MAKE_SET],
840 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
842 ac_make=`AS_ECHO(["$[2]"]) | sed 's/+/p/g; s/[[^a-zA-Z0-9_]]/_/g'`
843 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
844 [cat >conftest.make <<\_ACEOF
847 @echo '@@@%%%=$(MAKE)=@@@%%%'
849 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
850 case `${MAKE-make} -f conftest.make 2>/dev/null` in
852 eval ac_cv_prog_make_${ac_make}_set=yes;;
854 eval ac_cv_prog_make_${ac_make}_set=no;;
856 rm -f conftest.make])dnl
857 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
862 SET_MAKE="MAKE=${MAKE-make}"
864 AC_SUBST([SET_MAKE])dnl
870 AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
871 AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
872 AC_DEFUN([AC_PROG_RANLIB],
873 [AC_CHECK_TOOL(RANLIB, ranlib, :)])
878 # I don't know what it used to do, but it no longer does.
879 AU_DEFUN([AC_RSH], [],
880 [$0 is no longer supported. Remove this warning when you
886 # Check for a fully functional sed program that truncates
887 # as few characters as possible. Prefer GNU sed if found.
888 AC_DEFUN([AC_PROG_SED],
889 [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
890 [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
891 dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed.
892 ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
893 for ac_i in 1 2 3 4 5 6 7; do
894 ac_script="$ac_script$as_nl$ac_script"
896 echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
897 $as_unset ac_script || ac_script=
898 _AC_PATH_PROGS_FEATURE_CHECK(SED, [sed gsed],
899 [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
900 ["$ac_path_SED" -f conftest.sed])])])
901 SED="$ac_cv_path_SED"
909 AN_MAKEVAR([BISON], [AC_PROG_YACC])
910 AN_MAKEVAR([YACC], [AC_PROG_YACC])
911 AN_MAKEVAR([YFLAGS], [AC_PROG_YACC])
912 AN_PROGRAM([yacc], [AC_PROG_YACC])
913 AN_PROGRAM([byacc], [AC_PROG_YACC])
914 AN_PROGRAM([bison], [AC_PROG_YACC])
915 AC_DEFUN([AC_PROG_YACC],
916 [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)dnl
918 [The `Yet Another C Compiler' implementation to use. Defaults to the first
919 program found out of: `bison -y', `byacc', `yacc'.])dnl
921 [The list of arguments that will be passed by default to $YACC. This script
922 will default YFLAGS to the empty string to avoid a default value of `-d' given
923 by some make applications.])])