jfarrell | 4f54d13 | 2014-07-10 09:23:43 -0400 | [diff] [blame] | 1 | dnl |
| 2 | dnl Check Bison version |
jfarrell | 30a472e | 2014-07-10 18:42:30 -0400 | [diff] [blame] | 3 | dnl AC_PROG_BISON([MIN_VERSION=2.4]) |
jfarrell | 4f54d13 | 2014-07-10 09:23:43 -0400 | [diff] [blame] | 4 | dnl |
| 5 | dnl Will define BISON_USE_PARSER_H_EXTENSION if Automake is < 1.11 |
| 6 | dnl for use with .h includes. |
| 7 | dnl |
| 8 | |
| 9 | AC_DEFUN([AC_PROG_BISON], [ |
| 10 | if test "x$1" = "x" ; then |
jfarrell | 30a472e | 2014-07-10 18:42:30 -0400 | [diff] [blame] | 11 | bison_required_version="2.4" |
jfarrell | 4f54d13 | 2014-07-10 09:23:43 -0400 | [diff] [blame] | 12 | else |
| 13 | bison_required_version="$1" |
| 14 | fi |
| 15 | |
| 16 | AC_CHECK_PROG(have_prog_bison, [bison], [yes],[no]) |
| 17 | |
| 18 | AC_DEFINE_UNQUOTED([BISON_VERSION], [0.0], [Bison version if bison is not available]) |
| 19 | |
| 20 | #Do not use *.h extension for parser header files, use newer *.hh |
| 21 | bison_use_parser_h_extension=false |
| 22 | |
| 23 | if test "$have_prog_bison" = "yes" ; then |
| 24 | AC_MSG_CHECKING([for bison version >= $bison_required_version]) |
| 25 | bison_version=`bison --version | head -n 1 | cut '-d ' -f 4` |
| 26 | AC_DEFINE_UNQUOTED([BISON_VERSION], [$bison_version], [Defines bison version]) |
| 27 | if test "$bison_version" \< "$bison_required_version" ; then |
| 28 | BISON=: |
| 29 | AC_MSG_RESULT([no]) |
James Broadhead | 5e5eacf | 2014-08-09 16:20:00 +0100 | [diff] [blame] | 30 | AC_MSG_ERROR([Bison version $bison_required_version or higher must be installed on the system!]) |
jfarrell | 4f54d13 | 2014-07-10 09:23:43 -0400 | [diff] [blame] | 31 | else |
| 32 | AC_MSG_RESULT([yes]) |
| 33 | BISON=bison |
| 34 | AC_SUBST(BISON) |
| 35 | |
| 36 | #Verify automake version 1.11 headers for yy files are .h, > 1.12 uses .hh |
| 37 | automake_version=`automake --version | head -n 1 | cut '-d ' -f 4` |
| 38 | AC_DEFINE_UNQUOTED([AUTOMAKE_VERSION], [$automake_version], [Defines automake version]) |
| 39 | |
| 40 | if test "$automake_version" \< "1.12" ; then |
| 41 | #Use *.h extension for parser header file |
| 42 | bison_use_parser_h_extension=true |
| 43 | echo "Automake version < 1.12" |
| 44 | AC_DEFINE([BISON_USE_PARSER_H_EXTENSION], [1], [Use *.h extension for parser header file]) |
| 45 | fi |
| 46 | fi |
| 47 | else |
| 48 | BISON=: |
| 49 | AC_MSG_RESULT([NO]) |
| 50 | fi |
| 51 | |
| 52 | AM_CONDITIONAL([BISON_USE_PARSER_H_EXTENSION], [test x$bison_use_parser_h_extension = xtrue]) |
| 53 | AC_SUBST(BISON) |
| 54 | ]) |