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 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([In the future, Autoconf will not detect cross-tools
215 whose name does not start with the host triplet. If you think this
216 configuration is useful to you, please write to autoconf@gnu.org.])
217 ac_tool_warned=yes ;;
220 # AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
221 # -----------------------------------------------------------------------
222 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
223 AC_DEFUN([AC_PATH_TOOL],
224 [if test -n "$ac_tool_prefix"; then
225 AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])
227 if test -z "$ac_cv_path_$1"; then
229 _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
230 if test "x$ac_pt_$1" = x; then
242 # AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
243 # ------------------------------------------------------------------------
244 # (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
245 AC_DEFUN([AC_CHECK_TOOL],
246 [if test -n "$ac_tool_prefix"; then
247 AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4])
249 if test -z "$ac_cv_prog_$1"; then
251 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
252 if test "x$ac_ct_$1" = x; then
264 # AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
266 # ------------------------------------------------------------------
267 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
268 # none can be found with a cross prefix, then use the first one that
269 # was found without the cross prefix.
270 AC_DEFUN([AC_CHECK_TOOLS],
271 [if test -n "$ac_tool_prefix"; then
275 [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],,
277 test -n "$$1" && break
280 if test -z "$$1"; then
282 AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
283 if test "x$ac_ct_$1" = x; then
293 # AC_PATH_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
294 # -----------------------------------------------------------------------
295 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
296 AC_DEFUN([AC_PATH_TARGET_TOOL],
297 [AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
298 AC_PATH_PROG([$1], [$target_alias-$2], , [$4])
299 if test -z "$ac_cv_path_$1"; then
300 if test "$build" = "$target"; then
302 _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
310 ])# AC_PATH_TARGET_TOOL
313 # AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
314 # ------------------------------------------------------------------------
315 # (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
316 AC_DEFUN([AC_CHECK_TARGET_TOOL],
317 [AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
318 AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])
319 if test -z "$ac_cv_prog_$1"; then
320 if test "$build" = "$target"; then
322 _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
330 ])# AC_CHECK_TARGET_TOOL
333 # AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
335 # ------------------------------------------------------------------
336 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
337 # none can be found with a cross prefix, then use the first one that
338 # was found without the cross prefix.
339 AC_DEFUN([AC_CHECK_TARGET_TOOLS],
340 [AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
344 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
346 test -n "$$1" && break
348 if test -z "$$1"; then
349 if test "$build" = "$target"; then
351 AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
357 ])# AC_CHECK_TARGET_TOOLS
361 ## ---------------- ##
362 ## Specific tests. ##
363 ## ---------------- ##
365 # Please, keep this section sorted.
366 # (But of course when keeping related things together).
368 # Check for gawk first since it's generally better.
369 AN_MAKEVAR([AWK], [AC_PROG_AWK])
370 AN_PROGRAM([awk], [AC_PROG_AWK])
371 AN_PROGRAM([gawk], [AC_PROG_AWK])
372 AN_PROGRAM([mawk], [AC_PROG_AWK])
373 AN_PROGRAM([nawk], [AC_PROG_AWK])
374 AC_DEFUN([AC_PROG_AWK],
375 [AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])
380 AC_DEFUN([AC_PROG_EGREP],
381 [AC_REQUIRE([AC_PROG_GREP])dnl
382 AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP,
383 [if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
384 then ac_cv_path_EGREP="$GREP -E"
386 _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
388 EGREP="$ac_cv_path_EGREP"
395 AC_DEFUN([AC_PROG_FGREP],
396 [AC_REQUIRE([AC_PROG_GREP])dnl
397 AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP,
398 [if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
399 then ac_cv_path_FGREP="$GREP -F"
401 _AC_PROG_GREP(FGREP, fgrep, [FGREP])
403 FGREP="$ac_cv_path_FGREP"
410 # Check for a fully functional grep program that handles
411 # the longest lines possible and which respects multiple -e options.
412 # Prefer GNU grep if found.
413 AC_DEFUN([AC_PROG_GREP],
414 [AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP,
415 [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])])
416 GREP="$ac_cv_path_GREP"
421 # _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS)
422 # ------------------------------------------------------
423 # Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e.
424 # AIX silently truncates long lines before matching.
425 # NeXT understands only one -e and truncates long lines.
426 m4_define([_AC_PROG_GREP],
427 [_AC_PATH_PROG_FEATURE_CHECK([$1], [$2],
428 [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1],
429 ["$ac_path_$1" $3], [$1])], [$PATH$PATH_SEPARATOR/usr/xpg4/bin])
433 # _AC_PATH_PROG_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, FEATURE-TEST, [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 # _AC_PATH_PROG_FEATURE_CHECK will report that no acceptable program
439 # was found, and abort. If a suitable $ac_path_VARIABLE is found in the
440 # FEATURE-TEST macro, it can set $ac_path_VARIABLE_found=':' to accept
441 # that value without any further checks.
442 m4_define([_AC_PATH_PROG_FEATURE_CHECK],
443 [# Extract the first word of "$2" to use in msg output
444 if test -z "$$1"; then
445 set dummy $2; ac_prog_name=$[2]
446 AC_CACHE_VAL([ac_cv_path_$1],
447 [ac_path_$1_found=false
448 # Loop through the user's path and test for each of PROGNAME-LIST
450 [for ac_prog in $2; do
451 for ac_exec_ext in '' $ac_executable_extensions; do
452 ac_path_$1="$as_dir/$ac_prog$ac_exec_ext"
453 AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
455 $ac_path_$1_found && break 3
461 if test -z "$$1"; then
462 AC_MSG_ERROR([no acceptable $ac_prog_name could be found in dnl
463 m4_default([$4], [\$PATH])])
472 # _AC_FEATURE_CHECK_LENGTH(PROGPATH, CACHE-VAR, CHECK-CMD, [MATCH-STRING])
473 # ------------------------------------------------------------------------
474 # For use as the FEATURE-TEST argument to _AC_PATH_PROG_FEATURE_TEST.
475 # On each iteration run CHECK-CMD on an input file, storing the value
476 # of PROGPATH in CACHE-VAR if the CHECK-CMD succeeds. The input file
477 # is always one line, starting with only 10 characters, and doubling
478 # in length at each iteration until approx 10000 characters or the
479 # feature check succeeds. The feature check is called at each
480 # iteration by appending (optionally, MATCH-STRING and) a newline
481 # to the file, and using the result as input to CHECK-CMD.
482 m4_define([_AC_FEATURE_CHECK_LENGTH],
483 [# Check for GNU $1 and select it if it is found.
484 _AC_PATH_PROG_FLAVOR_GNU([$$1],
485 [$2="$$1" $1_found=:],
487 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
490 cat "conftest.in" "conftest.in" >"conftest.tmp"
491 mv "conftest.tmp" "conftest.in"
492 cp "conftest.in" "conftest.nl"
493 echo '$4' >> "conftest.nl"
494 $3 < "conftest.nl" >"conftest.out" 2>/dev/null || break
495 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
496 ac_count=`expr $ac_count + 1`
497 if test $ac_count -gt ${$1_max-0}; then
498 # Best one so far, save it but keep looking for a better one
500 dnl # Using $1_max so that each tool feature checked gets its
501 dnl # own variable. Don't reset it otherwise the implied search
502 dnl # for best performing tool in a list breaks down.
505 # 10*(2^10) chars as input seems more than enough
506 test $ac_count -gt 10 && break
512 # _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
513 # ----------------------------------------------------------------
514 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
516 case `"$1" --version 2>&1` in
523 ])# _AC_PATH_PROG_FLAVOR_GNU
528 AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
529 AN_PROGRAM([install], [AC_PROG_INSTALL])
530 AC_DEFUN([AC_PROG_INSTALL],
531 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
532 AC_REQUIRE_AUX_FILE([install-sh])dnl
533 # Find a good install program. We prefer a C program (faster),
534 # so one script is as good as another. But avoid the broken or
535 # incompatible versions:
536 # SysV /etc/install, /usr/sbin/install
537 # SunOS /usr/etc/install
540 # AmigaOS /C/install, which installs bootblocks on floppy discs
541 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
542 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
543 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
544 # OS/2's system install, which has a completely different semantic
545 # ./install, which can be erroneously created by make from ./install.sh.
546 AC_MSG_CHECKING([for a BSD-compatible install])
547 if test -z "$INSTALL"; then
548 AC_CACHE_VAL(ac_cv_path_install,
549 [_AS_PATH_WALK([$PATH],
550 [# Account for people who put trailing slashes in PATH elements.
552 ./ | .// | /[cC]/* | \
553 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
554 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
557 # OSF1 and SCO ODT 3.0 have their own names for install.
558 # Don't use installbsd from OSF since it installs stuff as root
560 for ac_prog in ginstall scoinst install; do
561 for ac_exec_ext in '' $ac_executable_extensions; do
562 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then
563 if test $ac_prog = install &&
564 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
565 # AIX install. It has an incompatible calling convention.
567 elif test $ac_prog = install &&
568 grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
569 # program-specific install script used by HP pwplus--don't use.
571 elif rm -fr conftest.dir &&
572 $as_dir/$ac_prog$ac_exec_ext -c -d conftest.dir/d >/dev/null 2>&1 &&
573 rmdir conftest.dir/d conftest.dir >/dev/null 2>&1; then
574 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
584 if test "${ac_cv_path_install+set}" = set; then
585 INSTALL=$ac_cv_path_install
587 # As a last resort, use the slow shell script. Don't cache a
588 # value for INSTALL within a source directory, because that will
589 # break other packages using the cache if that directory is
590 # removed, or if the value is a relative name.
591 INSTALL=$ac_install_sh
594 dnl Do special magic for INSTALL instead of AC_SUBST, to get
595 dnl relative names right.
596 AC_MSG_RESULT([$INSTALL])
598 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
599 # It thinks the first close brace ends the variable substitution.
600 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
601 AC_SUBST(INSTALL_PROGRAM)dnl
603 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
604 AC_SUBST(INSTALL_SCRIPT)dnl
606 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
607 AC_SUBST(INSTALL_DATA)dnl
613 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
615 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
616 # created by `make install' are always world readable, even if the
617 # installer happens to have an overly restrictive umask (e.g. 077).
618 # This was a mistake. There are at least two reasons why we must not
620 # - it causes special bits like SGID to be ignored,
621 # - it may be too restrictive (some setups expect 775 directories).
623 # Do not use -m 0755 and let people choose whatever they expect by
626 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
627 # Some implementations (such as Solaris 8's) are not thread-safe: if a
628 # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
629 # concurrently, both version can detect that a/ is missing, but only
630 # one can create it and the other will error out. Consequently we
631 # restrict ourselves to GNU mkdir (using the --version option ensures
633 AC_DEFUN([AC_PROG_MKDIR_P],
634 [AC_REQUIRE([AC_PROG_INSTALL])dnl
635 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
636 # We used to define $(mkdir_p) as `mkdir -p .', in order to
637 # allow $(mkdir_p) to be used without argument. As in
638 # $(mkdir_p) $(somedir)
639 # where $(somedir) is conditionally defined. However we don't do
641 # 1. before we restricted the check to GNU mkdir, `mkdir -p .' was
642 # reported to fail in read-only directories. The system where this
643 # happened has been forgotten.
644 # 2. in practice we call $(mkdir_p) on directories such as
645 # $(mkdir_p) "$(DESTDIR)$(somedir)"
646 # and we don't want to create $(DESTDIR) if $(somedir) is empty.
647 # To support the latter case, we have to write
648 # test -z "$(somedir)" || $(mkdir_p) "$(DESTDIR)$(somedir)"
649 # so $(mkdir_p) always has an argument.
650 # We will have better chances of detecting a missing test if
651 # $(mkdir_p) complains about missing arguments.
652 # 3. $(mkdir_p) is named after `mkdir -p' and we don't expect this
653 # to accept no argument.
654 # 4. having something like `mkdir .' in the output is unsightly.
657 # On NextStep and OpenStep, the `mkdir' command does not
658 # recognize any option. It will interpret all options as
659 # directories to create.
660 for d in ./-p ./--version
662 test -d $d && rmdir $d
664 mkdir_p="$INSTALL -d"
672 # Look for flex or lex. Set its associated library to LEXLIB.
673 # Check if lex declares yytext as a char * by default, not a char[].
674 AN_MAKEVAR([LEX], [AC_PROG_LEX])
675 AN_PROGRAM([lex], [AC_PROG_LEX])
676 AN_PROGRAM([flex], [AC_PROG_LEX])
677 AC_DEFUN_ONCE([AC_PROG_LEX],
678 [AC_CHECK_PROGS(LEX, flex lex, :)
681 AC_CHECK_LIB(fl, yywrap, LEXLIB="-lfl",
682 [AC_CHECK_LIB(l, yywrap, LEXLIB="-ll")])
685 if test "x$LEX" != "x:"; then
686 _AC_PROG_LEX_YYTEXT_DECL
690 # _AC_PROG_LEX_YYTEXT_DECL
691 # ------------------------
692 # Check if lex declares yytext as a char * by default, not a char[].
693 m4_define([_AC_PROG_LEX_YYTEXT_DECL],
694 [AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
695 [# The minimal lex program is just a single line: %%. But some broken lexes
696 # (Solaris, I think it was) want two %% lines, so accommodate them.
697 cat >conftest.l <<_ACEOF
701 AC_TRY_EVAL(LEX conftest.l)
702 if test -f lex.yy.c; then
703 ac_cv_prog_lex_root=lex.yy
704 elif test -f lexyy.c; then
705 ac_cv_prog_lex_root=lexyy
707 AC_MSG_ERROR([cannot find output from $LEX; giving up])
710 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
712 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
713 [# POSIX says lex can declare yytext either as a pointer or an array; the
714 # default is implementation-dependent. Figure out which it is, since
715 # not all implementations provide the %pointer and %array declarations.
716 ac_cv_prog_lex_yytext_pointer=no
717 echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
720 AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], ac_cv_prog_lex_yytext_pointer=yes)
722 rm -f "${LEX_OUTPUT_ROOT}.c"
725 if test $ac_cv_prog_lex_yytext_pointer = yes; then
726 AC_DEFINE(YYTEXT_POINTER, 1,
727 [Define to 1 if `lex' declares `yytext' as a `char *' by default,
730 ])# _AC_PROG_LEX_YYTEXT_DECL
733 # Require AC_PROG_LEX in case some people were just calling this macro.
734 AU_DEFUN([AC_DECL_YYTEXT], [AC_PROG_LEX])
739 AN_MAKEVAR([LN], [AC_PROG_LN_S])
740 AN_PROGRAM([ln], [AC_PROG_LN_S])
741 AC_DEFUN([AC_PROG_LN_S],
742 [AC_MSG_CHECKING([whether ln -s works])
743 AC_SUBST([LN_S], [$as_ln_s])dnl
744 if test "$LN_S" = "ln -s"; then
747 AC_MSG_RESULT([no, using $LN_S])
754 # Define SET_MAKE to set ${MAKE} if Make does not do so automatically. If Make
755 # does not run the test Makefile, we assume that the Make program the user will
756 # invoke does set $(MAKE). This is typical, and emitting `MAKE=foomake' is
757 # always wrong if `foomake' is not available or does not work.
758 AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET])
759 AN_PROGRAM([make], [AC_PROG_MAKE_SET])
760 AC_DEFUN([AC_PROG_MAKE_SET],
761 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
762 set dummy ${MAKE-make}; ac_make=`echo "$[2]" | sed 'y,:./+-,___p_,'`
763 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
764 [cat >conftest.make <<\_ACEOF
767 @echo 'ac_maketemp=X"$(MAKE)"'
769 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
770 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
771 if test "$ac_maketemp" != X ; then
772 eval ac_cv_prog_make_${ac_make}_set=yes
774 eval ac_cv_prog_make_${ac_make}_set=no
776 rm -f conftest.make])dnl
777 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
782 SET_MAKE="MAKE=${MAKE-make}"
784 AC_SUBST([SET_MAKE])dnl
790 AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
791 AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
792 AC_DEFUN([AC_PROG_RANLIB],
793 [AC_CHECK_TOOL(RANLIB, ranlib, :)])
798 # I don't know what it used to do, but it no longer does.
799 AU_DEFUN([AC_RSH], [],
800 [$0 is no longer supported. Remove this warning when you
806 # Check for a fully functional sed program that truncates
807 # as few characters as possible. Prefer GNU sed if found.
808 AC_DEFUN([AC_PROG_SED],
809 [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
810 [_AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed],
811 [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
812 ["$ac_path_SED" -e 's/a$//'])])])
813 SED="$ac_cv_path_SED"
820 AN_MAKEVAR([BISON], [AC_PROG_YACC])
821 AN_MAKEVAR([YACC], [AC_PROG_YACC])
822 AN_MAKEVAR([YFLAGS], [AC_PROG_YACC])
823 AN_PROGRAM([yacc], [AC_PROG_YACC])
824 AN_PROGRAM([byacc], [AC_PROG_YACC])
825 AN_PROGRAM([bison], [AC_PROG_YACC])
826 AC_DEFUN([AC_PROG_YACC],
827 [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)dnl
829 [The `Yet Another C Compiler' implementation to use. Defaults to the first
830 program found out of: `bison -y', `byacc', `yacc'.])dnl
832 [The list of arguments that will be passed by default to $YACC. This script
833 will default YFLAGS to the empty string to avoid a default value of `-d' given
834 by some make applications.])])