[postgis-tickets] r17250 - Wagyu build improvements

Raul raul at rmr.ninja
Tue Feb 12 03:34:13 PST 2019


Author: algunenano
Date: 2019-02-12 03:34:13 -0800 (Tue, 12 Feb 2019)
New Revision: 17250

Modified:
   trunk/configure.ac
   trunk/deps/wagyu/Makefile.in
   trunk/doc/installation.xml
   trunk/postgis/Makefile.in
Log:
Wagyu build improvements

Use same compiler as postgresql (adds extra -x cxx)
Pass the C++ standard library to postgres when linking wagyu

Closes #4321
Closes https://github.com/postgis/postgis/pull/371



Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2019-02-12 10:46:57 UTC (rev 17249)
+++ trunk/configure.ac	2019-02-12 11:34:13 UTC (rev 17250)
@@ -1483,11 +1483,51 @@
             WAGYU_LIB=libwagyu.la
             AC_SUBST([WAGYU_LIB])
 
+            dnl ============================================================
+            dnl We force  to use the same compiler as Postgresql
+            dnl ============================================================
+            CXX_SAVE="$CXX"
+            CC_SAVE="$CC"
+            CFLAGS_SAVE="$CFLAGS"
+            CXXFLAGS_SAVE="$CXXFLAGS"
+            CPPFLAGS_SAVE="$CPPFLAGS_SAVE"
+
+            WAGYU_CXX=`"$PG_CONFIG" --cc`
+            CPPFLAGS="-x c++"
+            CFLAGS=""
+            CXX="$WAGYU_CXX"
             AC_PROG_CXX
             AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
+            WAGYU_CXX="$CXX -x c++"
 
+            dnl ============================================================
+            dnl Check if we can declare the c++ stdlib
+            dnl ============================================================
+            CC="$WAGYU_CXX"
+
+            AC_CHECK_LIB(c++, main, [HAVE_CPP=yes], [HAVE_CPP=no])
+            AC_CHECK_LIB(stdc++, main, [HAVE_STDCPP=yes], [HAVE_STDCPP=no])
+
+            if test "x$HAVE_CPP" = "xyes"; then
+                WAGYU_LDFLAGS="-lc++"
+            elif test "x$HAVE_STDCPP" = "xyes"; then
+                WAGYU_LDFLAGS="-lstdc++"
+            else
+                AC_MSG_WARN("Could not find a C++ standard library")
+                WAGYU_LDFLAGS=""
+            fi
+
+            CXX="$CXX_SAVE"
+            CC="$CC_SAVE"
+            CFLAGS="$CFLAGS_SAVE"
+            CXXFLAGS="$CXXFLAGS_SAVE"
+            CPPFLAGS="$CPPFLAGS_SAVE"
+
             AC_DEFINE([HAVE_WAGYU], [1], [Define to 1 if wagyu is being built])
             AC_SUBST([HAVE_WAGYU])
+            AC_SUBST([WAGYU_CXX])
+            AC_SUBST([WAGYU_LDFLAGS])
+
             DEPS_MAKEFILE_LIST="$DEPS_MAKEFILE_LIST
                     deps/wagyu/Makefile"
     fi
@@ -1555,7 +1595,7 @@
 AC_MSG_RESULT([ -------------- Compiler Info ------------- ])
 AC_MSG_RESULT([  C compiler:           ${CC} ${CFLAGS}])
 if test "x$HAVE_WAGYU" = "xyes"; then
-    AC_MSG_RESULT([  C++ compiler:         ${CXX} ${CXXFLAGS}])
+    AC_MSG_RESULT([  C++ compiler (Wagyu): ${WAGYU_CXX} ${CXXFLAGS}])
 fi
 AC_MSG_RESULT([  CPPFLAGS:             $CPPFLAGS])
 AC_MSG_RESULT([  SQL preprocessor:     ${SQLPP}])
@@ -1674,4 +1714,4 @@
         AC_MSG_WARN([ | Alternatively, you may set the environment variables PCRE_CFLAGS and     |])
         AC_MSG_WARN([ | PCRE_LIBS to avoid the need to call pkg-config.                          |])
     fi
-fi
\ No newline at end of file
+fi

Modified: trunk/deps/wagyu/Makefile.in
===================================================================
--- trunk/deps/wagyu/Makefile.in	2019-02-12 10:46:57 UTC (rev 17249)
+++ trunk/deps/wagyu/Makefile.in	2019-02-12 11:34:13 UTC (rev 17250)
@@ -22,8 +22,8 @@
 # *
 # **********************************************************************/
 
-CXX = @CXX@
-CXXFLAGS =-I../../liblwgeom -Iinclude @CPPFLAGS@ @WARNFLAGS@ @CXXFLAGS@ @PICFLAGS@
+CXX = @WAGYU_CXX@
+CXXFLAGS =-I../../liblwgeom -Iinclude @CPPFLAGS@ @CXXFLAGS@ @PICFLAGS@
 LDFLAGS = @LDFLAGS@
 top_builddir = @top_builddir@
 libdir = @libdir@

Modified: trunk/doc/installation.xml
===================================================================
--- trunk/doc/installation.xml	2019-02-12 10:46:57 UTC (rev 17249)
+++ trunk/doc/installation.xml	2019-02-12 11:34:13 UTC (rev 17250)
@@ -241,7 +241,7 @@
 			  To enable ST_AsMVT protobuf-c library (for usage) and the protoc-c compiler (for building) are required.
 				Also, pkg-config is required to verify the correct minimum version of protobuf-c.
 				See <ulink url="https://github.com/protobuf-c/protobuf-c">protobuf-c</ulink>.
-                To use Wagyu to validate MVT polygons faster, a c++11 compiler is required. It will use the CXX and CXXFLAGS and needs <varname>--with-wagyu</varname> to be passed during configure.
+                To use Wagyu to validate MVT polygons faster, a c++11 compiler is required. It requires <varname>--with-wagyu</varname> to be passed during configure; and it will use CXXFLAGS and the same compiler as the PostgreSQL installation.
 			</para>
 		</listitem>
 

Modified: trunk/postgis/Makefile.in
===================================================================
--- trunk/postgis/Makefile.in	2019-02-12 10:46:57 UTC (rev 17249)
+++ trunk/postgis/Makefile.in	2019-02-12 11:34:13 UTC (rev 17250)
@@ -63,7 +63,7 @@
 WAGYU_LIBPATH = ../deps/wagyu/@WAGYU_LIB@
 ifeq (@HAVE_WAGYU@,yes)
 WAYGU_INCLUDE += -I../deps/wagyu
-WAYGU_LIB = $(WAGYU_LIBPATH)
+WAYGU_LIB = $(WAGYU_LIBPATH) @WAGYU_LDFLAGS@
 WAGYU_DEP = $(WAGYU_LIBPATH)
 endif
 



More information about the postgis-tickets mailing list