tools.at 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337
  1. # -*- Autotest -*-
  2. AT_BANNER([Executables (autoheader, autoupdate...).])
  3. # Copyright (C) 2000-2001, 2003-2004, 2006-2012 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 3 of the License, or
  9. # (at your option) 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, see <http://www.gnu.org/licenses/>.
  18. ## ----------------------------- ##
  19. ## Syntax of the shell scripts. ##
  20. ## ----------------------------- ##
  21. # We use `/bin/sh -n script' to check that there are no syntax errors
  22. # in the scripts. Although incredible, there are /bin/sh that go into
  23. # endless loops with `-n', e.g., SunOS's:
  24. #
  25. # $ uname -a
  26. # SunOS ondine 4.1.3 2 sun4m unknown
  27. # $ cat endless.sh
  28. # while false
  29. # do
  30. # :
  31. # done
  32. # exit 0
  33. # $ time sh endless.sh
  34. # sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total
  35. # $ time sh -nx endless.sh
  36. # ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total
  37. #
  38. # So before using `/bin/sh -n' to check our scripts, we first check
  39. # that `/bin/sh -n' is not broken to death.
  40. AT_SETUP([Syntax of the shell scripts])
  41. AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
  42. # Specify the absolute name of the tool, as some shells don't honor PATH when
  43. # running `sh PROG'.
  44. AT_CHECK_SHELL_SYNTAX(["$abs_top_builddir/bin/autoconf"])
  45. AT_CHECK_SHELL_SYNTAX(["$abs_top_builddir/tests/autoconf"])
  46. AT_CHECK_SHELL_SYNTAX(["$abs_top_builddir/tests/testsuite"])
  47. # These are not built, they are in the src tree.
  48. AT_CHECK_SHELL_SYNTAX(["$abs_top_srcdir/build-aux/install-sh"])
  49. AT_CHECK_SHELL_SYNTAX(["$abs_top_srcdir/build-aux/missing"])
  50. AT_CLEANUP
  51. ## ---------------------------- ##
  52. ## Syntax of the Perl scripts. ##
  53. ## ---------------------------- ##
  54. AT_SETUP([Syntax of the Perl scripts])
  55. AT_CHECK_PERL_SYNTAX([autoheader])
  56. AT_CHECK_PERL_SYNTAX([autom4te])
  57. AT_CHECK_PERL_SYNTAX([autoreconf])
  58. AT_CHECK_PERL_SYNTAX([autoscan])
  59. AT_CHECK_PERL_SYNTAX([autoupdate])
  60. AT_CHECK_PERL_SYNTAX([ifnames])
  61. AT_CLEANUP
  62. ## ------------------ ##
  63. ## autom4te's cache. ##
  64. ## ------------------ ##
  65. AT_SETUP([autom4te cache])
  66. AT_DATA_M4SUGAR([[script.4s]],
  67. [[m4_include([foo])
  68. ]])
  69. # Everything is OK.
  70. touch foo
  71. AT_CHECK_M4SUGAR
  72. # We moved a file: it should fail
  73. mkdir sub
  74. mv foo sub
  75. AT_CHECK_M4SUGAR([], [1], [],
  76. [m4:script.4s:1: cannot open `foo': No such file or directory
  77. autom4te: m4 failed with exit status: 1
  78. ])
  79. # But if we change the main file, then we should no longer complain of
  80. # missing files.
  81. AT_DATA_M4SUGAR([[script.4s]],
  82. [[m4_include([sub/foo])
  83. ]])
  84. AT_CHECK_M4SUGAR
  85. AT_CLEANUP
  86. # autom4te --force
  87. # ----------------
  88. AT_SETUP([autom4te --force])
  89. AT_DATA([file.m4],
  90. [[right
  91. ]])
  92. AT_CHECK_AUTOM4TE([-o file file.m4])
  93. # Create a file whose time stamp is in the future.
  94. # (next year)-01-01 00:01 UTC should always be in the future,
  95. # even on slow machines.
  96. echo BAD >file
  97. this_year=`TZ=UTC0 date +%Y`
  98. AS_VAR_ARITH([next_year], [$this_year + 1])
  99. TZ=UTC0 touch -t ${next_year}01010001 file
  100. AT_CHECK_AUTOM4TE([--force -o file file.m4])
  101. AT_CHECK([cat file], 0,
  102. [[right
  103. ]])
  104. AT_CLEANUP
  105. # autom4te and file names containing whitespace
  106. # ---------------------------------------------
  107. AT_SETUP([autom4te and whitespace in file names])
  108. x=
  109. export x
  110. rm -f a b
  111. for funny in \
  112. 'with funny '\'' $x & #! name' \
  113. 'with funny \ '\'' \'\'' " <a >b * ? name ' # "restore font-lock
  114. do
  115. funny=`func_sanitize_file_name "$funny"`
  116. file=" file $funny"
  117. outfile="$file out "
  118. dir=`func_sanitize_dir_name " dir $funny"`
  119. cachedir=" cache$dir"
  120. TMPDIR=" tmp$dir"
  121. export TMPDIR
  122. # skip if we cannot create such a file or directory
  123. AT_CHECK([mkdir "$dir" "$cachedir" "$TMPDIR" && touch "$file" || exit 77])
  124. cat >"$file" <<'END'
  125. [m4@&t@_init[]m4@&t@_include(foo.m4)
  126. m4@&t@_divert([])d@&t@nl
  127. FOO]
  128. END
  129. cat >"$dir"/foo.m4 <<'END'
  130. [m4@&t@_define([FOO], [bar])]
  131. END
  132. AT_CHECK_AUTOM4TE([-C "$cachedir" -B "$dir" --language=m4sugar -o "$outfile" "$file"])
  133. AT_CHECK([cat "$outfile"], [],
  134. [[bar
  135. ]])
  136. rm -rf "$outfile" "$cachedir"
  137. AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar -o "$outfile" "$file"])
  138. AT_CHECK([cat "$outfile"], [],
  139. [[bar
  140. ]])
  141. # This exercises a slightly different code path and will catch an open with
  142. # trailing whitespace:
  143. cat >"$file" <<'END'
  144. [m4@&t@_init[]m4@&t@_include(foo.m4)
  145. m4@&t@_pattern_forbid([^bar$])
  146. m4@&t@_divert([])d@&t@nl
  147. FOO]
  148. END
  149. rm -rf "$outfile" "$cachedir"
  150. AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar -o "$outfile" "$file"],
  151. [1], [], [stderr])
  152. AT_CHECK([grep 'possibly undefined macro' stderr], [], [ignore])
  153. cat >"$file" <<'END'
  154. [m4@&t@_init[]m4@&t@_include(foo.m4)
  155. m4@&t@_divert([])d@&t@nl]
  156. END
  157. rm -rf "$file.m4f"
  158. AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar --freeze -o "$file.m4f" "$file"])
  159. AT_CHECK([test -s "$file.m4f"])
  160. # Check --reload-state
  161. AT_CHECK_AUTOM4TE([-C "$cachedir" --language=m4sugar -o "$outfile" "$file.m4f" /dev/null])
  162. test ! -f b
  163. done
  164. AT_CLEANUP
  165. # autom4te --trace and unusual macro names
  166. # ----------------------------------------
  167. AT_SETUP([autom4te --trace and unusual macro names])
  168. AT_DATA([file.m4],
  169. [[
  170. ]])
  171. AT_CHECK_AUTOM4TE([-t 'TR A CE' -t 'TR(A)CE' file.m4])
  172. AT_CLEANUP
  173. AT_SETUP([autom4te --trace and whitespace])
  174. dnl line numbering differs between m4 1.4.6 and 1.4.13 if we don't
  175. dnl go through a single line wrapper
  176. AT_DATA_M4SUGAR([file.m4],
  177. [[m4_define([foo], [m4_echo([ a
  178. b c ], [\
  179. d\
  180. ])])
  181. foo
  182. ]])
  183. AT_CHECK_AUTOM4TE([--language=m4sugar -t 'm4@&t@_echo' file.m4], [0],
  184. [[file.m4:5:m4@&t@_echo: a b c :d
  185. ]])
  186. AT_CLEANUP
  187. ## ------------------ ##
  188. ## autoconf --trace. ##
  189. ## ------------------ ##
  190. # autoconf --trace: user macros
  191. # -----------------------------
  192. AT_SETUP([autoconf --trace: user macros])
  193. AT_DATA([configure.ac],
  194. [[m4_define([active], [ACTIVE])
  195. m4_define([TRACE1], [TRACE2(m4_shift($@))])
  196. m4_define([TRACE2], [[$2], $1])
  197. # No arguments.
  198. TRACE1
  199. TRACE2
  200. # With arguments, single line.
  201. TRACE1(foo, @bar, @baz)
  202. TRACE1(foo, TRACE1(bar, baz))
  203. TRACE1(foo, active, baz)
  204. TRACE1(foo, [active], TRACE1(active, [active]))
  205. ]])
  206. # Several --traces.
  207. AT_CHECK_AUTOCONF([-t TRACE1 -t TRACE2], 0,
  208. [[configure.ac:6:TRACE1:
  209. configure.ac:6:TRACE2:
  210. configure.ac:7:TRACE2:
  211. configure.ac:10:TRACE1:foo:@bar:@baz
  212. configure.ac:10:TRACE2:@bar:@baz
  213. configure.ac:11:TRACE1:bar:baz
  214. configure.ac:11:TRACE2:baz
  215. configure.ac:11:TRACE1:foo::baz
  216. configure.ac:11:TRACE2::baz
  217. configure.ac:12:TRACE1:foo:ACTIVE:baz
  218. configure.ac:12:TRACE2:ACTIVE:baz
  219. configure.ac:13:TRACE1:ACTIVE:active
  220. configure.ac:13:TRACE2:active
  221. configure.ac:13:TRACE1:foo:active::ACTIVE
  222. configure.ac:13:TRACE2:active::ACTIVE
  223. ]])
  224. # Several line requests.
  225. AT_CHECK_AUTOCONF([[-t TRACE1:'
  226. [$1], [$2], [$3].']], 0,
  227. [[
  228. [], [], [].
  229. [foo], [@bar], [@baz].
  230. [bar], [baz], [].
  231. [foo], [], [baz].
  232. [foo], [ACTIVE], [baz].
  233. [ACTIVE], [active], [].
  234. [foo], [active], [].
  235. ]])
  236. # ${sep}@.
  237. AT_CHECK_AUTOCONF([-t TRACE2:'${)===(}@'], 0,
  238. [[[]
  239. []
  240. [@bar])===([@baz]
  241. [baz]
  242. [])===([baz]
  243. [ACTIVE])===([baz]
  244. [active]
  245. [active])===([])===([ACTIVE]
  246. ]])
  247. # Arguments spanning multiple lines.
  248. AT_DATA([configure.ac],
  249. [[m4_define([TRACE], [])
  250. TRACE(foo
  251. bar,
  252. bar
  253. foo)
  254. ]])
  255. AT_CHECK_AUTOCONF([-t TRACE:'$%'], 0,
  256. [[foo bar:bar foo
  257. ]])
  258. AT_CLEANUP
  259. # autoconf --trace: builtins
  260. # --------------------------
  261. AT_SETUP([autoconf --trace: builtins])
  262. AT_DATA([configure.ac],
  263. [[define([active], [ACTIVE])
  264. ]])
  265. AT_CHECK_AUTOCONF([[-t define | sed -n '$p']],
  266. 0,
  267. [[configure.ac:1:define:active:ACTIVE
  268. ]])
  269. # FIXME: Without `$1' the following test dies. Groumphf, once again to
  270. # dive into obscure feature interaction...
  271. # Note that using `-i' means we need the *.m4 files, not the *.m4f files,
  272. # hence we need srcdir, not builddir.
  273. AT_CHECK_AUTOCONF([[-t define:'$1' -i| sed -n '$p']],
  274. 0,
  275. [[active
  276. ]])
  277. AT_CLEANUP
  278. ## ---------------------------- ##
  279. ## autoconf: forbidden tokens. ##
  280. ## ---------------------------- ##
  281. # autoconf: forbidden tokens, basic
  282. # ---------------------------------
  283. AT_SETUP([autoconf: forbidden tokens,[] basic])
  284. AT_DATA_M4SH([configure.ac],
  285. [[AS_INIT
  286. m4_foo
  287. _m4_bar
  288. AS_FOO
  289. _AS_BAR
  290. [dnl]
  291. ]])
  292. dnl This test needs autom4te's cache, in spite of any ~/.autom4te.cfg.
  293. AT_DATA([.autom4te.cfg], [[
  294. begin-language: "Autoconf"
  295. args: --cache=autom4te.cache
  296. end-language: "Autoconf"
  297. begin-language: "Autoconf-without-aclocal-m4"
  298. args: --cache=autom4te.cache
  299. end-language: "Autoconf-without-aclocal-m4"
  300. ]])
  301. AT_CHECK_AUTOCONF([], 1, [],
  302. [[configure.ac:2: error: possibly undefined macro: m4@&t@_foo
  303. If this token and others are legitimate, please use m4@&t@_pattern_allow.
  304. See the Autoconf documentation.
  305. configure.ac:3: error: possibly undefined macro: _m4@&t@_bar
  306. configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
  307. configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
  308. configure.ac:6: error: possibly undefined macro: d@&t@nl
  309. ]])
  310. # Second run should succeed and yield no output.
  311. AT_CHECK([autoconf])
  312. AT_CLEANUP
  313. # autoconf: forbidden tokens, exceptions
  314. # --------------------------------------
  315. AT_SETUP([autoconf: forbidden tokens,[] exceptions])
  316. AT_DATA_M4SH([configure.ac],
  317. [[AS_INIT
  318. # This is allowed in spite of the name.
  319. # It is on purpose that we check the case where there are several
  320. # tokens on the same line.
  321. m4_pattern_allow([^AS_ALLOWED$])
  322. NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
  323. # Test forbidding.
  324. m4_pattern_forbid([^FORBIDDEN$])
  325. NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
  326. # Test Autoconf's patterns.
  327. AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
  328. BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
  329. # This is legal, although there is `AS_DEFINE' in there.
  330. BAS_DEFINE
  331. # AS_THIS_IS_A_COMMENT so just shut up.
  332. It would be very bad if Autoconf forgot to expand [AS_]INIT!
  333. ]])
  334. AT_CHECK_AUTOCONF([], 1, [],
  335. [[configure.ac:1: error: possibly undefined macro: AS@&t@_INIT
  336. If this token and others are legitimate, please use m4@&t@_pattern_allow.
  337. See the Autoconf documentation.
  338. configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
  339. configure.ac:10: error: possibly undefined macro: FORBIDDEN
  340. configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID
  341. configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
  342. ]])
  343. AT_CLEANUP
  344. # autoconf: automatically allowed tokens
  345. # --------------------------------------
  346. AT_SETUP([autoconf: automatically allowed tokens])
  347. AT_DATA_M4SH([configure.ac],
  348. [[AC_INIT
  349. m4_pattern_forbid([^FB_])
  350. AC_DEFINE([FB_ONE])
  351. AC_SUBST([FB_TWO])
  352. AC_OUTPUT
  353. ]])
  354. AT_CHECK_AUTOCONF
  355. AT_CLEANUP
  356. # autoconf: do not forbid the empty token
  357. # ---------------------------------------
  358. AT_SETUP([autoconf: the empty token])
  359. AT_DATA_M4SH([configure.ac],
  360. [[m4_init[]m4_pattern_allow([^foo$])
  361. m4_divert([])dnl
  362. line that begins with a space
  363. ]])
  364. AT_CHECK_AUTOCONF
  365. AT_CLEANUP
  366. # autoconf: subdirectories
  367. # ------------------------
  368. AT_SETUP([autoconf: subdirectories])
  369. AT_DATA([configure.ac],
  370. [[AC_INIT
  371. AC_PROG_MKDIR_P
  372. AC_CONFIG_FILES(sub/foo)
  373. AC_OUTPUT
  374. ]])
  375. mkdir sub
  376. AT_DATA([sub/foo.in],
  377. [[@MKDIR_P@
  378. ]])
  379. AT_DATA([install-sh])
  380. AT_CHECK_AUTOCONF
  381. AT_CHECK_CONFIGURE
  382. AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
  383. AT_CLEANUP
  384. # autoconf: input from stdin
  385. # --------------------------
  386. AT_SETUP([autoconf: input from stdin])
  387. # Past Autoconf versions failed to read from stdin when other, non-frozen input
  388. # files were present.
  389. AT_DATA([aclocal.m4])
  390. AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
  391. 0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
  392. ])
  393. AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
  394. 0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
  395. ])
  396. AT_CLEANUP
  397. # autoconf: AC_AUTOCONF_VERSION
  398. # -----------------------------
  399. AT_SETUP([autoconf: AC_AUTOCONF_VERSION])
  400. AT_DATA([configure.ac],
  401. [[AC_INIT
  402. version m4@&t@_defn([AC_AUTOCONF_VERSION]) version
  403. AC_OUTPUT
  404. ]])
  405. AT_CHECK_AUTOCONF
  406. AT_CHECK([[grep 'version ]]AT_PACKAGE_VERSION[[ version' configure]],
  407. 0, [ignore])
  408. AT_CLEANUP
  409. # autoconf: AC_PRESERVE_HELP_ORDER
  410. # --------------------------------
  411. AT_SETUP([autoconf: AC_PRESERVE_HELP_ORDER])
  412. AT_KEYWORDS([m4@&t@_divert_text])
  413. AT_DATA_AUTOCONF([configure.ac],
  414. [[AC_INIT
  415. AC_PRESERVE_HELP_ORDER
  416. AC_ARG_WITH([one], [ --with-one])
  417. AC_ARG_ENABLE([two], [ --enable-two])
  418. m4_divert_text([HELP_ENABLE], [arbitrary $text])
  419. AC_ARG_WITH([three], [ --with-three])
  420. AC_OUTPUT
  421. ]])
  422. AT_CHECK_AUTOCONF
  423. AT_CHECK_CONFIGURE([--help], [], [stdout])
  424. AT_CHECK([sed -n '/^Optional/,/^$/p' stdout], [],
  425. [[Optional Features and Packages:
  426. --disable-option-checking ignore unrecognized --enable/--with options
  427. --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
  428. --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
  429. --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
  430. --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
  431. --with-one
  432. --enable-two
  433. arbitrary $text
  434. --with-three
  435. ]])
  436. AT_CLEANUP
  437. ## --------- ##
  438. ## ifnames. ##
  439. ## --------- ##
  440. AT_SETUP([ifnames])
  441. AT_DATA([iftest1.c],
  442. [[#ifdef DEF1
  443. #ifndef DEF2
  444. #if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
  445. # if SPACES
  446. # if TABS
  447. /* #if C_COMMENTS */
  448. // #if CXX_COMMENTS
  449. #if LINE1 = \
  450. LINE2
  451. #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
  452. ]])
  453. AT_DATA([iftest2.c],
  454. [[#ifdef IFTEST2
  455. #if VAL1
  456. ]])
  457. AT_CHECK([ifnames iftest1.c iftest2.c], 0,
  458. [DEF1 iftest1.c
  459. DEF2 iftest1.c
  460. DEF3 iftest1.c
  461. DEF4 iftest1.c
  462. IFTEST2 iftest2.c
  463. LINE1 iftest1.c
  464. LINE2 iftest1.c
  465. SPACES iftest1.c
  466. TABS iftest1.c
  467. VAL1 iftest1.c iftest2.c
  468. VAL2 iftest1.c
  469. VAL3 iftest1.c
  470. VAL4 iftest1.c
  471. ], [])
  472. AT_CLEANUP
  473. ## ------------ ##
  474. ## autoheader. ##
  475. ## ------------ ##
  476. # autoheader is intensively used in its modern form throughout this
  477. # test suite. But we also have to check that acconfig.h still works.
  478. # autoheader uses autoconf --trace, so traces first.
  479. AT_SETUP([autoheader])
  480. AT_DATA([acconfig.h],
  481. [[/* Define this to whatever you want. */
  482. #undef this
  483. ]])
  484. # 1. Check that `acconfig.h' is still honored.
  485. AT_DATA([configure.ac],
  486. [[AC_INIT
  487. AC_CONFIG_HEADERS(config.h:config.hin)
  488. AC_DEFINE(this, "whatever you want.")
  489. ]])
  490. AT_CHECK_AUTOHEADER([], [], [], [ignore])
  491. AT_CHECK([cat config.hin], 0,
  492. [[/* config.hin. Generated from configure.ac by autoheader. */
  493. /* Define this to whatever you want. */
  494. #undef this
  495. /* Define to the address where bug reports for this package should be sent. */
  496. #undef PACKAGE_BUGREPORT
  497. /* Define to the full name of this package. */
  498. #undef PACKAGE_NAME
  499. /* Define to the full name and version of this package. */
  500. #undef PACKAGE_STRING
  501. /* Define to the one symbol short name of this package. */
  502. #undef PACKAGE_TARNAME
  503. /* Define to the home page for this package. */
  504. #undef PACKAGE_URL
  505. /* Define to the version of this package. */
  506. #undef PACKAGE_VERSION
  507. ]])
  508. # 2. Check that missing templates are a fatal error.
  509. AT_DATA([configure.ac],
  510. [[AC_INIT
  511. AC_CONFIG_HEADERS(config.h:config.hin)
  512. AC_DEFINE(that, "whatever you want.")
  513. ]])
  514. # The test suite goes too fast for the cache time stamps...
  515. # Pass --force.
  516. AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
  517. # 3. Check TOP and BOTTOM.
  518. AT_DATA([acconfig.h],
  519. [[/* Top from acconfig.h. */
  520. @TOP@
  521. /* Middle from acconfig.h. */
  522. @BOTTOM@
  523. /* Bottom from acconfig.h. */
  524. ]])
  525. AT_DATA([configure.ac],
  526. [[AC_INIT
  527. AC_CONFIG_HEADERS(config.h:config.hin)
  528. AH_TOP([Top1 from configure.ac.])
  529. AH_TOP([Top2 from configure.ac.])
  530. AH_TOP([The Cat in a h@t.])
  531. AH_VERBATIM([Middle], [Middle from configure.ac.])
  532. AH_VERBATIM([Mouse], [The Mouse in a h@t.])
  533. AH_BOTTOM([Bottom1 from configure.ac.])
  534. AH_BOTTOM([Bottom2 from configure.ac.])
  535. AH_BOTTOM([The Dog in a h@t.])
  536. AC_DEFINE([ANT], [@], [The Ant in a h@t.])
  537. ]])
  538. # Yes, that's right: the `middle' part of `acconfig.h' is still before
  539. # the AH_TOP part. But so what, you're not supposed to use the two
  540. # together.
  541. # Ignore STDERR which is the longish complaint against autoheader junk
  542. # files.
  543. AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
  544. AT_CHECK([cat config.hin], 0,
  545. [[/* config.hin. Generated from configure.ac by autoheader. */
  546. /* Top from acconfig.h. */
  547. /* Middle from acconfig.h. */
  548. Top1 from configure.ac.
  549. Top2 from configure.ac.
  550. The Cat in a h@t.
  551. /* The Ant in a h@t. */
  552. #undef ANT
  553. Middle from configure.ac.
  554. The Mouse in a h@t.
  555. /* Define to the address where bug reports for this package should be sent. */
  556. #undef PACKAGE_BUGREPORT
  557. /* Define to the full name of this package. */
  558. #undef PACKAGE_NAME
  559. /* Define to the full name and version of this package. */
  560. #undef PACKAGE_STRING
  561. /* Define to the one symbol short name of this package. */
  562. #undef PACKAGE_TARNAME
  563. /* Define to the home page for this package. */
  564. #undef PACKAGE_URL
  565. /* Define to the version of this package. */
  566. #undef PACKAGE_VERSION
  567. Bottom1 from configure.ac.
  568. Bottom2 from configure.ac.
  569. The Dog in a h@t.
  570. /* Bottom from acconfig.h. */
  571. ]])
  572. AT_CLEANUP
  573. # autoheader should see through m4 macros, just like autoconf
  574. # http://lists.gnu.org/archive/html/bug-autoconf/2009-06/msg00000.html
  575. AT_SETUP([autoheader and macros])
  576. AT_DATA([configure.ac],
  577. [[AC_INIT
  578. AC_CONFIG_HEADER([config.h])
  579. m4_define([PETER], [SIMSALABIM])
  580. m4_define([PAUL], [OPENSESAME])
  581. AC_DEFINE([PETER], [10], [Peter's public info])
  582. AC_DEFINE_UNQUOTED([PAUL], [`expr 4 + 6`], [Paul's public info])
  583. AC_OUTPUT
  584. ]])
  585. AT_CHECK_AUTOCONF
  586. AT_CHECK_AUTOHEADER
  587. AT_CHECK([grep -c SIMSALABIM configure config.h.in], [0],
  588. [[configure:1
  589. config.h.in:1
  590. ]])
  591. AT_CHECK([grep -c OPENSESAME configure config.h.in], [0],
  592. [[configure:1
  593. config.h.in:1
  594. ]])
  595. AT_CHECK([grep -c PETER configure config.h.in], [1],
  596. [[configure:0
  597. config.h.in:0
  598. ]])
  599. AT_CHECK([grep -c PAUL configure config.h.in], [1],
  600. [[configure:0
  601. config.h.in:0
  602. ]])
  603. AT_CLEANUP
  604. ## ------------ ##
  605. ## autoupdate. ##
  606. ## ------------ ##
  607. # Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
  608. AT_SETUP([autoupdate])
  609. AT_DATA([configure.ac],
  610. [[AC_INIT(Test, 1.0)
  611. AC_CANONICAL_SYSTEM
  612. # The doc says 27 is a valid fubar.
  613. fubar=27
  614. AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
  615. ]])
  616. AT_DATA([expout],
  617. [[AC_INIT([Test],[1.0])
  618. AC_CANONICAL_TARGET
  619. # The doc says 27 is a valid fubar.
  620. fubar=27
  621. AC_CONFIG_FILES([Makefile])
  622. AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
  623. AC_OUTPUT
  624. ]])
  625. # Checking `autoupdate'.
  626. AT_CHECK_AUTOUPDATE
  627. AT_CHECK([cat configure.ac], 0, [expout])
  628. # Checking that `autoupdate' is idempotent
  629. AT_CHECK_AUTOUPDATE
  630. AT_CHECK([cat configure.ac], 0, [expout])
  631. AT_CLEANUP
  632. # autoupdating AC_LINK_FILES
  633. # --------------------------
  634. AT_SETUP([autoupdating AC_LINK_FILES])
  635. AT_DATA([configure.ac],
  636. [[AC_INIT
  637. AC_LINK_FILES(dst1 dst2, src1 src2)
  638. AC_OUTPUT
  639. ]])
  640. AT_DATA([dst1], dst1
  641. )
  642. AT_DATA([dst2], dst2
  643. )
  644. # Checking `autoupdate'.
  645. AT_CHECK_AUTOUPDATE([], 0, [], ignore)
  646. AT_CHECK_AUTOCONF
  647. AT_CHECK_CONFIGURE
  648. AT_CHECK([cat src1], 0, [dst1
  649. ])
  650. AT_CHECK([cat src2], 0, [dst2
  651. ])
  652. AT_CLEANUP
  653. # autoupdating AC_PREREQ
  654. # ----------------------
  655. AT_SETUP([autoupdating AC_PREREQ])
  656. # Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
  657. AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
  658. autoupdate_version=`cat stdout`
  659. [echo "AC_PREREQ([$autoupdate_version])" >expout]
  660. AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
  661. 0, [expout], [])
  662. AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
  663. 0, [expout], [])
  664. AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
  665. 63, [], [ignore])
  666. AT_CLEANUP
  667. # autoupdating AU_ALIAS
  668. # ---------------------
  669. AT_SETUP([autoupdating AU_ALIAS])
  670. AT_DATA([configure.ac],
  671. [[AC_INIT
  672. AC_DEFUN([FOO], [$#])
  673. AU_ALIAS([BAZ],[FOO])
  674. test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
  675. AC_PROG_CC
  676. AC_STDC_HEADERS
  677. AC_OUTPUT
  678. ]])
  679. # Checking `autoupdate'.
  680. AT_CHECK_AUTOUPDATE
  681. AT_CHECK_AUTOCONF
  682. AT_CHECK_CONFIGURE
  683. AT_CHECK([grep 'AC_HEADER_STDC[(]' configure.ac], 1, [ignore], [ignore])
  684. AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
  685. AT_CLEANUP
  686. # autoupdating OLD to NEW
  687. # -----------------------
  688. # The example taken from the code comments.
  689. AT_SETUP([autoupdating OLD to NEW])
  690. AT_DATA([aclocal.m4],
  691. [[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
  692. AC_DEFUN([NEW], [echo "sum($1) = $2"])
  693. ]])
  694. AT_DATA([configure.ac],
  695. [[AC_INIT
  696. OLD(1, 2)
  697. NEW([0, 0], [0])
  698. ]])
  699. # Checking `autoupdate'.
  700. AT_CHECK_AUTOUPDATE
  701. AT_CHECK_AUTOCONF
  702. AT_CHECK_CONFIGURE
  703. AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
  704. AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
  705. AT_CLEANUP
  706. # autoupdating macros recursively
  707. # -------------------------------
  708. AT_SETUP([autoupdating macros recursively])
  709. AT_XFAIL_IF([:])
  710. AT_DATA([configure.ac],
  711. [[AC_INIT
  712. AC_PROG_CC
  713. AC_TRY_COMPILE([], [choke me], [echo bogus1],
  714. [AC_TRY_COMPILE([], [return 0;], [echo good], [echo bogus2])])
  715. AC_OUTPUT
  716. ]])
  717. # Checking `autoupdate'.
  718. AT_CHECK_AUTOUPDATE
  719. AT_CHECK([grep changequote configure.ac], [1])
  720. AT_CHECK([grep TRY_COMPILE configure.ac], [1])
  721. AT_CHECK_AUTOCONF
  722. AT_CHECK_CONFIGURE
  723. AT_CLEANUP
  724. # autoupdating AC_HELP_STRING
  725. # ---------------------------
  726. AT_SETUP([autoupdating AC_HELP_STRING])
  727. AT_DATA([configure.ac],
  728. [[AC_INIT
  729. AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
  730. ]])
  731. # Checking `autoupdate'.
  732. AT_CHECK_AUTOUPDATE([], [], [], [ignore])
  733. AT_CHECK_AUTOCONF
  734. AT_CHECK_CONFIGURE([], [], [], [ignore])
  735. AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
  736. AT_CLEANUP
  737. # autoupdating with m4sugar
  738. # -------------------------
  739. AT_SETUP([autoupdating with m4sugar])
  740. AT_DATA([aclocal.m4],
  741. [[AU_DEFUN([OLD],
  742. [m4@&t@_pushdef([foo], [bar])dn@&t@l
  743. echo "foo $1 foo"
  744. m4@&t@_popdef([foo])dn@&t@l
  745. ])
  746. ]])
  747. touch foo.in
  748. AT_DATA([configure.ac],
  749. [[AC_PREREQ(2.54)
  750. m4_define([gnumeric_version_epoch], [1])
  751. AC_INIT
  752. OLD([ bla bla ])
  753. AC_FOREACH([name], [n1 n2],
  754. [echo name
  755. ])
  756. AC_CHECKING([for feature])
  757. AC_MSG_RESULT_UNQUOTED([`echo done`])
  758. AC_OUTPUT([foo])
  759. ]])
  760. # Checking `autoupdate'.
  761. AT_CHECK_AUTOUPDATE([], [], [], [ignore])
  762. AT_CHECK_AUTOCONF
  763. AT_CHECK_CONFIGURE([], [], [], [ignore])
  764. AT_CLEANUP
  765. # autoupdating with m4_pushdef
  766. # ----------------------------
  767. AT_SETUP([autoupdating with m4@&t@_pushdef])
  768. AT_XFAIL_IF([:])
  769. touch foo.in
  770. AT_DATA([configure.ac],
  771. [[AC_INIT
  772. AC_PROG_CC
  773. # temporarily override this macro
  774. m4@&t@_pushdef([AC_MSG_RESULT_UNQUOTED], [:])
  775. AC_C_BIGENDIAN
  776. m4@&t@_popdef([AC_MSG_RESULT_UNQUOTED])
  777. AC_OUTPUT
  778. ]])
  779. # Checking `autoupdate'.
  780. AT_CHECK_AUTOUPDATE([], [], [], [ignore])
  781. AT_CHECK([grep changequote configure.ac], [1])
  782. AT_CHECK([grep [pushdef.*AC_MSG_RESULT_UNQUOTED] configure.ac], [0], [ignore])
  783. AT_CHECK_AUTOCONF
  784. AT_CHECK_CONFIGURE([], [], [], [ignore])
  785. AT_CLEANUP
  786. # autoupdating with AC_REQUIRE
  787. # ----------------------------
  788. AT_SETUP([autoupdating with AC_REQUIRE])
  789. AT_XFAIL_IF([:])
  790. AT_DATA([configure.ac],
  791. [[AC_DEFUN([MACRO],
  792. [AC_REQUIRE([AC_DECL_SYS_SIGLIST])
  793. AC_CHECK_DECLS([_sys_siglist], [], [], [#include <signal.h>])
  794. ])
  795. AC_INIT
  796. MACRO
  797. AC_OUTPUT
  798. ]])
  799. # Checking `autoupdate'.
  800. AT_CHECK_AUTOUPDATE([], [], [], [ignore])
  801. AT_CHECK_AUTOCONF
  802. AT_CHECK_CONFIGURE([], [], [], [ignore])
  803. AT_CLEANUP
  804. # autoupdating with complex quoting
  805. # ---------------------------------
  806. AT_SETUP([autoupdating with complex quoting])
  807. AT_XFAIL_IF([:])
  808. AT_DATA([configure.ac],
  809. [[m4_define([MACRO],
  810. [[#define STRING "hello, world\n"
  811. ]])
  812. AC_INIT
  813. AC_TRY_COMPILE([#include <stdio.h>
  814. ]MACRO[], [printf (STRING);],
  815. [], [AS_EXIT([1])])
  816. AC_OUTPUT
  817. ]])
  818. # Checking `autoupdate'.
  819. AT_CHECK_AUTOUPDATE([], [], [], [ignore])
  820. AT_CHECK_AUTOCONF
  821. AT_CHECK([grep MACRO configure], [1])
  822. AT_CHECK_CONFIGURE([], [], [], [ignore])
  823. AT_CLEANUP
  824. # autoupdating AC_LANG_SAVE
  825. # -------------------------
  826. AT_SETUP([autoupdating AC_LANG_SAVE])
  827. AT_DATA([configure.ac],
  828. [[AC_INIT
  829. AC_LANG_SAVE
  830. AC_LANG_RESTORE
  831. AC_LANG_SAVE
  832. AC_LANG_RESTORE
  833. ]])
  834. # Checking `autoupdate'.
  835. AT_CHECK_AUTOUPDATE([], [], [], [ignore])
  836. AT_CHECK_AUTOCONF
  837. AT_CHECK_CONFIGURE([], [], [], [ignore])
  838. AT_CLEANUP
  839. # autoupdating AC_FOREACH
  840. # -----------------------
  841. AT_SETUP([autoupdating AC_FOREACH])
  842. AT_DATA([aclocal.m4],
  843. [[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
  844. ]])
  845. AT_DATA([configure.ac],
  846. [[AC_INIT
  847. echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
  848. ]])
  849. # Checking `autoupdate'.
  850. AT_CHECK_AUTOUPDATE
  851. AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
  852. AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
  853. AT_CHECK_AUTOCONF
  854. AT_CHECK_CONFIGURE([], [0], [stdout])
  855. AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
  856. AT_CLEANUP
  857. # autoupdating with aclocal and m4_include
  858. # ----------------------------------------
  859. AT_SETUP([autoupdating with aclocal and m4@&t@_include])
  860. # We use aclocal.
  861. AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
  862. mkdir m4 aclocal
  863. AT_DATA([configure.in],
  864. [[AC_INIT(x,0)
  865. AC_UNCHANGED_MACRO
  866. AC_OLD_MACRO
  867. AC_OUTPUT
  868. ]])
  869. AT_DATA([m4/stuff.m4],
  870. [[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
  871. AC_DEFUN([AC_NEW_MACRO], [echo hi])
  872. AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
  873. ]])
  874. cp m4/stuff.m4 aclocal/stuff.m4
  875. AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore])
  876. # Checking `autoupdate'.
  877. AT_CHECK_AUTOUPDATE
  878. AT_CHECK([aclocal -I m4], [0], [ignore], [ignore])
  879. AT_CHECK_AUTOUPDATE
  880. AT_CLEANUP
  881. # Keeping autom4te.cfg complete
  882. # -----------------------------
  883. AT_SETUP([autom4te preselections])
  884. : ${sleep='sleep 1'} # Command to force different time stamps.
  885. # If this test should run on FAT file systems and older w32,
  886. # then setting $sleep correctly needs to be revisited.
  887. # We use aclocal and automake. Skip broken automake wrappers.
  888. AT_CHECK([automake --version || exit 77], [], [stdout], [ignore])
  889. AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
  890. AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
  891. AT_DATA([configure.in],
  892. [[AC_INIT(GNU foo, 1.0)
  893. AM_INIT_AUTOMAKE
  894. AC_CONFIG_FILES([Makefile])
  895. AC_OUTPUT
  896. ]])
  897. AT_DATA([Makefile.am],
  898. [[AUTOMAKE_OPTIONS = foreign
  899. ]])
  900. $sleep # `aclocal.m4' should be strictly younger than its inputs
  901. # If Autoconf is too old, or the user has turned caching off, skip:
  902. AT_CHECK([aclocal || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }],
  903. [], [], [ignore])
  904. AT_CHECK([test -d autom4te.cache || exit 77])
  905. AT_CHECK([autoconf])
  906. # If this test fails due to missing entries in lib/autom4te.in, then
  907. # comparing the old and new requests is a good place to start debugging:
  908. cp autom4te.cache/requests old-requests
  909. echo newer >newer
  910. $sleep # if `configure' is regenerated, we want it to be strictly newer,
  911. # to catch the error consistently.
  912. AT_CHECK([aclocal], [], [], [ignore])
  913. AT_CHECK([automake --no-force --add-missing], [], [], [ignore])
  914. AT_CHECK([autoconf])
  915. AT_CHECK([test "`find configure -newer newer`" = "" ||
  916. { diff old-requests autom4te.cache/requests; exit 1; }],
  917. [], [], [],
  918. [extract_version=['s/^[^0-9]*\([0-9][^ ]*\).*/\1/;q']
  919. automake_version=`automake --version | sed "$extract_version"`
  920. used_automake_version=`sed "$extract_version" "$abs_top_srcdir/Makefile.in"`
  921. AT_CHECK([if test "$automake_version" = "$used_automake_version"; ]dnl
  922. [then exit 1; else exit 77; fi])])
  923. AT_CLEANUP
  924. # autom4te cache creation
  925. # -----------------------
  926. # Ensure autom4te fails when it cannot create the cache directory
  927. # or create files there.
  928. AT_SETUP([autom4te cache creation])
  929. AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
  930. # Work in a subdirectory so autotest can scribble in the toplevel.
  931. mkdir sub
  932. chmod a-w sub
  933. AT_DATA([configure.ac],
  934. [[AC_INIT
  935. ]])
  936. AT_DATA([.autom4te.cfg],
  937. [[begin-language: "Autoconf-without-aclocal-m4"
  938. args: --cache=sub/autom4te.cache
  939. end-language: "Autoconf-without-aclocal-m4"
  940. ]])
  941. # Do not try this when we are root or on systems without permissions.
  942. # A failed redirection may cause a status of 2 with FreeBSD sh.
  943. AT_CHECK([(: > sub/some-file) || exit 1 && exit 77], 1, [ignore], [ignore])
  944. # Failure to create cache directory.
  945. AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
  946. AT_CHECK([grep 'cannot create .*autom4te.cache' stderr], [0], [ignore])
  947. AT_CHECK([test -f configure], [1])
  948. chmod u+w sub
  949. AT_CHECK_AUTOCONF
  950. rm -f configure sub/autom4te.cache/*
  951. chmod a-w sub/autom4te.cache
  952. # Failure to create a file in the cache directory.
  953. AT_CHECK_AUTOCONF([], [1], [ignore], [stderr])
  954. AT_CHECK([grep 'cannot open.*autom4te.cache' stderr], [0], [ignore])
  955. AT_CLEANUP
  956. # autom4te cache locking
  957. # ----------------------
  958. AT_SETUP([autom4te cache locking])
  959. # Cannot use AT_CHECK here, autotest internals could be messed up.
  960. (echo AC_INIT; sleep 2; echo) \
  961. | (autom4te --language=autoconf -o configure -; echo $? >&2 ) 2>errlog &
  962. AT_CHECK([echo AC_INIT | autom4te --language=autoconf -o configure -])
  963. wait
  964. # Ignore additional output from shell verbose or xtrace mode.
  965. AT_CHECK([grep 'cannot rename' errlog], [1])
  966. AT_CHECK([grep '^0$' errlog], [], [ignore])
  967. AT_CHECK_CONFIGURE
  968. AT_CLEANUP
  969. # autotools and file names containing whitespace
  970. # ----------------------------------------------
  971. AT_SETUP([autotools and whitespace in file names])
  972. # We use aclocal.
  973. AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
  974. x=
  975. export x
  976. rm -f a b
  977. for funny in \
  978. 'with funny '\'' $x & #! name ' \
  979. 'with funny \ '\'' \'\'' " <a >b * ? name ' #"
  980. do
  981. funny=`func_sanitize_file_name "$funny"`
  982. file=" file $funny"
  983. dir=`func_sanitize_dir_name " dir $funny"`
  984. TMPDIR=" tmp$dir"
  985. export TMPDIR
  986. # skip if we cannot create such a file or directory
  987. AT_CHECK([mkdir "$dir" "$TMPDIR" && touch "$file.in" || exit 77])
  988. cat >"$file.in" <<'END'
  989. [AC_INIT(x,0)
  990. m4@&t@_include([foo.m4])
  991. AC_CONFIG_HEADERS([config.h:config.hin])
  992. AC_MACRO
  993. AC_OUTPUT]
  994. END
  995. cat >"$dir"/foo.m4 <<'END'
  996. [AC_DEFUN([AC_MACRO], [echo hi])]
  997. END
  998. AT_CHECK_AUTOHEADER([-B "$dir" "$file.in"])
  999. AT_CHECK_AUTOHEADER([--force -I "$dir" "$file.in"])
  1000. AT_CHECK_AUTOUPDATE([-B "$dir" "$file.in"])
  1001. AT_CHECK_AUTOUPDATE([--force -I "$dir" "$file.in"])
  1002. AT_CHECK_AUTOUPDATE([-B "$dir" - < "$file.in"], [], [ignore])
  1003. AT_CHECK_AUTOCONF([-B "$dir" -o "$file" "$file.in"])
  1004. AT_CHECK_AUTOCONF([-I "$dir" -o "$file" "$file.in"])
  1005. # In autoconf, these exercise a slightly different code path:
  1006. AT_CHECK_AUTOCONF([--prepend-include="$dir" -o "$file" "$file.in"])
  1007. AT_CHECK_AUTOCONF([--include="$dir" -o "$file" "$file.in"])
  1008. AT_CHECK([autoscan -B "$dir"], [], [], [ignore])
  1009. AT_CHECK([autoscan --force -I "$dir"], [], [], [ignore])
  1010. # autoreconf requires a sane input file name. Also, disable aclocal.
  1011. mv -f "$file.in" configure.in
  1012. AT_DATA([aclocal.m4])
  1013. AT_CHECK([autoreconf -B "$dir"])
  1014. AT_CHECK([autoreconf --force -I "$dir"])
  1015. cat >"$file.c" <<'END'
  1016. #if FOO
  1017. #endif
  1018. END
  1019. AT_CHECK([ifnames "$file.c"], [], [ignore])
  1020. test ! -f b
  1021. done
  1022. AT_CLEANUP