Bug 344

Summary: Configure fails to find libpgport
Product: Slony-I Reporter: EngineeredVirus <hamid.quddus>
Component: other scriptsAssignee: Slony Bugs List <slony1-bugs>
Status: NEW ---    
Severity: normal CC: hamid.quddus, slony1-bugs
Priority: low    
Version: devel   
Hardware: PC   
OS: Linux   
See Also: http://www.slony.info/bugzilla/show_bug.cgi?id=364

Description EngineeredVirus 2014-06-30 01:36:04 UTC
Configure fails with the following error:
configure: error: "pgport was not found. build without --with-pgport=yes to disable"


Looking at the configure's conftest for libpgport test, I see that the libraries libpgcommon and libpgport are being linked in the wrong order.

This would cause configure to fail for some versions of gcc; e.g. in my case on CentOS 5.x 32-bit it fails with the above error.
===========================
[root@blinux ~]# uname -a
Linux blinux 2.6.18-371.8.1.el5 #1 SMP Thu Apr 24 18:23:07 EDT 2014 i686 i686 i386 GNU/Linux

[root@blinux ~]# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
===========================

To fix this, all we need to do is correct the order of linking for libpgport and libpgcommon. Following is the patch for configure:

===========================
--- a/configure
+++ b/configure
@@ -5741,7 +5741,7 @@ rm -f core conftest.err conftest.$ac_objext \
    if test $HAVE_PGCOMMON = 1  ; then
        EXTRALIBS=" -lpgcommon"
    fi
-   LIBS="$LIBS $EXTRALIBS -lpgport"
+   LIBS="$LIBS -lpgport $EXTRALIBS"
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
===========================
Comment 1 Steve Singer 2014-06-30 05:48:18 UTC
I am finding your diff a bit confusing.

Your diff says that the link order should be

LIBS="$LIBS -lpgport $EXTRALIBS"

but this IS what the link order is in config/acx_libpq.m4 both REL_2_1_STABLE and REL_2_2_STABLE


I agree that the link order should list pgport before libpgcommon.  

What version of slony did you hit this on? Was it from a release tar that includes 'configure' or a checkout of git (configure isn't committed in source control but gets generated by autoconf from the m4 files).