source: trunk/essentials/sys-devel/autoconf/lib/autoconf/programs.m4

Last change on this file was 3092, checked in by bird, 18 years ago

autoconf 2.61

File size: 28.4 KB
Line 
1# This file is part of Autoconf. -*- Autoconf -*-
2# Checking for programs.
3
4# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
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.
11#
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.
16#
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.
21
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.
29#
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.
37#
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.
48#
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.
52
53
54## ----------------------------- ##
55## Generic checks for programs. ##
56## ----------------------------- ##
57
58
59# _AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
60# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
61# [PATH], [REJECT])
62# -----------------------------------------------------
63AC_DEFUN([_AC_CHECK_PROG],
64[# Extract the first word of "$2", so it can be a program name with args.
65set dummy $2; ac_word=$[2]
66AC_MSG_CHECKING([for $ac_word])
67AC_CACHE_VAL(ac_cv_prog_$1,
68[if test -n "$$1"; then
69 ac_cv_prog_$1="$$1" # Let the user override the test.
70else
71m4_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
76m4_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
85done])
86m4_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+' '}$[@]"
97m4_if([$2], [$4],
98[ else
99 # Default is a loser.
100 AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl
101m4_default([$5], [\$PATH])])
102])dnl
103 fi
104fi])dnl
105dnl If no 4th arg is given, leave the cache variable unset,
106dnl so AC_CHECK_PROGS will keep looking.
107m4_ifvaln([$4],
108[ test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl
109fi])dnl
110$1=$ac_cv_prog_$1
111if test -n "$$1"; then
112 AC_MSG_RESULT([$$1])
113else
114 AC_MSG_RESULT([no])
115fi
116])# _AC_CHECK_PROG
117
118
119# AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
120# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
121# [PATH], [REJECT])
122# -----------------------------------------------------
123AC_DEFUN([AC_CHECK_PROG],
124[_AC_CHECK_PROG($@)
125AC_SUBST([$1])dnl
126])
127
128
129# AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
130# [PATH])
131# ------------------------------------------------------------------
132AC_DEFUN([AC_CHECK_PROGS],
133[for ac_prog in $2
134do
135 AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4])
136 test -n "$$1" && break
137done
138m4_ifvaln([$3], [test -n "$$1" || $1="$3"])])
139
140
141# _AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
142# ------------------------------------------------------------------------
143AC_DEFUN([_AC_PATH_PROG],
144[# Extract the first word of "$2", so it can be a program name with args.
145set dummy $2; ac_word=$[2]
146AC_MSG_CHECKING([for $ac_word])
147AC_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
160done])
161dnl If no 3rd arg is given, leave the cache variable unset,
162dnl so AC_PATH_PROGS will keep looking.
163m4_ifvaln([$3],
164[ test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl
165 ;;
166esac])dnl
167$1=$ac_cv_path_$1
168if test -n "$$1"; then
169 AC_MSG_RESULT([$$1])
170else
171 AC_MSG_RESULT([no])
172fi
173])# _AC_PATH_PROG
174
175
176# AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
177# -----------------------------------------------------------------------
178AC_DEFUN([AC_PATH_PROG],
179[_AC_PATH_PROG($@)
180AC_SUBST([$1])dnl
181])
182
183
184# AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
185# [PATH])
186# -----------------------------------------------------------------
187AC_DEFUN([AC_PATH_PROGS],
188[for ac_prog in $2
189do
190 AC_PATH_PROG([$1], [$ac_prog], , [$4])
191 test -n "$$1" && break
192done
193m4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl
194])
195
196
197
198
199## -------------------------- ##
200## Generic checks for tools. ##
201## -------------------------- ##
202
203
204# AC_CHECK_TOOL_PREFIX
205# --------------------
206AU_DEFUN([AC_CHECK_TOOL_PREFIX])
207
208
209# _AC_TOOL_WARN
210# -------------
211AC_DEFUN([_AC_TOOL_WARN],
212[case $cross_compiling:$ac_tool_warned in
213yes:)
214AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
215whose name does not start with the host triplet. If you think this
216configuration is useful to you, please write to autoconf@gnu.org.])
217ac_tool_warned=yes ;;
218esac])
219
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.)
223AC_DEFUN([AC_PATH_TOOL],
224[if test -n "$ac_tool_prefix"; then
225 AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])
226fi
227if 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
236else
237 $1="$ac_cv_path_$1"
238fi
239])# AC_PATH_TOOL
240
241
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.)
245AC_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])
248fi
249if 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
258else
259 $1="$ac_cv_prog_$1"
260fi
261])# AC_CHECK_TOOL
262
263
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.
270AC_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
279fi
280if 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
289fi
290])# AC_CHECK_TOOLS
291
292
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.)
296AC_DEFUN([AC_PATH_TARGET_TOOL],
297[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
298AC_PATH_PROG([$1], [$target_alias-$2], , [$4])
299if 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
307else
308 $1="$ac_cv_path_$1"
309fi
310])# AC_PATH_TARGET_TOOL
311
312
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.)
316AC_DEFUN([AC_CHECK_TARGET_TOOL],
317[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
318AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])
319if 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
327else
328 $1="$ac_cv_prog_$1"
329fi
330])# AC_CHECK_TARGET_TOOL
331
332
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.
339AC_DEFUN([AC_CHECK_TARGET_TOOLS],
340[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
341for ac_prog in $2
342do
343 AC_CHECK_PROG([$1],
344 [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
345 [$4])
346 test -n "$$1" && break
347done
348if 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
356fi
357])# AC_CHECK_TARGET_TOOLS
358
359
360
361## ---------------- ##
362## Specific tests. ##
363## ---------------- ##
364
365# Please, keep this section sorted.
366# (But of course when keeping related things together).
367
368# Check for gawk first since it's generally better.
369AN_MAKEVAR([AWK], [AC_PROG_AWK])
370AN_PROGRAM([awk], [AC_PROG_AWK])
371AN_PROGRAM([gawk], [AC_PROG_AWK])
372AN_PROGRAM([mawk], [AC_PROG_AWK])
373AN_PROGRAM([nawk], [AC_PROG_AWK])
374AC_DEFUN([AC_PROG_AWK],
375[AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])
376
377
378# AC_PROG_EGREP
379# -------------
380AC_DEFUN([AC_PROG_EGREP],
381[AC_REQUIRE([AC_PROG_GREP])dnl
382AC_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
391
392
393# AC_PROG_FGREP
394# -------------
395AC_DEFUN([AC_PROG_FGREP],
396[AC_REQUIRE([AC_PROG_GREP])dnl
397AC_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
406
407
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.
413AC_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])
418])
419
420
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.
426m4_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])
430])
431
432
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.
442m4_define([_AC_PATH_PROG_FEATURE_CHECK],
443[# Extract the first word of "$2" to use in msg output
444if test -z "$$1"; then
445set dummy $2; ac_prog_name=$[2]
446AC_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
457done
458])
459])
460$1="$ac_cv_path_$1"
461if test -z "$$1"; then
462 AC_MSG_ERROR([no acceptable $ac_prog_name could be found in dnl
463m4_default([$4], [\$PATH])])
464fi
465AC_SUBST([$1])
466else
467 ac_cv_path_$1=$$1
468fi
469])
470
471
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.
482m4_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"
500dnl # Using $1_max so that each tool feature checked gets its
501dnl # own variable. Don't reset it otherwise the implied search
502dnl # 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])
509])
510
511
512# _AC_PATH_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
513# ----------------------------------------------------------------
514m4_define([_AC_PATH_PROG_FLAVOR_GNU],
515[# Check for GNU $1
516case `"$1" --version 2>&1` in
517*GNU*)
518 $2;;
519m4_ifval([$3],
520[*)
521 $3;;
522])esac
523])# _AC_PATH_PROG_FLAVOR_GNU
524
525
526# AC_PROG_INSTALL
527# ---------------
528AN_MAKEVAR([INSTALL], [AC_PROG_INSTALL])
529AN_PROGRAM([install], [AC_PROG_INSTALL])
530AC_DEFUN([AC_PROG_INSTALL],
531[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
532AC_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.
546AC_MSG_CHECKING([for a BSD-compatible install])
547if test -z "$INSTALL"; then
548AC_CACHE_VAL(ac_cv_path_install,
549[_AS_PATH_WALK([$PATH],
550[# Account for people who put trailing slashes in PATH elements.
551case $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 ;;
579esac])
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
590fi
591dnl Do special magic for INSTALL instead of AC_SUBST, to get
592dnl relative names right.
593AC_MSG_RESULT([$INSTALL])
594
595# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
596# It thinks the first close brace ends the variable substitution.
597test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
598AC_SUBST(INSTALL_PROGRAM)dnl
599
600test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
601AC_SUBST(INSTALL_SCRIPT)dnl
602
603test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
604AC_SUBST(INSTALL_DATA)dnl
605])# AC_PROG_INSTALL
606
607
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.
612#
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).
620#
621# Do not use -m 0755 and let people choose whatever they expect by
622# setting umask.
623#
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.
630#
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.
650#
651# On NextStep and OpenStep, the `mkdir' command does not
652# recognize any option. It will interpret all options as
653# directories to create.
654AN_MAKEVAR([MKDIR_P], [AC_PROG_MKDIR_P])
655AC_DEFUN([AC_PROG_MKDIR_P],
656[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
657AC_REQUIRE_AUX_FILE([install-sh])dnl
658AC_MSG_CHECKING([for a thread-safe mkdir -p])
659if 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
684fi
685dnl Do special magic for MKDIR_P instead of AC_SUBST, to get
686dnl relative names right.
687AC_MSG_RESULT([$MKDIR_P])
688])# AC_PROG_MKDIR_P
689
690
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[].
695AN_MAKEVAR([LEX], [AC_PROG_LEX])
696AN_PROGRAM([lex], [AC_PROG_LEX])
697AN_PROGRAM([flex], [AC_PROG_LEX])
698AC_DEFUN_ONCE([AC_PROG_LEX],
699[AC_CHECK_PROGS(LEX, flex lex, :)
700if test "x$LEX" != "x:"; then
701 _AC_PROG_LEX_YYTEXT_DECL
702fi])
703
704
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.
709m4_define([_AC_PROG_LEX_YYTEXT_DECL],
710[cat >conftest.l <<_ACEOF[
711%%
712a { ECHO; }
713b { REJECT; }
714c { yymore (); }
715d { yyless (1); }
716e { yyless (input () != 0); }
717f { unput (yytext[0]); }
718. { BEGIN INITIAL; }
719%%
720#ifdef YYTEXT_POINTER
721extern char *yytext;
722#endif
723int
724main (void)
725{
726 return ! yylex () + ! yywrap ();
727}
728]_ACEOF
729_AC_DO_VAR(LEX conftest.l)
730AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
731if test -f lex.yy.c; then
732 ac_cv_prog_lex_root=lex.yy
733elif test -f lexyy.c; then
734 ac_cv_prog_lex_root=lexyy
735else
736 AC_MSG_ERROR([cannot find output from $LEX; giving up])
737fi])
738AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
739
740if 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
752fi
753AC_SUBST(LEXLIB)
754
755AC_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.
759ac_cv_prog_lex_yytext_pointer=no
760ac_save_LIBS=$LIBS
761LIBS="$LEXLIB $ac_save_LIBS"
762AC_LINK_IFELSE(
763 [#define YYTEXT_POINTER 1
764`cat $LEX_OUTPUT_ROOT.c`],
765 [ac_cv_prog_lex_yytext_pointer=yes])
766LIBS=$ac_save_LIBS
767])
768dnl
769if 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[]'.])
773fi
774rm -f conftest.l $LEX_OUTPUT_ROOT.c
775])# _AC_PROG_LEX_YYTEXT_DECL
776
777
778# Require AC_PROG_LEX in case some people were just calling this macro.
779AU_DEFUN([AC_DECL_YYTEXT], [AC_PROG_LEX])
780
781
782# AC_PROG_LN_S
783# ------------
784AN_MAKEVAR([LN], [AC_PROG_LN_S])
785AN_PROGRAM([ln], [AC_PROG_LN_S])
786AC_DEFUN([AC_PROG_LN_S],
787[AC_MSG_CHECKING([whether ln -s works])
788AC_SUBST([LN_S], [$as_ln_s])dnl
789if test "$LN_S" = "ln -s"; then
790 AC_MSG_RESULT([yes])
791else
792 AC_MSG_RESULT([no, using $LN_S])
793fi
794])# AC_PROG_LN_S
795
796
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.
803AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET])
804AN_PROGRAM([make], [AC_PROG_MAKE_SET])
805AC_DEFUN([AC_PROG_MAKE_SET],
806[AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
807set x ${MAKE-make}; ac_make=`echo "$[2]" | sed 's/+/p/g; s/[[^a-zA-Z0-9_]]/_/g'`
808AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
809[cat >conftest.make <<\_ACEOF
810SHELL = /bin/sh
811all:
812 @echo '@@@%%%=$(MAKE)=@@@%%%'
813_ACEOF
814# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
815case `${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;;
820esac
821rm -f conftest.make])dnl
822if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
823 AC_MSG_RESULT([yes])
824 SET_MAKE=
825else
826 AC_MSG_RESULT([no])
827 SET_MAKE="MAKE=${MAKE-make}"
828fi
829AC_SUBST([SET_MAKE])dnl
830])# AC_PROG_MAKE_SET
831
832
833# AC_PROG_RANLIB
834# --------------
835AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
836AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
837AC_DEFUN([AC_PROG_RANLIB],
838[AC_CHECK_TOOL(RANLIB, ranlib, :)])
839
840
841# AC_RSH
842# ------
843# I don't know what it used to do, but it no longer does.
844AU_DEFUN([AC_RSH], [],
845[$0 is no longer supported. Remove this warning when you
846adjust the code.])
847
848
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.
853AC_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
870
871
872# AC_PROG_YACC
873# ------------
874AN_MAKEVAR([BISON], [AC_PROG_YACC])
875AN_MAKEVAR([YACC], [AC_PROG_YACC])
876AN_MAKEVAR([YFLAGS], [AC_PROG_YACC])
877AN_PROGRAM([yacc], [AC_PROG_YACC])
878AN_PROGRAM([byacc], [AC_PROG_YACC])
879AN_PROGRAM([bison], [AC_PROG_YACC])
880AC_DEFUN([AC_PROG_YACC],
881[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)dnl
882AC_ARG_VAR(YACC,
883[The `Yet Another C Compiler' implementation to use. Defaults to the first
884program found out of: `bison -y', `byacc', `yacc'.])dnl
885AC_ARG_VAR(YFLAGS,
886[The list of arguments that will be passed by default to $YACC. This script
887will default YFLAGS to the empty string to avoid a default value of `-d' given
888by some make applications.])])
Note: See TracBrowser for help on using the repository browser.