]> git.saurik.com Git - bison.git/commitdiff
tests: generalize the compilation macros.
authorAkim Demaille <akim@lrde.epita.fr>
Mon, 25 Jun 2012 14:37:18 +0000 (16:37 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Tue, 26 Jun 2012 11:55:49 +0000 (13:55 +0200)
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): If OUTPUT ends with ".o",
then append the "natural" extension for the input file (.c or .cc).
If there is no source, pass -c.
* tests/headers.at, tests/input.at, tests/regression.at: Adjust.

tests/headers.at
tests/input.at
tests/local.at
tests/regression.at

index a28f2e1bd72cb94ccb60d9fee917f6d4b6ab4ac1..549d62dc5cbc4017be608c9e0875a2f92cb6c5e3 100644 (file)
@@ -111,8 +111,8 @@ main (void)
 
 # Link and execute, just to make sure everything is fine (and in
 # particular, that MY_LLOC is indeed defined somewhere).
-AT_COMPILE([caller.o], [-c caller.c])
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([caller.o])
+AT_COMPILE([input.o])
 AT_COMPILE([caller], [caller.o input.o])
 AT_PARSER_CHECK([./caller])
 
index 2f667d0ad5c6a6a3adf3b6a9751bb86bf48bcaf7..6d8d552c57a8695269012a639d217f38839d5d1a 100644 (file)
@@ -533,8 +533,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-d -v -o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
-AT_COMPILE([main.o], [-c main.c])
+AT_COMPILE([input.o])
+AT_COMPILE([main.o])
 AT_COMPILE([input], [input.o main.o])
 AT_PARSER_CHECK([./input], 0,
 [[[@<:@],
@@ -654,7 +654,7 @@ input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash
 AT_BISON_CHECK([-o input.c input.y])
 
 # Make sure we don't export silly token identifiers with periods or dashes.
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 
 
 # Periods are genuine letters, they can start identifiers.
index 85507a390c8ec7fee2d52a6813a1281d53647216..1646a5e650506d5a4ed21efd8914da44f60ecbfb 100644 (file)
@@ -537,21 +537,37 @@ m4_define([AT_QUELL_VALGRIND],
 
 # AT_COMPILE(OUTPUT, [SOURCES = OUTPUT.c])
 # ----------------------------------------
-# Compile SOURCES into OUTPUT.  If OUTPUT does not contain '.',
-# assume that we are linking too; this is a hack.
+# Compile SOURCES into OUTPUT.
+#
+# If OUTPUT does not contain '.', assume that we are linking too,
+# otherwise pass "-c"; this is a hack.  The default SOURCES is OUTPUT
+# with trailing .o removed, and ".c" appended.
 m4_define([AT_COMPILE],
-[AT_CHECK([$CC $CFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.c])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
+[AT_CHECK(m4_join([ ],
+                  [$CC $CFLAGS $CPPFLAGS],
+                  [m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
+                  [-o $1],
+                  [m4_default([$2], [m4_bpatsubst([$1], [\.o$]).c])],
+                  [m4_bmatch([$1], [[.]], [], [$LIBS])]),
           0, [ignore], [ignore])])
 
 # AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc])
-# --------------------------------------------
-# Compile SOURCES into OUTPUT.  If OUTPUT does not contain '.',
-# assume that we are linking too; this is a hack.
-# If the C++ compiler does not work, ignore the test.
+# ---------------------------------------------
+# Compile SOURCES into OUTPUT.  If the C++ compiler does not work,
+# ignore the test.
+#
+# If OUTPUT does not contain '.', assume that we are linking too,
+# otherwise pass "-c"; this is a hack.  The default SOURCES is OUTPUT
+# with trailing .o removed, and ".cc" appended.
 m4_define([AT_COMPILE_CXX],
 [AT_KEYWORDS(c++)
 AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore)
-AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.cc])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
+AT_CHECK(m4_join([ ],
+                 [$CXX $CXXFLAGS $CPPFLAGS],
+                 [m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
+                 [-o $1],
+                 [m4_default([$2], [m4_bpatsubst([$1], [\.o$]).cc])],
+                 [m4_bmatch([$1], [[.]], [], [$LIBS])]),
         0, [ignore], [ignore])])
 
 # AT_JAVA_COMPILE(SOURCES)
@@ -566,6 +582,11 @@ AT_CHECK([[$SHELL ../../../javacomp.sh ]$1],
 
 # AT_LANG_COMPILE(OUTPUT, [SOURCES = OUTPUT.c]
 # --------------------------------------------
+# Compile SOURCES into OUTPUT.  Skip if compiler does not work.
+#
+# If OUTPUT does not contain '.', assume that we are linking too,
+# otherwise pass "-c"; this is a hack.  The default SOURCES is OUTPUT
+# with trailing .o removed, and ".c"/".cc" appended.
 m4_define([AT_LANG_COMPILE],
 [m4_case(AT_LANG,
 [c],    [AT_COMPILE([$1], [$2])],
index 5c1ad32be86053d371b062b509e929b67e10d8f2..4208153a37bd99446d38834861f27c5a0b005c61 100644 (file)
@@ -41,7 +41,7 @@ program: 'x';
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 AT_COMPILE([input.o], [-DYYDEBUG -c input.c])
 
 AT_CLEANUP
@@ -71,7 +71,7 @@ program: { $$ = ""; };
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 
 AT_CLEANUP
 
@@ -111,7 +111,7 @@ exp: MY_TOKEN;
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-y -o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 
 AT_CLEANUP
 
@@ -156,7 +156,7 @@ exp: MY_TOKEN;
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 
 AT_CLEANUP
 
@@ -527,7 +527,7 @@ exp:
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 AT_CLEANUP