From: Ulya Trofimovich Date: Wed, 7 Aug 2019 22:10:26 +0000 (+0100) Subject: Install standard library files in $(datadir)/re2c/stdlib and search for include files... X-Git-Tag: 1.2.1~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3880fc84e55a3797b98b823505f02b2006a4006;p=re2c Install standard library files in $(datadir)/re2c/stdlib and search for include files in this location. This fixes bug #253 "re2c should install unicode_categories.re somewhere" (reported by Wesley W. Terpstra). --- diff --git a/Makefile.am b/Makefile.am index d717ddc4..40cb2e79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,14 @@ -# flags -# do *not* add CXXFLAGS here, add them in configure.ac + +# stdlib directory +stdlibdir = $(datadir)/re2c/stdlib + +# do not add compiler options/warnings here, add them in configure.ac AM_CXXFLAGS = $(CXXFLAGSDEFAULT) +AM_CXXFLAGS += -DRE2C_STDLIB_DIR='"$(stdlibdir)/"' if DEBUG AM_CXXFLAGS += -DRE2C_DEBUG endif + RE2CFLAGS = -br -W # binary @@ -257,6 +262,9 @@ re2c_SRC_DOC_EXT = \ DOC = doc/re2c.1 man_MANS = $(DOC) +# include files (stdlib) +dist_stdlib_DATA = include/unicode_categories.re + EXTRA_DIST = \ $(re2c_BOOT) \ $(re2c_CUSTOM) \ @@ -267,7 +275,6 @@ EXTRA_DIST = \ autogen.sh \ genhelp.sh \ examples \ - include \ test CLEANFILES = \ diff --git a/src/parse/input.cc b/src/parse/input.cc index 9a3ca29e..18f37bb7 100644 --- a/src/parse/input.cc +++ b/src/parse/input.cc @@ -39,6 +39,12 @@ bool Input::open(const std::string &filename, const std::string *parent path = incpaths[i] + name; file = fopen(path.c_str(), "rb"); } + + // if user-defined include paths failed, try stdlib path + if (!file) { + path = RE2C_STDLIB_DIR + name; + file = fopen(path.c_str(), "rb"); + } } if (!file) {