# -*- autoconf -*- AT_BANNER([Executables (autoheader, autoupdate...).]) ## -------------------------------------------------------- ## ## Check that the shell scripts are syntactically correct. ## ## -------------------------------------------------------- ## # We use `/bin/sh -n script' to check that there are no syntax errors # in the scripts. Although incredible, there are /bin/sh that go into # endless loops with `-n', e.g., SunOS's: # # $ uname -a # SunOS ondine 4.1.3 2 sun4m unknown # $ cat endless.sh # while false # do # : # done # exit 0 # $ time sh endless.sh # sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total # $ time sh -nx endless.sh # ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total # # So before using `/bin/sh -n' to check our scripts, we first check # that `/bin/sh -n' is not broken to death. AT_SETUP([Syntax of the scripts]) # A script that never returns. We don't care that it never returns, # broken /bin/sh loop equally with `false', but it makes it easier to # test the robusteness in a good environment: just remove the `-n'. AT_DATA(endless.sh, [[while : do : done ]]) # A script in charge of testing `/bin/sh -n'. AT_DATA(syntax.sh, [[(/bin/sh -n endless.sh) & sleep 2 if kill $! >/dev/null 2>&1; then # We managed to kill the child, which means that we probably # can't trust `/bin/sh -n', hence the test failed. exit 1 fi ]]) if /bin/sh ./syntax.sh; then # Specify the path to the tool, some shells don't honor PATH # when running `sh PROG'. AT_CHECK([/bin/sh -n ../autoconf], 0) AT_CHECK([/bin/sh -n ../autoreconf], 0) AT_CHECK([/bin/sh -n ../autoupdate], 0) AT_CHECK([/bin/sh -n ../ifnames], 0) # These are not built, they are in the src tree. AT_CHECK([/bin/sh -n $top_srcdir/install-sh], 0) AT_CHECK([/bin/sh -n $top_srcdir/mkinstalldirs], 0) AT_CHECK([/bin/sh -n $top_srcdir/missing], 0) fi AT_CLEANUP ## ------------ ## ## autoheader. ## ## ------------ ## # autoheader is intensively used in its modern form throught this # test suite. But we also have to check that acconfig.h still works. AT_SETUP([autoheader]) AT_DATA(acconfig.h, [[/* Define this to whatever you want. */ #undef this ]]) # 1. Check that `acconfig.h' is still honored. AT_DATA(configure.in, [[AC_INIT AC_CONFIG_HEADERS(config.h) AC_DEFINE(this, "whatever you want.") ]]) AT_CHECK([autoheader --autoconf-dir .. -expout </dev/null 2>&1; then # Generation of the script. AT_CHECK([AWK='gawk --posix' autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) # Tracing. AT_CHECK([AWK='gawk --posix' autoconf --autoconf-dir .. -l $at_srcdir -t AC_INIT], 0, ignore, []) # Syntax correctness of ifnames. AT_CHECK([AWK='gawk --posix' ifnames empty], 0, [], []) fi AT_CLEANUP(configure) ## --------- ## ## ifnames. ## ## --------- ## AT_SETUP([ifnames]) AT_DATA([iftest1.c], [[#ifdef DEF1 #ifndef DEF2 #if !defined(DEF3) && defined(DEF4) /* but not defined(DEF5) */ # if SPACES # if TABS /* #if C_COMMENTS */ // #if CXX_COMMENTS #if LINE1 = \ LINE2 #if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */ ]]) AT_DATA([iftest2.c], [[#ifdef IFTEST2 #if VAL1 ]]) AT_CHECK([ifnames iftest1.c iftest2.c], 0, [DEF1 iftest1.c DEF2 iftest1.c DEF3 iftest1.c DEF4 iftest1.c IFTEST2 iftest2.c LINE1 iftest1.c LINE2 iftest1.c SPACES iftest1.c TABS iftest1.c VAL1 iftest1.c iftest2.c VAL2 iftest1.c VAL3 iftest1.c VAL4 iftest1.c ], []) AT_CLEANUP(configure)