Fix typo in previous patch.
[autoconf.git] / tests / semantics.at
blobbb4481b7220871d750fa6d6a929a675b6b811b80
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 [AT_CHECK_DEFINES(
114 [#define HAVE_DECL_MYENUM 1
115 #define HAVE_DECL_MYFUNC 1
116 #define HAVE_DECL_MYMACRO1 1
117 #define HAVE_DECL_MYMACRO2 1
118 #define HAVE_DECL_MYSTRUCT 1
119 #define HAVE_DECL_NO 0
120 #define HAVE_DECL_YES 1
121 ])])
124 # AC_CHECK_FUNCS
125 # --------------
126 # Check that it performs the correct actions:
127 # Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
128 AT_CHECK_MACRO([AC_CHECK_FUNCS],
129 [AC_CHECK_FUNCS(printf autoconf_ftnirp)],
130 [AT_CHECK_DEFINES(
131 [/* #undef HAVE_AUTOCONF_FTNIRP */
132 #define HAVE_PRINTF 1
133 ])])
136 # AC_REPLACE_FUNCS
137 # ----------------
138 # Check that it performs the correct actions: autoconf_ftnirp.c must
139 # be compiled, and must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
140 # FIXME: Maybe check the traces?
141 AT_SETUP([AC_REPLACE_FUNCS])
143 AT_DATA([config.in],
144 [@LIBOBJS@
147 AT_CONFIGURE_AC(
148 [AC_CONFIG_FILES(config.libobjs:config.in)
149 AC_REPLACE_FUNCS(printf autoconf_ftnirp)])
151 AT_CHECK_AUTOCONF([-W obsolete])
152 AT_CHECK_AUTOHEADER
153 AT_CHECK_CONFIGURE
154 AT_CHECK_ENV
155 AT_CHECK_DEFINES(
156 [/* #undef HAVE_AUTOCONF_FTNIRP */
157 #define HAVE_PRINTF 1
160 AT_CHECK([sed 's/  */ /g;s/^ //;s/ $//' config.libobjs], [],
161          [${LIBOBJDIR}autoconf_ftnirp$U.o
164 AT_CLEANUP
167 # AC_CHECK_HEADERS
168 # ----------------
169 # Check that it performs the correct actions:
170 # Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
171 AT_SETUP([AC_CHECK_HEADERS])
173 AT_DATA([autoconf_io.h],
174 [blah blah
177 AT_CONFIGURE_AC([AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
178 AT_CHECK_AUTOCONF([-W obsolete])
179 AT_CHECK_AUTOHEADER
180 AT_CHECK_CONFIGURE([CPPFLAGS=-I.], [0], [ignore],
181 [configure: WARNING: autoconf_io.h: present but cannot be compiled
182 configure: WARNING: autoconf_io.h:     check for missing prerequisite headers?
183 configure: WARNING: autoconf_io.h: see the Autoconf documentation
184 configure: WARNING: autoconf_io.h:     section "Present But Cannot Be Compiled"
185 configure: WARNING: autoconf_io.h: proceeding with the compiler's result
187 AT_CHECK_ENV
188 AT_CHECK_DEFINES(
189 [/* #undef HAVE_AUTOCONF_IO_H */
190 #define HAVE_STDIO_H 1
193 AT_CLEANUP
196 # AC_CHECK_HEADERS_OLD
197 # --------------------
198 # Check that it performs the correct actions:
199 # Must not check prerequisites, hence define header2.h
200 AT_SETUP([AC_CHECK_HEADERS (preprocessor test)])
202 AT_DATA([header1.h],
203 [typedef int foo;
206 AT_DATA([header2.h],
207 [typedef foo bar;
210 AT_CONFIGURE_AC([AC_CHECK_HEADERS(header2.h, [], [], -)])
212 AT_CHECK_AUTOCONF([-W obsolete])
213 AT_CHECK_AUTOHEADER
214 AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
215 AT_CHECK_ENV
216 AT_CHECK_DEFINES(
217 [#define HAVE_HEADER2_H 1
220 AT_CLEANUP
223 # AC_CHECK_HEADERS_NEW
224 # --------------------
225 # Check that it performs the correct actions:
226 # Must check prerequisites, hence define header2.h but not header3.h
227 AT_SETUP([AC_CHECK_HEADERS (compiler test)])
229 AT_DATA([header1.h],
230 [typedef int foo;
233 AT_DATA([header2.h],
234 [typedef foo bar;
237 AT_DATA([header3.h],
238 [typedef bar wow;
241 AT_CONFIGURE_AC(
242 [AC_CHECK_HEADERS(header2.h header3.h, [], [], [[@%:@include "header1.h"]])])
244 AT_CHECK_AUTOCONF([-W obsolete])
245 AT_CHECK_AUTOHEADER
246 AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
247 AT_CHECK_ENV
248 AT_CHECK_DEFINES(
249 [#define HAVE_HEADER2_H 1
250 /* #undef HAVE_HEADER3_H */
253 AT_CLEANUP
256 # AC_CHECK_MEMBER
257 # ---------------
258 # Check that it performs the correct actions.
259 # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
260 AT_CHECK_MACRO([AC_CHECK_MEMBER],
261 [[AC_CHECK_MEMBER([struct yes_s.yes],
262                   [AC_DEFINE([HAVE_STRUCT_YES_S_YES], [1],
263                              [Define to 1 if `yes' is a member of `struct yes_s'.])],,
264                    [struct sub { int x; };
265                     struct yes_s { int yes; struct sub substruct; };])
266   AC_CHECK_MEMBER([struct yes_s.no],
267                   [AC_DEFINE([HAVE_STRUCT_YES_S_NO], [1],
268                              [Define to 1 if `no' is a member of `struct yes_s'.])],,
269                    [struct sub { int x; };
270                     struct yes_s { int yes; struct sub substruct; };])
271   AC_CHECK_MEMBER([struct yes_s.substruct],
272                   [AC_DEFINE([HAVE_STRUCT_YES_S_SUBSTRUCT], [1],
273                              [Define to 1 if `substruct' is a member of `struct yes_s'.])],,
274                    [struct sub { int x; };
275                     struct yes_s { int yes; struct sub substruct; };])]],
276 [AT_CHECK_DEFINES(
277 [/* #undef HAVE_STRUCT_YES_S_NO */
278 #define HAVE_STRUCT_YES_S_SUBSTRUCT 1
279 #define HAVE_STRUCT_YES_S_YES 1
280 ])])
282 # AC_CHECK_MEMBERS
283 # ----------------
284 # Check that it performs the correct actions.
285 # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
286 AT_CHECK_MACRO([AC_CHECK_MEMBERS],
287 [[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no, struct yes_s.substruct],,,
288                    [struct sub { int x; };
289                     struct yes_s { int yes; struct sub substruct; };])]],
290 [AT_CHECK_DEFINES(
291 [/* #undef HAVE_STRUCT_YES_S_NO */
292 #define HAVE_STRUCT_YES_S_SUBSTRUCT 1
293 #define HAVE_STRUCT_YES_S_YES 1
295 AT_CHECK([grep 'yes.*member of.*yes_s' config.h], [], [ignore])
299 # AC_CHECK_ALIGNOF
300 # ----------------
301 AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF],
302 [[AC_CHECK_ALIGNOF(char)
303 AC_CHECK_ALIGNOF(charchar,
304 [[#include <stddef.h>
305 #include <stdio.h>
306 typedef char charchar[2];]])
307 AC_CHECK_ALIGNOF(charcharchar)
309 [AT_CHECK_DEFINES(
310 [#define ALIGNOF_CHAR 1
311 #define ALIGNOF_CHARCHAR 1
312 #define ALIGNOF_CHARCHARCHAR 0
313 ])])
316 # AC_CHECK_ALIGNOF struct
317 # -----------------------
318 AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF struct],
319 [[AC_CHECK_ALIGNOF([struct { char c; }])
320 AC_CHECK_ALIGNOF([struct nosuchstruct])
322 [AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [^0]" config.h]],
323          0, ignore)
324 AT_CHECK([[grep "#define ALIGNOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
325          0, ignore)
328 # AC_CHECK_SIZEOF
329 # ---------------
330 AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF],
331 [[AC_CHECK_SIZEOF(char)
332 AC_CHECK_SIZEOF(charchar,,
333 [[#include <stdio.h>
334 typedef char charchar[2];]])
335 AC_CHECK_SIZEOF(charcharchar)
337 [AT_CHECK_DEFINES(
338 [#define SIZEOF_CHAR 1
339 #define SIZEOF_CHARCHAR 2
340 #define SIZEOF_CHARCHARCHAR 0
341 ])])
344 # AC_CHECK_SIZEOF struct
345 # ----------------------
346 AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF struct],
347 [[AC_C_CONST
348 AC_CHECK_SIZEOF([struct x], [], [struct x { char c; int x; };])
349 AC_CHECK_SIZEOF([const struct x], [], [struct x { const char *p; int x; };])
350 AC_CHECK_SIZEOF([struct nosuchstruct])
352 [AT_CHECK([[grep "#define SIZEOF_STRUCT_X [^0]" config.h]],
353          0, ignore)
354 AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT_X [^0]" config.h]],
355          0, ignore)
356 AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
357          0, ignore)
361 # AC_CHECK_TYPES
362 # --------------
363 # Check that it performs the correct actions.
364 # Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S.
365 # `int' and `struct yes_s' are both checked to test both the compiler
366 # builtin types, and defined types.
367 AT_CHECK_MACRO([AC_CHECK_TYPES],
368 [[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,,
369                  [struct yes_s { int yes ;} ;])]],
370 [AT_CHECK_DEFINES(
371 [#define HAVE_INT 1
372 /* #undef HAVE_STRUCT_NO_S */
373 #define HAVE_STRUCT_YES_S 1
374 ])])
377 # AC_CHECK_TYPES
378 # --------------
379 # Check that we properly dispatch properly to the old implementation
380 # or to the new one.
381 AT_SETUP([AC_CHECK_TYPES: backward compatibility])
383 AT_DATA([configure.ac],
384 [[AC_INIT
385 define([_AC_CHECK_TYPE_NEW], [NEW])
386 define([_AC_CHECK_TYPE_OLD], [OLD])
387 #(cut-from-here
388 AC_CHECK_TYPE(ptrdiff_t)
389 AC_CHECK_TYPE(ptrdiff_t, int)
390 AC_CHECK_TYPE(quad, long long int)
391 AC_CHECK_TYPE(table_42, [int[42]])
392 # Nice machine!
393 AC_CHECK_TYPE(uint8_t, uint65536_t)
394 AC_CHECK_TYPE(a,b,c,d)
395 #to-here)
396 AC_OUTPUT
399 AT_CHECK_AUTOCONF
400 AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]],
401          0,
402          [NEW
410 AT_CLEANUP
413 # AC_CHECK_FILES
414 # --------------
415 # FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
416 # open AH_TEMPLATE to `configure.ac', which is not yet the case.
417 AT_CHECK_MACRO([AC_CHECK_FILES],
418 [touch at-exists1 at-exists2
419 ac_exists2=at-exists2
420 ac_missing2=at-missing2
421 AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
422 rm at-exists1 at-exists2],
423 [AT_CHECK_DEFINES(
424 [#define HAVE_AT_EXISTS1 1
425 /* #undef HAVE_AT_MISSING1 */
426 ])])
430 ## ------------------------------ ##
431 ## AC_CHECK_PROG & AC_PATH_PROG.  ##
432 ## ------------------------------ ##
435 # AT_CHECK_PROGS_PREPARE
436 # ----------------------
437 # Create a sub directory `path' with 6 subdirs which all 7 contain
438 # an executable `tool'. `6' contains a `better' tool.
439 m4_define([AT_CHECK_PROGS_PREPARE],
440 [mkdir path
442 cat >path/tool <<\EOF
443 #! /bin/sh
444 exit 0
446 chmod +x path/tool
448 for i in 1 2 3 4 5 6
450   mkdir path/$i
451   cp path/tool path/$i
452 done
453 cp path/tool path/6/better])
456 # -------------------------------- #
457 # AC_CHECK_PROG & AC_CHECK_PROGS.  #
458 # -------------------------------- #
460 AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS])
462 AT_CHECK_PROGS_PREPARE
464 AT_DATA([configure.ac],
465 [[AC_INIT
466 pwd=`pwd`
467 p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
468 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
469 fail=false
471 AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
472 test "$TOOL1" = found || fail=:
474 # Yes, the semantics of this macro is weird.
475 AC_CHECK_PROG(TOOL2, tool,, not-found, $path)
476 test "$TOOL2" = not-found || fail=:
478 AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
479 test "$TOOL3" = "$pwd/path/2/tool" || fail=:
481 AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
482 test "$TOOL4" = better || fail=:
484 # When a tool is not found, and no value is given for not-found,
485 # the variable is left empty.
486 AC_CHECK_PROGS(TOOL5, missing,, $path)
487 test -z "$TOOL5" || fail=:
489 AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
490 test "$TOOL6" = tool || fail=:
492 # No AC-OUTPUT, we don't need config.status.
493 $fail &&
494   AC_MSG_ERROR([[CHECK_PROG failed]])
495 AS_EXIT(0)
498 AT_CHECK_AUTOCONF
499 AT_CHECK_CONFIGURE
501 AT_CLEANUP
505 ## ---------------- ##
506 ## AC_C_BIGENDIAN.  ##
507 ## ---------------- ##
509 AT_SETUP([AC_C_BIGENDIAN])
510 AT_KEYWORDS([cross])
512 # Make sure that AC_C_BIGENDIAN behave the same whether we are
513 # cross-compiling or not.
515 _AT_CHECK_AC_MACRO(
516   [[AC_C_BIGENDIAN(
517       [ac_endian=big],
518       [ac_endian=little],
519       [ac_endian=unknown],
520       [ac_endian=universal])
521    echo $ac_endian > at-endian
524 rm -f config.hin  # So that next run of autoheader is quiet.
525 _AT_CHECK_AC_MACRO(
526   [[# Force cross compiling.
527    cross_compiling=yes
528    ac_tool_warned=yes
529    AC_C_BIGENDIAN(
530      [ac_endian=big],
531      [ac_endian=little],
532      [ac_endian=unknown],
533      [ac_endian=universal])
534    ac_prevendian=`cat at-endian`
535    # Check that we have found the same result as in the previous run
536    # or unknown (because the cross-compiling check is allowed to fail;
537    # although it might be interesting to suppress this comparison, just
538    # to know on which system it fails if it ever does).
539    if test $ac_endian != $ac_prevendian && test $ac_endian != unknown; then
540      AC_MSG_ERROR([unexpected endianness: first run found '$ac_prevendian' but second run found '$ac_endian'])
541    fi
544 # Make sure AC_C_BIGENDIAN with no argument will create a config.h template
545 # containing "WORDS_BIGENDIAN".
546 AT_CONFIGURE_AC([[AC_C_BIGENDIAN]])
547 # --force is necessary, the computer might be too fast.
548 AT_CHECK_AUTOHEADER([--force])
549 AT_CHECK([grep WORDS_BIGENDIAN config.hin], [], [ignore])
551 AT_CLEANUP
554 # ------------------------------ #
555 # AC_PATH_PROG & AC_PATH_PROGS.  #
556 # ------------------------------ #
558 AT_SETUP([AC_PATH_PROG & AC_PATH_PROGS])
560 AT_CHECK_PROGS_PREPARE
562 AT_DATA([configure.ac],
563 [[AC_INIT
564 pwd=`pwd`
565 p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
566 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
567 fail=false
569 AC_PATH_PROG(TOOL1, tool, not-found, $path)
570 test "$TOOL1" = "$pwd/path/1/tool" || fail=:
572 AC_PATH_PROG(TOOL2, better, not-found, $path)
573 test "$TOOL2" = "$pwd/path/6/better" || fail=:
575 # When a tool is not found, and no value is given for not-found,
576 # the variable is left empty.
577 AC_PATH_PROGS(TOOL3, missing,, $path)
578 test -z "$TOOL3" || fail=:
580 AC_PATH_PROGS(TOOL4, missing tool better,, $path)
581 test "$TOOL4" = "$pwd/path/1/tool" || fail=:
583 # No AC-OUTPUT, we don't need config.status.
584 $fail &&
585   AC_MSG_ERROR([[PATH_PROG failed]])
586 AS_EXIT(0)
589 AT_CHECK_AUTOCONF
590 AT_CHECK_CONFIGURE
592 AT_CLEANUP
596 # ----------------------------- #
597 # AC_PATH_PROGS_FEATURE_CHECK.  #
598 # ----------------------------- #
600 AT_SETUP([AC_PATH_PROGS_FEATURE_CHECK])
602 # This test doesn't work if `pwd` contains white space
603 case `pwd` in
604   *\ * | *\     *) AT_CHECK([exit 77]) ;;
605 esac
607 AT_CHECK_PROGS_PREPARE
609 AT_DATA([configure.ac],
610 [[AC_INIT
611 pwd=`pwd`
612 p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
613 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
614 fail=false
616 # Find first candidate and stop search
617 AC_PATH_PROGS_FEATURE_CHECK(TOOL1, [tool better],
618   [$ac_path_TOOL1 && ac_cv_path_TOOL1=$ac_path_TOOL1 ac_path_TOOL1_found=:],
619   fail=:, $path)
620 test -z "$TOOL1" || fail=:
621 test "$ac_cv_path_TOOL1" = "$pwd/path/1/tool" || fail=:
623 # Keep searching each candidate
624 AC_PATH_PROGS_FEATURE_CHECK(TOOL2, [tool better],
625   [$ac_path_TOOL2 && ac_cv_path_TOOL2=$ac_path_TOOL2],
626   fail=:, $path)
627 test "$ac_cv_path_TOOL2" = "$pwd/path/6/better" || fail=:
629 # Only accept better candidate
630 AC_PATH_PROGS_FEATURE_CHECK(TOOL3, [tool better],
631   [case "$ac_path_TOOL3" in #(
632     *better) ac_cv_path_TOOL3=$ac_path_TOOL3;;
633   esac],
634   fail=:, $path)
635 test "$ac_cv_path_TOOL3" = "$pwd/path/6/better" || fail=:
637 # When a tool is not found, and no action is given for not-found,
638 # the variable is left empty.
639 AC_PATH_PROGS_FEATURE_CHECK(TOOL4, missing,
640   [ac_cv_path_TOOL4=$ac_path_TOOL4], [], $path)
641 test -z "$ac_cv_path_TOOL4" || fail=:
643 # Test action when tool is not found
644 AC_PATH_PROGS_FEATURE_CHECK(TOOL5, missing, [],
645   [ac_cv_path_TOOL5='not found'], $path)
646 test "$ac_cv_path_TOOL5" = "not found" || fail=:
648 # Test that pre-set tool bypasses feature test
649 TOOL6=$pwd/path/6/better
650 AC_PATH_PROGS_FEATURE_CHECK(TOOL6, tool, fail=:, fail=:, $path)
651 test "$ac_cv_path_TOOL6" = "$pwd/path/6/better" || fail=:
653 # A blank pre-set does not bypass feature test
654 TOOL7=
655 AC_PATH_PROGS_FEATURE_CHECK(TOOL7, [tool better],
656   [$ac_path_TOOL7 && ac_cv_path_TOOL7=$ac_path_TOOL7 ac_path_TOOL7_found=:],
657   fail=:, $path)
658 test -z "$TOOL7" || fail=:
659 test "$ac_cv_path_TOOL7" = "$pwd/path/1/tool" || fail=:
661 # No AC-OUTPUT, we don't need config.status.
662 $fail &&
663   AC_MSG_ERROR([[PATH_PROG failed]])
664 AS_EXIT(0)
667 AT_CHECK_AUTOCONF
668 AT_CHECK_CONFIGURE
670 AT_CLEANUP
675 ## -------------- ##
676 ## AC_PATH_XTRA.  ##
677 ## -------------- ##
680 AT_SETUP([AC_PATH_XTRA])
682 _AT_CHECK_AC_MACRO([AC_PATH_XTRA])
684 # Check X_DISPLAY_MISSING.
685 AT_CHECK_CONFIGURE([--without-x])
686 AT_CHECK_DEFINES(
687 [#define X_DISPLAY_MISSING 1
690 AT_CLEANUP
693 ## ------------------------------- ##
694 ## Obsolete non-updatable macros.  ##
695 ## ------------------------------- ##
698 AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete])
699 AT_CHECK_MACRO([AC_FUNC_SETVBUF_REVERSED], , ,[-W no-obsolete])
700 AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-W no-obsolete])