| 1 | # -*- Autotest -*-
|
|---|
| 2 |
|
|---|
| 3 | # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
|---|
| 4 | # Foundation, Inc.
|
|---|
| 5 | #
|
|---|
| 6 | # This program is free software; you can redistribute it and/or modify
|
|---|
| 7 | # it under the terms of the GNU General Public License as published by
|
|---|
| 8 | # the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | # any later version.
|
|---|
| 10 | #
|
|---|
| 11 | # This program is distributed in the hope that it will be useful,
|
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 14 | # GNU General Public License for more details.
|
|---|
| 15 | #
|
|---|
| 16 | # You should have received a copy of the GNU General Public License
|
|---|
| 17 | # along with this program; if not, write to the Free Software
|
|---|
| 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|---|
| 19 | # 02110-1301, USA.
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | AT_BANNER([[Testing config.status.]])
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | ## ---------------------------------------- ##
|
|---|
| 26 | ## AC_CONFIG_COMMANDS with empty commands. ##
|
|---|
| 27 | ## ---------------------------------------- ##
|
|---|
| 28 |
|
|---|
| 29 | AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
|
|---|
| 30 | [[AC_CONFIG_COMMANDS([foo], [], [:])
|
|---|
| 31 | ]])
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | ## -------------------------- ##
|
|---|
| 35 | ## Multiple AC_CONFIG_FILES. ##
|
|---|
| 36 | ## -------------------------- ##
|
|---|
| 37 |
|
|---|
| 38 | AT_SETUP([Multiple AC_CONFIG_FILES])
|
|---|
| 39 |
|
|---|
| 40 | AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
|
|---|
| 41 | AT_CHECK_AUTOCONF([], 1, [], [ignore])
|
|---|
| 42 |
|
|---|
| 43 | AT_CLEANUP
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | ## ------------ ##
|
|---|
| 48 | ## AC_ARG_VAR. ##
|
|---|
| 49 | ## ------------ ##
|
|---|
| 50 |
|
|---|
| 51 | # AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
|
|---|
| 52 | # ----------------------------------------------
|
|---|
| 53 | # Check that AC_ARG_VAR caches the latest values, diagnoses
|
|---|
| 54 | # inconsistencies, and arms config.status.
|
|---|
| 55 | m4_define([AT_CHECK_AC_ARG_VAR],
|
|---|
| 56 | [rm -f config.cache
|
|---|
| 57 |
|
|---|
| 58 | # Initial value.
|
|---|
| 59 | m4_ifval([$1],
|
|---|
| 60 | [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious],
|
|---|
| 61 | [unset precious])
|
|---|
| 62 | AT_CHECK_CONFIGURE([--config-cache -q])
|
|---|
| 63 | AT_CHECK([cat file], [], [`$1'
|
|---|
| 64 | ])
|
|---|
| 65 |
|
|---|
| 66 | # Testing --recheck: 1. have the environment `forget' about PRECIOUS.
|
|---|
| 67 | unset precious
|
|---|
| 68 | # 2. Rerun config.status to recreate `file'.
|
|---|
| 69 | AT_CHECK([./config.status --recheck], [], [ignore])
|
|---|
| 70 | AT_CHECK([./config.status], [], [ignore])
|
|---|
| 71 | # 3. Check that file contains the old value of PRECIOUS.
|
|---|
| 72 | AT_CHECK([cat file], [], [`$1'
|
|---|
| 73 | ])
|
|---|
| 74 |
|
|---|
| 75 | # Second value: we should issue an error here: the value
|
|---|
| 76 | # has changed!
|
|---|
| 77 | m4_ifval([$2],
|
|---|
| 78 | [precious='$2'; export precious],
|
|---|
| 79 | [unset precious])
|
|---|
| 80 | AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
|
|---|
| 81 |
|
|---|
| 82 | ])# AT_CHECK_AC_ARG_VAR
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | AT_SETUP([AC_ARG_VAR])
|
|---|
| 86 |
|
|---|
| 87 | # We don't want to run this test if this shell doesn't support
|
|---|
| 88 | # `unset'.
|
|---|
| 89 | AT_CHECK([
|
|---|
| 90 | if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
|
|---|
| 91 | exit 0
|
|---|
| 92 | else
|
|---|
| 93 | exit 77
|
|---|
| 94 | fi
|
|---|
| 95 | ])
|
|---|
| 96 |
|
|---|
| 97 | AT_DATA([configure.ac],
|
|---|
| 98 | [[AC_INIT
|
|---|
| 99 | AC_ARG_VAR([precious], [this variable costs a lot])
|
|---|
| 100 | echo "precious:$precious"
|
|---|
| 101 | AC_OUTPUT(file)
|
|---|
| 102 | ]])
|
|---|
| 103 |
|
|---|
| 104 | AT_DATA([file.in],
|
|---|
| 105 | [[`@precious@'
|
|---|
| 106 | ]])
|
|---|
| 107 |
|
|---|
| 108 | AT_CHECK_AUTOCONF
|
|---|
| 109 |
|
|---|
| 110 | # Set a precious variable
|
|---|
| 111 | AT_CHECK_AC_ARG_VAR([], [apple of my eye])
|
|---|
| 112 |
|
|---|
| 113 | # Unset a precious variable
|
|---|
| 114 | AT_CHECK_AC_ARG_VAR([apple of my eye], [])
|
|---|
| 115 |
|
|---|
| 116 | # Change a precious variable
|
|---|
| 117 | AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
|
|---|
| 118 |
|
|---|
| 119 | # Change a precious variable that contains braces
|
|---|
| 120 | AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
|
|---|
| 121 |
|
|---|
| 122 | # Change a precious variable that contains all kinds of fun
|
|---|
| 123 | AT_CHECK_AC_ARG_VAR(['p r ec"iou$], [orange of my eye])
|
|---|
| 124 |
|
|---|
| 125 | AT_CLEANUP
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | ## ---------------------------------------------- ##
|
|---|
| 131 | ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
|
|---|
| 132 | ## ---------------------------------------------- ##
|
|---|
| 133 |
|
|---|
| 134 | AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
|
|---|
| 135 |
|
|---|
| 136 | AT_DATA([configure.ac],
|
|---|
| 137 | [[AC_INIT
|
|---|
| 138 | rm -f -r header var-header file var-file link var-link command var-command
|
|---|
| 139 | echo 'OK' >input
|
|---|
| 140 |
|
|---|
| 141 | # Be sure to also stress the associated INIT-CMDS.
|
|---|
| 142 | case $what_to_test in
|
|---|
| 143 | header)
|
|---|
| 144 | AC_CONFIG_HEADERS(header:input);;
|
|---|
| 145 | var-header)
|
|---|
| 146 | AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
|
|---|
| 147 |
|
|---|
| 148 | file)
|
|---|
| 149 | AC_CONFIG_FILES(file:input);;
|
|---|
| 150 | var-file)
|
|---|
| 151 | AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
|
|---|
| 152 |
|
|---|
| 153 | command)
|
|---|
| 154 | AC_CONFIG_COMMANDS(command,
|
|---|
| 155 | [cp input command]);;
|
|---|
| 156 | var-command)
|
|---|
| 157 | AC_CONFIG_COMMANDS(var-command,
|
|---|
| 158 | [cp $command_in var-command], [command_in=input]);;
|
|---|
| 159 |
|
|---|
| 160 | link)
|
|---|
| 161 | AC_CONFIG_LINKS(link:input);;
|
|---|
| 162 | var-link)
|
|---|
| 163 | AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
|
|---|
| 164 | esac
|
|---|
| 165 | AC_OUTPUT
|
|---|
| 166 | ]])
|
|---|
| 167 |
|
|---|
| 168 | AT_CHECK_AUTOCONF
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 | # AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
|
|---|
| 172 | # ------------------------------------------------------------------
|
|---|
| 173 | # Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
|
|---|
| 174 | # are properly created, with the right content.
|
|---|
| 175 | # Use `grep OK' instead of a simple `cat' to avoid banners such as in
|
|---|
| 176 | # AC_CONFIG_HEADERS.
|
|---|
| 177 | m4_define([AT_CHECK_CONFIG_CREATION],
|
|---|
| 178 | [AT_CHECK_CONFIGURE([what_to_test=$1])
|
|---|
| 179 | AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
|
|---|
| 180 | [ignore], [$1
|
|---|
| 181 | ])
|
|---|
| 182 | AT_CHECK([grep OK $1], [], [OK
|
|---|
| 183 | ])
|
|---|
| 184 |
|
|---|
| 185 | AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
|
|---|
| 186 | # config.status might be stupidly expecting data on stdin, if it's
|
|---|
| 187 | # really broken...
|
|---|
| 188 | AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
|
|---|
| 189 | AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
|
|---|
| 190 | [ignore], [var-$1
|
|---|
| 191 | ])
|
|---|
| 192 | AT_CHECK([grep OK var-$1], [], [OK
|
|---|
| 193 | ])
|
|---|
| 194 | ])# AT_CHECK_CONFIG_CREATION
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 | # Create a file
|
|---|
| 198 | AT_CHECK_CONFIG_CREATION(file)
|
|---|
| 199 |
|
|---|
| 200 | # Create a header
|
|---|
| 201 | AT_CHECK_CONFIG_CREATION(header)
|
|---|
| 202 |
|
|---|
| 203 | # Execute a command
|
|---|
| 204 | AT_CHECK_CONFIG_CREATION(command)
|
|---|
| 205 |
|
|---|
| 206 | # Create a link
|
|---|
| 207 | AT_CHECK_CONFIG_CREATION(link)
|
|---|
| 208 |
|
|---|
| 209 | AT_CLEANUP
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 | ## ---------------------------------------- ##
|
|---|
| 214 | ## Macro calls in AC_CONFIG_COMMANDS tags. ##
|
|---|
| 215 | ## ---------------------------------------- ##
|
|---|
| 216 |
|
|---|
| 217 | AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags])
|
|---|
| 218 |
|
|---|
| 219 | AT_DATA_M4SUGAR([configure.ac],
|
|---|
| 220 | [[AC_INIT
|
|---|
| 221 | AC_CONFIG_COMMANDS([m4_if(1,1,mytag)])
|
|---|
| 222 | AC_OUTPUT
|
|---|
| 223 | ]])
|
|---|
| 224 |
|
|---|
| 225 | AT_CHECK_AUTOCONF
|
|---|
| 226 | AT_CHECK_CONFIGURE
|
|---|
| 227 |
|
|---|
| 228 | AT_CLEANUP
|
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 | ## ------------------- ##
|
|---|
| 233 | ## Missing templates. ##
|
|---|
| 234 | ## ------------------- ##
|
|---|
| 235 |
|
|---|
| 236 | # Check that config.status detects missing input files
|
|---|
| 237 | AT_SETUP([Missing templates])
|
|---|
| 238 |
|
|---|
| 239 | AT_DATA([configure.ac],
|
|---|
| 240 | [[AC_INIT
|
|---|
| 241 | AC_CONFIG_FILES([nonexistent])
|
|---|
| 242 | AC_OUTPUT
|
|---|
| 243 | ]])
|
|---|
| 244 |
|
|---|
| 245 | AT_CHECK_AUTOCONF
|
|---|
| 246 | AT_CHECK_CONFIGURE([], [1], [],
|
|---|
| 247 | [[config.status: error: cannot find input file: nonexistent.in
|
|---|
| 248 | ]])
|
|---|
| 249 | # Make sure that the output file doesn't exist
|
|---|
| 250 | AT_CHECK([test -f nonexistent], 1)
|
|---|
| 251 |
|
|---|
| 252 | AT_CLEANUP
|
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 | ## ---------------------- ##
|
|---|
| 258 | ## configure invocation. ##
|
|---|
| 259 | ## ---------------------- ##
|
|---|
| 260 |
|
|---|
| 261 | # Check that `configure' and `config.status' honor their interface.
|
|---|
| 262 | #
|
|---|
| 263 | # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
|
|---|
| 264 | # and verify that (i) `configure' correctly receives the arguments,
|
|---|
| 265 | # (ii) correctly passes them to `config.status', which we check by
|
|---|
| 266 | # running `config.status --recheck', and (iii) correctly passes them
|
|---|
| 267 | # to sub-configure scripts.
|
|---|
| 268 |
|
|---|
| 269 | AT_SETUP([configure invocation])
|
|---|
| 270 |
|
|---|
| 271 | mkdir sub
|
|---|
| 272 |
|
|---|
| 273 | AT_DATA([configure.ac],
|
|---|
| 274 | [[AC_INIT
|
|---|
| 275 | AC_CONFIG_SUBDIRS([sub])
|
|---|
| 276 | echo "result=$one$enable_two$with_three"
|
|---|
| 277 | AC_OUTPUT
|
|---|
| 278 | ]])
|
|---|
| 279 |
|
|---|
| 280 | AT_DATA([sub/configure.ac],
|
|---|
| 281 | [[AC_INIT
|
|---|
| 282 | echo "result=$one$enable_two$with_three"
|
|---|
| 283 | AC_OUTPUT
|
|---|
| 284 | ]])
|
|---|
| 285 |
|
|---|
| 286 | echo fake install-sh script >install-sh
|
|---|
| 287 |
|
|---|
| 288 | AT_CHECK_AUTOCONF
|
|---|
| 289 | cd sub
|
|---|
| 290 | AT_CHECK_AUTOCONF
|
|---|
| 291 | cd ..
|
|---|
| 292 |
|
|---|
| 293 | AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
|
|---|
| 294 | sed -n -e 's/^result=//p'], 0,
|
|---|
| 295 | [m4_do([onetwothree
|
|---|
| 296 | ], [onetwothree
|
|---|
| 297 | ])])
|
|---|
| 298 | AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
|
|---|
| 299 | [onetwothree
|
|---|
| 300 | ])
|
|---|
| 301 |
|
|---|
| 302 | AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
|
|---|
| 303 | sed -n -e 's/^result=//p'], 0,
|
|---|
| 304 | [m4_do(["'$ " ' $ "'$
|
|---|
| 305 | ], ["'$ " ' $ "'$
|
|---|
| 306 | ])])
|
|---|
| 307 | AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
|
|---|
| 308 | ["'$ " ' $ "'$
|
|---|
| 309 | ])
|
|---|
| 310 |
|
|---|
| 311 | AT_CLEANUP
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 | ## -------------------------------------------- ##
|
|---|
| 316 | ## Check that `#define' templates are honored. ##
|
|---|
| 317 | ## -------------------------------------------- ##
|
|---|
| 318 |
|
|---|
| 319 | # Use various forms of `#define' templates, and make sure there are no
|
|---|
| 320 | # problems when a symbol is prefix of another.
|
|---|
| 321 |
|
|---|
| 322 | AT_SETUP([[#define header templates]])
|
|---|
| 323 |
|
|---|
| 324 | AT_DATA([configure.ac],
|
|---|
| 325 | [[AC_INIT
|
|---|
| 326 | AC_CONFIG_HEADERS(config.h:config.hin)
|
|---|
| 327 |
|
|---|
| 328 | # I18n of dummy variables: their French translations.
|
|---|
| 329 | AC_DEFINE(foo, toto)
|
|---|
| 330 | AC_DEFINE(bar, tata)
|
|---|
| 331 | AC_DEFINE(baz, titi)
|
|---|
| 332 | AC_DEFINE(fubar, tutu)
|
|---|
| 333 |
|
|---|
| 334 | # Symbols which are prefixes of another.
|
|---|
| 335 | AC_DEFINE(a, A)
|
|---|
| 336 | AC_DEFINE(aaa, AAA)
|
|---|
| 337 | AC_DEFINE(aa, AA)
|
|---|
| 338 | AC_CONFIG_FILES(defs)
|
|---|
| 339 |
|
|---|
| 340 | # Things included in confdefs.h, but which make no sense in
|
|---|
| 341 | # config.h, nor in $DEFS.
|
|---|
| 342 | cat <<\EOF >>confdefs.h
|
|---|
| 343 | /* Hi Mum! Look, I am doing C++! */
|
|---|
| 344 | #ifdef __cplusplus
|
|---|
| 345 | void exit (int status);
|
|---|
| 346 | #endif
|
|---|
| 347 | EOF
|
|---|
| 348 |
|
|---|
| 349 | # In addition of config.h output a full DEFS
|
|---|
| 350 | AC_OUTPUT_MAKE_DEFS
|
|---|
| 351 | DEFS_SAVED=$DEFS
|
|---|
| 352 | AC_SUBST(DEFS_SAVED)
|
|---|
| 353 | AC_OUTPUT
|
|---|
| 354 | ]])
|
|---|
| 355 |
|
|---|
| 356 | AT_DATA([defs.in],
|
|---|
| 357 | [[@DEFS_SAVED@
|
|---|
| 358 | ]])
|
|---|
| 359 |
|
|---|
| 360 | AT_DATA([config.hin],
|
|---|
| 361 | [[#define foo 0
|
|---|
| 362 | # define bar bar
|
|---|
| 363 | # define baz "Archimedes was sinking in his baz"
|
|---|
| 364 | # define fubar tutu
|
|---|
| 365 | #define a B
|
|---|
| 366 | #define aa BB
|
|---|
| 367 | #define aaa BBB
|
|---|
| 368 | #undef a
|
|---|
| 369 | #undef aa
|
|---|
| 370 | #undef aaa
|
|---|
| 371 | ]])
|
|---|
| 372 |
|
|---|
| 373 | AT_CHECK_AUTOCONF
|
|---|
| 374 | AT_CHECK_CONFIGURE
|
|---|
| 375 |
|
|---|
| 376 | AT_DATA([expout],
|
|---|
| 377 | [[/* config.h. Generated from config.hin by configure. */
|
|---|
| 378 | #define foo toto
|
|---|
| 379 | # define bar tata
|
|---|
| 380 | # define baz titi
|
|---|
| 381 | # define fubar tutu
|
|---|
| 382 | #define a A
|
|---|
| 383 | #define aa AA
|
|---|
| 384 | #define aaa AAA
|
|---|
| 385 | #define a A
|
|---|
| 386 | #define aa AA
|
|---|
| 387 | #define aaa AAA
|
|---|
| 388 | ]])
|
|---|
| 389 | AT_CHECK([cat config.h], 0, expout)
|
|---|
| 390 |
|
|---|
| 391 | # Check the value of DEFS.
|
|---|
| 392 | AT_DATA([expout],
|
|---|
| 393 | [[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA
|
|---|
| 394 | ]])
|
|---|
| 395 |
|
|---|
| 396 | # Because we strip trailing spaces in `testsuite' we can't leave one in
|
|---|
| 397 | # expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
|
|---|
| 398 | AT_CHECK([sed -e 's/ $//' defs], 0, expout)
|
|---|
| 399 |
|
|---|
| 400 | AT_CLEANUP
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 | ## ------------------------- ##
|
|---|
| 405 | ## Torturing config.status. ##
|
|---|
| 406 | ## ------------------------- ##
|
|---|
| 407 |
|
|---|
| 408 | ## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly
|
|---|
| 409 | ## big value. This is mostly to check that Autoconf produces portable sed
|
|---|
| 410 | ## scripts in config.status. sed is used to skip the first two lines
|
|---|
| 411 | ## `Generated by...'.
|
|---|
| 412 |
|
|---|
| 413 | # We use m4_for many times.
|
|---|
| 414 | m4_pattern_allow([^m4_for$])
|
|---|
| 415 |
|
|---|
| 416 | AT_SETUP([Torturing config.status])
|
|---|
| 417 |
|
|---|
| 418 | dnl The value used as a big value for AC_DEFINE.
|
|---|
| 419 | dnl Don't use sh active chars here, below it is also used in a sh
|
|---|
| 420 | dnl assignment.
|
|---|
| 421 | m4_define([AT_BIG_VALUE],
|
|---|
| 422 | [This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
|
|---|
| 423 |
|
|---|
| 424 | m4_define([AT_DESCRIPTION],
|
|---|
| 425 | [Define to a long string if your `Autoconf' works properly.])
|
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 | # AT_DUMMY_VAR(NUMBER)
|
|---|
| 429 | # --------------------
|
|---|
| 430 | # Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
|
|---|
| 431 | # so that the check for user name space invasion does not complain
|
|---|
| 432 | # of the new variables defined.
|
|---|
| 433 | #
|
|---|
| 434 | # Note that you should not use the name ac_dummy, because it will be
|
|---|
| 435 | # turned into ac_uummy during the construction of config.status. Yes,
|
|---|
| 436 | # this is admittedly a bug, but it would be too hard to fix this.
|
|---|
| 437 | # There is really no point in AC_DEFINE a var named ac_d.*.
|
|---|
| 438 | m4_pattern_allow([^m4_bpatsubst$])
|
|---|
| 439 | m4_define([AT_DUMMY_VAR],
|
|---|
| 440 | [ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 | AT_DATA([dummy.in],
|
|---|
| 445 | [m4_for([AT_Count], 1, 100, 1,
|
|---|
| 446 | [@AT_DUMMY_VAR(AT_Count)@
|
|---|
| 447 | @[f]AT_Count@
|
|---|
| 448 | ])])
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 | i=1
|
|---|
| 452 | while test $i != 101; do
|
|---|
| 453 | echo "content of file $i" > file_$i
|
|---|
| 454 | i=`expr $i + 1`
|
|---|
| 455 | done
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 | # ------------ #
|
|---|
| 459 | # configure.ac #
|
|---|
| 460 | # ------------ #
|
|---|
| 461 |
|
|---|
| 462 | m4_pattern_allow([^m4_(define|defun)$])
|
|---|
| 463 | AT_DATA([configure.ac],
|
|---|
| 464 | dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
|
|---|
| 465 | dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
|
|---|
| 466 | [[m4_define([AC_DUMMY_VAR],]
|
|---|
| 467 | m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
|
|---|
| 468 |
|
|---|
| 469 | [[m4_define([AC_DESCRIPTION],]
|
|---|
| 470 | m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
|
|---|
| 471 |
|
|---|
| 472 | [[m4_define([AC_BIG_VALUE],]
|
|---|
| 473 | m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
|
|---|
| 474 |
|
|---|
| 475 | [[# AC_DEFUBST(NAME)
|
|---|
| 476 | # ----------------
|
|---|
| 477 | # Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
|
|---|
| 478 | # used in the torture tests.
|
|---|
| 479 | m4_defun([AC_DEFUBST],
|
|---|
| 480 | [AC_DUMMY_VAR($1)="AC_BIG_VALUE"
|
|---|
| 481 | AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
|
|---|
| 482 | AC_DESCRIPTION)
|
|---|
| 483 | AC_SUBST(AC_DUMMY_VAR($1))
|
|---|
| 484 | AC_SUBST_FILE([f]$1)
|
|---|
| 485 | f$1=file_$1
|
|---|
| 486 | ])
|
|---|
| 487 |
|
|---|
| 488 | AC_INIT
|
|---|
| 489 | AC_CONFIG_HEADERS(config.h:config.hin)
|
|---|
| 490 | AC_CONFIG_FILES(dummy)
|
|---|
| 491 | m4_for(AC_Count, 1, 100, 1,
|
|---|
| 492 | [AC_DEFUBST(AC_Count)])
|
|---|
| 493 | AC_OUTPUT
|
|---|
| 494 | ]])# configure.ac
|
|---|
| 495 |
|
|---|
| 496 | AT_CHECK_AUTOCONF
|
|---|
| 497 | AT_CHECK_AUTOHEADER
|
|---|
| 498 | AT_CHECK_CONFIGURE
|
|---|
| 499 |
|
|---|
| 500 | # Checking that AC_DEFINE worked properly.
|
|---|
| 501 | AT_DATA([expout],
|
|---|
| 502 | [/* Define to the address where bug reports for this package should be sent. */
|
|---|
| 503 | #define PACKAGE_BUGREPORT ""
|
|---|
| 504 |
|
|---|
| 505 | /* Define to the full name of this package. */
|
|---|
| 506 | #define PACKAGE_NAME ""
|
|---|
| 507 |
|
|---|
| 508 | /* Define to the full name and version of this package. */
|
|---|
| 509 | #define PACKAGE_STRING ""
|
|---|
| 510 |
|
|---|
| 511 | /* Define to the one symbol short name of this package. */
|
|---|
| 512 | #define PACKAGE_TARNAME ""
|
|---|
| 513 |
|
|---|
| 514 | /* Define to the version of this package. */
|
|---|
| 515 | #define PACKAGE_VERSION ""
|
|---|
| 516 | m4_for(AT_Count, 1, 100, 1,
|
|---|
| 517 | [
|
|---|
| 518 | /* AT_DESCRIPTION */
|
|---|
| 519 | [#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
|
|---|
| 520 | ])])
|
|---|
| 521 | AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
|
|---|
| 522 |
|
|---|
| 523 | # Checking that AC_SUBST worked properly.
|
|---|
| 524 | AT_DATA([expout],
|
|---|
| 525 | [m4_for(AT_Count, 1, 100, 1,
|
|---|
| 526 | [AT_BIG_VALUE
|
|---|
| 527 | content of file AT_Count
|
|---|
| 528 | ])])
|
|---|
| 529 |
|
|---|
| 530 | AT_CHECK([cat dummy], 0, expout)
|
|---|
| 531 |
|
|---|
| 532 | AT_CLEANUP
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 | ## ------------------------------- ##
|
|---|
| 536 | ## Substitute a 2000-byte string. ##
|
|---|
| 537 | ## ------------------------------- ##
|
|---|
| 538 |
|
|---|
| 539 | # Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
|
|---|
| 540 | # sed dumps core around 8 KiB. However, POSIX says that sed need not
|
|---|
| 541 | # handle lines longer than 2048 bytes (including the trailing newline).
|
|---|
| 542 | # So we'll just test a 2000-byte value.
|
|---|
| 543 |
|
|---|
| 544 | AT_SETUP([Substitute a 2000-byte string])
|
|---|
| 545 |
|
|---|
| 546 | AT_DATA([Foo.in], [@foo@
|
|---|
| 547 | ])
|
|---|
| 548 |
|
|---|
| 549 | AT_DATA([configure.ac],
|
|---|
| 550 | [[AC_INIT
|
|---|
| 551 | AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
|
|---|
| 552 | AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
|
|---|
| 553 | AC_CONFIG_FILES([Foo])
|
|---|
| 554 | AC_OUTPUT
|
|---|
| 555 | ]])
|
|---|
| 556 |
|
|---|
| 557 | AT_CHECK_AUTOCONF
|
|---|
| 558 | AT_CHECK_CONFIGURE
|
|---|
| 559 | AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
|
|---|
| 560 | )
|
|---|
| 561 | AT_CLEANUP
|
|---|
| 562 |
|
|---|
| 563 |
|
|---|
| 564 | ## ------------------------------ ##
|
|---|
| 565 | ## Define to a 2000-byte string. ##
|
|---|
| 566 | ## ------------------------------ ##
|
|---|
| 567 |
|
|---|
| 568 | AT_SETUP([Define to a 2000-byte string])
|
|---|
| 569 |
|
|---|
| 570 | AT_CONFIGURE_AC(
|
|---|
| 571 | [[
|
|---|
| 572 | AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
|
|---|
| 573 | ]])
|
|---|
| 574 |
|
|---|
| 575 | AT_CHECK_AUTOCONF
|
|---|
| 576 | AT_CHECK_AUTOHEADER
|
|---|
| 577 | AT_CHECK_CONFIGURE
|
|---|
| 578 | AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
|
|---|
| 579 | ])
|
|---|
| 580 | AT_CLEANUP
|
|---|
| 581 |
|
|---|
| 582 |
|
|---|
| 583 | ## ------------------------------------------ ##
|
|---|
| 584 | ## Substitute and define special characters. ##
|
|---|
| 585 | ## ------------------------------------------ ##
|
|---|
| 586 |
|
|---|
| 587 | # Use characters special to the shell, sed, and M4.
|
|---|
| 588 |
|
|---|
| 589 | AT_SETUP([Substitute and define special characters])
|
|---|
| 590 |
|
|---|
| 591 | AT_DATA([Foo.in], [@foo@
|
|---|
| 592 | ])
|
|---|
| 593 |
|
|---|
| 594 | AT_CONFIGURE_AC(
|
|---|
| 595 | [[foo="AS@&t@_ESCAPE([[X*'[]+ ", `\($foo]])"
|
|---|
| 596 | AC_SUBST([foo])
|
|---|
| 597 | AC_DEFINE([foo], [[X*'[]+ ", `\($foo]], [Awful value.])
|
|---|
| 598 | AC_CONFIG_FILES([Foo])]])
|
|---|
| 599 |
|
|---|
| 600 | AT_CHECK_AUTOCONF
|
|---|
| 601 | AT_CHECK_AUTOHEADER
|
|---|
| 602 | AT_CHECK_CONFIGURE
|
|---|
| 603 | AT_CHECK([cat Foo], 0, [[X*'[]+ ", `\($foo
|
|---|
| 604 | ]])
|
|---|
| 605 | AT_CHECK_DEFINES([[#define foo X*'[]+ ", `\($foo
|
|---|
| 606 | ]])
|
|---|
| 607 | AT_CLEANUP
|
|---|
| 608 |
|
|---|
| 609 |
|
|---|
| 610 | ## ---------------------- ##
|
|---|
| 611 | ## Substitute a newline. ##
|
|---|
| 612 | ## ---------------------- ##
|
|---|
| 613 |
|
|---|
| 614 | AT_SETUP([Substitute a newline])
|
|---|
| 615 |
|
|---|
| 616 | AT_DATA([Foo.in],
|
|---|
| 617 | [@foo@
|
|---|
| 618 | ])
|
|---|
| 619 |
|
|---|
| 620 | AT_DATA([configure.ac],
|
|---|
| 621 | [[AC_INIT
|
|---|
| 622 | AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
|
|---|
| 623 | foo='one
|
|---|
| 624 | two'
|
|---|
| 625 | AC_SUBST([foo])
|
|---|
| 626 | AC_CONFIG_FILES([Foo])
|
|---|
| 627 | AC_OUTPUT
|
|---|
| 628 | ]])
|
|---|
| 629 |
|
|---|
| 630 | AT_CHECK_AUTOCONF
|
|---|
| 631 | AT_CHECK_CONFIGURE
|
|---|
| 632 | AT_CHECK([cat Foo], 0, [one
|
|---|
| 633 | two
|
|---|
| 634 | ])
|
|---|
| 635 | AT_CLEANUP
|
|---|
| 636 |
|
|---|
| 637 |
|
|---|
| 638 | ## ------------------ ##
|
|---|
| 639 | ## Define a newline. ##
|
|---|
| 640 | ## ------------------ ##
|
|---|
| 641 |
|
|---|
| 642 | AT_SETUP([Define a newline])
|
|---|
| 643 | AT_XFAIL_IF(:)
|
|---|
| 644 | AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
|
|---|
| 645 | two], [This spans two lines.])
|
|---|
| 646 | ]])
|
|---|
| 647 | AT_CHECK_AUTOCONF
|
|---|
| 648 | AT_CHECK_AUTOHEADER
|
|---|
| 649 | AT_CHECK_CONFIGURE
|
|---|
| 650 | AT_CHECK_DEFINES([[#define foo one
|
|---|
| 651 | two
|
|---|
| 652 | ]])
|
|---|
| 653 | AT_CLEANUP
|
|---|
| 654 |
|
|---|
| 655 |
|
|---|
| 656 | ## ------------------------ ##
|
|---|
| 657 | ## datarootdir workaround. ##
|
|---|
| 658 | ## ------------------------ ##
|
|---|
| 659 |
|
|---|
| 660 | AT_SETUP([datarootdir workaround])
|
|---|
| 661 |
|
|---|
| 662 | AT_DATA([Foo.in],
|
|---|
| 663 | [@datadir@
|
|---|
| 664 | @docdir@
|
|---|
| 665 | @infodir@
|
|---|
| 666 | @localedir@
|
|---|
| 667 | @mandir@
|
|---|
| 668 | ])
|
|---|
| 669 |
|
|---|
| 670 | AT_DATA([Bar.in],
|
|---|
| 671 | [@mydatadir@
|
|---|
| 672 | ])
|
|---|
| 673 |
|
|---|
| 674 | AT_DATA([configure.ac],
|
|---|
| 675 | [[AC_INIT
|
|---|
| 676 | d@&t@nl The following line silences the warnings, if uncommented:
|
|---|
| 677 | d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
|
|---|
| 678 | AC_CONFIG_AUX_DIR($top_srcdir/build-aux)
|
|---|
| 679 |
|
|---|
| 680 | # This substitution is wrong and bogus! Don't use it in your own code!
|
|---|
| 681 | # Read `info Autoconf "Defining Directories"'!
|
|---|
| 682 | AC_SUBST([mydatadir], [${datadir}/my])
|
|---|
| 683 |
|
|---|
| 684 | AC_CONFIG_FILES([Foo Bar])
|
|---|
| 685 | AC_OUTPUT
|
|---|
| 686 | ]])
|
|---|
| 687 |
|
|---|
| 688 | AT_CHECK_AUTOCONF
|
|---|
| 689 | AT_CHECK_CONFIGURE([], [], [],
|
|---|
| 690 | [config.status: WARNING: Foo.in seems to ignore the --datarootdir setting
|
|---|
| 691 | config.status: WARNING: Bar contains a reference to the variable `datarootdir'
|
|---|
| 692 | which seems to be undefined. Please make sure it is defined.
|
|---|
| 693 | ])
|
|---|
| 694 | AT_CHECK([grep datarootdir Foo], 1, [])
|
|---|
| 695 |
|
|---|
| 696 | rm configure
|
|---|
| 697 | sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
|
|---|
| 698 | mv t configure.ac
|
|---|
| 699 |
|
|---|
| 700 | AT_CHECK_AUTOCONF
|
|---|
| 701 | AT_CHECK_CONFIGURE
|
|---|
| 702 |
|
|---|
| 703 | AT_CLEANUP
|
|---|
| 704 |
|
|---|
| 705 |
|
|---|
| 706 | ## -------- ##
|
|---|
| 707 | ## srcdir. ##
|
|---|
| 708 | ## -------- ##
|
|---|
| 709 |
|
|---|
| 710 | AT_SETUP([srcdir])
|
|---|
| 711 |
|
|---|
| 712 | rm -f -r at-dir
|
|---|
| 713 | mkdir at-dir
|
|---|
| 714 | : >at-dir/bar.in
|
|---|
| 715 | : >foo.in
|
|---|
| 716 |
|
|---|
| 717 | AT_DATA([configure.ac],
|
|---|
| 718 | [[AC_INIT
|
|---|
| 719 |
|
|---|
| 720 | AC_CONFIG_FILES([foo at-dir/bar])
|
|---|
| 721 |
|
|---|
| 722 | AC_CONFIG_COMMANDS([report],
|
|---|
| 723 | [test -f $srcdir/configure.ac ||
|
|---|
| 724 | AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
|
|---|
| 725 | [srcdir=$srcdir])
|
|---|
| 726 |
|
|---|
| 727 | AC_OUTPUT
|
|---|
| 728 | rm -f -r foo at-dir/bar
|
|---|
| 729 | ]])
|
|---|
| 730 |
|
|---|
| 731 | AT_CHECK_AUTOCONF
|
|---|
| 732 |
|
|---|
| 733 | # In place.
|
|---|
| 734 | AT_CHECK([./configure], [], [ignore])
|
|---|
| 735 |
|
|---|
| 736 | # Relative name.
|
|---|
| 737 | AT_CHECK([cd at-dir && ../configure], [], [ignore])
|
|---|
| 738 |
|
|---|
| 739 | # Absolute name.
|
|---|
| 740 | at_here=`pwd`
|
|---|
| 741 | AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
|
|---|
| 742 |
|
|---|
| 743 | AT_CLEANUP
|
|---|
| 744 |
|
|---|
| 745 |
|
|---|
| 746 | ## ----------------- ##
|
|---|
| 747 | ## Signal handling. ##
|
|---|
| 748 | ## ----------------- ##
|
|---|
| 749 |
|
|---|
| 750 | AT_SETUP([Signal handling])
|
|---|
| 751 |
|
|---|
| 752 | AT_DATA([configure.ac],
|
|---|
| 753 | [[AC_INIT
|
|---|
| 754 | kill -2 $$
|
|---|
| 755 | exit 77
|
|---|
| 756 | ]])
|
|---|
| 757 |
|
|---|
| 758 | AT_CHECK_AUTOCONF
|
|---|
| 759 | AT_CHECK_CONFIGURE([], 1, ignore, ignore)
|
|---|
| 760 |
|
|---|
| 761 | AT_CLEANUP
|
|---|
| 762 |
|
|---|
| 763 |
|
|---|
| 764 |
|
|---|
| 765 | AT_BANNER([autoreconf.])
|
|---|
| 766 |
|
|---|
| 767 | ## ---------------------------- ##
|
|---|
| 768 | ## Configuring subdirectories. ##
|
|---|
| 769 | ## ---------------------------- ##
|
|---|
| 770 |
|
|---|
| 771 | # .
|
|---|
| 772 | # |-- builddir
|
|---|
| 773 | # | |-- config.log
|
|---|
| 774 | # | |-- config.status
|
|---|
| 775 | # | `-- inner
|
|---|
| 776 | # | |-- config.log
|
|---|
| 777 | # | |-- config.status
|
|---|
| 778 | # | `-- innermost
|
|---|
| 779 | # | `-- config
|
|---|
| 780 | # |-- configure
|
|---|
| 781 | # |-- configure.ac
|
|---|
| 782 | # |-- inner
|
|---|
| 783 | # | |-- configure
|
|---|
| 784 | # | |-- configure.ac
|
|---|
| 785 | # | `-- innermost
|
|---|
| 786 | # | `-- config.in
|
|---|
| 787 | # `-- install-sh
|
|---|
| 788 | #
|
|---|
| 789 | AT_SETUP([Configuring subdirectories])
|
|---|
| 790 | AT_KEYWORDS(autoreconf)
|
|---|
| 791 |
|
|---|
| 792 | # We use aclocal (via autoreconf).
|
|---|
| 793 | AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
|
|---|
| 794 | # It should understand configure.ac.
|
|---|
| 795 | AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
|
|---|
| 796 |
|
|---|
| 797 | # Set CONFIG_SITE to a nonexistent file, so that there are
|
|---|
| 798 | # no worries about nonstandard values for 'prefix'.
|
|---|
| 799 | CONFIG_SITE=no-such-file
|
|---|
| 800 | export CONFIG_SITE
|
|---|
| 801 |
|
|---|
| 802 | # The contents of `inner/', and `inner/innermost/'.
|
|---|
| 803 | AS_MKDIR_P([inner/innermost])
|
|---|
| 804 |
|
|---|
| 805 | # We have to use configure.in, not configure.ac, if we still want to
|
|---|
| 806 | # be compatible with Automake 1.4: aclocal (run by autoreconf) would
|
|---|
| 807 | # die because it can't find configure.in.
|
|---|
| 808 | AT_DATA([inner/configure.in],
|
|---|
| 809 | [[AC_INIT(GNU Inner, 1.0)
|
|---|
| 810 | AC_CONFIG_SRCDIR([innermost/config.in])
|
|---|
| 811 | AC_ARG_VAR([INNER], [an inner variable])
|
|---|
| 812 | AC_SUBST([INNER])
|
|---|
| 813 | if test "x$INNER" = x; then
|
|---|
| 814 | INNER=inner
|
|---|
| 815 | fi
|
|---|
| 816 | AC_CONFIG_FILES([innermost/config])
|
|---|
| 817 | AC_OUTPUT
|
|---|
| 818 | ]])
|
|---|
| 819 |
|
|---|
| 820 | AT_DATA([inner/innermost/config.in],
|
|---|
| 821 | [INNER=@INNER@
|
|---|
| 822 | srcdir=@srcdir@
|
|---|
| 823 | top_srcdir=@top_srcdir@
|
|---|
| 824 | prefix=@prefix@
|
|---|
| 825 | ])
|
|---|
| 826 |
|
|---|
| 827 | # The contents of `.'
|
|---|
| 828 | AT_DATA([install-sh], [])
|
|---|
| 829 |
|
|---|
| 830 | # nonexistent is allowed not to exist.
|
|---|
| 831 | AT_DATA([configure.in],
|
|---|
| 832 | [[AC_INIT(GNU Outer, 1.0)
|
|---|
| 833 | AC_ARG_VAR([OUTER], [an outer variable])
|
|---|
| 834 | if false; then
|
|---|
| 835 | AC_CONFIG_SUBDIRS([nonexistent])
|
|---|
| 836 | fi
|
|---|
| 837 | AC_CONFIG_SUBDIRS([inner])
|
|---|
| 838 | AC_OUTPUT
|
|---|
| 839 | ]])
|
|---|
| 840 |
|
|---|
| 841 | # If there are improperly quoted AC_DEFUN installed in share/aclocal,
|
|---|
| 842 | # they trigger warnings from aclocal 1.8, so ignore stderr.
|
|---|
| 843 | AT_CHECK([autoreconf], [], [], [ignore])
|
|---|
| 844 | AT_CHECK([test -f inner/configure])
|
|---|
| 845 |
|
|---|
| 846 | # Running the outer configure recursively should provide the innermost
|
|---|
| 847 | # help strings.
|
|---|
| 848 | AT_CHECK([./configure --help=recursive | grep INNER], 0, [ignore])
|
|---|
| 849 |
|
|---|
| 850 | # Running the outer configure should trigger the inner.
|
|---|
| 851 | AT_CHECK_CONFIGURE
|
|---|
| 852 | AT_CHECK([cat inner/innermost/config], 0,
|
|---|
| 853 | [INNER=inner
|
|---|
| 854 | srcdir=.
|
|---|
| 855 | top_srcdir=..
|
|---|
| 856 | prefix=/usr/local
|
|---|
| 857 | ])
|
|---|
| 858 |
|
|---|
| 859 | # The same, but from a builddir.
|
|---|
| 860 | AS_MKDIR_P([builddir])
|
|---|
| 861 | AT_CHECK([cd builddir && ../configure], 0, [ignore])
|
|---|
| 862 | AT_CHECK([cat builddir/inner/innermost/config], 0,
|
|---|
| 863 | [INNER=inner
|
|---|
| 864 | srcdir=../../../inner/innermost
|
|---|
| 865 | top_srcdir=../../../inner
|
|---|
| 866 | prefix=/usr/local
|
|---|
| 867 | ])
|
|---|
| 868 |
|
|---|
| 869 | # Make sure precious variables and command line options are properly
|
|---|
| 870 | # passed, even when there are duplicates.
|
|---|
| 871 | AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
|
|---|
| 872 | AT_CHECK([cat builddir/inner/innermost/config], 0,
|
|---|
| 873 | [INNER=good
|
|---|
| 874 | srcdir=../../../inner/innermost
|
|---|
| 875 | top_srcdir=../../../inner
|
|---|
| 876 | prefix=/good
|
|---|
| 877 | ])
|
|---|
| 878 |
|
|---|
| 879 | # Make sure --prefix is properly quoted
|
|---|
| 880 | AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore])
|
|---|
| 881 | AT_CHECK([cat builddir/inner/innermost/config], 0,
|
|---|
| 882 | [INNER=inner
|
|---|
| 883 | srcdir=../../../inner/innermost
|
|---|
| 884 | top_srcdir=../../../inner
|
|---|
| 885 | prefix=/a b c$ 'd
|
|---|
| 886 | ])
|
|---|
| 887 |
|
|---|
| 888 | # Make sure --silent is properly passed...
|
|---|
| 889 | AT_CHECK([cd builddir && ../configure --silent], 0, [])
|
|---|
| 890 | # ...but not stored in config.status.
|
|---|
| 891 | AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
|
|---|
| 892 | AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
|
|---|
| 893 |
|
|---|
| 894 | # Make sure we can run autoreconf on a subdirectory
|
|---|
| 895 | rm -f configure configure.in
|
|---|
| 896 | AT_CHECK([autoreconf inner], [], [], [ignore])
|
|---|
| 897 |
|
|---|
| 898 | # Make sure we can pass a configure.ac name
|
|---|
| 899 | AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore])
|
|---|
| 900 | AT_CHECK([autoreconf inner/configure.in], [], [], [ignore])
|
|---|
| 901 |
|
|---|
| 902 | AT_CLEANUP
|
|---|
| 903 |
|
|---|
| 904 |
|
|---|
| 905 |
|
|---|
| 906 | ## -------------- ##
|
|---|
| 907 | ## Deep Package. ##
|
|---|
| 908 | ## -------------- ##
|
|---|
| 909 |
|
|---|
| 910 | AT_SETUP([Deep Package])
|
|---|
| 911 | AT_KEYWORDS(autoreconf)
|
|---|
| 912 |
|
|---|
| 913 | # We use aclocal (via autoreconf).
|
|---|
| 914 | AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
|---|
| 915 |
|
|---|
| 916 | # The contents of `.'
|
|---|
| 917 | AT_DATA([install-sh], [])
|
|---|
| 918 | AT_DATA([configure.in],
|
|---|
| 919 | [[AC_INIT(GNU Outer, 1.0)
|
|---|
| 920 | AC_ARG_VAR([OUTER], [an outer variable])
|
|---|
| 921 | AC_CONFIG_SUBDIRS([inner])
|
|---|
| 922 | AC_OUTPUT
|
|---|
| 923 | ]])
|
|---|
| 924 |
|
|---|
| 925 | # The contents of `inner/', and `inner/innermost/'.
|
|---|
| 926 | AS_MKDIR_P([inner/innermost])
|
|---|
| 927 |
|
|---|
| 928 | AT_DATA([inner/configure.in],
|
|---|
| 929 | [[AC_INIT(GNU Inner, 1.0)
|
|---|
| 930 | AC_ARG_VAR([INNER], [an inner variable])
|
|---|
| 931 | AC_CONFIG_SUBDIRS(innermost)
|
|---|
| 932 | AC_OUTPUT
|
|---|
| 933 | ]])
|
|---|
| 934 |
|
|---|
| 935 | AT_DATA([inner/innermost/configure.in],
|
|---|
| 936 | [[AC_INIT(GNU Innermost, 1.0)
|
|---|
| 937 | AC_ARG_VAR([INNERMOST], [an innermost variable])
|
|---|
| 938 | AC_CONFIG_HEADERS(config.h:config.hin)
|
|---|
| 939 | AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
|
|---|
| 940 | AC_OUTPUT
|
|---|
| 941 | ]])
|
|---|
| 942 |
|
|---|
| 943 | AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
|
|---|
| 944 | AT_CHECK([test -f inner/configure])
|
|---|
| 945 | AT_CHECK([test -f inner/innermost/configure])
|
|---|
| 946 | AT_CHECK([test -f inner/innermost/config.hin])
|
|---|
| 947 |
|
|---|
| 948 | # Running the outer configure recursively should provide the innermost
|
|---|
| 949 | # help strings.
|
|---|
| 950 | AT_CHECK([./configure --help=recursive | grep " INNER "], 0, [ignore])
|
|---|
| 951 | AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
|
|---|
| 952 |
|
|---|
| 953 | # Running the outer configure should trigger the inner.
|
|---|
| 954 | AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
|
|---|
| 955 | AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
|
|---|
| 956 | [[#define INNERMOST tsomrenni
|
|---|
| 957 | ]])
|
|---|
| 958 |
|
|---|
| 959 | # The same, but from a builddir.
|
|---|
| 960 | AS_MKDIR_P([builddir])
|
|---|
| 961 | AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
|
|---|
| 962 | AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
|
|---|
| 963 | [[#define INNERMOST build/tsomrenni
|
|---|
| 964 | ]])
|
|---|
| 965 |
|
|---|
| 966 | AT_CLEANUP
|
|---|
| 967 |
|
|---|
| 968 |
|
|---|
| 969 |
|
|---|
| 970 | ## -------------------------------- ##
|
|---|
| 971 | ## Non-Autoconf AC_CONFIG_SUBDIRS. ##
|
|---|
| 972 | ## -------------------------------- ##
|
|---|
| 973 |
|
|---|
| 974 | AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
|
|---|
| 975 | AT_KEYWORDS([autoreconf])
|
|---|
| 976 |
|
|---|
| 977 | # We use aclocal (via autoreconf).
|
|---|
| 978 | AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
|---|
| 979 |
|
|---|
| 980 | AT_DATA([install-sh], [])
|
|---|
| 981 | AT_DATA([configure.in],
|
|---|
| 982 | [[AC_INIT(GNU Outer, 1.0)
|
|---|
| 983 | AC_CONFIG_SUBDIRS([inner])
|
|---|
| 984 | AC_OUTPUT
|
|---|
| 985 | ]])
|
|---|
| 986 |
|
|---|
| 987 | AS_MKDIR_P([inner])
|
|---|
| 988 |
|
|---|
| 989 | AT_DATA([inner/configure],
|
|---|
| 990 | [[#! /bin/sh
|
|---|
| 991 | case "$*" in
|
|---|
| 992 | *--help*) echo 'No Autoconf here, folks!' ;;
|
|---|
| 993 | *) echo got_it >myfile ;;
|
|---|
| 994 | esac
|
|---|
| 995 | exit 0
|
|---|
| 996 | ]])
|
|---|
| 997 | chmod +x inner/configure
|
|---|
| 998 |
|
|---|
| 999 | AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
|
|---|
| 1000 |
|
|---|
| 1001 | # Running the outer configure recursively should provide the innermost
|
|---|
| 1002 | # help strings.
|
|---|
| 1003 | AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
|
|---|
| 1004 |
|
|---|
| 1005 | # Running the outer configure should trigger the inner.
|
|---|
| 1006 | AT_CHECK([./configure], 0, [ignore])
|
|---|
| 1007 | AT_CHECK([test -f inner/myfile], 0)
|
|---|
| 1008 |
|
|---|
| 1009 | AT_CLEANUP
|
|---|
| 1010 |
|
|---|
| 1011 |
|
|---|
| 1012 |
|
|---|
| 1013 | ## ----------------- ##
|
|---|
| 1014 | ## Empty directory. ##
|
|---|
| 1015 | ## ----------------- ##
|
|---|
| 1016 |
|
|---|
| 1017 | AT_SETUP([Empty directory])
|
|---|
| 1018 | AT_KEYWORDS([autoreconf])
|
|---|
| 1019 |
|
|---|
| 1020 | # We use aclocal (via autoreconf).
|
|---|
| 1021 | AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
|---|
| 1022 |
|
|---|
| 1023 | # The test group directory is not necessarily _empty_, but it does not contain
|
|---|
| 1024 | # files meaningful to `autoreconf'.
|
|---|
| 1025 |
|
|---|
| 1026 | AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
|
|---|
| 1027 |
|
|---|
| 1028 | AT_CLEANUP
|
|---|
| 1029 |
|
|---|
| 1030 |
|
|---|
| 1031 |
|
|---|
| 1032 | ## ------------------------------ ##
|
|---|
| 1033 | ## Unusual Automake input files. ##
|
|---|
| 1034 | ## ------------------------------ ##
|
|---|
| 1035 |
|
|---|
| 1036 | # This parallels gnumake.test in Automake.
|
|---|
| 1037 |
|
|---|
| 1038 | AT_SETUP([Unusual Automake input files])
|
|---|
| 1039 | AT_KEYWORDS([autoreconf])
|
|---|
| 1040 |
|
|---|
| 1041 | # We use aclocal and automake via autoreconf.
|
|---|
| 1042 | AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
|
|---|
| 1043 |
|
|---|
| 1044 | AT_DATA([configure.in],
|
|---|
| 1045 | [[AC_INIT(GNU foo, 1.0)
|
|---|
| 1046 | AM_INIT_AUTOMAKE
|
|---|
| 1047 | AC_CONFIG_FILES([HeeHee])
|
|---|
| 1048 | AC_OUTPUT
|
|---|
| 1049 | ]])
|
|---|
| 1050 |
|
|---|
| 1051 | AT_DATA([HeeHee.am],
|
|---|
| 1052 | [[# Humans do no worse than `GNUmakefile.am'.
|
|---|
| 1053 | AUTOMAKE_OPTIONS = foreign 1.8
|
|---|
| 1054 | ]])
|
|---|
| 1055 |
|
|---|
| 1056 | AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr],
|
|---|
| 1057 | [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])])
|
|---|
| 1058 | AT_CHECK([test -f HeeHee.in])
|
|---|
| 1059 |
|
|---|
| 1060 | AT_CLEANUP
|
|---|