From 9eceb6c6d30ba64747911b2267f658d130daa90b Mon Sep 17 00:00:00 2001 From: Jesse Thilo Date: Fri, 12 Feb 1999 15:18:12 +0000 Subject: [PATCH] Defined locations of parser files in config.h instead of Makefile. --- Makefile.am | 11 ++--------- acconfig.h | 6 ++++++ acinclude.m4 | 13 +++++++++++++ configure.in | 5 +++++ src/files.c | 3 ++- src/files.h | 2 +- 6 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 acinclude.m4 diff --git a/Makefile.am b/Makefile.am index 0a4a1048..deaf7820 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,12 +1,5 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -AUTOMAKE_OPTIONS = 1.3 - -#names of parser files -PFILE = bison.simple -PFILE1 = bison.hairy - -INCLUDES = -DXPFILE=\"$(datadir)/$(PFILE)\" \ - -DXPFILE1=\"$(datadir)/$(PFILE1)\" +AUTOMAKE_OPTIONS = 1.4 bin_PROGRAMS = bison @@ -22,7 +15,7 @@ bison_LDADD = @ALLOCA@ noinst_HEADERS = alloc.h files.h gram.h lex.h machine.h state.h \ symtab.h system.h types.h getopt.h -data_DATA = $(PFILE) $(PFILE1) +data_DATA = bison.simple bison.hairy info_TEXINFOS = bison.texinfo man_MANS = bison.1 diff --git a/acconfig.h b/acconfig.h index 658ee9d5..eed30ed0 100644 --- a/acconfig.h +++ b/acconfig.h @@ -10,6 +10,12 @@ /* Define if the compiler understands prototypes. */ #undef PROTOTYPES + +/* The location of the simple parser (bison.simple). */ +#undef XPFILE + +/* The location of the semantic parser (bison.hairy). */ +#undef XPFILE1 @BOTTOM@ #if defined(PROTOTYPES) || defined(__cplusplus) diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..6d72b703 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,13 @@ +dnl BISON_DEFINE_FILE(VARNAME, FILE) +dnl Defines (with AC_DEFINE) VARNAME to the expansion of the FILE +dnl variable, expanding ${prefix} and such. +dnl Example: BISON_DEFINE_FILE(DATADIR, datadir) +dnl By Alexandre Oliva +AC_DEFUN(BISON_DEFINE_FILE, [ + ac_expanded=`( + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + eval echo \""[$]$2"\" + )` + AC_DEFINE_UNQUOTED($1, "$ac_expanded") +]) diff --git a/configure.in b/configure.in index 75d4bac6..1525dc71 100644 --- a/configure.in +++ b/configure.in @@ -30,4 +30,9 @@ dnl Checks for library functions. AC_FUNC_ALLOCA AC_CHECK_FUNCS(mkstemp setlocale) +PFILE="${datadir}/bison.simple" +BISON_DEFINE_FILE(XPFILE, PFILE) +PFILE1="${datadir}/bison.hairy" +BISON_DEFINE_FILE(XPFILE1, PFILE1) + AC_OUTPUT(Makefile) diff --git a/src/files.c b/src/files.c index 348900fe..f227685e 100644 --- a/src/files.c +++ b/src/files.c @@ -19,6 +19,8 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "system.h" + #if defined (VMS) & !defined (__VMS_POSIX) #include #define unlink delete @@ -40,7 +42,6 @@ Boston, MA 02111-1307, USA. */ #endif #include -#include "system.h" #include "files.h" #include "alloc.h" #include "gram.h" diff --git a/src/files.h b/src/files.h index e72dd201..6bc1e4e5 100644 --- a/src/files.h +++ b/src/files.h @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. */ /* These two should be pathnames for opening the sample parser files. When bison is installed, they should be absolute pathnames. - XPFILE1 and XPFILE2 normally come from the Makefile. */ + XPFILE1 and XPFILE2 normally come from config.h. */ #define PFILE XPFILE /* Simple parser */ #define PFILE1 XPFILE1 /* Semantic parser */ -- 2.45.2