RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / share / autoconf / autoconf / programs.m4
blob9e27bf710bd7bd441f6b66a5fae4bec8fb394106
1 # This file is part of Autoconf.                       -*- Autoconf -*-
2 # Checking for programs.
4 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
6 # Foundation, Inc.
8 # This file is part of Autoconf.  This program is free
9 # software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the
11 # Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # Under Section 7 of GPL version 3, you are granted additional
20 # permissions described in the Autoconf Configure Script Exception,
21 # version 3.0, as published by the Free Software Foundation.
23 # You should have received a copy of the GNU General Public License
24 # and a copy of the Autoconf Configure Script Exception along with
25 # this program; see the files COPYINGv3 and COPYING.EXCEPTION
26 # respectively.  If not, see <http://www.gnu.org/licenses/>.
28 # Written by David MacKenzie, with help from
29 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
30 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
33 ## ----------------------------- ##
34 ## Generic checks for programs.  ##
35 ## ----------------------------- ##
38 # _AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
39 #               [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
40 #               [PATH], [REJECT])
41 # -----------------------------------------------------
42 AC_DEFUN([_AC_CHECK_PROG],
43 [# Extract the first word of "$2", so it can be a program name with args.
44 set dummy $2; ac_word=$[2]
45 AC_MSG_CHECKING([for $ac_word])
46 AC_CACHE_VAL(ac_cv_prog_$1,
47 [if test -n "$$1"; then
48   ac_cv_prog_$1="$$1" # Let the user override the test.
49 else
50 m4_ifvaln([$6],
51 [  ac_prog_rejected=no])dnl
52 _AS_PATH_WALK([$5],
53 [for ac_exec_ext in '' $ac_executable_extensions; do
54   if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then
55 m4_ifvaln([$6],
56 [    if test "$as_dir/$ac_word$ac_exec_ext" = "$6"; then
57        ac_prog_rejected=yes
58        continue
59      fi])dnl
60     ac_cv_prog_$1="$3"
61     _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext])
62     break 2
63   fi
64 done])
65 m4_ifvaln([$6],
66 [if test $ac_prog_rejected = yes; then
67   # We found a bogon in the path, so make sure we never use it.
68   set dummy $ac_cv_prog_$1
69   shift
70   if test $[@%:@] != 0; then
71     # We chose a different compiler from the bogus one.
72     # However, it has the same basename, so the bogon will be chosen
73     # first if we set $1 to just the basename; use the full file name.
74     shift
75     ac_cv_prog_$1="$as_dir/$ac_word${1+' '}$[@]"
76 m4_if([$2], [$4],
77 [  else
78     # Default is a loser.
79     AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
80 m4_default([$5], [\$PATH])])
81 ])dnl
82   fi
83 fi])dnl
84 dnl If no 4th arg is given, leave the cache variable unset,
85 dnl so AC_CHECK_PROGS will keep looking.
86 m4_ifvaln([$4],
87 [  test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl
88 fi])dnl
89 $1=$ac_cv_prog_$1
90 if test -n "$$1"; then
91   AC_MSG_RESULT([$$1])
92 else
93   AC_MSG_RESULT([no])
95 ])# _AC_CHECK_PROG
98 # AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
99 #               [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
100 #               [PATH], [REJECT])
101 # -----------------------------------------------------
102 AC_DEFUN([AC_CHECK_PROG],
103 [_AC_CHECK_PROG($@)
104 AC_SUBST([$1])dnl
108 # AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
109 #                [PATH])
110 # ------------------------------------------------------------------
111 AC_DEFUN([AC_CHECK_PROGS],
112 [for ac_prog in $2
114   AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4])
115   test -n "$$1" && break
116 done
117 m4_ifvaln([$3], [test -n "$$1" || $1="$3"])])
120 # _AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
121 # ------------------------------------------------------------------------
122 AC_DEFUN([_AC_PATH_PROG],
123 [# Extract the first word of "$2", so it can be a program name with args.
124 set dummy $2; ac_word=$[2]
125 AC_MSG_CHECKING([for $ac_word])
126 AC_CACHE_VAL([ac_cv_path_$1],
127 [case $$1 in
128   [[\\/]]* | ?:[[\\/]]*)
129   ac_cv_path_$1="$$1" # Let the user override the test with a path.
130   ;;
131   *)
132   _AS_PATH_WALK([$4],
133 [for ac_exec_ext in '' $ac_executable_extensions; do
134   if AS_EXECUTABLE_P(["$as_dir/$ac_word$ac_exec_ext"]); then
135     ac_cv_path_$1="$as_dir/$ac_word$ac_exec_ext"
136     _AS_ECHO_LOG([found $as_dir/$ac_word$ac_exec_ext])
137     break 2
138   fi
139 done])
140 dnl If no 3rd arg is given, leave the cache variable unset,
141 dnl so AC_PATH_PROGS will keep looking.
142 m4_ifvaln([$3],
143 [  test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl
144   ;;
145 esac])dnl
146 $1=$ac_cv_path_$1
147 if test -n "$$1"; then
148   AC_MSG_RESULT([$$1])
149 else
150   AC_MSG_RESULT([no])
152 ])# _AC_PATH_PROG
155 # AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
156 # -----------------------------------------------------------------------
157 AC_DEFUN([AC_PATH_PROG],
158 [_AC_PATH_PROG($@)
159 AC_SUBST([$1])dnl
163 # AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
164 #               [PATH])
165 # -----------------------------------------------------------------
166 AC_DEFUN([AC_PATH_PROGS],
167 [for ac_prog in $2
169   AC_PATH_PROG([$1], [$ac_prog], , [$4])
170   test -n "$$1" && break
171 done
172 m4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl
178 ## -------------------------- ##
179 ## Generic checks for tools.  ##
180 ## -------------------------- ##
183 # AC_CHECK_TOOL_PREFIX
184 # --------------------
185 AU_DEFUN([AC_CHECK_TOOL_PREFIX])
188 # _AC_TOOL_WARN
189 # -------------
190 AC_DEFUN([_AC_TOOL_WARN],
191 [case $cross_compiling:$ac_tool_warned in
192 yes:)
193 AC_MSG_WARN([using cross tools not prefixed with host triplet])
194 ac_tool_warned=yes ;;
195 esac])
197 # AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
198 # -----------------------------------------------------------------------
199 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
200 AC_DEFUN([AC_PATH_TOOL],
201 [if test -n "$ac_tool_prefix"; then
202   AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])
204 if test -z "$ac_cv_path_$1"; then
205   ac_pt_$1=$$1
206   _AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
207   if test "x$ac_pt_$1" = x; then
208     $1="$3"
209   else
210     _AC_TOOL_WARN
211     $1=$ac_pt_$1
212   fi
213 else
214   $1="$ac_cv_path_$1"
216 ])# AC_PATH_TOOL
219 # AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
220 # ------------------------------------------------------------------------
221 # (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
222 AC_DEFUN([AC_CHECK_TOOL],
223 [if test -n "$ac_tool_prefix"; then
224   AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4])
226 if test -z "$ac_cv_prog_$1"; then
227   ac_ct_$1=$$1
228   _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
229   if test "x$ac_ct_$1" = x; then
230     $1="$3"
231   else
232     _AC_TOOL_WARN
233     $1=$ac_ct_$1
234   fi
235 else
236   $1="$ac_cv_prog_$1"
238 ])# AC_CHECK_TOOL
241 # AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
242 #                [PATH])
243 # ------------------------------------------------------------------
244 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
245 # none can be found with a cross prefix, then use the first one that
246 # was found without the cross prefix.
247 AC_DEFUN([AC_CHECK_TOOLS],
248 [if test -n "$ac_tool_prefix"; then
249   for ac_prog in $2
250   do
251     AC_CHECK_PROG([$1],
252                   [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],,
253                   [$4])
254     test -n "$$1" && break
255   done
257 if test -z "$$1"; then
258   ac_ct_$1=$$1
259   AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
260   if test "x$ac_ct_$1" = x; then
261     $1="$3"
262   else
263     _AC_TOOL_WARN
264     $1=$ac_ct_$1
265   fi
267 ])# AC_CHECK_TOOLS
270 # AC_PATH_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
271 # ------------------------------------------------------------------------------
272 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
273 AC_DEFUN([AC_PATH_TARGET_TOOL],
274 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
275 AC_PATH_PROG([$1], [$target_alias-$2], , [$4])
276 if test -z "$ac_cv_path_$1"; then
277   if test "$build" = "$target"; then
278     ac_pt_$1=$$1
279     _AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
280     $1=$ac_pt_$1
281   else
282     $1="$3"
283   fi
284 else
285   $1="$ac_cv_path_$1"
287 ])# AC_PATH_TARGET_TOOL
290 # AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
291 # -------------------------------------------------------------------------------
292 # (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
293 AC_DEFUN([AC_CHECK_TARGET_TOOL],
294 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
295 AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])
296 if test -z "$ac_cv_prog_$1"; then
297   if test "$build" = "$target"; then
298     ac_ct_$1=$$1
299     _AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
300     $1=$ac_ct_$1
301   else
302     $1="$3"
303   fi
304 else
305   $1="$ac_cv_prog_$1"
307 ])# AC_CHECK_TARGET_TOOL
310 # AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
311 #                       [PATH])
312 # -------------------------------------------------------------------------
313 # Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
314 # none can be found with a cross prefix, then use the first one that
315 # was found without the cross prefix.
316 AC_DEFUN([AC_CHECK_TARGET_TOOLS],
317 [AC_REQUIRE([AC_CANONICAL_TARGET])dnl
318 for ac_prog in $2
320   AC_CHECK_PROG([$1],
321                 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
322                 [$4])
323   test -n "$$1" && break
324 done
325 if test -z "$$1"; then
326   if test "$build" = "$target"; then
327     ac_ct_$1=$$1
328     AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
329     $1=$ac_ct_$1
330   else
331     $1="$3"
332   fi
334 ])# AC_CHECK_TARGET_TOOLS
338 ## ---------------- ##
339 ## Specific tests.  ##
340 ## ---------------- ##
342 # Please, keep this section sorted.
343 # (But of course when keeping related things together).
345 # Check for gawk first since it's generally better.
346 AN_MAKEVAR([AWK],  [AC_PROG_AWK])
347 AN_PROGRAM([awk],  [AC_PROG_AWK])
348 AN_PROGRAM([gawk], [AC_PROG_AWK])
349 AN_PROGRAM([mawk], [AC_PROG_AWK])
350 AN_PROGRAM([nawk], [AC_PROG_AWK])
351 AC_DEFUN([AC_PROG_AWK],
352 [AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])
355 # AC_PROG_EGREP
356 # -------------
357 AC_DEFUN([AC_PROG_EGREP],
358 [AC_REQUIRE([AC_PROG_GREP])dnl
359 AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP,
360    [if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
361    then ac_cv_path_EGREP="$GREP -E"
362    else
363      _AC_PROG_GREP(EGREP, egrep, ['EGREP$'])
364    fi])
365  EGREP="$ac_cv_path_EGREP"
366  AC_SUBST([EGREP])
367 ])# AC_PROG_EGREP
370 # AC_PROG_FGREP
371 # -------------
372 AC_DEFUN([AC_PROG_FGREP],
373 [AC_REQUIRE([AC_PROG_GREP])dnl
374 AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP,
375    [if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
376    then ac_cv_path_FGREP="$GREP -F"
377    else
378      _AC_PROG_GREP(FGREP, fgrep, [FGREP])
379    fi])
380  FGREP="$ac_cv_path_FGREP"
381  AC_SUBST([FGREP])
382 ])# AC_PROG_FGREP
385 # AC_PROG_GREP
386 # ------------
387 # Check for a fully functional grep program that handles
388 # the longest lines possible and which respects multiple -e options.
389 # Prefer GNU grep if found.
390 AC_DEFUN([AC_PROG_GREP],
391 [AC_CACHE_CHECK([for grep that handles long lines and -e], ac_cv_path_GREP,
392    [_$0(GREP, [grep ggrep], [-e 'GREP$' -e '-(cannot match)-'])])
393  GREP="$ac_cv_path_GREP"
394  AC_SUBST([GREP])
398 # _AC_PROG_GREP(VARIABLE, PROGNAME-LIST, PROG-ARGUMENTS)
399 # ------------------------------------------------------
400 # Solaris 9 /usr/xpg4/bin/*grep is suitable, but /usr/bin/*grep lacks -e.
401 # AIX silently truncates long lines before matching.
402 # NeXT understands only one -e and truncates long lines.
403 m4_define([_AC_PROG_GREP],
404 [_AC_PATH_PROGS_FEATURE_CHECK([$1], [$2],
405         [_AC_FEATURE_CHECK_LENGTH([ac_path_$1], [ac_cv_path_$1],
406                 ["$ac_path_$1" $3], [$1])], [],
407         [$PATH$PATH_SEPARATOR/usr/xpg4/bin])dnl
411 # _AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST, FEATURE-TEST,
412 #                              [ACTION-IF-NOT-FOUND], [PATH=$PATH])
413 # -------------------------------------------------------------------
414 # FEATURE-TEST is called repeatedly with $ac_path_VARIABLE set to the
415 # name of a program in PROGNAME-LIST found in PATH.  FEATURE-TEST must set
416 # $ac_cv_path_VARIABLE to the path of an acceptable program, or else
417 # ACTION-IF-NOT-FOUND is executed; the default action (for internal use
418 # only) issues a fatal error message.  If a suitable $ac_path_VARIABLE is
419 # found in the FEATURE-TEST macro, it can set $ac_path_VARIABLE_found=':'
420 # to accept that value without any further checks.
421 m4_define([_AC_PATH_PROGS_FEATURE_CHECK],
422 [if test -z "$$1"; then
423   ac_path_$1_found=false
424   # Loop through the user's path and test for each of PROGNAME-LIST
425   _AS_PATH_WALK([$5],
426   [for ac_prog in $2; do
427     for ac_exec_ext in '' $ac_executable_extensions; do
428       ac_path_$1="$as_dir/$ac_prog$ac_exec_ext"
429       AS_EXECUTABLE_P(["$ac_path_$1"]) || continue
431       $ac_path_$1_found && break 3
432     done
433   done])dnl
434   if test -z "$ac_cv_path_$1"; then
435     m4_default([$4],
436       [AC_MSG_ERROR([no acceptable m4_bpatsubst([$2], [ .*]) could be dnl
437 found in m4_default([$5], [\$PATH])])])
438   fi
439 else
440   ac_cv_path_$1=$$1
445 # AC_PATH_PROGS_FEATURE_CHECK(VARIABLE, PROGNAME-LIST,
446 #                             FEATURE-TEST, [ACTION-IF-NOT-FOUND=:],
447 #                             [PATH=$PATH])
448 # ----------------------------------------------------------------
449 # Designed to be used inside AC_CACHE_VAL.  It is recommended,
450 # but not required, that the user also use AC_ARG_VAR([VARIABLE]).
451 # If VARIABLE is not empty, set the cache variable
452 # $ac_cv_path_VARIABLE to VARIABLE without any further tests.
453 # Otherwise, call FEATURE_TEST repeatedly with $ac_path_VARIABLE
454 # set to the name of a program in PROGNAME-LIST found in PATH.  If
455 # no invocation of FEATURE-TEST sets $ac_cv_path_VARIABLE to the
456 # path of an acceptable program, ACTION-IF-NOT-FOUND is executed.
457 # FEATURE-TEST is invoked even when $ac_cv_path_VARIABLE is set,
458 # in case a better candidate occurs later in PATH; to accept the
459 # current setting and bypass further checks, FEATURE-TEST can set
460 # $ac_path_VARIABLE_found=':'.  Note that, unlike AC_CHECK_PROGS,
461 # this macro does not have any side effect on the current value
462 # of VARIABLE.
463 m4_define([AC_PATH_PROGS_FEATURE_CHECK],
464 [_$0([$1], [$2], [$3], m4_default([$4], [:]), [$5])dnl
468 # _AC_FEATURE_CHECK_LENGTH(PROGPATH, CACHE-VAR, CHECK-CMD, [MATCH-STRING])
469 # ------------------------------------------------------------------------
470 # For use as the FEATURE-TEST argument to _AC_PATH_PROGS_FEATURE_TEST.
471 # On each iteration run CHECK-CMD on an input file, storing the value
472 # of PROGPATH in CACHE-VAR if the CHECK-CMD succeeds.  The input file
473 # is always one line, starting with only 10 characters, and doubling
474 # in length at each iteration until approx 10000 characters or the
475 # feature check succeeds.  The feature check is called at each
476 # iteration by appending (optionally, MATCH-STRING and) a newline
477 # to the file, and using the result as input to CHECK-CMD.
478 m4_define([_AC_FEATURE_CHECK_LENGTH],
479 [# Check for GNU $1 and select it if it is found.
480   _AC_PATH_PROG_FLAVOR_GNU([$$1],
481     [$2="$$1" $1_found=:],
482   [ac_count=0
483   AS_ECHO_N([0123456789]) >"conftest.in"
484   while :
485   do
486     cat "conftest.in" "conftest.in" >"conftest.tmp"
487     mv "conftest.tmp" "conftest.in"
488     cp "conftest.in" "conftest.nl"
489     AS_ECHO(['$4']) >> "conftest.nl"
490     $3 < "conftest.nl" >"conftest.out" 2>/dev/null || break
491     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
492     AS_VAR_ARITH([ac_count], [$ac_count + 1])
493     if test $ac_count -gt ${$1_max-0}; then
494       # Best one so far, save it but keep looking for a better one
495       $2="$$1"
496 dnl   # Using $1_max so that each tool feature checked gets its
497 dnl   # own variable.  Don't reset it otherwise the implied search
498 dnl   # for best performing tool in a list breaks down.
499       $1_max=$ac_count
500     fi
501     # 10*(2^10) chars as input seems more than enough
502     test $ac_count -gt 10 && break
503   done
504   rm -f conftest.in conftest.tmp conftest.nl conftest.out])dnl
508 # _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
509 # ----------------------------------------------------------------
510 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
511 [# Check for GNU $1
512 case `"$1" --version 2>&1` in
513 *GNU*)
514   $2;;
515 m4_ifval([$3],
517   $3;;
518 ])esac
519 ])# _AC_PATH_PROG_FLAVOR_GNU
522 # AC_PROG_INSTALL
523 # ---------------
524 AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
525 AN_PROGRAM([install], [AC_PROG_INSTALL])
526 AC_DEFUN_ONCE([AC_PROG_INSTALL],
527 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
528 AC_REQUIRE_AUX_FILE([install-sh])dnl
529 # Find a good install program.  We prefer a C program (faster),
530 # so one script is as good as another.  But avoid the broken or
531 # incompatible versions:
532 # SysV /etc/install, /usr/sbin/install
533 # SunOS /usr/etc/install
534 # IRIX /sbin/install
535 # AIX /bin/install
536 # AmigaOS /C/install, which installs bootblocks on floppy discs
537 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
538 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
539 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
540 # OS/2's system install, which has a completely different semantic
541 # ./install, which can be erroneously created by make from ./install.sh.
542 # Reject install programs that cannot install multiple files.
543 AC_MSG_CHECKING([for a BSD-compatible install])
544 if test -z "$INSTALL"; then
545 AC_CACHE_VAL(ac_cv_path_install,
546 [_AS_PATH_WALK([$PATH],
547 [[# Account for people who put trailing slashes in PATH elements.
548 case $as_dir/ in @%:@((
549   ./ | .// | /[cC]/* | \
550   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
551   ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
552   /usr/ucb/* ) ;;
553   *)]
554     # OSF1 and SCO ODT 3.0 have their own names for install.
555     # Don't use installbsd from OSF since it installs stuff as root
556     # by default.
557     for ac_prog in ginstall scoinst install; do
558       for ac_exec_ext in '' $ac_executable_extensions; do
559         if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then
560           if test $ac_prog = install &&
561             grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
562             # AIX install.  It has an incompatible calling convention.
563             :
564           elif test $ac_prog = install &&
565             grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
566             # program-specific install script used by HP pwplus--don't use.
567             :
568           else
569             rm -rf conftest.one conftest.two conftest.dir
570             echo one > conftest.one
571             echo two > conftest.two
572             mkdir conftest.dir
573             if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
574               test -s conftest.one && test -s conftest.two &&
575               test -s conftest.dir/conftest.one &&
576               test -s conftest.dir/conftest.two
577             then
578               ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
579               break 3
580             fi
581           fi
582         fi
583       done
584     done
585     ;;
586 esac
588 rm -rf conftest.one conftest.two conftest.dir
589 ])dnl
590   if test "${ac_cv_path_install+set}" = set; then
591     INSTALL=$ac_cv_path_install
592   else
593     # As a last resort, use the slow shell script.  Don't cache a
594     # value for INSTALL within a source directory, because that will
595     # break other packages using the cache if that directory is
596     # removed, or if the value is a relative name.
597     INSTALL=$ac_install_sh
598   fi
600 dnl Do special magic for INSTALL instead of AC_SUBST, to get
601 dnl relative names right.
602 AC_MSG_RESULT([$INSTALL])
604 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
605 # It thinks the first close brace ends the variable substitution.
606 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
607 AC_SUBST(INSTALL_PROGRAM)dnl
609 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
610 AC_SUBST(INSTALL_SCRIPT)dnl
612 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
613 AC_SUBST(INSTALL_DATA)dnl
614 ])# AC_PROG_INSTALL
617 # AC_PROG_MKDIR_P
618 # ---------------
619 # Check whether `mkdir -p' is known to be thread-safe, and fall back to
620 # install-sh -d otherwise.
622 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
623 # created by `make install' are always world readable, even if the
624 # installer happens to have an overly restrictive umask (e.g. 077).
625 # This was a mistake.  There are at least two reasons why we must not
626 # use `-m 0755':
627 #   - it causes special bits like SGID to be ignored,
628 #   - it may be too restrictive (some setups expect 775 directories).
630 # Do not use -m 0755 and let people choose whatever they expect by
631 # setting umask.
633 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
634 # Some implementations (such as Solaris 8's) are vulnerable to race conditions:
635 # if a parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
636 # concurrently, both version can detect that a/ is missing, but only
637 # one can create it and the other will error out.  Consequently we
638 # restrict ourselves to known race-free implementations.
640 # Automake used to define mkdir_p as `mkdir -p .', in order to
641 # allow $(mkdir_p) to be used without argument.  As in
642 #   $(mkdir_p) $(somedir)
643 # where $(somedir) is conditionally defined.  However we don't do
644 # that for MKDIR_P.
645 #  1. before we restricted the check to GNU mkdir, `mkdir -p .' was
646 #     reported to fail in read-only directories.  The system where this
647 #     happened has been forgotten.
648 #  2. in practice we call $(MKDIR_P) on directories such as
649 #       $(MKDIR_P) "$(DESTDIR)$(somedir)"
650 #     and we don't want to create $(DESTDIR) if $(somedir) is empty.
651 #     To support the latter case, we have to write
652 #       test -z "$(somedir)" || $(MKDIR_P) "$(DESTDIR)$(somedir)"
653 #     so $(MKDIR_P) always has an argument.
654 #     We will have better chances of detecting a missing test if
655 #     $(MKDIR_P) complains about missing arguments.
656 #  3. $(MKDIR_P) is named after `mkdir -p' and we don't expect this
657 #     to accept no argument.
658 #  4. having something like `mkdir .' in the output is unsightly.
660 # On NextStep and OpenStep, the `mkdir' command does not
661 # recognize any option.  It will interpret all options as
662 # directories to create.
663 AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
664 AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
665 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
666 AC_REQUIRE_AUX_FILE([install-sh])dnl
667 AC_MSG_CHECKING([for a thread-safe mkdir -p])
668 if test -z "$MKDIR_P"; then
669   AC_CACHE_VAL([ac_cv_path_mkdir],
670     [_AS_PATH_WALK([$PATH$PATH_SEPARATOR/opt/sfw/bin],
671       [for ac_prog in mkdir gmkdir; do
672          for ac_exec_ext in '' $ac_executable_extensions; do
673            AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]) || continue
674            case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
675              'mkdir (GNU coreutils) '* | \
676              'mkdir (coreutils) '* | \
677              'mkdir (fileutils) '4.1*)
678                ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
679                break 3;;
680            esac
681          done
682        done])])
683   test -d ./--version && rmdir ./--version
684   if test "${ac_cv_path_mkdir+set}" = set; then
685     MKDIR_P="$ac_cv_path_mkdir -p"
686   else
687     # As a last resort, use the slow shell script.  Don't cache a
688     # value for MKDIR_P within a source directory, because that will
689     # break other packages using the cache if that directory is
690     # removed, or if the value is a relative name.
691     MKDIR_P="$ac_install_sh -d"
692   fi
694 dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST,
695 dnl to get relative names right.  However, also AC_SUBST here so
696 dnl that Automake versions before 1.10 will pick it up (they do not
697 dnl trace AC_SUBST_TRACE).
698 dnl FIXME: Remove this once we drop support for Automake < 1.10.
699 AC_SUBST([MKDIR_P])dnl
700 AC_MSG_RESULT([$MKDIR_P])
701 ])# AC_PROG_MKDIR_P
704 # AC_PROG_LEX
705 # -----------
706 # Look for flex or lex.  Set its associated library to LEXLIB.
707 # Check if lex declares yytext as a char * by default, not a char[].
708 AN_MAKEVAR([LEX],  [AC_PROG_LEX])
709 AN_PROGRAM([lex],  [AC_PROG_LEX])
710 AN_PROGRAM([flex], [AC_PROG_LEX])
711 AC_DEFUN_ONCE([AC_PROG_LEX],
712 [AC_CHECK_PROGS(LEX, flex lex, :)
713 if test "x$LEX" != "x:"; then
714   _AC_PROG_LEX_YYTEXT_DECL
715 fi])
718 # _AC_PROG_LEX_YYTEXT_DECL
719 # ------------------------
720 # Check for the Lex output root, the Lex library, and whether Lex
721 # declares yytext as a char * by default.
722 m4_define([_AC_PROG_LEX_YYTEXT_DECL],
723 [cat >conftest.l <<_ACEOF[
725 a { ECHO; }
726 b { REJECT; }
727 c { yymore (); }
728 d { yyless (1); }
729 e { 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 test -z "${LEXLIB+set}"; 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([`cat $LEX_OUTPUT_ROOT.c`], [ac_cv_lib_lex=$ac_lib])
760       test "$ac_cv_lib_lex" != 'none needed' && break
761     done
762     LIBS=$ac_save_LIBS
763   ])
764   test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
766 AC_SUBST(LEXLIB)
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
773 ac_save_LIBS=$LIBS
774 LIBS="$LEXLIB $ac_save_LIBS"
775 AC_LINK_IFELSE(
776   [#define YYTEXT_POINTER 1
777 `cat $LEX_OUTPUT_ROOT.c`],
778   [ac_cv_prog_lex_yytext_pointer=yes])
779 LIBS=$ac_save_LIBS
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,
785              not a `char[]'.])
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])
795 # AC_PROG_LN_S
796 # ------------
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
803   AC_MSG_RESULT([yes])
804 else
805   AC_MSG_RESULT([no, using $LN_S])
807 ])# AC_PROG_LN_S
810 # AC_PROG_MAKE_SET
811 # ----------------
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)])
820 set x ${MAKE-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
824 SHELL = /bin/sh
825 all:
826         @echo '@@@%%%=$(MAKE)=@@@%%%'
827 _ACEOF
828 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
829 case `${MAKE-make} -f conftest.make 2>/dev/null` in
830   *@@@%%%=?*=@@@%%%*)
831     eval ac_cv_prog_make_${ac_make}_set=yes;;
832   *)
833     eval ac_cv_prog_make_${ac_make}_set=no;;
834 esac
835 rm -f conftest.make])dnl
836 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
837   AC_MSG_RESULT([yes])
838   SET_MAKE=
839 else
840   AC_MSG_RESULT([no])
841   SET_MAKE="MAKE=${MAKE-make}"
843 AC_SUBST([SET_MAKE])dnl
844 ])# AC_PROG_MAKE_SET
847 # AC_PROG_RANLIB
848 # --------------
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, :)])
855 # AC_RSH
856 # ------
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
860 adjust the code.])
863 # AC_PROG_SED
864 # -----------
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"
874      done
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"
881  AC_SUBST([SED])dnl
882  rm -f conftest.sed
883 ])# AC_PROG_SED
886 # AC_PROG_YACC
887 # ------------
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 -y' byacc, yacc)dnl
896 AC_ARG_VAR(YACC,
897 [The `Yet Another C Compiler' implementation to use.  Defaults to the first
898 program found out of: `bison -y', `byacc', `yacc'.])dnl
899 AC_ARG_VAR(YFLAGS,
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.])])