From: Sandro Santilli Date: Thu, 12 Apr 2012 14:09:22 +0000 (+0000) Subject: Use an SQLPP command for pre-processing SQL files (#1694) X-Git-Tag: 2.0.1~133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10fc02f7a5f26bcda0ef35a35be7d5d8af931b32;p=postgis Use an SQLPP command for pre-processing SQL files (#1694) The SQLPP command is figured at ./configure time. It will use cpp(1) or gpp(1) if any is found in that order or fallback to whatever CPP expands to (usually the compiler with -E) git-svn-id: http://svn.osgeo.org/postgis/trunk@9639 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index d797b98ef..292df9fb2 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,22 @@ AC_PROG_CXX AC_PATH_PROG([ANT], [ant], []) AC_SUBST([ANT]) +dnl +dnl SQL Preprocessor +dnl +AC_PATH_PROG([CPPBIN], [cpp], []) +if test "x$CPPBIN" != "x"; then + SQLPP="${CPPBIN} -traditional-cpp -P" +else + AC_PATH_PROG([GPP], [gpp_], []) + if test "x$GPP" != "x"; then + SQLPP="${GPP} -C -s \'" dnl Use better string support + else + SQLPP="${CPP} -traditional-cpp" + fi +fi +AC_SUBST([SQLPP]) + dnl dnl Define PIC flags in PICFLAGS (note: this variable is set as part of libtool initialisation above) dnl @@ -1104,6 +1120,7 @@ AC_MSG_RESULT() AC_MSG_RESULT([ -------------- Compiler Info ------------- ]) AC_MSG_RESULT([ C compiler: ${CC} ${CFLAGS}]) AC_MSG_RESULT([ C++ compiler: ${CXX} ${CXXFLAGS}]) +AC_MSG_RESULT([ SQL preprocessor: ${SQLPP}]) AC_MSG_RESULT() AC_MSG_RESULT([ -------------- Dependencies -------------- ]) AC_MSG_RESULT([ GEOS config: ${GEOSCONFIG}]) diff --git a/postgis/Makefile.in b/postgis/Makefile.in index b70cfe62a..61c3b31c1 100644 --- a/postgis/Makefile.in +++ b/postgis/Makefile.in @@ -18,7 +18,10 @@ MODULEDIR=contrib/$(MODULE_big) DATA_built=postgis.sql uninstall_postgis.sql postgis_upgrade_20_minor.sql legacy.sql uninstall_legacy.sql legacy_minimal.sql DATA=../spatial_ref_sys.sql -# SQL objects (files requiring C pre-processing) +# SQL preprocessor +SQLPP = @SQLPP@ + +# SQL objects (files requiring pre-processing) SQL_OBJS=postgis.sql.in legacy.sql.in legacy_minimal.sql.in # PostgreSQL objects @@ -128,9 +131,9 @@ postgis_upgrade_20_minor.sql.in: postgis_drop_before.sql postgis.sql postgis_dro postgis_upgrade_20_minor.sql: postgis_upgrade_20_minor.sql.in ../utils/postgis_proc_upgrade.pl $(PERL) ../utils/postgis_proc_upgrade.pl $< 2.0 > $@ -# Generate any .sql.in files from .sql.in.c files by running them through the C pre-processor +# Generate any .sql.in files from .sql.in.c files by running them through the SQL pre-processor $(SQL_OBJS): %.in: %.in.c - $(CPP) -traditional-cpp -I../libpgcommon $< | grep -v '^#' > $@ + $(SQLPP) -I../libpgcommon $< | grep -v '^#' > $@ # SQL objects are also dependent on postgis_config.h for PostgreSQL version $(SQL_OBJS): ../postgis_config.h ../postgis_svn_revision.h diff --git a/raster/rt_pg/Makefile.in b/raster/rt_pg/Makefile.in index 0fef806b0..c82062078 100644 --- a/raster/rt_pg/Makefile.in +++ b/raster/rt_pg/Makefile.in @@ -17,7 +17,10 @@ MODULEDIR=contrib/postgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@ DATA_built=rtpostgis.sql rtpostgis_upgrade_20_minor.sql uninstall_rtpostgis.sql rtpostgis_legacy.sql DATA= -# SQL objects (files requiring C pre-processing) +# SQL preprocessor +SQLPP = @SQLPP@ + +# SQL objects (files requiring pre-processing) SQL_OBJS=rtpostgis.sql.in rtpostgis_drop.sql.in rtpostgis_upgrade_cleanup.sql.in rtpostgis_legacy.sql.in # Objects to build using PGXS @@ -87,9 +90,9 @@ endif # Objects dependencies $(OBJS): ../../liblwgeom/.libs/liblwgeom.a ../../libpgcommon/libpgcommon.a ../../postgis_config.h ../../postgis_svn_revision.h -# Generate any .sql.in files from .sql.in.c files by running them through the C pre-processor +# Generate any .sql.in files from .sql.in.c files by running them through the SQL pre-processor $(SQL_OBJS): %.in: %.in.c - $(CPP) -I../../postgis/ -I../../ -traditional-cpp $< | grep -v '^#' > $@ + $(SQLPP) -I../../postgis/ -I../../ $< | grep -v '^#' > $@ # SQL objects deps here $(SQL_OBJS): ../../postgis/sqldefines.h ../../postgis_svn_revision.h diff --git a/topology/Makefile.in b/topology/Makefile.in index 70a5cc8a7..ce0131992 100644 --- a/topology/Makefile.in +++ b/topology/Makefile.in @@ -26,7 +26,10 @@ MODULEDIR=contrib/$(PGIS_MODULE_big) # Files to be copied to the contrib/ directory DATA_built=topology.sql topology_upgrade_20_minor.sql uninstall_topology.sql -# SQL objects (files requiring C pre-processing) +# SQL preprocessor +SQLPP = @SQLPP@ + +# SQL objects (files requiring pre-processing) SQL_OBJS = \ topology.sql \ topology_upgrade.sql \ @@ -73,9 +76,9 @@ endif %.sql: %.sql.in sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@ -# Generate any .sql.in files from .sql.in.c files by running them through the C pre-processor +# Generate any .sql.in files from .sql.in.c files by running them through the SQL pre-processor %.in: %.in.c - $(CPP) -traditional-cpp $< | grep -v '^#' > $@ + $(SQLPP) $< | grep -v '^#' > $@ #Generate upgrade script by stripping things that can't be reinstalled #e.g. don't bother with tables, types, triggers, and domains