test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / compile2.sh
blob5da31c7e6540328944608b23496a68dfdbc2acf8
1 #! /bin/sh
2 # Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Make sure 'compile' deals correctly with Windows-style paths.
19 am_create_testdir=empty
20 . test-init.sh
22 get_shell_script compile
24 cat >mycc <<'END'
25 source_seen=no
26 for arg
28 test "X$arg" = X-o && exit 1
29 test "X$arg" = "X$amtest_source" && source_seen=yes
30 done
31 if test "$source_seen" != yes; then
32 echo "$0: no source file seen" >&2
33 exit 1
35 if test ! -f "$amtest_source"; then
36 echo "$0: $amtest_source not readable" >&2
37 exit 1
39 if test ! -d "$amtest_lock"; then
40 echo "$0: no lockdir $amtest_lock" >&2
41 exit 1
43 touch "$amtest_obj"
44 END
46 chmod +x ./mycc
48 # In case this test runs on a system with backslash directory separators:
49 mkdir libltdl libltdl/libltdl
51 # Backslashes in the input and the output name should be accepted.
52 # Since this test might run on non-w32 systems, we need to be careful not
53 # to use any backslash sequences which might be interpreted by 'echo'.
54 amtest_source='libltdl\libltdl\slist.c'
55 amtest_object='libltdl\libltdl\libltdl_libltdl_la-slist.obj'
56 amtest_obj='slist.o'
57 amtest_lock='slist_o.d'
58 export amtest_source amtest_object amtest_obj amtest_lock
60 : > "$amtest_source"
61 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
62 test -f "$amtest_object"
64 # Absolute Windows paths should be accepted.
65 # Do not actually run this test on anything that could be Windows.
66 if test -d 'C:\'; then
67 skip_ "this test shouldn't run on a Windows-like system"
69 case $PATH_SEPARATOR in
70 ';'|':');;
71 *) skip_ "unrecognized PATH separator '$PATH_SEPARATOR'"
72 esac
74 amtest_source='C:\libltdl\libltdl\slist.c'
75 amtest_object='C:\libltdl\libltdl\libltdl_libltdl_la-slist.obj'
76 amtest_obj='slist.o'
77 amtest_lock='slist_o.d'
78 export amtest_source amtest_object amtest_obj amtest_lock
80 : > "$amtest_source"
81 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
82 test -f "$amtest_object"