Prefer HTTPS to FTP and HTTP
[autoconf.git] / lib / autoconf / programs.m4
blob4d1b34e2afb7034824e050d5f2f61823656abf24
1 # This file is part of Autoconf.                       -*- Autoconf -*-
2 # Checking for programs.
4 # Copyright (C) 1992-1996, 1998-2017 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 <https://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],
38 #               [PATH], [REJECT])
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.
47 else
48 m4_ifvaln([$6],
49 [  ac_prog_rejected=no])dnl
50 _AS_PATH_WALK([$5],
51 [for ac_exec_ext in '' $ac_executable_extensions; do
52   if AS_EXECUTABLE_P(["$as_dir$ac_word$ac_exec_ext"]); then
53 m4_ifvaln([$6],
54 [    if test "$as_dir$ac_word$ac_exec_ext" = "$6"; then
55        ac_prog_rejected=yes
56        continue
57      fi])dnl
58     ac_cv_prog_$1="$3"
59     _AS_ECHO_LOG([found $as_dir$ac_word$ac_exec_ext])
60     break 2
61   fi
62 done])
63 m4_ifvaln([$6],
64 [if test $ac_prog_rejected = yes; then
65   # We found a bogon in the path, so make sure we never use it.
66   set dummy $ac_cv_prog_$1
67   shift
68   if test $[@%:@] != 0; then
69     # We chose a different compiler from the bogus one.
70     # However, it has the same basename, so the bogon will be chosen
71     # first if we set $1 to just the basename; use the full file name.
72     shift
73     ac_cv_prog_$1="$as_dir$ac_word${1+' '}$[@]"
74 m4_if([$2], [$4],
75 [  else
76     # Default is a loser.
77     AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
78 m4_default([$5], [\$PATH])])
79 ])dnl
80   fi
81 fi])dnl
82 dnl If no 4th arg is given, leave the cache variable unset,
83 dnl so AC_CHECK_PROGS will keep looking.
84 m4_ifvaln([$4],
85 [  test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl
86 fi])dnl
87 $1=$ac_cv_prog_$1
88 if test -n "$$1"; then
89   AC_MSG_RESULT([$$1])
90 else
91   AC_MSG_RESULT([no])
93 ])# _AC_CHECK_PROG
96 # AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
97 #               [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
98 #               [PATH], [REJECT])
99 # -----------------------------------------------------
100 AC_DEFUN([AC_CHECK_PROG],
101 [_AC_CHECK_PROG($@)
102 AC_SUBST([$1])dnl
106 # AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
107 #                [PATH])
108 # ------------------------------------------------------------------
109 AC_DEFUN([AC_CHECK_PROGS],
110 [for ac_prog in $2
112   AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4])
113   test -n "$$1" && break
114 done
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],
125 [case $$1 in
126   [[\\/]]* | ?:[[\\/]]*)
127   ac_cv_path_$1="$$1" # Let the user override the test with a path.
128   ;;
129   *)
130   _AS_PATH_WALK([$4],
131 [for ac_exec_ext in '' $ac_executable_extensions; do
132   if AS_EXECUTABLE_P(["$as_dir$ac_word$ac_exec_ext"]); then
133     ac_cv_path_$1="$as_dir$ac_word$ac_exec_ext"
134     _AS_ECHO_LOG([found $as_dir$ac_word$ac_exec_ext])
135     break 2
136   fi
137 done])
138 dnl If no 3rd arg is given, leave the cache variable unset,
139 dnl so AC_PATH_PROGS will keep looking.
140 m4_ifvaln([$3],
141 [  test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl
142   ;;
143 esac])dnl
144 $1=$ac_cv_path_$1
145 if test -n "$$1"; then
146   AC_MSG_RESULT([$$1])
147 else
148   AC_MSG_RESULT([no])
150 ])# _AC_PATH_PROG
153 # AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
154 # -----------------------------------------------------------------------
155 AC_DEFUN([AC_PATH_PROG],
156 [_AC_PATH_PROG($@)
157 AC_SUBST([$1])dnl
161 # AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
162 #               [PATH])
163 # -----------------------------------------------------------------
164 AC_DEFUN([AC_PATH_PROGS],
165 [for ac_prog in $2
167   AC_PATH_PROG([$1], [$ac_prog], , [$4])
168   test -n "$$1" && break
169 done
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])
186 # _AC_TOOL_WARN
187 # -------------
188 AC_DEFUN([_AC_TOOL_WARN],
189 [case $cross_compiling:$ac_tool_warned in
190 yes:)
191 AC_MSG_WARN([using cross tools not prefixed with host triplet])
192 ac_tool_warned=yes ;;
193 esac])
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
203   ac_pt_$1=$$1
204   _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
205   if test "x$ac_pt_$1" = x; then
206     $1="$3"
207   else
208     _AC_TOOL_WARN
209     $1=$ac_pt_$1
210   fi
211 else
212   $1="$ac_cv_path_$1"
214 ])# AC_PATH_TOOL
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
225   ac_ct_$1=$$1
226   _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
227   if test "x$ac_ct_$1" = x; then
228     $1="$3"
229   else
230     _AC_TOOL_WARN
231     $1=$ac_ct_$1
232   fi
233 else
234   $1="$ac_cv_prog_$1"
236 ])# AC_CHECK_TOOL
239 # AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
240 #                [PATH])
241 # ------------------------------------------------------------------
242 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
243 # none can be found with a cross prefix, then use the first one that
244 # was found without the cross prefix.
245 AC_DEFUN([AC_CHECK_TOOLS],
246 [if test -n "$ac_tool_prefix"; then
247   for ac_prog in $2
248   do
249     AC_CHECK_PROG([$1],
250                   [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],,
251                   [$4])
252     test -n "$$1" && break
253   done
255 if test -z "$$1"; then
256   ac_ct_$1=$$1
257   AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
258   if test "x$ac_ct_$1" = x; then
259     $1="$3"
260   else
261     _AC_TOOL_WARN
262     $1=$ac_ct_$1
263   fi
265 ])# AC_CHECK_TOOLS
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
276     ac_pt_$1=$$1
277     _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
278     $1=$ac_pt_$1
279   else
280     $1="$3"
281   fi
282 else
283   $1="$ac_cv_path_$1"
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
296     ac_ct_$1=$$1
297     _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
298     $1=$ac_ct_$1
299   else
300     $1="$3"
301   fi
302 else
303   $1="$ac_cv_prog_$1"
305 ])# AC_CHECK_TARGET_TOOL
308 # AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
309 #                       [PATH])
310 # -------------------------------------------------------------------------
311 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
312 # none can be found with a cross prefix, then use the first one that
313 # was found without the cross prefix.
314 AC_DEFUN([AC_CHECK_TARGET_TOOLS],
315 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
316 for ac_prog in $2
318   AC_CHECK_PROG([$1],
319                 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
320                 [$4])
321   test -n "$$1" && break
322 done
323 if test -z "$$1"; then
324   if test "$build" = "$target"; then
325     ac_ct_$1=$$1
326     AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
327     $1=$ac_ct_$1
328   else
329     $1="$3"
330   fi
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, )])
353 # AC_PROG_EGREP
354 # -------------
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"
360    else
361      _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
362    fi])
363  EGREP="$ac_cv_path_EGREP"
364  AC_SUBST([EGREP])
365 ])# AC_PROG_EGREP
368 # AC_PROG_FGREP
369 # -------------
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"
375    else
376      _AC_PROG_GREP(FGREP, fgrep, [FGREP])
377    fi])
378  FGREP="$ac_cv_path_FGREP"
379  AC_SUBST([FGREP])
380 ])# AC_PROG_FGREP
383 # AC_PROG_GREP
384 # ------------
385 # Check for a fully functional grep program that handles
386 # the longest lines possible and which respects multiple -e options.
387 # Prefer GNU grep if found.
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"
392  AC_SUBST([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
423   _AS_PATH_WALK([$5],
424   [for ac_prog in $2
425    do
426     for ac_exec_ext in '' $ac_executable_extensions; do
427       ac_path_$1="$as_dir$ac_prog$ac_exec_ext"
428       AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
430       $ac_path_$1_found && break 3
431     done
432   done])dnl
433   if test -z "$ac_cv_path_$1"; then
434     m4_default([$4],
435       [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl
436 found in m4_default([$5], [\$PATH])])])
437   fi
438 else
439   ac_cv_path_$1=$$1
444 # AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST,
445 #                             FEATURE-TEST, [ACTION-IF-NOT-FOUND=:],
446 #                             [PATH=$PATH])
447 # ------------------------------------------------------------------
448 # Designed to be used inside AC_CACHE_VAL.  It is recommended,
449 # but not required, that the user also use AC_ARG_VAR([VARIABLE]).
450 # If VARIABLE is not empty, set the cache variable
451 # $ac_cv_path_VARIABLE to VARIABLE without any further tests.
452 # Otherwise, call FEATURE_TEST repeatedly with $ac_path_VARIABLE
453 # set to the name of a program in PROGNAME-LIST found in PATH.  If
454 # no invocation of FEATURE-TEST sets $ac_cv_path_VARIABLE to the
455 # path of an acceptable program, ACTION-IF-NOT-FOUND is executed.
456 # FEATURE-TEST is invoked even when $ac_cv_path_VARIABLE is set,
457 # in case a better candidate occurs later in PATH; to accept the
458 # current setting and bypass further checks, FEATURE-TEST can set
459 # $ac_path_VARIABLE_found=':'.  Note that, unlike AC_CHECK_PROGS,
460 # this macro does not have any side effect on the current value
461 # of VARIABLE.
462 m4_define([AC_PATH_PROGS_FEATURE_CHECK],
463 [_$0([$1], [$2], [$3], m4_default([$4], [:]), [$5])dnl
467 # _AC_FEATURE_CHECK_LENGTH(PROGPATH, CACHE-VAR, CHECK-CMD, [MATCH-STRING])
468 # ------------------------------------------------------------------------
469 # For use as the FEATURE-TEST argument to _AC_PATH_PROGS_FEATURE_TEST.
470 # On each iteration run CHECK-CMD on an input file, storing the value
471 # of PROGPATH in CACHE-VAR if the CHECK-CMD succeeds.  The input file
472 # is always one line, starting with only 10 characters, and doubling
473 # in length at each iteration until approx 10000 characters or the
474 # feature check succeeds.  The feature check is called at each
475 # iteration by appending (optionally, MATCH-STRING and) a newline
476 # to the file, and using the result as input to CHECK-CMD.
477 m4_define([_AC_FEATURE_CHECK_LENGTH],
478 [# Check for GNU $1 and select it if it is found.
479   _AC_PATH_PROG_FLAVOR_GNU([$$1],
480     [$2="$$1" $1_found=:],
481   [ac_count=0
482   AS_ECHO_N([0123456789]) >"conftest.in"
483   while :
484   do
485     cat "conftest.in" "conftest.in" >"conftest.tmp"
486     mv "conftest.tmp" "conftest.in"
487     cp "conftest.in" "conftest.nl"
488     AS_ECHO(['$4']) >> "conftest.nl"
489     $3 < "conftest.nl" >"conftest.out" 2>/dev/null || break
490     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
491     AS_VAR_ARITH([ac_count], [$ac_count + 1])
492     if test $ac_count -gt ${$1_max-0}; then
493       # Best one so far, save it but keep looking for a better one
494       $2="$$1"
495 dnl   # Using $1_max so that each tool feature checked gets its
496 dnl   # own variable.  Don't reset it otherwise the implied search
497 dnl   # for best performing tool in a list breaks down.
498       $1_max=$ac_count
499     fi
500     # 10*(2^10) chars as input seems more than enough
501     test $ac_count -gt 10 && break
502   done
503   rm -f conftest.in conftest.tmp conftest.nl conftest.out])dnl
507 # _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
508 # ----------------------------------------------------------------
509 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
510 [# Check for GNU $1
511 case `"$1" --version 2>&1` in
512 *GNU*)
513   $2;;
514 m4_ifval([$3],
516   $3;;
517 ])esac
518 ])# _AC_PATH_PROG_FLAVOR_GNU
521 # AC_PROG_INSTALL
522 # ---------------
523 AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
524 AN_PROGRAM([install], [AC_PROG_INSTALL])
525 AC_DEFUN_ONCE([AC_PROG_INSTALL],
526 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
527 AC_REQUIRE_AUX_FILE([install-sh])dnl
528 # Find a good install program.  We prefer a C program (faster),
529 # so one script is as good as another.  But avoid the broken or
530 # incompatible versions:
531 # SysV /etc/install, /usr/sbin/install
532 # SunOS /usr/etc/install
533 # IRIX /sbin/install
534 # AIX /bin/install
535 # AmigaOS /C/install, which installs bootblocks on floppy discs
536 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
537 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
538 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
539 # OS/2's system install, which has a completely different semantic
540 # ./install, which can be erroneously created by make from ./install.sh.
541 # Reject install programs that cannot install multiple files.
542 AC_MSG_CHECKING([for a BSD-compatible install])
543 if test -z "$INSTALL"; then
544 AC_CACHE_VAL(ac_cv_path_install,
545 [_AS_PATH_WALK([$PATH],
546 [[# Account for fact that we put trailing slashes in our PATH walk.
547 case $as_dir in @%:@((
548   ./ | /[cC]/* | \
549   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
550   ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
551   /usr/ucb/* ) ;;
552   *)]
553     # OSF1 and SCO ODT 3.0 have their own names for install.
554     # Don't use installbsd from OSF since it installs stuff as root
555     # by default.
556     for ac_prog in ginstall scoinst install; do
557       for ac_exec_ext in '' $ac_executable_extensions; do
558         if AS_EXECUTABLE_P(["$as_dir$ac_prog$ac_exec_ext"]); then
559           if test $ac_prog = install &&
560             grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
561             # AIX install.  It has an incompatible calling convention.
562             :
563           elif test $ac_prog = install &&
564             grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
565             # program-specific install script used by HP pwplus--don't use.
566             :
567           else
568             rm -rf conftest.one conftest.two conftest.dir
569             echo one > conftest.one
570             echo two > conftest.two
571             mkdir conftest.dir
572             if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
573               test -s conftest.one && test -s conftest.two &&
574               test -s conftest.dir/conftest.one &&
575               test -s conftest.dir/conftest.two
576             then
577               ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c"
578               break 3
579             fi
580           fi
581         fi
582       done
583     done
584     ;;
585 esac
587 rm -rf conftest.one conftest.two conftest.dir
588 ])dnl
589   if test ${ac_cv_path_install+y}; then
590     INSTALL=$ac_cv_path_install
591   else
592     # As a last resort, use the slow shell script.  Don't cache a
593     # value for INSTALL within a source directory, because that will
594     # break other packages using the cache if that directory is
595     # removed, or if the value is a relative name.
596     INSTALL=$ac_install_sh
597   fi
599 dnl Do special magic for INSTALL instead of AC_SUBST, to get
600 dnl relative names right.
601 AC_MSG_RESULT([$INSTALL])
603 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
604 # It thinks the first close brace ends the variable substitution.
605 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
606 AC_SUBST(INSTALL_PROGRAM)dnl
608 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
609 AC_SUBST(INSTALL_SCRIPT)dnl
611 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
612 AC_SUBST(INSTALL_DATA)dnl
613 ])# AC_PROG_INSTALL
616 # AC_PROG_MKDIR_P
617 # ---------------
618 # Check whether `mkdir -p' is known to be thread-safe, and fall back to
619 # install-sh -d otherwise.
621 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
622 # created by `make install' are always world readable, even if the
623 # installer happens to have an overly restrictive umask (e.g. 077).
624 # This was a mistake.  There are at least two reasons why we must not
625 # use `-m 0755':
626 #   - it causes special bits like SGID to be ignored,
627 #   - it may be too restrictive (some setups expect 775 directories).
629 # Do not use -m 0755 and let people choose whatever they expect by
630 # setting umask.
632 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
633 # Some implementations (such as Solaris 8's) are vulnerable to race conditions:
634 # if a parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
635 # concurrently, both version can detect that a/ is missing, but only
636 # one can create it and the other will error out.  Consequently we
637 # restrict ourselves to known race-free implementations.
639 # Automake used to define mkdir_p as `mkdir -p .', in order to
640 # allow $(mkdir_p) to be used without argument.  As in
641 #   $(mkdir_p) $(somedir)
642 # where $(somedir) is conditionally defined.  However we don't do
643 # that for MKDIR_P.
644 #  1. before we restricted the check to GNU mkdir, `mkdir -p .' was
645 #     reported to fail in read-only directories.  The system where this
646 #     happened has been forgotten.
647 #  2. in practice we call $(MKDIR_P) on directories such as
648 #       $(MKDIR_P) "$(DESTDIR)$(somedir)"
649 #     and we don't want to create $(DESTDIR) if $(somedir) is empty.
650 #     To support the latter case, we have to write
651 #       test -z "$(somedir)" || $(MKDIR_P) "$(DESTDIR)$(somedir)"
652 #     so $(MKDIR_P) always has an argument.
653 #     We will have better chances of detecting a missing test if
654 #     $(MKDIR_P) complains about missing arguments.
655 #  3. $(MKDIR_P) is named after `mkdir -p' and we don't expect this
656 #     to accept no argument.
657 #  4. having something like `mkdir .' in the output is unsightly.
659 # On NextStep and OpenStep, the `mkdir' command does not
660 # recognize any option.  It will interpret all options as
661 # directories to create.
662 AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
663 AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
664 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
665 AC_REQUIRE_AUX_FILE([install-sh])dnl
666 AC_MSG_CHECKING([for a thread-safe mkdir -p])
667 if test -z "$MKDIR_P"; then
668   AC_CACHE_VAL([ac_cv_path_mkdir],
669     [_AS_PATH_WALK([$PATH$PATH_SEPARATOR/opt/sfw/bin],
670       [for ac_prog in mkdir gmkdir; do
671          for ac_exec_ext in '' $ac_executable_extensions; do
672            AS_EXECUTABLE_P(["$as_dir$ac_prog$ac_exec_ext"]) || continue
673            case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #(
674              'mkdir ('*'coreutils) '* | \
675              'BusyBox '* | \
676              'mkdir (fileutils) '4.1*)
677                ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext
678                break 3;;
679            esac
680          done
681        done])])
682   test -d ./--version && rmdir ./--version
683   if test ${ac_cv_path_mkdir+y}; then
684     MKDIR_P="$ac_cv_path_mkdir -p"
685   else
686     # As a last resort, use the slow shell script.  Don't cache a
687     # value for MKDIR_P within a source directory, because that will
688     # break other packages using the cache if that directory is
689     # removed, or if the value is a relative name.
690     MKDIR_P="$ac_install_sh -d"
691   fi
693 dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST,
694 dnl to get relative names right.  However, also AC_SUBST here so
695 dnl that Automake versions before 1.10 will pick it up (they do not
696 dnl trace AC_SUBST_TRACE).
697 dnl FIXME: Remove this once we drop support for Automake < 1.10.
698 AC_SUBST([MKDIR_P])dnl
699 AC_MSG_RESULT([$MKDIR_P])
700 ])# AC_PROG_MKDIR_P
703 # AC_PROG_LEX
704 # -----------
705 # Look for flex or lex.  Set its associated library to LEXLIB.
706 # Check if lex declares yytext as a char * by default, not a char[].
707 AN_MAKEVAR([LEX],  [AC_PROG_LEX])
708 AN_PROGRAM([lex],  [AC_PROG_LEX])
709 AN_PROGRAM([flex], [AC_PROG_LEX])
710 AC_DEFUN_ONCE([AC_PROG_LEX],
711 [AC_CHECK_PROGS(LEX, flex lex, :)
712 if test "x$LEX" != "x:"; then
713   _AC_PROG_LEX_YYTEXT_DECL
714 fi])
717 # _AC_PROG_LEX_YYTEXT_DECL
718 # ------------------------
719 # Check for the Lex output root, the Lex library, and whether Lex
720 # declares yytext as a char * by default.
721 m4_define([_AC_PROG_LEX_YYTEXT_DECL],
722 [cat >conftest.l <<_ACEOF[
724 a { ECHO; }
725 b { REJECT; }
726 c { yymore (); }
727 d { yyless (1); }
728 e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument.  */
729     yyless ((input () != 0)); }
730 f { unput (yytext[0]); }
731 . { BEGIN INITIAL; }
733 #ifdef YYTEXT_POINTER
734 extern char *yytext;
735 #endif
737 main (void)
739   return ! yylex () + ! yywrap ();
741 ]_ACEOF
742 _AC_DO_VAR(LEX conftest.l)
743 AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
744 if test -f lex.yy.c; then
745   ac_cv_prog_lex_root=lex.yy
746 elif test -f lexyy.c; then
747   ac_cv_prog_lex_root=lexyy
748 else
749   AC_MSG_ERROR([cannot find output from $LEX; giving up])
750 fi])
751 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
753 if ${LEXLIB+false} :; then
754   AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
755     ac_save_LIBS=$LIBS
756     ac_cv_lib_lex='none needed'
757     for ac_lib in '' -lfl -ll; do
758       LIBS="$ac_lib $ac_save_LIBS"
759       AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]],
760         [ac_cv_lib_lex=$ac_lib])
761       test "$ac_cv_lib_lex" != 'none needed' && break
762     done
763     LIBS=$ac_save_LIBS
764   ])
765   test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
767 AC_SUBST(LEXLIB)
769 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
770 [# POSIX says lex can declare yytext either as a pointer or an array; the
771 # default is implementation-dependent.  Figure out which it is, since
772 # not all implementations provide the %pointer and %array declarations.
773 ac_cv_prog_lex_yytext_pointer=no
774 ac_save_LIBS=$LIBS
775 LIBS="$LEXLIB $ac_save_LIBS"
776 AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED
777   [#define YYTEXT_POINTER 1
778 `cat $LEX_OUTPUT_ROOT.c`]],
779   [ac_cv_prog_lex_yytext_pointer=yes])
780 LIBS=$ac_save_LIBS
783 if test $ac_cv_prog_lex_yytext_pointer = yes; then
784   AC_DEFINE(YYTEXT_POINTER, 1,
785             [Define to 1 if `lex' declares `yytext' as a `char *' by default,
786              not a `char[]'.])
788 rm -f conftest.l $LEX_OUTPUT_ROOT.c
789 ])# _AC_PROG_LEX_YYTEXT_DECL
792 # Require AC_PROG_LEX in case some people were just calling this macro.
793 AU_DEFUN([AC_DECL_YYTEXT],  [AC_PROG_LEX])
796 # AC_PROG_LN_S
797 # ------------
798 AN_MAKEVAR([LN], [AC_PROG_LN_S])
799 AN_PROGRAM([ln], [AC_PROG_LN_S])
800 AC_DEFUN([AC_PROG_LN_S],
801 [AC_MSG_CHECKING([whether ln -s works])
802 AC_SUBST([LN_S], [$as_ln_s])dnl
803 if test "$LN_S" = "ln -s"; then
804   AC_MSG_RESULT([yes])
805 else
806   AC_MSG_RESULT([no, using $LN_S])
808 ])# AC_PROG_LN_S
811 # AC_PROG_MAKE_SET
812 # ----------------
813 # Define SET_MAKE to set ${MAKE} if Make does not do so automatically.  If Make
814 # does not run the test Makefile, we assume that the Make program the user will
815 # invoke does set $(MAKE).  This is typical, and emitting `MAKE=foomake' is
816 # always wrong if `foomake' is not available or does not work.
817 AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET])
818 AN_PROGRAM([make], [AC_PROG_MAKE_SET])
819 AC_DEFUN([AC_PROG_MAKE_SET],
820 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
821 set x ${MAKE-make}
822 ac_make=`AS_ECHO(["$[2]"]) | sed 's/+/p/g; s/[[^a-zA-Z0-9_]]/_/g'`
823 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
824 [cat >conftest.make <<\_ACEOF
825 SHELL = /bin/sh
826 all:
827         @echo '@@@%%%=$(MAKE)=@@@%%%'
828 _ACEOF
829 # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
830 case `${MAKE-make} -f conftest.make 2>/dev/null` in
831   *@@@%%%=?*=@@@%%%*)
832     eval ac_cv_prog_make_${ac_make}_set=yes;;
833   *)
834     eval ac_cv_prog_make_${ac_make}_set=no;;
835 esac
836 rm -f conftest.make])dnl
837 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
838   AC_MSG_RESULT([yes])
839   SET_MAKE=
840 else
841   AC_MSG_RESULT([no])
842   SET_MAKE="MAKE=${MAKE-make}"
844 AC_SUBST([SET_MAKE])dnl
845 ])# AC_PROG_MAKE_SET
848 # AC_PROG_RANLIB
849 # --------------
850 AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
851 AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
852 AC_DEFUN([AC_PROG_RANLIB],
853 [AC_CHECK_TOOL(RANLIB, ranlib, :)])
856 # AC_RSH
857 # ------
858 # I don't know what it used to do, but it no longer does.
859 AU_DEFUN([AC_RSH], [],
860 [$0 is no longer supported.  Remove this warning when you
861 adjust the code.])
864 # AC_PROG_SED
865 # -----------
866 # Check for a fully functional sed program that truncates
867 # as few characters as possible.  Prefer GNU sed if found.
868 AC_DEFUN([AC_PROG_SED],
869 [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
870     [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
871      dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed.
872      ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
873      for ac_i in 1 2 3 4 5 6 7; do
874        ac_script="$ac_script$as_nl$ac_script"
875      done
876      echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
877      AS_UNSET([ac_script])
878      _AC_PATH_PROGS_FEATURE_CHECK(SED, [sed gsed],
879         [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
880                 ["$ac_path_SED" -f conftest.sed])])])
881  SED="$ac_cv_path_SED"
882  AC_SUBST([SED])dnl
883  rm -f conftest.sed
884 ])# AC_PROG_SED
887 # AC_PROG_YACC
888 # ------------
889 AN_MAKEVAR([BISON],  [AC_PROG_YACC])
890 AN_MAKEVAR([YACC],  [AC_PROG_YACC])
891 AN_MAKEVAR([YFLAGS],  [AC_PROG_YACC])
892 AN_PROGRAM([yacc],  [AC_PROG_YACC])
893 AN_PROGRAM([byacc], [AC_PROG_YACC])
894 AN_PROGRAM([bison], [AC_PROG_YACC])
895 AC_DEFUN([AC_PROG_YACC],
896 [AC_CHECK_PROGS(YACC, 'bison -o y.tab.c' byacc, yacc)dnl
897 AC_ARG_VAR(YACC,
898 [The `Yet Another Compiler Compiler' implementation to use.  Defaults to
899 the first program found out of: `bison -o y.tab.c', `byacc', `yacc'.])dnl
900 AC_ARG_VAR(YFLAGS,
901 [The list of arguments that will be passed by default to $YACC.  This script
902 will default YFLAGS to the empty string to avoid a default value of `-d' given
903 by some make applications.])])