docs: mention bash bug with word splitting
[autoconf.git] / tests / semantics.at
blob48136cd2f16251a815929431bdb093a377d1e985
1 #                                                       -*- Autotest -*-
3 AT_BANNER([Semantics.])
5 # Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2010
6 # Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 ## -------------------------------- ##
23 ## Members of the AC_CHECK family.  ##
24 ## -------------------------------- ##
27 # AC_CHECK_LIB
28 # ------------
29 # Well, I can't imagine a system where `cos' is neither in libc, nor
30 # in libm.  Nor can I imagine a lib more likely to exists than libm.
31 # But there are systems without libm, on which we don't want to have
32 # this test fail, so exit successfully if `cos' is in libc.
33 AT_CHECK_MACRO([AC_CHECK_LIB],
34 [AC_TRY_LINK_FUNC(cos,
35                   [AC_MSG_ERROR([`cos' is in `libc'], 77)])
37 AC_CHECK_LIB(m, cos,,
38              [AC_MSG_ERROR([cannot find `cos' in `libm'])])
40 # No kidding, using variables was broken in 2.50 :(
41 ac_sin=sin
42 AC_CHECK_LIB(m, $ac_sin,,
43       [AC_MSG_ERROR([cannot find `\$ac_sin' (= `$ac_sin') in `libm'])])
45 ac_m=m
46 AC_CHECK_LIB($ac_m, acos,,
47       [AC_MSG_ERROR([cannot find `acos' in `\$ac_m' (= `$ac_m')])])
49 ac_asin=asin
50 AC_CHECK_LIB($ac_m, $ac_asin,,
51       [AC_MSG_ERROR([cannot find `\$ac_asin' (= `$ac_asin') in `\$ac_m' (= `$ac_m')])])
53 # But if the bug is in the caching mechanism, then be sure we
54 # correctly detect failures.
56 AC_CHECK_LIB(m, cossack,
57              [AC_MSG_ERROR([found `cossack' in `libm'])])
59 # No kidding, using variables was broken in 2.50 :(
60 ac_sinner=sinner
61 AC_CHECK_LIB(m, $ac_sinner,
62       [AC_MSG_ERROR([found `\$ac_sinner' (= `$ac_sinner') in `libm'])])
64 ac_m=m
65 AC_CHECK_LIB($ac_m, acossack,
66       [AC_MSG_ERROR([found `acossack' in `\$ac_m' (= `$ac_m')])])
68 ac_asinner=asinner
69 AC_CHECK_LIB($ac_m, $ac_asinner,
70       [AC_MSG_ERROR([found `\$ac_asinner' (= `$ac_asinner') in `\$ac_m' (= `$ac_m')])])
75 # AC_SEARCH_LIBS
76 # --------------
77 AT_CHECK_MACRO([AC_SEARCH_LIBS],
79 AC_SEARCH_LIBS(cos, oser m ust,,
80              [AC_MSG_ERROR([cannot find `cos'])])
82 case "$ac_cv_search_cos" in
83   -loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_cos must be a cool library!]) ;;
84 esac
88 # AC_SEARCH_LIBS (none needed)
89 # ----------------------------
90 AT_CHECK_MACRO([AC_SEARCH_LIBS (none needed)],
92 AC_SEARCH_LIBS(printf, oser c ust,,
93              [AC_MSG_ERROR([cannot find `printf'])])
95 case "$ac_cv_search_printf" in
96   -loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_printf must be a cool library!]) ;;
97   -lc) AC_MSG_ERROR([huh, you need to give -lc?])
98 esac
102 # AC_CHECK_DECLS
103 # --------------
104 # Check that it performs the correct actions:
105 AT_CHECK_MACRO([AC_CHECK_DECLS],
106 [[AC_CHECK_DECLS([yes, no, myenum, mystruct, myfunc, mymacro1, mymacro2],,,
107                  [[int yes = 1;
108                    enum { myenum };
109                    struct { int x[20]; } mystruct;
110                    extern int myfunc();
111                    #define mymacro1(arg) arg
112                    #define mymacro2]])
113   # The difference in space-before-open-paren is intentional.
114   AC_CHECK_DECLS([basenam (char *), dirnam(char *),
115                   [moreargs (char, short, int, long, void *, char [], float, double)]],,,
116                  [[#ifdef __cplusplus
117                    extern "C++" char *basenam (char *);
118                    extern "C++" const char *basenam (const char *);
119                    #else
120                    extern char *basenam (const char *);
121                    #endif
122                    #ifdef __cplusplus
123                    extern "C" {
124                    #endif
125                    extern int moreargs (char, short, int, long, void *,
126                                         char [], float, double);
127                    #ifdef __cplusplus
128                    }
129                    #endif
130                    ]])
131   AC_CHECK_DECL([declared (char *)],, [AS_EXIT([1])],
132                 [[#ifdef __cplusplus
133                   extern "C++" char *declared (char *);
134                   extern "C++" const char *declared (const char *);
135                   #else
136                   extern char *declared (const char *);
137                   #endif
138                 ]])
139   AC_CHECK_DECL([undeclared (char *)], [AS_EXIT([1])],, [[]])
141 [AT_CHECK_DEFINES(
142 [#define HAVE_DECL_BASENAM 1
143 #define HAVE_DECL_DIRNAM 0
144 #define HAVE_DECL_MOREARGS 1
145 #define HAVE_DECL_MYENUM 1
146 #define HAVE_DECL_MYFUNC 1
147 #define HAVE_DECL_MYMACRO1 1
148 #define HAVE_DECL_MYMACRO2 1
149 #define HAVE_DECL_MYSTRUCT 1
150 #define HAVE_DECL_NO 0
151 #define HAVE_DECL_YES 1
152 ])])
155 # AC_CHECK_FUNCS
156 # --------------
157 # Check that it performs the correct actions:
158 # Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
159 AT_CHECK_MACRO([AC_CHECK_FUNCS],
160 [AC_CHECK_FUNCS(printf autoconf_ftnirp)],
161 [AT_CHECK_DEFINES(
162 [/* #undef HAVE_AUTOCONF_FTNIRP */
163 #define HAVE_PRINTF 1
164 ])])
167 # AC_REPLACE_FUNCS
168 # ----------------
169 # Check that it performs the correct actions: autoconf_ftnirp.c must
170 # be compiled, and must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
171 # FIXME: Maybe check the traces?
172 AT_SETUP([AC_REPLACE_FUNCS])
174 AT_DATA([config.in],
175 [@LIBOBJS@
178 AT_CONFIGURE_AC(
179 [AC_CONFIG_FILES(config.libobjs:config.in)
180 AC_REPLACE_FUNCS(printf autoconf_ftnirp)])
182 AT_CHECK_AUTOCONF([-W obsolete])
183 AT_CHECK_AUTOHEADER
184 AT_CHECK_CONFIGURE
185 AT_CHECK_ENV
186 AT_CHECK_DEFINES(
187 [/* #undef HAVE_AUTOCONF_FTNIRP */
188 #define HAVE_PRINTF 1
191 AT_CHECK([sed 's/  */ /g;s/^ //;s/ $//' config.libobjs], [],
192          [${LIBOBJDIR}autoconf_ftnirp$U.o
195 AT_CLEANUP
198 # AC_CHECK_HEADERS
199 # ----------------
200 # Check that it performs the correct actions:
201 # Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
202 AT_SETUP([AC_CHECK_HEADERS])
204 AT_DATA([autoconf_io.h],
205 [blah blah
208 AT_CONFIGURE_AC([AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
209 AT_CHECK_AUTOCONF([-W obsolete])
210 AT_CHECK_AUTOHEADER
211 AT_CHECK_CONFIGURE([CPPFLAGS=-I.], [0], [ignore],
212 [configure: WARNING: autoconf_io.h: present but cannot be compiled
213 configure: WARNING: autoconf_io.h:     check for missing prerequisite headers?
214 configure: WARNING: autoconf_io.h: see the Autoconf documentation
215 configure: WARNING: autoconf_io.h:     section "Present But Cannot Be Compiled"
216 configure: WARNING: autoconf_io.h: proceeding with the compiler's result
218 AT_CHECK_ENV
219 AT_CHECK_DEFINES(
220 [/* #undef HAVE_AUTOCONF_IO_H */
221 #define HAVE_STDIO_H 1
224 AT_CLEANUP
227 # AC_CHECK_HEADERS_OLD
228 # --------------------
229 # Check that it performs the correct actions:
230 # Must not check prerequisites, hence define header2.h
231 AT_SETUP([AC_CHECK_HEADERS (preprocessor test)])
233 AT_DATA([header1.h],
234 [typedef int foo;
237 AT_DATA([header2.h],
238 [typedef foo bar;
241 AT_CONFIGURE_AC([AC_CHECK_HEADERS(header2.h, [], [], -)])
243 AT_CHECK_AUTOCONF([-W obsolete])
244 AT_CHECK_AUTOHEADER
245 AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
246 AT_CHECK_ENV
247 AT_CHECK_DEFINES(
248 [#define HAVE_HEADER2_H 1
251 AT_CLEANUP
254 # AC_CHECK_HEADERS_NEW
255 # --------------------
256 # Check that it performs the correct actions:
257 # Must check prerequisites, hence define header2.h but not header3.h
258 AT_SETUP([AC_CHECK_HEADERS (compiler test)])
260 AT_DATA([header1.h],
261 [typedef int foo;
264 AT_DATA([header2.h],
265 [typedef foo bar;
268 AT_DATA([header3.h],
269 [typedef bar wow;
272 AT_CONFIGURE_AC(
273 [AC_CHECK_HEADERS(header2.h header3.h, [], [], [[@%:@include "header1.h"]])])
275 AT_CHECK_AUTOCONF([-W obsolete])
276 AT_CHECK_AUTOHEADER
277 AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
278 AT_CHECK_ENV
279 AT_CHECK_DEFINES(
280 [#define HAVE_HEADER2_H 1
281 /* #undef HAVE_HEADER3_H */
284 AT_CLEANUP
287 # AC_CHECK_MEMBER
288 # ---------------
289 # Check that it performs the correct actions.
290 # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
291 AT_CHECK_MACRO([AC_CHECK_MEMBER],
292 [[AC_CHECK_MEMBER([struct yes_s.yes],
293                   [AC_DEFINE([HAVE_STRUCT_YES_S_YES], [1],
294                              [Define to 1 if `yes' is a member of `struct yes_s'.])],,
295                    [struct sub { int x; };
296                     struct yes_s { int yes; struct sub substruct; };])
297   AC_CHECK_MEMBER([struct yes_s.no],
298                   [AC_DEFINE([HAVE_STRUCT_YES_S_NO], [1],
299                              [Define to 1 if `no' is a member of `struct yes_s'.])],,
300                    [struct sub { int x; };
301                     struct yes_s { int yes; struct sub substruct; };])
302   AC_CHECK_MEMBER([struct yes_s.substruct],
303                   [AC_DEFINE([HAVE_STRUCT_YES_S_SUBSTRUCT], [1],
304                              [Define to 1 if `substruct' is a member of `struct yes_s'.])],,
305                    [struct sub { int x; };
306                     struct yes_s { int yes; struct sub substruct; };])]],
307 [AT_CHECK_DEFINES(
308 [/* #undef HAVE_STRUCT_YES_S_NO */
309 #define HAVE_STRUCT_YES_S_SUBSTRUCT 1
310 #define HAVE_STRUCT_YES_S_YES 1
311 ])])
313 # AC_CHECK_MEMBERS
314 # ----------------
315 # Check that it performs the correct actions.
316 # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
317 AT_CHECK_MACRO([AC_CHECK_MEMBERS],
318 [[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no, struct yes_s.substruct],,,
319                    [struct sub { int x; };
320                     struct yes_s { int yes; struct sub substruct; };])]],
321 [AT_CHECK_DEFINES(
322 [/* #undef HAVE_STRUCT_YES_S_NO */
323 #define HAVE_STRUCT_YES_S_SUBSTRUCT 1
324 #define HAVE_STRUCT_YES_S_YES 1
326 AT_CHECK([grep 'yes.*member of.*yes_s' config.h], [], [ignore])
330 # AC_CHECK_ALIGNOF
331 # ----------------
332 AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF],
333 [[AC_CHECK_ALIGNOF(char)
334 AC_CHECK_ALIGNOF(charchar,
335 [[#include <stddef.h>
336 #include <stdio.h>
337 typedef char charchar[2];]])
338 AC_CHECK_ALIGNOF(charcharchar)
340 [AT_CHECK_DEFINES(
341 [#define ALIGNOF_CHAR 1
342 #define ALIGNOF_CHARCHAR 1
343 #define ALIGNOF_CHARCHARCHAR 0
344 ])])
347 # AC_CHECK_ALIGNOF struct
348 # -----------------------
349 AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF struct],
350 [[AC_CHECK_ALIGNOF([struct { char c; }])
351 AC_CHECK_ALIGNOF([struct nosuchstruct])
353 [AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [1-9]" config.h]],
354          0, ignore)
355 AT_CHECK([[grep "#define ALIGNOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
356          0, ignore)
359 # AC_CHECK_SIZEOF
360 # ---------------
361 AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF],
362 [[AC_CHECK_SIZEOF(char)
363 AC_CHECK_SIZEOF(charchar,,
364 [[#include <stdio.h>
365 typedef char charchar[2];]])
366 AC_CHECK_SIZEOF(charcharchar)
368 [AT_CHECK_DEFINES(
369 [#define SIZEOF_CHAR 1
370 #define SIZEOF_CHARCHAR 2
371 #define SIZEOF_CHARCHARCHAR 0
372 ])])
375 # AC_CHECK_SIZEOF struct
376 # ----------------------
377 AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF struct],
378 [[AC_C_CONST
379 AC_CHECK_SIZEOF([struct x], [], [struct x { char c; int x; };])
380 AC_CHECK_SIZEOF([const struct x], [], [struct x { const char *p; int x; };])
381 AC_CHECK_SIZEOF([struct nosuchstruct])
382 # Taken from autoconf.texi:Generic Compiler Characteristics.
383 AC_CHECK_SIZEOF([int *])
385 [AT_CHECK([[grep "#define SIZEOF_STRUCT_X [1-9]" config.h]],
386          0, ignore)
387 AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [1-9]" config.h]],
388          0, ignore)
389 AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
390          0, ignore)
391 AT_CHECK([[grep "#define SIZEOF_INT_P [1-9]" config.h]],
392          0, ignore)
396 # AC_CHECK_TYPES
397 # --------------
398 # Check that it performs the correct actions.
399 # Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S.
400 # `int' and `struct yes_s' are both checked to test both the compiler
401 # builtin types, and defined types.
402 AT_CHECK_MACRO([AC_CHECK_TYPES],
403 [[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,,
404                  [struct yes_s { int yes ;} ;])]],
405 [AT_CHECK_DEFINES(
406 [#define HAVE_INT 1
407 /* #undef HAVE_STRUCT_NO_S */
408 #define HAVE_STRUCT_YES_S 1
409 ])])
412 # AC_CHECK_TYPES
413 # --------------
414 # Check that we properly dispatch properly to the old implementation
415 # or to the new one.
416 AT_SETUP([AC_CHECK_TYPES: backward compatibility])
418 AT_DATA([configure.ac],
419 [[AC_INIT
420 define([_AC_CHECK_TYPE_NEW], [NEW])
421 define([_AC_CHECK_TYPE_OLD], [OLD])
422 #(cut-from-here
423 AC_CHECK_TYPE(ptrdiff_t)
424 AC_CHECK_TYPE(ptrdiff_t, int)
425 AC_CHECK_TYPE(quad, long long int)
426 AC_CHECK_TYPE(table_42, [int[42]])
427 # Nice machine!
428 AC_CHECK_TYPE(uint8_t, uint65536_t)
429 AC_CHECK_TYPE(a,b,c,d)
430 #to-here)
431 AC_OUTPUT
434 AT_CHECK_AUTOCONF
435 AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]],
436          0,
437          [NEW
445 AT_CLEANUP
448 # AC_CHECK_FILES
449 # --------------
450 # FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
451 # open AH_TEMPLATE to `configure.ac', which is not yet the case.
452 AT_CHECK_MACRO([AC_CHECK_FILES],
453 [touch at-exists1 at-exists2
454 ac_exists2=at-exists2
455 ac_missing2=at-missing2
456 AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
457 rm at-exists1 at-exists2],
458 [AT_CHECK_DEFINES(
459 [#define HAVE_AT_EXISTS1 1
460 /* #undef HAVE_AT_MISSING1 */
461 ])])
465 ## ------------------------------ ##
466 ## AC_CHECK_PROG & AC_PATH_PROG.  ##
467 ## ------------------------------ ##
470 # AT_CHECK_PROGS_PREPARE
471 # ----------------------
472 # Create a sub directory `path' with 6 subdirs which all 7 contain
473 # an executable `tool'. `6' contains a `better' tool.
474 m4_define([AT_CHECK_PROGS_PREPARE],
475 [mkdir path
477 cat >path/tool <<\EOF
478 #! /bin/sh
479 exit 0
481 chmod +x path/tool
483 for i in 1 2 3 4 5 6
485   mkdir path/$i
486   cp path/tool path/$i
487 done
488 cp path/tool path/6/better])
491 # -------------------------------- #
492 # AC_CHECK_PROG & AC_CHECK_PROGS.  #
493 # -------------------------------- #
495 AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS])
497 AT_CHECK_PROGS_PREPARE
499 AT_DATA([configure.ac],
500 [[AC_INIT
501 pwd=`pwd`
502 p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
503 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
504 fail=false
506 AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
507 test "$TOOL1" = found || fail=:
509 # Yes, the semantics of this macro is weird.
510 AC_CHECK_PROG(TOOL2, tool,, not-found, $path)
511 test "$TOOL2" = not-found || fail=:
513 AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
514 test "$TOOL3" = "$pwd/path/2/tool" || fail=:
516 AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
517 test "$TOOL4" = better || fail=:
519 # When a tool is not found, and no value is given for not-found,
520 # the variable is left empty.
521 AC_CHECK_PROGS(TOOL5, missing,, $path)
522 test -z "$TOOL5" || fail=:
524 AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
525 test "$TOOL6" = tool || fail=:
527 # No AC-OUTPUT, we don't need config.status.
528 $fail &&
529   AC_MSG_ERROR([[CHECK_PROG failed]])
530 AS_EXIT(0)
533 AT_CHECK_AUTOCONF
534 AT_CHECK_CONFIGURE
536 AT_CLEANUP
540 ## ---------------- ##
541 ## AC_C_BIGENDIAN.  ##
542 ## ---------------- ##
544 AT_SETUP([AC_C_BIGENDIAN])
545 AT_KEYWORDS([cross])
547 # Make sure that AC_C_BIGENDIAN behave the same whether we are
548 # cross-compiling or not.
550 _AT_CHECK_AC_MACRO(
551   [[AC_C_BIGENDIAN(
552       [ac_endian=big],
553       [ac_endian=little],
554       [ac_endian=unknown],
555       [ac_endian=universal])
556    echo $ac_endian > at-endian
559 rm -f config.hin  # So that next run of autoheader is quiet.
560 _AT_CHECK_AC_MACRO(
561   [[# Force cross compiling.
562    cross_compiling=yes
563    ac_tool_warned=yes
564    AC_C_BIGENDIAN(
565      [ac_endian=big],
566      [ac_endian=little],
567      [ac_endian=unknown],
568      [ac_endian=universal])
569    ac_prevendian=`cat at-endian`
570    # Check that we have found the same result as in the previous run
571    # or unknown (because the cross-compiling check is allowed to fail;
572    # although it might be interesting to suppress this comparison, just
573    # to know on which system it fails if it ever does).
574    if test $ac_endian != $ac_prevendian && test $ac_endian != unknown; then
575      AC_MSG_ERROR([unexpected endianness: first run found '$ac_prevendian' but second run found '$ac_endian'])
576    fi
579 # Make sure AC_C_BIGENDIAN with no argument will create a config.h template
580 # containing "WORDS_BIGENDIAN".
581 AT_CONFIGURE_AC([[AC_C_BIGENDIAN]])
582 # --force is necessary, the computer might be too fast.
583 AT_CHECK_AUTOHEADER([--force])
584 AT_CHECK([grep WORDS_BIGENDIAN config.hin], [], [ignore])
586 AT_CLEANUP
589 # ------------------------------ #
590 # AC_PATH_PROG & AC_PATH_PROGS.  #
591 # ------------------------------ #
593 AT_SETUP([AC_PATH_PROG & AC_PATH_PROGS])
595 AT_CHECK_PROGS_PREPARE
597 AT_DATA([configure.ac],
598 [[AC_INIT
599 pwd=`pwd`
600 p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
601 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
602 fail=false
604 AC_PATH_PROG(TOOL1, tool, not-found, $path)
605 test "$TOOL1" = "$pwd/path/1/tool" || fail=:
607 AC_PATH_PROG(TOOL2, better, not-found, $path)
608 test "$TOOL2" = "$pwd/path/6/better" || fail=:
610 # When a tool is not found, and no value is given for not-found,
611 # the variable is left empty.
612 AC_PATH_PROGS(TOOL3, missing,, $path)
613 test -z "$TOOL3" || fail=:
615 AC_PATH_PROGS(TOOL4, missing tool better,, $path)
616 test "$TOOL4" = "$pwd/path/1/tool" || fail=:
618 # No AC-OUTPUT, we don't need config.status.
619 $fail &&
620   AC_MSG_ERROR([[PATH_PROG failed]])
621 AS_EXIT(0)
624 AT_CHECK_AUTOCONF
625 AT_CHECK_CONFIGURE
627 AT_CLEANUP
631 # ----------------------------- #
632 # AC_PATH_PROGS_FEATURE_CHECK.  #
633 # ----------------------------- #
635 AT_SETUP([AC_PATH_PROGS_FEATURE_CHECK])
637 # This test doesn't work if `pwd` contains white space
638 case `pwd` in
639   *\ * | *\     *) AT_CHECK([exit 77]) ;;
640 esac
642 AT_CHECK_PROGS_PREPARE
644 AT_DATA([configure.ac],
645 [[AC_INIT
646 pwd=`pwd`
647 p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
648 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
649 fail=false
651 # Find first candidate and stop search
652 AC_PATH_PROGS_FEATURE_CHECK(TOOL1, [tool better],
653   [$ac_path_TOOL1 && ac_cv_path_TOOL1=$ac_path_TOOL1 ac_path_TOOL1_found=:],
654   fail=:, $path)
655 test -z "$TOOL1" || fail=:
656 test "$ac_cv_path_TOOL1" = "$pwd/path/1/tool" || fail=:
658 # Keep searching each candidate
659 AC_PATH_PROGS_FEATURE_CHECK(TOOL2, [tool better],
660   [$ac_path_TOOL2 && ac_cv_path_TOOL2=$ac_path_TOOL2],
661   fail=:, $path)
662 test "$ac_cv_path_TOOL2" = "$pwd/path/6/better" || fail=:
664 # Only accept better candidate
665 AC_PATH_PROGS_FEATURE_CHECK(TOOL3, [tool better],
666   [case "$ac_path_TOOL3" in #(
667     *better) ac_cv_path_TOOL3=$ac_path_TOOL3;;
668   esac],
669   fail=:, $path)
670 test "$ac_cv_path_TOOL3" = "$pwd/path/6/better" || fail=:
672 # When a tool is not found, and no action is given for not-found,
673 # the variable is left empty.
674 AC_PATH_PROGS_FEATURE_CHECK(TOOL4, missing,
675   [ac_cv_path_TOOL4=$ac_path_TOOL4], [], $path)
676 test -z "$ac_cv_path_TOOL4" || fail=:
678 # Test action when tool is not found
679 AC_PATH_PROGS_FEATURE_CHECK(TOOL5, missing, [],
680   [ac_cv_path_TOOL5='not found'], $path)
681 test "$ac_cv_path_TOOL5" = "not found" || fail=:
683 # Test that pre-set tool bypasses feature test
684 TOOL6=$pwd/path/6/better
685 AC_PATH_PROGS_FEATURE_CHECK(TOOL6, tool, fail=:, fail=:, $path)
686 test "$ac_cv_path_TOOL6" = "$pwd/path/6/better" || fail=:
688 # A blank pre-set does not bypass feature test
689 TOOL7=
690 AC_PATH_PROGS_FEATURE_CHECK(TOOL7, [tool better],
691   [$ac_path_TOOL7 && ac_cv_path_TOOL7=$ac_path_TOOL7 ac_path_TOOL7_found=:],
692   fail=:, $path)
693 test -z "$TOOL7" || fail=:
694 test "$ac_cv_path_TOOL7" = "$pwd/path/1/tool" || fail=:
696 # No AC-OUTPUT, we don't need config.status.
697 $fail &&
698   AC_MSG_ERROR([[PATH_PROG failed]])
699 AS_EXIT(0)
702 AT_CHECK_AUTOCONF
703 AT_CHECK_CONFIGURE
705 AT_CLEANUP
710 ## -------------- ##
711 ## AC_PATH_XTRA.  ##
712 ## -------------- ##
715 AT_SETUP([AC_PATH_XTRA])
717 _AT_CHECK_AC_MACRO([AC_PATH_XTRA])
719 # Check X_DISPLAY_MISSING.
720 AT_CHECK_CONFIGURE([--without-x])
721 AT_CHECK_DEFINES(
722 [#define X_DISPLAY_MISSING 1
725 AT_CLEANUP
728 ## ------------------------------- ##
729 ## Obsolete non-updatable macros.  ##
730 ## ------------------------------- ##
733 AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete])
734 AT_CHECK_MACRO([AC_FUNC_SETVBUF_REVERSED], , ,[-W no-obsolete])
735 AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-W no-obsolete])