#! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Check that automake lex support ensures that lex-generated C
# files use correct "#line" directives. Try also with the
# 'subdir-object' option enabled.
-# See also sister test 'yacc-line.test'.
+# See also sister test 'yacc-line.sh'.
-required=lex
-. ./defs || Exit 1
+required='cc lex'
+. test-init.sh
cat >> configure.ac << 'END'
AC_CONFIG_FILES([sub/Makefile])
# For debugging,
ls -l . sub sub/dir
- $FGREP '.l' $c_outputs
+ $EGREP 'line|\.l' $c_outputs
- # Adjusted "#line" should not contain reference to the builddir.
- $EGREP '#.*line.*(build|\.\.).*\.l' $c_outputs && Exit 1
+ grep '#.*line.*build.*\.l' $c_outputs && exit 1
+ # Adjusted "#line" should not contain reference to the absolute
+ # srcdir.
+ $EGREP '#.*line *"?/.*\.l' $c_outputs && exit 1
# Adjusted "#line" should not contain reference to the default
# output file names, e.g., 'lex.yy.c'.
- $EGREP '#.*line.*lex\.yy' $c_outputs && Exit 1
- # Don't be excessively strict in grepping, to avoid spurious failures.
- grep '#.*line.*zardoz\.l' zardoz.c
- grep '#.*line.*quux\.l' bar-quux.c
- grep '#.*line.*zardoz\.l' sub/foo-zardoz.c
- grep '#.*line.*quux\.l' sub/dir/quux.c
+ grep '#.*line.*lex\.yy' $c_outputs && exit 1
+ # Look out for a silly regression.
+ grep "#.*\.l.*\.l" $c_outputs && exit 1
+ if $vpath; then
+ grep '#.*line.*"\.\./zardoz\.l"' zardoz.c
+ grep '#.*line.*"\.\./dir/quux\.l"' bar-quux.c
+ grep '#.*line.*"\.\./\.\./sub/zardoz\.l"' sub/foo-zardoz.c
+ grep '#.*line.*"\.\./\.\./sub/dir/quux\.l"' sub/dir/quux.c
+ else
+ grep '#.*line.*"zardoz\.l"' zardoz.c
+ grep '#.*line.*"dir/quux\.l"' bar-quux.c
+ grep '#.*line.*"zardoz\.l"' sub/foo-zardoz.c
+ grep '#.*line.*"dir/quux\.l"' sub/dir/quux.c
+ fi
+
cd $srcdir
done