Update autoconf to version 2.61
[msysgit.git] / share / autoconf / autoconf / programs.m4
blob60540e4a1eeed3e5f6834f8874d60a9bcee2f07e
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)
10 # 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 # 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
20 # 02110-1301, USA.
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],
61 #               [PATH], [REJECT])
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.
70 else
71 m4_ifvaln([$6],
72 [  ac_prog_rejected=no])dnl
73 _AS_PATH_WALK([$5],
74 [for ac_exec_ext in '' $ac_executable_extensions; do
75   if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then
76 m4_ifvaln([$6],
77 [    if test "$as_dir/$ac_word$ac_exec_ext" = "$6"; then
78        ac_prog_rejected=yes
79        continue
80      fi])dnl
81     ac_cv_prog_$1="$3"
82     _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext])
83     break 2
84   fi
85 done])
86 m4_ifvaln([$6],
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
90   shift
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.
95     shift
96     ac_cv_prog_$1="$as_dir/$ac_word${1+' '}$[@]"
97 m4_if([$2], [$4],
98 [  else
99     # Default is a loser.
100     AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
101 m4_default([$5], [\$PATH])])
102 ])dnl
103   fi
104 fi])dnl
105 dnl If no 4th arg is given, leave the cache variable unset,
106 dnl so AC_CHECK_PROGS will keep looking.
107 m4_ifvaln([$4],
108 [  test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl
109 fi])dnl
110 $1=$ac_cv_prog_$1
111 if test -n "$$1"; then
112   AC_MSG_RESULT([$$1])
113 else
114   AC_MSG_RESULT([no])
116 ])# _AC_CHECK_PROG
119 # AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
120 #               [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
121 #               [PATH], [REJECT])
122 # -----------------------------------------------------
123 AC_DEFUN([AC_CHECK_PROG],
124 [_AC_CHECK_PROG($@)
125 AC_SUBST([$1])dnl
129 # AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
130 #                [PATH])
131 # ------------------------------------------------------------------
132 AC_DEFUN([AC_CHECK_PROGS],
133 [for ac_prog in $2
135   AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4])
136   test -n "$$1" && break
137 done
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],
148 [case $$1 in
149   [[\\/]]* | ?:[[\\/]]*)
150   ac_cv_path_$1="$$1" # Let the user override the test with a path.
151   ;;
152   *)
153   _AS_PATH_WALK([$4],
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])
158     break 2
159   fi
160 done])
161 dnl If no 3rd arg is given, leave the cache variable unset,
162 dnl so AC_PATH_PROGS will keep looking.
163 m4_ifvaln([$3],
164 [  test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl
165   ;;
166 esac])dnl
167 $1=$ac_cv_path_$1
168 if test -n "$$1"; then
169   AC_MSG_RESULT([$$1])
170 else
171   AC_MSG_RESULT([no])
173 ])# _AC_PATH_PROG
176 # AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
177 # -----------------------------------------------------------------------
178 AC_DEFUN([AC_PATH_PROG],
179 [_AC_PATH_PROG($@)
180 AC_SUBST([$1])dnl
184 # AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
185 #               [PATH])
186 # -----------------------------------------------------------------
187 AC_DEFUN([AC_PATH_PROGS],
188 [for ac_prog in $2
190   AC_PATH_PROG([$1], [$ac_prog], , [$4])
191   test -n "$$1" && break
192 done
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])
209 # _AC_TOOL_WARN
210 # -------------
211 AC_DEFUN([_AC_TOOL_WARN],
212 [case $cross_compiling:$ac_tool_warned in
213 yes:)
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 ;;
218 esac])
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
228   ac_pt_$1=$$1
229   _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
230   if test "x$ac_pt_$1" = x; then
231     $1="$3"
232   else
233     _AC_TOOL_WARN
234     $1=$ac_pt_$1
235   fi
236 else
237   $1="$ac_cv_path_$1"
239 ])# AC_PATH_TOOL
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
250   ac_ct_$1=$$1
251   _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
252   if test "x$ac_ct_$1" = x; then
253     $1="$3"
254   else
255     _AC_TOOL_WARN
256     $1=$ac_ct_$1
257   fi
258 else
259   $1="$ac_cv_prog_$1"
261 ])# AC_CHECK_TOOL
264 # AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
265 #                [PATH])
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
272   for ac_prog in $2
273   do
274     AC_CHECK_PROG([$1],
275                   [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],,
276                   [$4])
277     test -n "$$1" && break
278   done
280 if test -z "$$1"; then
281   ac_ct_$1=$$1
282   AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
283   if test "x$ac_ct_$1" = x; then
284     $1="$3"
285   else
286     _AC_TOOL_WARN
287     $1=$ac_ct_$1
288   fi
290 ])# AC_CHECK_TOOLS
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
301     ac_pt_$1=$$1
302     _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
303     $1=$ac_pt_$1
304   else
305     $1="$3"
306   fi
307 else
308   $1="$ac_cv_path_$1"
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
321     ac_ct_$1=$$1
322     _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
323     $1=ac_ct_$1
324   else
325     $1="$3"
326   fi
327 else
328   $1="$ac_cv_prog_$1"
330 ])# AC_CHECK_TARGET_TOOL
333 # AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
334 #                       [PATH])
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
341 for ac_prog in $2
343   AC_CHECK_PROG([$1],
344                 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
345                 [$4])
346   test -n "$$1" && break
347 done
348 if test -z "$$1"; then
349   if test "$build" = "$target"; then
350     ac_ct_$1=$$1
351     AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
352     $1=$ac_ct_$1
353   else
354     $1="$3"
355   fi
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, )])
378 # AC_PROG_EGREP
379 # -------------
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"
385    else
386      _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
387    fi])
388  EGREP="$ac_cv_path_EGREP"
389  AC_SUBST([EGREP])
390 ])# AC_PROG_EGREP
393 # AC_PROG_FGREP
394 # -------------
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"
400    else
401      _AC_PROG_GREP(FGREP, fgrep, [FGREP])
402    fi])
403  FGREP="$ac_cv_path_FGREP"
404  AC_SUBST([FGREP])
405 ])# AC_PROG_FGREP
408 # AC_PROG_GREP
409 # ------------
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"
417  AC_SUBST([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
449 _AS_PATH_WALK([$4],
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
454     $3
455     $ac_path_$1_found && break 3
456   done
457 done
460 $1="$ac_cv_path_$1"
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])])
465 AC_SUBST([$1])
466 else
467   ac_cv_path_$1=$$1
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=:],
486   [ac_count=0
487   echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
488   while :
489   do
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
499       $2="$$1"
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.
503       $1_max=$ac_count
504     fi
505     # 10*(2^10) chars as input seems more than enough
506     test $ac_count -gt 10 && break
507   done
508   rm -f conftest.in conftest.tmp conftest.nl conftest.out])
512 # _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
513 # ----------------------------------------------------------------
514 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
515 [# Check for GNU $1
516 case `"$1" --version 2>&1` in
517 *GNU*)
518   $2;;
519 m4_ifval([$3],
521   $3;;
522 ])esac
523 ])# _AC_PATH_PROG_FLAVOR_GNU
526 # AC_PROG_INSTALL
527 # ---------------
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
538 # IRIX /sbin/install
539 # AIX /bin/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.
551 case $as_dir/ in
552   ./ | .// | /[cC]/* | \
553   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
554   ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
555   /usr/ucb/* ) ;;
556   *)
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
559     # by default.
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.
566             :
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.
570             :
571           else
572             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
573             break 3
574           fi
575         fi
576       done
577     done
578     ;;
579 esac])
580 ])dnl
581   if test "${ac_cv_path_install+set}" = set; then
582     INSTALL=$ac_cv_path_install
583   else
584     # As a last resort, use the slow shell script.  Don't cache a
585     # value for INSTALL within a source directory, because that will
586     # break other packages using the cache if that directory is
587     # removed, or if the value is a relative name.
588     INSTALL=$ac_install_sh
589   fi
591 dnl Do special magic for INSTALL instead of AC_SUBST, to get
592 dnl relative names right.
593 AC_MSG_RESULT([$INSTALL])
595 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
596 # It thinks the first close brace ends the variable substitution.
597 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
598 AC_SUBST(INSTALL_PROGRAM)dnl
600 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
601 AC_SUBST(INSTALL_SCRIPT)dnl
603 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
604 AC_SUBST(INSTALL_DATA)dnl
605 ])# AC_PROG_INSTALL
608 # AC_PROG_MKDIR_P
609 # ---------------
610 # Check whether `mkdir -p' is known to be thread-safe, and fall back to
611 # install-sh -d otherwise.
613 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
614 # created by `make install' are always world readable, even if the
615 # installer happens to have an overly restrictive umask (e.g. 077).
616 # This was a mistake.  There are at least two reasons why we must not
617 # use `-m 0755':
618 #   - it causes special bits like SGID to be ignored,
619 #   - it may be too restrictive (some setups expect 775 directories).
621 # Do not use -m 0755 and let people choose whatever they expect by
622 # setting umask.
624 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
625 # Some implementations (such as Solaris 8's) are vulnerable to race conditions:
626 # if a parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
627 # concurrently, both version can detect that a/ is missing, but only
628 # one can create it and the other will error out.  Consequently we
629 # restrict ourselves to known race-free implementations.
631 # Automake used to define mkdir_p as `mkdir -p .', in order to
632 # allow $(mkdir_p) to be used without argument.  As in
633 #   $(mkdir_p) $(somedir)
634 # where $(somedir) is conditionally defined.  However we don't do
635 # that for MKDIR_P.
636 #  1. before we restricted the check to GNU mkdir, `mkdir -p .' was
637 #     reported to fail in read-only directories.  The system where this
638 #     happened has been forgotten.
639 #  2. in practice we call $(MKDIR_P) on directories such as
640 #       $(MKDIR_P) "$(DESTDIR)$(somedir)"
641 #     and we don't want to create $(DESTDIR) if $(somedir) is empty.
642 #     To support the latter case, we have to write
643 #       test -z "$(somedir)" || $(MKDIR_P) "$(DESTDIR)$(somedir)"
644 #     so $(MKDIR_P) always has an argument.
645 #     We will have better chances of detecting a missing test if
646 #     $(MKDIR_P) complains about missing arguments.
647 #  3. $(MKDIR_P) is named after `mkdir -p' and we don't expect this
648 #     to accept no argument.
649 #  4. having something like `mkdir .' in the output is unsightly.
651 # On NextStep and OpenStep, the `mkdir' command does not
652 # recognize any option.  It will interpret all options as
653 # directories to create.
654 AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
655 AC_DEFUN([AC_PROG_MKDIR_P],
656 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
657 AC_REQUIRE_AUX_FILE([install-sh])dnl
658 AC_MSG_CHECKING([for a thread-safe mkdir -p])
659 if test -z "$MKDIR_P"; then
660   AC_CACHE_VAL([ac_cv_path_mkdir],
661     [_AS_PATH_WALK([$PATH$PATH_SEPARATOR/opt/sfw/bin],
662       [for ac_prog in mkdir gmkdir; do
663          for ac_exec_ext in '' $ac_executable_extensions; do
664            AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]) || continue
665            case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
666              'mkdir (GNU coreutils) '* | \
667              'mkdir (coreutils) '* | \
668              'mkdir (fileutils) '4.1*)
669                ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
670                break 3;;
671            esac
672          done
673        done])])
674   if test "${ac_cv_path_mkdir+set}" = set; then
675     MKDIR_P="$ac_cv_path_mkdir -p"
676   else
677     # As a last resort, use the slow shell script.  Don't cache a
678     # value for MKDIR_P within a source directory, because that will
679     # break other packages using the cache if that directory is
680     # removed, or if the value is a relative name.
681     test -d ./--version && rmdir ./--version
682     MKDIR_P="$ac_install_sh -d"
683   fi
685 dnl Do special magic for MKDIR_P instead of AC_SUBST, to get
686 dnl relative names right.
687 AC_MSG_RESULT([$MKDIR_P])
688 ])# AC_PROG_MKDIR_P
691 # AC_PROG_LEX
692 # -----------
693 # Look for flex or lex.  Set its associated library to LEXLIB.
694 # Check if lex declares yytext as a char * by default, not a char[].
695 AN_MAKEVAR([LEX],  [AC_PROG_LEX])
696 AN_PROGRAM([lex],  [AC_PROG_LEX])
697 AN_PROGRAM([flex], [AC_PROG_LEX])
698 AC_DEFUN_ONCE([AC_PROG_LEX],
699 [AC_CHECK_PROGS(LEX, flex lex, :)
700 if test "x$LEX" != "x:"; then
701   _AC_PROG_LEX_YYTEXT_DECL
702 fi])
705 # _AC_PROG_LEX_YYTEXT_DECL
706 # ------------------------
707 # Check for the Lex output root, the Lex library, and whether Lex
708 # declares yytext as a char * by default.
709 m4_define([_AC_PROG_LEX_YYTEXT_DECL],
710 [cat >conftest.l <<_ACEOF[
712 a { ECHO; }
713 b { REJECT; }
714 c { yymore (); }
715 d { yyless (1); }
716 e { yyless (input () != 0); }
717 f { unput (yytext[0]); }
718 . { BEGIN INITIAL; }
720 #ifdef YYTEXT_POINTER
721 extern char *yytext;
722 #endif
724 main (void)
726   return ! yylex () + ! yywrap ();
728 ]_ACEOF
729 _AC_DO_VAR(LEX conftest.l)
730 AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
731 if test -f lex.yy.c; then
732   ac_cv_prog_lex_root=lex.yy
733 elif test -f lexyy.c; then
734   ac_cv_prog_lex_root=lexyy
735 else
736   AC_MSG_ERROR([cannot find output from $LEX; giving up])
737 fi])
738 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
740 if test -z "${LEXLIB+set}"; then
741   AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
742     ac_save_LIBS=$LIBS
743     ac_cv_lib_lex='none needed'
744     for ac_lib in '' -lfl -ll; do
745       LIBS="$ac_lib $ac_save_LIBS"
746       AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], [ac_cv_lib_lex=$ac_lib])
747       test "$ac_cv_lib_lex" != 'none needed' && break
748     done
749     LIBS=$ac_save_LIBS
750   ])
751   test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
753 AC_SUBST(LEXLIB)
755 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
756 [# POSIX says lex can declare yytext either as a pointer or an array; the
757 # default is implementation-dependent.  Figure out which it is, since
758 # not all implementations provide the %pointer and %array declarations.
759 ac_cv_prog_lex_yytext_pointer=no
760 ac_save_LIBS=$LIBS
761 LIBS="$LEXLIB $ac_save_LIBS"
762 AC_LINK_IFELSE(
763   [#define YYTEXT_POINTER 1
764 `cat $LEX_OUTPUT_ROOT.c`],
765   [ac_cv_prog_lex_yytext_pointer=yes])
766 LIBS=$ac_save_LIBS
769 if test $ac_cv_prog_lex_yytext_pointer = yes; then
770   AC_DEFINE(YYTEXT_POINTER, 1,
771             [Define to 1 if `lex' declares `yytext' as a `char *' by default,
772              not a `char[]'.])
774 rm -f conftest.l $LEX_OUTPUT_ROOT.c
775 ])# _AC_PROG_LEX_YYTEXT_DECL
778 # Require AC_PROG_LEX in case some people were just calling this macro.
779 AU_DEFUN([AC_DECL_YYTEXT],  [AC_PROG_LEX])
782 # AC_PROG_LN_S
783 # ------------
784 AN_MAKEVAR([LN], [AC_PROG_LN_S])
785 AN_PROGRAM([ln], [AC_PROG_LN_S])
786 AC_DEFUN([AC_PROG_LN_S],
787 [AC_MSG_CHECKING([whether ln -s works])
788 AC_SUBST([LN_S], [$as_ln_s])dnl
789 if test "$LN_S" = "ln -s"; then
790   AC_MSG_RESULT([yes])
791 else
792   AC_MSG_RESULT([no, using $LN_S])
794 ])# AC_PROG_LN_S
797 # AC_PROG_MAKE_SET
798 # ----------------
799 # Define SET_MAKE to set ${MAKE} if Make does not do so automatically.  If Make
800 # does not run the test Makefile, we assume that the Make program the user will
801 # invoke does set $(MAKE).  This is typical, and emitting `MAKE=foomake' is
802 # always wrong if `foomake' is not available or does not work.
803 AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET])
804 AN_PROGRAM([make], [AC_PROG_MAKE_SET])
805 AC_DEFUN([AC_PROG_MAKE_SET],
806 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
807 set x ${MAKE-make}; ac_make=`echo "$[2]" | sed 's/+/p/g; s/[[^a-zA-Z0-9_]]/_/g'`
808 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
809 [cat >conftest.make <<\_ACEOF
810 SHELL = /bin/sh
811 all:
812         @echo '@@@%%%=$(MAKE)=@@@%%%'
813 _ACEOF
814 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
815 case `${MAKE-make} -f conftest.make 2>/dev/null` in
816   *@@@%%%=?*=@@@%%%*)
817     eval ac_cv_prog_make_${ac_make}_set=yes;;
818   *)
819     eval ac_cv_prog_make_${ac_make}_set=no;;
820 esac
821 rm -f conftest.make])dnl
822 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
823   AC_MSG_RESULT([yes])
824   SET_MAKE=
825 else
826   AC_MSG_RESULT([no])
827   SET_MAKE="MAKE=${MAKE-make}"
829 AC_SUBST([SET_MAKE])dnl
830 ])# AC_PROG_MAKE_SET
833 # AC_PROG_RANLIB
834 # --------------
835 AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
836 AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
837 AC_DEFUN([AC_PROG_RANLIB],
838 [AC_CHECK_TOOL(RANLIB, ranlib, :)])
841 # AC_RSH
842 # ------
843 # I don't know what it used to do, but it no longer does.
844 AU_DEFUN([AC_RSH], [],
845 [$0 is no longer supported.  Remove this warning when you
846 adjust the code.])
849 # AC_PROG_SED
850 # -----------
851 # Check for a fully functional sed program that truncates
852 # as few characters as possible.  Prefer GNU sed if found.
853 AC_DEFUN([AC_PROG_SED],
854 [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
855     [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
856      dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed.
857      ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
858      for ac_i in 1 2 3 4 5 6 7; do
859        ac_script="$ac_script$as_nl$ac_script"
860      done
861      echo "$ac_script" | sed 99q >conftest.sed
862      $as_unset ac_script || ac_script=
863      _AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed],
864         [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
865                 ["$ac_path_SED" -f conftest.sed])])])
866  SED="$ac_cv_path_SED"
867  AC_SUBST([SED])dnl
868  rm -f conftest.sed
869 ])# AC_PROG_SED
872 # AC_PROG_YACC
873 # ------------
874 AN_MAKEVAR([BISON],  [AC_PROG_YACC])
875 AN_MAKEVAR([YACC],  [AC_PROG_YACC])
876 AN_MAKEVAR([YFLAGS],  [AC_PROG_YACC])
877 AN_PROGRAM([yacc],  [AC_PROG_YACC])
878 AN_PROGRAM([byacc], [AC_PROG_YACC])
879 AN_PROGRAM([bison], [AC_PROG_YACC])
880 AC_DEFUN([AC_PROG_YACC],
881 [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)dnl
882 AC_ARG_VAR(YACC,
883 [The `Yet Another C Compiler' implementation to use.  Defaults to the first
884 program found out of: `bison -y', `byacc', `yacc'.])dnl
885 AC_ARG_VAR(YFLAGS,
886 [The list of arguments that will be passed by default to $YACC.  This script
887 will default YFLAGS to the empty string to avoid a default value of `-d' given
888 by some make applications.])])