| 1 | # -*- Autotest -*-
|
|---|
| 2 |
|
|---|
| 3 | AT_BANNER([Semantics.])
|
|---|
| 4 |
|
|---|
| 5 | # Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Free Software
|
|---|
| 6 | # Foundation, Inc.
|
|---|
| 7 | #
|
|---|
| 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 2, or (at your option)
|
|---|
| 11 | # any later version.
|
|---|
| 12 | #
|
|---|
| 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.
|
|---|
| 17 | #
|
|---|
| 18 | # You should have received a copy of the GNU General Public License
|
|---|
| 19 | # along with this program; if not, write to the Free Software
|
|---|
| 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|---|
| 21 | # 02110-1301, USA.
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | ## -------------------------------- ##
|
|---|
| 25 | ## Members of the AC_CHECK family. ##
|
|---|
| 26 | ## -------------------------------- ##
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | # AC_CHECK_LIB
|
|---|
| 30 | # ------------
|
|---|
| 31 | # Well, I can't imagine a system where `cos' is neither in libc, nor
|
|---|
| 32 | # in libm. Nor can I imagine a lib more likely to exists than libm.
|
|---|
| 33 | # But there are systems without libm, on which we don't want to have
|
|---|
| 34 | # this test fail, so exit successfully if `cos' is in libc.
|
|---|
| 35 | AT_CHECK_MACRO([AC_CHECK_LIB],
|
|---|
| 36 | [AC_TRY_LINK_FUNC(cos,
|
|---|
| 37 | [AC_MSG_ERROR([`cos' is in `libc'], 77)])
|
|---|
| 38 |
|
|---|
| 39 | AC_CHECK_LIB(m, cos,,
|
|---|
| 40 | [AC_MSG_ERROR([cannot find `cos' in `libm'])])
|
|---|
| 41 |
|
|---|
| 42 | # No kidding, using variables was broken in 2.50 :(
|
|---|
| 43 | ac_sin=sin
|
|---|
| 44 | AC_CHECK_LIB(m, $ac_sin,,
|
|---|
| 45 | [AC_MSG_ERROR([cannot find `\$ac_sin' (= `$ac_sin') in `libm'])])
|
|---|
| 46 |
|
|---|
| 47 | ac_m=m
|
|---|
| 48 | AC_CHECK_LIB($ac_m, acos,,
|
|---|
| 49 | [AC_MSG_ERROR([cannot find `acos' in `\$ac_m' (= `$ac_m')])])
|
|---|
| 50 |
|
|---|
| 51 | ac_asin=asin
|
|---|
| 52 | AC_CHECK_LIB($ac_m, $ac_asin,,
|
|---|
| 53 | [AC_MSG_ERROR([cannot find `\$ac_asin' (= `$ac_asin') in `\$ac_m' (= `$at_m')])])
|
|---|
| 54 |
|
|---|
| 55 | # But if the bug is in the caching mechanism, then be sure we
|
|---|
| 56 | # correctly detect failures.
|
|---|
| 57 |
|
|---|
| 58 | AC_CHECK_LIB(m, cossack,
|
|---|
| 59 | [AC_MSG_ERROR([found `cossack' in `libm'])])
|
|---|
| 60 |
|
|---|
| 61 | # No kidding, using variables was broken in 2.50 :(
|
|---|
| 62 | ac_sinner=sinner
|
|---|
| 63 | AC_CHECK_LIB(m, $ac_sinner,
|
|---|
| 64 | [AC_MSG_ERROR([found `\$ac_sinner' (= `$ac_sinner') in `libm'])])
|
|---|
| 65 |
|
|---|
| 66 | ac_m=m
|
|---|
| 67 | AC_CHECK_LIB($ac_m, acossack,
|
|---|
| 68 | [AC_MSG_ERROR([found `acossack' in `\$ac_m' (= `$ac_m')])])
|
|---|
| 69 |
|
|---|
| 70 | ac_asinner=asinner
|
|---|
| 71 | AC_CHECK_LIB($ac_m, $ac_asinner,
|
|---|
| 72 | [AC_MSG_ERROR([found `\$ac_asinner' (= `$ac_asinner') in `\$ac_m' (= `$at_m')])])
|
|---|
| 73 |
|
|---|
| 74 | ])
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | # AC_SEARCH_LIBS
|
|---|
| 78 | # --------------
|
|---|
| 79 | AT_CHECK_MACRO([AC_SEARCH_LIBS],
|
|---|
| 80 | [
|
|---|
| 81 | AC_SEARCH_LIBS(cos, oser m ust,,
|
|---|
| 82 | [AC_MSG_ERROR([cannot find `cos'])])
|
|---|
| 83 |
|
|---|
| 84 | case "$ac_cv_search_cos" in
|
|---|
| 85 | -loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_cos must be a cool library!]) ;;
|
|---|
| 86 | esac
|
|---|
| 87 | ])
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 | # AC_SEARCH_LIBS (none needed)
|
|---|
| 91 | # ----------------------------
|
|---|
| 92 | AT_CHECK_MACRO([AC_SEARCH_LIBS (none needed)],
|
|---|
| 93 | [
|
|---|
| 94 | AC_SEARCH_LIBS(printf, oser c ust,,
|
|---|
| 95 | [AC_MSG_ERROR([cannot find `printf'])])
|
|---|
| 96 |
|
|---|
| 97 | case "$ac_cv_search_printf" in
|
|---|
| 98 | -loser|-lust) AC_MSG_ERROR([jeez, $ac_cv_search_printf must be a cool library!]) ;;
|
|---|
| 99 | -lc) AC_MSG_ERROR([huh, you need to give -lc?])
|
|---|
| 100 | esac
|
|---|
| 101 | ])
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | # AC_CHECK_DECLS
|
|---|
| 105 | # --------------
|
|---|
| 106 | # Check that it performs the correct actions:
|
|---|
| 107 | AT_CHECK_MACRO([AC_CHECK_DECLS],
|
|---|
| 108 | [[AC_CHECK_DECLS([yes, no, myenum, mystruct, myfunc, mymacro1, mymacro2],,,
|
|---|
| 109 | [[int yes = 1;
|
|---|
| 110 | enum { myenum };
|
|---|
| 111 | struct { int x[20]; } mystruct;
|
|---|
| 112 | extern int myfunc();
|
|---|
| 113 | #define mymacro1(arg) arg
|
|---|
| 114 | #define mymacro2]])]],
|
|---|
| 115 | [AT_CHECK_DEFINES(
|
|---|
| 116 | [#define HAVE_DECL_MYENUM 1
|
|---|
| 117 | #define HAVE_DECL_MYFUNC 1
|
|---|
| 118 | #define HAVE_DECL_MYMACRO1 1
|
|---|
| 119 | #define HAVE_DECL_MYMACRO2 1
|
|---|
| 120 | #define HAVE_DECL_MYSTRUCT 1
|
|---|
| 121 | #define HAVE_DECL_NO 0
|
|---|
| 122 | #define HAVE_DECL_YES 1
|
|---|
| 123 | ])])
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 | # AC_CHECK_FUNCS
|
|---|
| 127 | # --------------
|
|---|
| 128 | # Check that it performs the correct actions:
|
|---|
| 129 | # Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
|
|---|
| 130 | AT_CHECK_MACRO([AC_CHECK_FUNCS],
|
|---|
| 131 | [AC_CHECK_FUNCS(printf autoconf_ftnirp)],
|
|---|
| 132 | [AT_CHECK_DEFINES(
|
|---|
| 133 | [/* #undef HAVE_AUTOCONF_FTNIRP */
|
|---|
| 134 | #define HAVE_PRINTF 1
|
|---|
| 135 | ])])
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | # AC_REPLACE_FUNCS
|
|---|
| 139 | # ----------------
|
|---|
| 140 | # Check that it performs the correct actions: autoconf_ftnirp.c must
|
|---|
| 141 | # be compiled, and must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
|
|---|
| 142 | # FIXME: Maybe check the traces?
|
|---|
| 143 | AT_SETUP([AC_REPLACE_FUNCS])
|
|---|
| 144 |
|
|---|
| 145 | AT_DATA([config.in],
|
|---|
| 146 | [@LIBOBJS@
|
|---|
| 147 | ])
|
|---|
| 148 |
|
|---|
| 149 | AT_CONFIGURE_AC(
|
|---|
| 150 | [AC_CONFIG_FILES(config.libobjs:config.in)
|
|---|
| 151 | AC_REPLACE_FUNCS(printf autoconf_ftnirp)])
|
|---|
| 152 |
|
|---|
| 153 | AT_CHECK_AUTOCONF([-W obsolete])
|
|---|
| 154 | AT_CHECK_AUTOHEADER
|
|---|
| 155 | AT_CHECK_CONFIGURE
|
|---|
| 156 | AT_CHECK_ENV
|
|---|
| 157 | AT_CHECK_DEFINES(
|
|---|
| 158 | [/* #undef HAVE_AUTOCONF_FTNIRP */
|
|---|
| 159 | #define HAVE_PRINTF 1
|
|---|
| 160 | ])
|
|---|
| 161 |
|
|---|
| 162 | AT_CHECK([sed 's/ */ /g;s/^ //;s/ $//' config.libobjs], [],
|
|---|
| 163 | [${LIBOBJDIR}autoconf_ftnirp$U.o
|
|---|
| 164 | ])
|
|---|
| 165 |
|
|---|
| 166 | AT_CLEANUP([config.libobjs])
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 | # AC_CHECK_HEADERS
|
|---|
| 170 | # ----------------
|
|---|
| 171 | # Check that it performs the correct actions:
|
|---|
| 172 | # Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
|
|---|
| 173 | AT_CHECK_MACRO([AC_CHECK_HEADERS],
|
|---|
| 174 | [AC_CHECK_HEADERS(stdio.h autoconf_io.h)],
|
|---|
| 175 | [AT_CHECK_DEFINES(
|
|---|
| 176 | [/* #undef HAVE_AUTOCONF_IO_H */
|
|---|
| 177 | #define HAVE_STDIO_H 1
|
|---|
| 178 | ])])
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | # AC_CHECK_HEADERS_OLD
|
|---|
| 182 | # --------------------
|
|---|
| 183 | # Check that it performs the correct actions:
|
|---|
| 184 | # Must not check prerequisites, hence define header2.h
|
|---|
| 185 | AT_SETUP([AC_CHECK_HEADERS_OLD])
|
|---|
| 186 |
|
|---|
| 187 | AT_DATA([header1.h],
|
|---|
| 188 | [typedef int foo;
|
|---|
| 189 | ])
|
|---|
| 190 |
|
|---|
| 191 | AT_DATA([header2.h],
|
|---|
| 192 | [typedef foo bar;
|
|---|
| 193 | ])
|
|---|
| 194 |
|
|---|
| 195 | AT_CONFIGURE_AC([AC_CHECK_HEADERS(header2.h, [], [], -)])
|
|---|
| 196 |
|
|---|
| 197 | AT_CHECK_AUTOCONF([-W obsolete])
|
|---|
| 198 | AT_CHECK_AUTOHEADER
|
|---|
| 199 | AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
|
|---|
| 200 | AT_CHECK_ENV
|
|---|
| 201 | AT_CHECK_DEFINES(
|
|---|
| 202 | [#define HAVE_HEADER2_H 1
|
|---|
| 203 | ])
|
|---|
| 204 |
|
|---|
| 205 | AT_CLEANUP([header1.h header2.h])
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 | # AC_CHECK_HEADERS_NEW
|
|---|
| 209 | # --------------------
|
|---|
| 210 | # Check that it performs the correct actions:
|
|---|
| 211 | # Must check prerequisites, hence define header2.h but not header3.h
|
|---|
| 212 | AT_SETUP([AC_CHECK_HEADERS_NEW])
|
|---|
| 213 |
|
|---|
| 214 | AT_DATA([header1.h],
|
|---|
| 215 | [typedef int foo;
|
|---|
| 216 | ])
|
|---|
| 217 |
|
|---|
| 218 | AT_DATA([header2.h],
|
|---|
| 219 | [typedef foo bar;
|
|---|
| 220 | ])
|
|---|
| 221 |
|
|---|
| 222 | AT_DATA([header3.h],
|
|---|
| 223 | [typedef bar wow;
|
|---|
| 224 | ])
|
|---|
| 225 |
|
|---|
| 226 | AT_CONFIGURE_AC(
|
|---|
| 227 | [AC_CHECK_HEADERS(header2.h header3.h, [], [], [[@%:@include "header1.h"]])])
|
|---|
| 228 |
|
|---|
| 229 | AT_CHECK_AUTOCONF([-W obsolete])
|
|---|
| 230 | AT_CHECK_AUTOHEADER
|
|---|
| 231 | AT_CHECK_CONFIGURE([CPPFLAGS=-I.])
|
|---|
| 232 | AT_CHECK_ENV
|
|---|
| 233 | AT_CHECK_DEFINES(
|
|---|
| 234 | [#define HAVE_HEADER2_H 1
|
|---|
| 235 | /* #undef HAVE_HEADER3_H */
|
|---|
| 236 | ])
|
|---|
| 237 |
|
|---|
| 238 | AT_CLEANUP([header1.h header2.h header3.h])
|
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 | # AC_CHECK_MEMBERS
|
|---|
| 242 | # ----------------
|
|---|
| 243 | # Check that it performs the correct actions.
|
|---|
| 244 | # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
|
|---|
| 245 | AT_CHECK_MACRO([AC_CHECK_MEMBERS],
|
|---|
| 246 | [[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no, struct yes_s.substruct],,,
|
|---|
| 247 | [struct sub { int x; };
|
|---|
| 248 | struct yes_s { int yes; struct sub substruct; };])]],
|
|---|
| 249 | [AT_CHECK_DEFINES(
|
|---|
| 250 | [/* #undef HAVE_STRUCT_YES_S_NO */
|
|---|
| 251 | #define HAVE_STRUCT_YES_S_SUBSTRUCT 1
|
|---|
| 252 | #define HAVE_STRUCT_YES_S_YES 1
|
|---|
| 253 | ])])
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 | # AC_CHECK_ALIGNOF
|
|---|
| 257 | # ----------------
|
|---|
| 258 | AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF],
|
|---|
| 259 | [[AC_CHECK_ALIGNOF(char)
|
|---|
| 260 | AC_CHECK_ALIGNOF(charchar,
|
|---|
| 261 | [[#include <stddef.h>
|
|---|
| 262 | #include <stdio.h>
|
|---|
| 263 | typedef char charchar[2];]])
|
|---|
| 264 | AC_CHECK_ALIGNOF(charcharchar)
|
|---|
| 265 | ]],
|
|---|
| 266 | [AT_CHECK_DEFINES(
|
|---|
| 267 | [#define ALIGNOF_CHAR 1
|
|---|
| 268 | #define ALIGNOF_CHARCHAR 1
|
|---|
| 269 | #define ALIGNOF_CHARCHARCHAR 0
|
|---|
| 270 | ])])
|
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 | # AC_CHECK_ALIGNOF struct
|
|---|
| 274 | # -----------------------
|
|---|
| 275 | AT_CHECK_MACRO_CROSS([AC_CHECK_ALIGNOF struct],
|
|---|
| 276 | [[AC_CHECK_ALIGNOF([struct { char c; }])
|
|---|
| 277 | AC_CHECK_ALIGNOF([struct nosuchstruct])
|
|---|
| 278 | ]],
|
|---|
| 279 | [AT_CHECK([[grep "#define ALIGNOF_STRUCT___CHAR_C___ [^0]" config.h]],
|
|---|
| 280 | 0, ignore)
|
|---|
| 281 | AT_CHECK([[grep "#define ALIGNOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
|
|---|
| 282 | 0, ignore)
|
|---|
| 283 | ])
|
|---|
| 284 |
|
|---|
| 285 | # AC_CHECK_SIZEOF
|
|---|
| 286 | # ---------------
|
|---|
| 287 | AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF],
|
|---|
| 288 | [[AC_CHECK_SIZEOF(char)
|
|---|
| 289 | AC_CHECK_SIZEOF(charchar,,
|
|---|
| 290 | [[#include <stdio.h>
|
|---|
| 291 | typedef char charchar[2];]])
|
|---|
| 292 | AC_CHECK_SIZEOF(charcharchar)
|
|---|
| 293 | ]],
|
|---|
| 294 | [AT_CHECK_DEFINES(
|
|---|
| 295 | [#define SIZEOF_CHAR 1
|
|---|
| 296 | #define SIZEOF_CHARCHAR 2
|
|---|
| 297 | #define SIZEOF_CHARCHARCHAR 0
|
|---|
| 298 | ])])
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 | # AC_CHECK_SIZEOF struct
|
|---|
| 302 | # ----------------------
|
|---|
| 303 | AT_CHECK_MACRO_CROSS([AC_CHECK_SIZEOF struct],
|
|---|
| 304 | [[AC_C_CONST
|
|---|
| 305 | AC_CHECK_SIZEOF([struct { char c; int x; }])
|
|---|
| 306 | AC_CHECK_SIZEOF([const struct { const char *p; int x; }])
|
|---|
| 307 | AC_CHECK_SIZEOF([struct nosuchstruct])
|
|---|
| 308 | ]],
|
|---|
| 309 | [AT_CHECK([[grep "#define SIZEOF_STRUCT___CHAR_C__INT_X___ [^0]" config.h]],
|
|---|
| 310 | 0, ignore)
|
|---|
| 311 | AT_CHECK([[grep "#define SIZEOF_CONST_STRUCT___CONST_CHAR_PP__INT_X___ [^0]" config.h]],
|
|---|
| 312 | 0, ignore)
|
|---|
| 313 | AT_CHECK([[grep "#define SIZEOF_STRUCT_NOSUCHSTRUCT 0" config.h]],
|
|---|
| 314 | 0, ignore)
|
|---|
| 315 | ])
|
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 | # AC_CHECK_TYPES
|
|---|
| 319 | # --------------
|
|---|
| 320 | # Check that it performs the correct actions.
|
|---|
| 321 | # Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S.
|
|---|
| 322 | # `int' and `struct yes_s' are both checked to test both the compiler
|
|---|
| 323 | # builtin types, and defined types.
|
|---|
| 324 | AT_CHECK_MACRO([AC_CHECK_TYPES],
|
|---|
| 325 | [[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,,
|
|---|
| 326 | [struct yes_s { int yes ;} ;])]],
|
|---|
| 327 | [AT_CHECK_DEFINES(
|
|---|
| 328 | [#define HAVE_INT 1
|
|---|
| 329 | /* #undef HAVE_STRUCT_NO_S */
|
|---|
| 330 | #define HAVE_STRUCT_YES_S 1
|
|---|
| 331 | ])])
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 | # AC_CHECK_TYPES
|
|---|
| 335 | # --------------
|
|---|
| 336 | # Check that we properly dispatch properly to the old implementation
|
|---|
| 337 | # or to the new one.
|
|---|
| 338 | AT_SETUP([AC_CHECK_TYPES: backward compatibility])
|
|---|
| 339 |
|
|---|
| 340 | AT_DATA([configure.ac],
|
|---|
| 341 | [[AC_INIT
|
|---|
| 342 | define([_AC_CHECK_TYPE_NEW], [NEW])
|
|---|
| 343 | define([_AC_CHECK_TYPE_OLD], [OLD])
|
|---|
| 344 | #(cut-from-here
|
|---|
| 345 | AC_CHECK_TYPE(ptrdiff_t)
|
|---|
| 346 | AC_CHECK_TYPE(ptrdiff_t, int)
|
|---|
| 347 | AC_CHECK_TYPE(quad, long long int)
|
|---|
| 348 | AC_CHECK_TYPE(table_42, [int[42]])
|
|---|
| 349 | # Nice machine!
|
|---|
| 350 | AC_CHECK_TYPE(uint8_t, uint65536_t)
|
|---|
| 351 | AC_CHECK_TYPE(a,b,c,d)
|
|---|
| 352 | #to-here)
|
|---|
| 353 | AC_OUTPUT
|
|---|
| 354 | ]])
|
|---|
| 355 |
|
|---|
| 356 | AT_CHECK_AUTOCONF
|
|---|
| 357 | AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]],
|
|---|
| 358 | 0,
|
|---|
| 359 | [NEW
|
|---|
| 360 | OLD
|
|---|
| 361 | OLD
|
|---|
| 362 | OLD
|
|---|
| 363 | OLD
|
|---|
| 364 | NEW
|
|---|
| 365 | ])
|
|---|
| 366 |
|
|---|
| 367 | AT_CLEANUP
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 | # AC_CHECK_FILES
|
|---|
| 371 | # --------------
|
|---|
| 372 | # FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
|
|---|
| 373 | # open AH_TEMPLATE to `configure.ac', which is not yet the case.
|
|---|
| 374 | AT_CHECK_MACRO([AC_CHECK_FILES],
|
|---|
| 375 | [touch at-exists1 at-exists2
|
|---|
| 376 | ac_exists2=at-exists2
|
|---|
| 377 | ac_missing2=at-missing2
|
|---|
| 378 | AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
|
|---|
| 379 | rm at-exists1 at-exists2],
|
|---|
| 380 | [AT_CHECK_DEFINES(
|
|---|
| 381 | [#define HAVE_AT_EXISTS1 1
|
|---|
| 382 | /* #undef HAVE_AT_MISSING1 */
|
|---|
| 383 | ])])
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 | ## ------------------------------ ##
|
|---|
| 388 | ## AC_CHECK_PROG & AC_PATH_PROG. ##
|
|---|
| 389 | ## ------------------------------ ##
|
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 | # AT_CHECK_PROGS_PREPARE
|
|---|
| 393 | # ----------------------
|
|---|
| 394 | # Create a sub directory `path' with 6 subdirs which all 7 contain
|
|---|
| 395 | # an executable `tool'. `6' contains a `better' tool.
|
|---|
| 396 | m4_define([AT_CHECK_PROGS_PREPARE],
|
|---|
| 397 | [mkdir path
|
|---|
| 398 |
|
|---|
| 399 | cat >path/tool <<\EOF
|
|---|
| 400 | #! /bin/sh
|
|---|
| 401 | exit 0
|
|---|
| 402 | EOF
|
|---|
| 403 | chmod +x path/tool
|
|---|
| 404 |
|
|---|
| 405 | for i in 1 2 3 4 5 6
|
|---|
| 406 | do
|
|---|
| 407 | mkdir path/$i
|
|---|
| 408 | cp path/tool path/$i
|
|---|
| 409 | done
|
|---|
| 410 | cp path/tool path/6/better])
|
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 | # -------------------------------- #
|
|---|
| 414 | # AC_CHECK_PROG & AC_CHECK_PROGS. #
|
|---|
| 415 | # -------------------------------- #
|
|---|
| 416 |
|
|---|
| 417 | AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS])
|
|---|
| 418 |
|
|---|
| 419 | AT_CHECK_PROGS_PREPARE
|
|---|
| 420 |
|
|---|
| 421 | AT_DATA([configure.ac],
|
|---|
| 422 | [[AC_INIT
|
|---|
| 423 | pwd=`pwd`
|
|---|
| 424 | p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
|
|---|
| 425 | path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
|
|---|
| 426 | fail=false
|
|---|
| 427 |
|
|---|
| 428 | AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
|
|---|
| 429 | test "$TOOL1" = found || fail=:
|
|---|
| 430 |
|
|---|
| 431 | # Yes, the semantics of this macro is weird.
|
|---|
| 432 | AC_CHECK_PROG(TOOL2, tool,, not-found, $path)
|
|---|
| 433 | test "$TOOL2" = not-found || fail=:
|
|---|
| 434 |
|
|---|
| 435 | AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
|
|---|
| 436 | test "$TOOL3" = "$pwd/path/2/tool" || fail=:
|
|---|
| 437 |
|
|---|
| 438 | AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
|
|---|
| 439 | test "$TOOL4" = better || fail=:
|
|---|
| 440 |
|
|---|
| 441 | # When a tool is not found, and no value is given for not-found,
|
|---|
| 442 | # the variable is left empty.
|
|---|
| 443 | AC_CHECK_PROGS(TOOL5, missing,, $path)
|
|---|
| 444 | test -z "$TOOL5" || fail=:
|
|---|
| 445 |
|
|---|
| 446 | AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
|
|---|
| 447 | test "$TOOL6" = tool || fail=:
|
|---|
| 448 |
|
|---|
| 449 | # No AC-OUTPUT, we don't need config.status.
|
|---|
| 450 | $fail &&
|
|---|
| 451 | AC_MSG_ERROR([[CHECK_PROG failed]])
|
|---|
| 452 | AS_EXIT(0)
|
|---|
| 453 | ]])
|
|---|
| 454 |
|
|---|
| 455 | AT_CHECK_AUTOCONF
|
|---|
| 456 | AT_CHECK_CONFIGURE
|
|---|
| 457 |
|
|---|
| 458 | AT_CLEANUP(path)
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 | ## ---------------- ##
|
|---|
| 463 | ## AC_C_BIGENDIAN. ##
|
|---|
| 464 | ## ---------------- ##
|
|---|
| 465 |
|
|---|
| 466 | AT_SETUP([AC_C_BIGENDIAN])
|
|---|
| 467 | AT_KEYWORDS([cross])
|
|---|
| 468 |
|
|---|
| 469 | # Make sure that AC_C_BIGENDIAN behave the same whether we are
|
|---|
| 470 | # cross-compiling or not.
|
|---|
| 471 |
|
|---|
| 472 | _AT_CHECK_AC_MACRO(
|
|---|
| 473 | [[AC_C_BIGENDIAN([ac_endian=big],[ac_endian=little],[ac_endian=unknown])
|
|---|
| 474 | echo $ac_endian > at-endian
|
|---|
| 475 | ]])
|
|---|
| 476 |
|
|---|
| 477 | rm -f config.hin # So that next run of autoheader is quiet.
|
|---|
| 478 | _AT_CHECK_AC_MACRO(
|
|---|
| 479 | [[# Force cross compiling.
|
|---|
| 480 | cross_compiling=yes
|
|---|
| 481 | ac_tool_warned=yes
|
|---|
| 482 | AC_C_BIGENDIAN([ac_endian=big],[ac_endian=little],[ac_endian=unknown])
|
|---|
| 483 | ac_prevendian=`cat at-endian`
|
|---|
| 484 | # Check that we have found the same result as in the previous run
|
|---|
| 485 | # or unknown (because the cross-compiling check is allowed to fail;
|
|---|
| 486 | # although it might be interesting to suppress this comparison, just
|
|---|
| 487 | # to know on which system it fails if it ever does).
|
|---|
| 488 | if test $ac_endian != $ac_prevendian && test $ac_endian != unknown; then
|
|---|
| 489 | AC_MSG_ERROR([unexpected endianness: first run found '$ac_prevendian' but second run found '$ac_endian'])
|
|---|
| 490 | fi
|
|---|
| 491 | ]])
|
|---|
| 492 |
|
|---|
| 493 | # Make sure AC_C_BIGENDIAN with no argument will define WORDS_BIGENDIAN
|
|---|
| 494 | AT_CONFIGURE_AC([[AC_C_BIGENDIAN]])
|
|---|
| 495 | # --force is necessary, the computer might be too fast.
|
|---|
| 496 | AT_CHECK_AUTOHEADER([--force])
|
|---|
| 497 | AT_CHECK([grep WORDS_BIGENDIAN config.hin], [], [ignore])
|
|---|
| 498 |
|
|---|
| 499 | AT_CLEANUP(at-endian)
|
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 | # ------------------------------ #
|
|---|
| 503 | # AC_PATH_PROG & AC_PATH_PROGS. #
|
|---|
| 504 | # ------------------------------ #
|
|---|
| 505 |
|
|---|
| 506 | AT_SETUP([AC_PATH_PROG & AC_PATH_PROGS])
|
|---|
| 507 |
|
|---|
| 508 | AT_CHECK_PROGS_PREPARE
|
|---|
| 509 |
|
|---|
| 510 | AT_DATA([configure.ac],
|
|---|
| 511 | [[AC_INIT
|
|---|
| 512 | pwd=`pwd`
|
|---|
| 513 | p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
|
|---|
| 514 | path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
|
|---|
| 515 | fail=false
|
|---|
| 516 |
|
|---|
| 517 | AC_PATH_PROG(TOOL1, tool, not-found, $path)
|
|---|
| 518 | test "$TOOL1" = "$pwd/path/1/tool" || fail=:
|
|---|
| 519 |
|
|---|
| 520 | AC_PATH_PROG(TOOL2, better, not-found, $path)
|
|---|
| 521 | test "$TOOL2" = "$pwd/path/6/better" || fail=:
|
|---|
| 522 |
|
|---|
| 523 | # When a tool is not found, and no value is given for not-found,
|
|---|
| 524 | # the variable is left empty.
|
|---|
| 525 | AC_PATH_PROGS(TOOL3, missing,, $path)
|
|---|
| 526 | test -z "$TOOL3" || fail=:
|
|---|
| 527 |
|
|---|
| 528 | AC_PATH_PROGS(TOOL4, missing tool better,, $path)
|
|---|
| 529 | test "$TOOL4" = "$pwd/path/1/tool" || fail=:
|
|---|
| 530 |
|
|---|
| 531 | # No AC-OUTPUT, we don't need config.status.
|
|---|
| 532 | $fail &&
|
|---|
| 533 | AC_MSG_ERROR([[PATH_PROG failed]])
|
|---|
| 534 | AS_EXIT(0)
|
|---|
| 535 | ]])
|
|---|
| 536 |
|
|---|
| 537 | AT_CHECK_AUTOCONF
|
|---|
| 538 | AT_CHECK_CONFIGURE
|
|---|
| 539 |
|
|---|
| 540 | AT_CLEANUP(path)
|
|---|
| 541 |
|
|---|
| 542 |
|
|---|
| 543 |
|
|---|
| 544 |
|
|---|
| 545 | ## -------------- ##
|
|---|
| 546 | ## AC_PATH_XTRA. ##
|
|---|
| 547 | ## -------------- ##
|
|---|
| 548 |
|
|---|
| 549 |
|
|---|
| 550 | AT_SETUP([AC_PATH_XTRA])
|
|---|
| 551 |
|
|---|
| 552 | _AT_CHECK_AC_MACRO([AC_PATH_XTRA])
|
|---|
| 553 |
|
|---|
| 554 | # Check X_DISPLAY_MISSING.
|
|---|
| 555 | AT_CHECK_CONFIGURE([--without-x])
|
|---|
| 556 | AT_CHECK_DEFINES(
|
|---|
| 557 | [#define X_DISPLAY_MISSING 1
|
|---|
| 558 | ])
|
|---|
| 559 |
|
|---|
| 560 | AT_CLEANUP
|
|---|
| 561 |
|
|---|
| 562 |
|
|---|
| 563 | ## ------------------------------- ##
|
|---|
| 564 | ## Obsolete non-updatable macros. ##
|
|---|
| 565 | ## ------------------------------- ##
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 | AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete])
|
|---|
| 569 | AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-W no-obsolete])
|
|---|