]> granicus.if.org Git - postgis/commitdiff
Use an SQLPP command for pre-processing SQL files (#1694)
authorSandro Santilli <strk@keybit.net>
Thu, 12 Apr 2012 14:09:22 +0000 (14:09 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 12 Apr 2012 14:09:22 +0000 (14:09 +0000)
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

configure.ac
postgis/Makefile.in
raster/rt_pg/Makefile.in
topology/Makefile.in

index d797b98ef55e76962a94b6ff6c3c434bb952c429..292df9fb2827340f29943bc49c5cc03711443dee 100644 (file)
@@ -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}])
index b70cfe62ab414fdee14e4f8af800c59c09c46269..61c3b31c1ef9cdb80f761813602465290ce36ad6 100644 (file)
@@ -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
index 0fef806b0f9d8bb612c90e689014a6478ed34b75..c8206207899cb589eff6f8bff5df6753c0a45a9f 100644 (file)
@@ -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
index 70a5cc8a7cf7dee3771aed8bdcb98a9f9528ad3a..ce0131992885e133cae97521ed61bc85350871cd 100644 (file)
@@ -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