Only include the libpq header directory OR the server header directory but not both
authorSteve Singer <ssinger@ca.afilias.info>
Thu, 3 Oct 2013 17:32:08 +0000 (13:32 -0400)
committerSteve Singer <ssinger@ca.afilias.info>
Thu, 3 Oct 2013 17:33:05 +0000 (13:33 -0400)
This addresses bug 315 where a debian install had libpq-dev 9.3 installed
and postgresql-server-dev 8.4 installed.  The libpq headers are in /usr/include/postgresql
but the server headers are in /usr/lib/postgresql/8.4/server.

configure checks were failing because we were pulling in a mixutre of headers
from both versions.  The only slony component that needs the server
headers are the backend functions and they shouldn't need to use libpq headers.

This patch sets CPPFLAGS as approriate for one or the other but not both

Makefile.global.in
config/acx_libpq.m4
configure.ac
src/backend/Makefile
src/parsestatements/Makefile
src/slon/Makefile
src/slonik/Makefile
src/slony_logshipper/Makefile

index 3e8eeb87208fb1634f22a7a77c4cdd32b5f6d11c..71d13180a4d4e2fdfa5235f2c56ae08ca6555ac8 100644 (file)
@@ -45,7 +45,8 @@ FLEX=                 @LEX@
 
 #build tool flags
 CFLAGS=                        @CFLAGS@
-CPPFLAGS=              @CPPFLAGS@
+CPPFLAGS_CLIENT=              @CPPFLAGS_CLIENT@
+CPPFLAGS_SERVER=       @CPPFLAGS_SERVER@
 LDFLAGS=               @LDFLAGS@
 PTHREAD_CFLAGS=     @PTHREAD_CFLAGS@
 PTHREAD_LIBS=          @PTHREAD_LIBS@
index 22722f8b8fc774155214113069546677eb0634fc..9b91f9412172ba986acfc54729b20a815a99d10b 100644 (file)
@@ -230,7 +230,6 @@ else
 fi
 
 TEMP_CPPFLAGS=$CPPFLAGS
-
 CPPFLAGS="$TEMP_CPPFLAGS -I$PG_INCLUDEDIR"
 AC_CHECK_HEADER(libpq-fe.h, HAVE_LIBPQFE=1)
 if test -n "HAVE_LIBPQFE" ; then
@@ -241,8 +240,9 @@ else
     )
 fi
 
-CPPFLAGS="$TEMP_CPPFLAGS -I$PG_INCLUDEDIR -I$PG_INCLUDESERVERDIR"
-
+CPPFLAGS_SERVER="$TEMP_CPPFLAGS  -I$PG_INCLUDESERVERDIR"
+CPPFLAGS_CLIENT="$TEMP_CPPFLAGS -I$PG_INCLUDEDIR"
+CPPFLAGS=$CPPFLAGS_SERVER
 dnl ---------------------------------------------------
 dnl Add the port specific include directory if required
 dnl ---------------------------------------------------
@@ -381,7 +381,7 @@ case "${host_os}" in
        *)
                LIBS="$LIBS -L$PG_LIBDIR -Wl,-rpath,$PG_LIBDIR -lpq"
 esac
-
+CPPFLAGS=$CPPFLAGS_CLIENT
 AC_RUN_IFELSE(
        [AC_LANG_PROGRAM([#include "libpq-fe.h"], [if (PQisthreadsafe()) {return 0;} else {return 1;}])], 
        [echo "PQisthreadsafe() true"], 
@@ -405,6 +405,8 @@ else
   AC_MSG_RESULT([yes, and it takes $ac_cv_ScanKeywordLookup_args arguments])
 fi
 
+CPPFLAGS=$CPPFLAGS_SERVER
+
 AC_MSG_CHECKING(for typenameTypeId)
 if test -z "$ac_cv_typenameTypeId_args"; then
   AC_TRY_COMPILE(
index 37902bb140b26a4b7bc85aa234efdf1ddf2f4cda..85f10419ef639e43fafe72f775f2818ec0bea20c 100644 (file)
@@ -311,7 +311,8 @@ if test x"$with_perlsharedir" = x""; then
 fi
 
 AC_SUBST(perlsharedir, $with_perlsharedir)
-
+AC_SUBST(CPPFLAGS_SERVER)
+AC_SUBST(CPPFLAGS_CLIENT)
 AC_CONFIG_FILES([
     Makefile.global GNUmakefile
 ])
index 869a455c834ab204f495ccd82de3399b96a0235a..84d8b1ee68b4b14c8656fdf017b798b784d4de03 100644 (file)
@@ -13,7 +13,7 @@ SLFILEDESC="Slony replication functions"
 NAME           = slony1_funcs
 SO_NAME = $(NAME).$(VERSION)$(DLSUFFIX)
 include $(slony_top_builddir)/Makefile.global
-
+CPPFLAGS:=$(CPPFLAGS_SERVER)
 override CFLAGS += -I$(slony_top_builddir) $(CFLAGS_SL)
 
 
index 09648c0540ccdc8caaceb78eb57fc326bf9da877..d2b926b6b9d5a05f534abe87e257f60b7aa1c1e7 100644 (file)
@@ -2,6 +2,8 @@ slony_subdir = src/parsestatements
 slony_top_builddir = ../..
 include $(slony_top_builddir)/Makefile.global
 
+CPPFLAGS:=$(CPPFLAGS_CLIENT)
+
 PROG=test-scanner
 FLEX=flex
 
index b652bf669bbd892290de982636343cb90c6a18b0..a98693b6d9391c57531e73d34653fa9309372a42 100644 (file)
@@ -11,7 +11,7 @@ slony_subdir = src/slon
 slony_top_builddir = ../..
 SLFILEDESC="Slony replication engine"
 include $(slony_top_builddir)/Makefile.global
-
+CPPFLAGS:=$(CPPFLAGS_CLIENT)
 SFILES=$(wildcard *.c)
 CC = $(PTHREAD_CC)
 
index fa8113aacd550133fd55df648f87abed2f4b8b04..9929882281d9e41ffdc01f860f198579a171656d 100644 (file)
@@ -10,6 +10,7 @@ slony_subdir = src/slonik
 slony_top_builddir = ../..
 SLFILEDESC="Slony command interpreter"
 include $(slony_top_builddir)/Makefile.global
+CPPFLAGS:=$(CPPFLAGS_CLIENT)
 
 ifeq ($(PORTNAME), aix)
   CFLAGS += -D_LARGE_FILES
index d5cbca71deee005548930409a57b871e21fdb174..b35a0e585745e16c740ddcdd89f94a800a97dd6d 100644 (file)
@@ -11,7 +11,7 @@ slony_subdir = src/slony_logshipper
 slony_top_builddir = ../..
 SLFILEDESC="Slony command interpreter"
 include $(slony_top_builddir)/Makefile.global
-
+CPPFLAGS:=$(CPPFLAGS_CLIENT)
 ifeq ($(PORTNAME), aix)
   CFLAGS += -D_LARGE_FILES
 endif