1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Checking for programs.
4 # Copyright (C) 1992-1996, 1998-2013 Free Software Foundation, Inc.
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.
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 # 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.
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/>.
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.
31 ## ----------------------------- ##
32 ## Generic checks for programs. ##
33 ## ----------------------------- ##
36 # _AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
37 # [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
39 # -----------------------------------------------------
40 AC_DEFUN([_AC_CHECK_PROG],
41 [# Extract the first word of "$2", so it can be a program name with args.
42 set dummy $2; ac_word=$[2]
43 AC_MSG_CHECKING([for $ac_word])
44 AC_CACHE_VAL(ac_cv_prog_$1,
45 [if test -n "$$1"; then
46 ac_cv_prog_$1="$$1" # Let the user override the test.
49 [ ac_prog_rejected=no])dnl
51 [for ac_exec_ext in '' $ac_executable_extensions; do
52 if AS_EXECUTABLE_P(["$as_dir$ac_word$ac_exec_ext"]); then
54 [ if test "$as_dir$ac_word$ac_exec_ext" = "$6"; then
59 _AS_ECHO_LOG([found $as_dir$ac_word$ac_exec_ext])
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
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.
73 ac_cv_prog_$1="$as_dir$ac_word${1+' '}$[@]"
77 AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
78 m4_default([$5], [\$PATH])])
82 dnl If no 4th arg is given, leave the cache variable unset,
83 dnl so AC_CHECK_PROGS will keep looking.
85 [ test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl
88 if test -n "$$1"; then
96 # AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
97 # [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
99 # -----------------------------------------------------
100 AC_DEFUN([AC_CHECK_PROG],
106 # AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
108 # ------------------------------------------------------------------
109 AC_DEFUN([AC_CHECK_PROGS],
112 AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4])
113 test -n "$$1" && break
115 m4_ifvaln([$3], [test -n "$$1" || $1="$3"])])
118 # _AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
119 # ------------------------------------------------------------------------
120 AC_DEFUN([_AC_PATH_PROG],
121 [# Extract the first word of "$2", so it can be a program name with args.
122 set dummy $2; ac_word=$[2]
123 AC_MSG_CHECKING([for $ac_word])
124 AC_CACHE_VAL([ac_cv_path_$1],
126 [[\\/]]* | ?:[[\\/]]*)
127 ac_cv_path_$1="$$1" # Let the user override the test with a path.
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])
138 dnl If no 3rd arg is given, leave the cache variable unset,
139 dnl so AC_PATH_PROGS will keep looking.
141 [ test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl
145 if test -n "$$1"; then
153 # AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
154 # -----------------------------------------------------------------------
155 AC_DEFUN([AC_PATH_PROG],
161 # AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
163 # -----------------------------------------------------------------
164 AC_DEFUN([AC_PATH_PROGS],
167 AC_PATH_PROG([$1], [$ac_prog], , [$4])
168 test -n "$$1" && break
170 m4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl
176 ## -------------------------- ##
177 ## Generic checks for tools. ##
178 ## -------------------------- ##
181 # AC_CHECK_TOOL_PREFIX
182 # --------------------
183 AU_DEFUN([AC_CHECK_TOOL_PREFIX])
188 AC_DEFUN([_AC_TOOL_WARN],
189 [case $cross_compiling:$ac_tool_warned in
191 AC_MSG_WARN([using cross tools not prefixed with host triplet])
192 ac_tool_warned=yes ;;
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.)
198 AC_DEFUN([AC_PATH_TOOL],
199 [if test -n "$ac_tool_prefix"; then
200 AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])
202 if test -z "$ac_cv_path_$1"; then
204 _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
205 if test "x$ac_pt_$1" = x; then
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.)
220 AC_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])
224 if test -z "$ac_cv_prog_$1"; then
226 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
227 if test "x$ac_ct_$1" = x; then
239 # AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
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.
245 AC_DEFUN([AC_CHECK_TOOLS],
246 [if test -n "$ac_tool_prefix"; then
250 [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],,
252 test -n "$$1" && break
255 if test -z "$$1"; then
257 AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
258 if test "x$ac_ct_$1" = x; then
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.)
271 AC_DEFUN([AC_PATH_TARGET_TOOL],
272 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
273 AC_PATH_PROG([$1], [$target_alias-$2], , [$4])
274 if test -z "$ac_cv_path_$1"; then
275 if test "$build" = "$target"; then
277 _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
285 ])# AC_PATH_TARGET_TOOL
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.)
291 AC_DEFUN([AC_CHECK_TARGET_TOOL],
292 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
293 AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])
294 if test -z "$ac_cv_prog_$1"; then
295 if test "$build" = "$target"; then
297 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
305 ])# AC_CHECK_TARGET_TOOL
308 # AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
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.
314 AC_DEFUN([AC_CHECK_TARGET_TOOLS],
315 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
319 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
321 test -n "$$1" && break
323 if test -z "$$1"; then
324 if test "$build" = "$target"; then
326 AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
332 ])# AC_CHECK_TARGET_TOOLS
336 ## ---------------- ##
337 ## Specific tests. ##
338 ## ---------------- ##
340 # Please, keep this section sorted.
341 # (But of course when keeping related things together).
343 # Check for gawk first since it's generally better.
344 AN_MAKEVAR([AWK], [AC_PROG_AWK])
345 AN_PROGRAM([awk], [AC_PROG_AWK])
346 AN_PROGRAM([gawk], [AC_PROG_AWK])
347 AN_PROGRAM([mawk], [AC_PROG_AWK])
348 AN_PROGRAM([nawk], [AC_PROG_AWK])
349 AC_DEFUN([AC_PROG_AWK],
350 [AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])
355 AC_DEFUN([AC_PROG_EGREP],
356 [AC_REQUIRE([AC_PROG_GREP])dnl
357 AC_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"
361 _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
363 EGREP="$ac_cv_path_EGREP"
370 AC_DEFUN([AC_PROG_FGREP],
371 [AC_REQUIRE([AC_PROG_GREP])dnl
372 AC_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"
376 _AC_PROG_GREP(FGREP, fgrep, [FGREP])
378 FGREP="$ac_cv_path_FGREP"
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.
388 AC_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"
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.
401 m4_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
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.
419 m4_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
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
429 $ac_path_$1_found && break 3
432 if test -z "$ac_cv_path_$1"; then
434 [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl
435 found in m4_default([$5], [\$PATH])])])
443 # AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST,
444 # FEATURE-TEST, [ACTION-IF-NOT-FOUND=:],
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
461 m4_define([AC_PATH_PROGS_FEATURE_CHECK],
462 [_$0([$1], [$2], [$3], m4_default([$4], [:]), [$5])dnl
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.
476 m4_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=:],
481 AS_ECHO_N([0123456789]) >"conftest.in"
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
494 dnl # Using $1_max so that each tool feature checked gets its
495 dnl # own variable. Don't reset it otherwise the implied search
496 dnl # for best performing tool in a list breaks down.
499 # 10*(2^10) chars as input seems more than enough
500 test $ac_count -gt 10 && break
502 rm -f conftest.in conftest.tmp conftest.nl conftest.out])dnl
506 # _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
507 # ----------------------------------------------------------------
508 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
510 case `"$1" --version 2>&1` in
517 ])# _AC_PATH_PROG_FLAVOR_GNU
522 AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
523 AN_PROGRAM([install], [AC_PROG_INSTALL])
524 AC_DEFUN_ONCE([AC_PROG_INSTALL],
525 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
526 AC_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
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.
541 AC_MSG_CHECKING([for a BSD-compatible install])
542 if test -z "$INSTALL"; then
543 AC_CACHE_VAL(ac_cv_path_install,
544 [_AS_PATH_WALK([$PATH],
545 [[# Account for fact that we put trailing slashes in our PATH walk.
546 case $as_dir in @%:@((
548 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
549 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
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
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.
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.
567 rm -rf conftest.one conftest.two conftest.dir
568 echo one > conftest.one
569 echo two > conftest.two
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
576 ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c"
586 rm -rf conftest.one conftest.two conftest.dir
588 if test "${ac_cv_path_install+set}" = set; then
589 INSTALL=$ac_cv_path_install
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
598 dnl Do special magic for INSTALL instead of AC_SUBST, to get
599 dnl relative names right.
600 AC_MSG_RESULT([$INSTALL])
602 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
603 # It thinks the first close brace ends the variable substitution.
604 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
605 AC_SUBST(INSTALL_PROGRAM)dnl
607 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
608 AC_SUBST(INSTALL_SCRIPT)dnl
610 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
611 AC_SUBST(INSTALL_DATA)dnl
617 # Check whether `mkdir -p' is known to be thread-safe, and fall back to
618 # install-sh -d otherwise.
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
625 # - it causes special bits like SGID to be ignored,
626 # - it may be too restrictive (some setups expect 775 directories).
628 # Do not use -m 0755 and let people choose whatever they expect by
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.
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
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.
658 # On NextStep and OpenStep, the `mkdir' command does not
659 # recognize any option. It will interpret all options as
660 # directories to create.
661 AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
662 AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
663 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
664 AC_REQUIRE_AUX_FILE([install-sh])dnl
665 AC_MSG_CHECKING([for a thread-safe mkdir -p])
666 if 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
681 test -d ./--version && rmdir ./--version
682 if test "${ac_cv_path_mkdir+set}" = set; then
683 MKDIR_P="$ac_cv_path_mkdir -p"
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"
692 dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST,
693 dnl to get relative names right. However, also AC_SUBST here so
694 dnl that Automake versions before 1.10 will pick it up (they do not
695 dnl trace AC_SUBST_TRACE).
696 dnl FIXME: Remove this once we drop support for Automake < 1.10.
697 AC_SUBST([MKDIR_P])dnl
698 AC_MSG_RESULT([$MKDIR_P])
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[].
706 AN_MAKEVAR([LEX], [AC_PROG_LEX])
707 AN_PROGRAM([lex], [AC_PROG_LEX])
708 AN_PROGRAM([flex], [AC_PROG_LEX])
709 AC_DEFUN_ONCE([AC_PROG_LEX],
710 [AC_CHECK_PROGS(LEX, flex lex, :)
711 if test "x$LEX" != "x:"; then
712 _AC_PROG_LEX_YYTEXT_DECL
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.
720 m4_define([_AC_PROG_LEX_YYTEXT_DECL],
721 [cat >conftest.l <<_ACEOF[
727 e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */
728 yyless ((input () != 0)); }
729 f { unput (yytext[0]); }
732 #ifdef YYTEXT_POINTER
738 return ! yylex () + ! yywrap ();
741 _AC_DO_VAR(LEX conftest.l)
742 AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
743 if test -f lex.yy.c; then
744 ac_cv_prog_lex_root=lex.yy
745 elif test -f lexyy.c; then
746 ac_cv_prog_lex_root=lexyy
748 AC_MSG_ERROR([cannot find output from $LEX; giving up])
750 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
752 if test -z "${LEXLIB+set}"; then
753 AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
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
764 test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
768 AC_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.
772 ac_cv_prog_lex_yytext_pointer=no
774 LIBS="$LEXLIB $ac_save_LIBS"
775 AC_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])
782 if 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,
787 rm -f conftest.l $LEX_OUTPUT_ROOT.c
788 ])# _AC_PROG_LEX_YYTEXT_DECL
791 # Require AC_PROG_LEX in case some people were just calling this macro.
792 AU_DEFUN([AC_DECL_YYTEXT], [AC_PROG_LEX])
797 AN_MAKEVAR([LN], [AC_PROG_LN_S])
798 AN_PROGRAM([ln], [AC_PROG_LN_S])
799 AC_DEFUN([AC_PROG_LN_S],
800 [AC_MSG_CHECKING([whether ln -s works])
801 AC_SUBST([LN_S], [$as_ln_s])dnl
802 if test "$LN_S" = "ln -s"; then
805 AC_MSG_RESULT([no, using $LN_S])
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.
816 AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET])
817 AN_PROGRAM([make], [AC_PROG_MAKE_SET])
818 AC_DEFUN([AC_PROG_MAKE_SET],
819 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
821 ac_make=`AS_ECHO(["$[2]"]) | sed 's/+/p/g; s/[[^a-zA-Z0-9_]]/_/g'`
822 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
823 [cat >conftest.make <<\_ACEOF
826 @echo '@@@%%%=$(MAKE)=@@@%%%'
828 # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
829 case `${MAKE-make} -f conftest.make 2>/dev/null` in
831 eval ac_cv_prog_make_${ac_make}_set=yes;;
833 eval ac_cv_prog_make_${ac_make}_set=no;;
835 rm -f conftest.make])dnl
836 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
841 SET_MAKE="MAKE=${MAKE-make}"
843 AC_SUBST([SET_MAKE])dnl
849 AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
850 AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
851 AC_DEFUN([AC_PROG_RANLIB],
852 [AC_CHECK_TOOL(RANLIB, ranlib, :)])
857 # I don't know what it used to do, but it no longer does.
858 AU_DEFUN([AC_RSH], [],
859 [$0 is no longer supported. Remove this warning when you
865 # Check for a fully functional sed program that truncates
866 # as few characters as possible. Prefer GNU sed if found.
867 AC_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"
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"
888 AN_MAKEVAR([BISON], [AC_PROG_YACC])
889 AN_MAKEVAR([YACC], [AC_PROG_YACC])
890 AN_MAKEVAR([YFLAGS], [AC_PROG_YACC])
891 AN_PROGRAM([yacc], [AC_PROG_YACC])
892 AN_PROGRAM([byacc], [AC_PROG_YACC])
893 AN_PROGRAM([bison], [AC_PROG_YACC])
894 AC_DEFUN([AC_PROG_YACC],
895 [AC_CHECK_PROGS(YACC, 'bison -o y.tab.c' byacc, yacc)dnl
897 [The `Yet Another Compiler Compiler' implementation to use. Defaults to
898 the first program found out of: `bison -o y.tab.c', `byacc', `yacc'.])dnl
900 [The list of arguments that will be passed by default to $YACC. This script
901 will default YFLAGS to the empty string to avoid a default value of `-d' given
902 by some make applications.])])