Thread: [PATCH] acinclude.m4 fixes for wx 2.6, wx-nondebug, postgres-ssl and others

[PATCH] acinclude.m4 fixes for wx 2.6, wx-nondebug, postgres-ssl and others

From
"Florian G. Pflug"
Date:
Hi

This patch
    .) Doesn't actually switch pgadmin3 over to using wx2.6 aka CVS HEAD ;-)
    .) It just e.g. adds a 2.6-case to checks where there is a 2.4 and a 2.5 case
    .) It works around the postgres-ssl problem on osx, by checking
    wether libpq links libssl directly (otool -L ;-) ).
    .) Fixes statically linking against libpq (There is no libcrypt on osx)
    .) Fixes linking against a non-debug wxMac. Non-debug versions are
    named macu_*, but relevant part of acinclude.m4 only checked for mac, mac_d & macud.
    Added macu

Statically linking pgadmin3 against libpq and wx now works for me out-of-the-box
This should fix both the problems OpenMacNew was having, and the "I have to fiddle
with LIBS" problems

Everybody with a Mac - please test, if you have the time ;-))))

greetings, Florian Pflug
Index: acinclude.m4
===================================================================
RCS file: /projects/pgadmin3/acinclude.m4,v
retrieving revision 1.44
diff -a -u -r1.44 acinclude.m4
--- acinclude.m4    12 Apr 2005 07:36:41 -0000    1.44
+++ acinclude.m4    14 Apr 2005 13:12:53 -0000
@@ -131,7 +131,18 @@
     AC_LANG_SAVE
     AC_LANG_C
     AC_CHECK_LIB(pq, PQexec, [pgsql_cv_libpq=yes], [pgsql_cv_libpq=no])
-    AC_CHECK_LIB(pq, SSL_connect, [pgsql_ssl_libpq=yes], [pgsql_ssl_libpq=no])
+    if test "$build_cpu-$build_vendor" = "powerpc-apple"; then
+        echo -n "Checking if libpq links against libssl: "
+        if test "$(otool -L ${LIBPQ_HOME}/lib/libpq.?.dylib | grep -c libssl)" -gt 0
+        then
+            pgsql_ssl_libpq="yes"
+        else
+            pgsql_ssl_libpq="no"
+        fi
+        echo $pgsql_ssl_libpq
+    else
+        AC_CHECK_LIB(pq, SSL_connect, [pgsql_ssl_libpq=yes], [pgsql_ssl_libpq=no])
+    fi
     AC_LANG_RESTORE

     if test "$pgsql_include" != ""
@@ -143,11 +154,18 @@

     if test "$pg_static_build" = "yes"
     then
+        if test "$build_cpu-$build_vendor" = "powerpc-apple"
+        then
+            CRYPT_LIB=""
+        else
+            CRYPT_LIB="-lcrypt"
+        fi
+
         if test "$pgsql_ssl_libpq" = "yes"
         then
-            LIBS="${LIBPQ_HOME}/lib/libpq.a -lcrypt $LIBS -lssl -lcrypto"
+            LIBS="${LIBPQ_HOME}/lib/libpq.a $CRYPT_LIB $LIBS -lssl -lcrypto"
         else
-            LIBS="${LIBPQ_HOME}/lib/libpq.a -lcrypt $LIBS -lcrypto"
+            LIBS="${LIBPQ_HOME}/lib/libpq.a $CRYPT_LIB $LIBS -lcrypto"
         fi
     else
         if test "$pgsql_ssl_libpq" = "yes"
@@ -253,6 +271,9 @@
     # Which version of wxWindows is this?
     WX_VERSION=`${WX_CONFIG} --version`
     case "${WX_VERSION}" in
+        2.6*)
+            WX_VERSION="2.6"
+            ;;
         2.5*)
             WX_VERSION="2.5"
             ;;
@@ -311,6 +332,14 @@
                 LIBS="$LIBS ${WX_HOME}/lib/libwx_mac_stc-${WX_VERSION}.a ${WX_HOME}/lib/libwx_mac_ogl-${WX_VERSION}.a"
                 LIBS="$LIBS $WX_NEW_LDFLAGS"
                 ;;
+            *libwx_macu-*)
+                LIBS="$LIBS ${WX_HOME}/lib/libwx_macu_stc-${WX_VERSION}.a
${WX_HOME}/lib/libwx_macu_ogl-${WX_VERSION}.a"
+                LIBS="$LIBS $WX_NEW_LDFLAGS"
+                ;;
+            *libwx_macu_core*)
+                LIBS="$LIBS ${WX_HOME}/lib/libwx_macu_stc-${WX_VERSION}.a
${WX_HOME}/lib/libwx_macu_ogl-${WX_VERSION}.a"
+                LIBS="$LIBS $WX_NEW_LDFLAGS"
+                ;;
             *libwx_gtk2ud-*)
                 LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2ud_stc-${WX_VERSION}.a
${WX_HOME}/lib/libwx_gtk2ud_ogl-${WX_VERSION}.a"
                 LIBS="$LIBS $WX_NEW_LDFLAGS"
@@ -408,6 +437,14 @@
                 LIBS="$LIBS -lwx_mac_stc-${WX_VERSION} -lwx_mac_ogl-${WX_VERSION}"
                 LIBS="$LIBS $WX_NEW_LDFLAGS"
                 ;;
+            *wx_macu-*)
+                LIBS="$LIBS -lwx_macu_stc-${WX_VERSION} -lwx_macu_ogl-${WX_VERSION}"
+                LIBS="$LIBS $WX_NEW_LDFLAGS"
+                ;;
+            *wx_macu_core*)
+                LIBS="$LIBS -lwx_macu_stc-${WX_VERSION} -lwx_macu_ogl-${WX_VERSION}"
+                LIBS="$LIBS $WX_NEW_LDFLAGS"
+                ;;
             *wx_gtk2ud-*)
                 LIBS="$LIBS -lwx_gtk2ud_stc-${WX_VERSION} -lwx_gtk2ud_ogl-${WX_VERSION}"
                 LIBS="$LIBS $WX_NEW_LDFLAGS"

Attachment

Re: [PATCH] acinclude.m4 fixes for wx 2.6,

From
OpenMacNews
Date:
hi,

>     .) Fixes statically linking against libpq (There is no libcrypt on osx)

that's correct -- and has been annoying in the past!

just fyi, a workaround is a symlink, specifically:

/usr/local/lib/libcrypt.dylib ->
/System/Library/Frameworks/System.framework/System

for reference, see:
    # http://lists.spread.org/pipermail/spread-users/2001-March/000039.html
    # http://developer.apple.com/technotes/tn2002/tn2071.html
    #
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/Config.3pm.html

so far, its served me well.

richard


Re: [PATCH] acinclude.m4 fixes for wx 2.6, wx-nondebug,

From
"Florian G. Pflug"
Date:
OpenMacNews wrote:
> hi,
>
>>     .) Fixes statically linking against libpq (There is no libcrypt on
>> osx)
>
> that's correct -- and has been annoying in the past!
> just fyi, a workaround is a symlink, specifically:
>
> /usr/local/lib/libcrypt.dylib ->
> /System/Library/Frameworks/System.framework/System
Hm... at least for pgadmin this isn't needed (anymore).
It doesn't try to link against libcrypt when
$build_cpu-$build_vendor == "powerpc-apple" anymore ;-)

Anyway, thanks for the tip

greetings, Florian Pflug

Attachment

Re: [PATCH] acinclude.m4 fixes for wx 2.6, wx-nondebug, postgres-ssl and others

From
Chris Campbell
Date:
I compiled CVS HEAD against a non-debug wxMac 2.5.5 (with toplevel.cpp
patch). Compiled successfully out of the box. And it doesn't have the
window sizing problem. However, I do get a big blank error window if I
attempt to connect to a server and it rejects the connection (incorrect
password, etc).

I put my build up at:

    http://gwenmalone.com/pgAdmin3.tar.gz (4.8 MB)

if anyone wants to try it.

BTW, why don't we just link against the static libpq.a? Then we don't
need Frameworks/libpq.4.dylib, and we can probably make the whole thing
a bit smaller. Right now, it's a total of about 18 MB, with all the
docs and everything (executable size is about 7 MB). The description of
this patch seems to imply that we are linking against libpq statically,
but I see "-lpq" in the linker flags when we link the executable.

Thanks!

- Chris

On Apr 14, 2005, at 09:28, Florian G. Pflug wrote:

> Hi
>
> This patch
>     .) Doesn't actually switch pgadmin3 over to using wx2.6 aka CVS HEAD
> ;-)
>     .) It just e.g. adds a 2.6-case to checks where there is a 2.4 and a
> 2.5 case
>     .) It works around the postgres-ssl problem on osx, by checking
>     wether libpq links libssl directly (otool -L ;-) ).
>     .) Fixes statically linking against libpq (There is no libcrypt on
> osx)
>     .) Fixes linking against a non-debug wxMac. Non-debug versions are
>     named macu_*, but relevant part of acinclude.m4 only checked for mac,
> mac_d & macud.
>     Added macu
>
> Statically linking pgadmin3 against libpq and wx now works for me
> out-of-the-box
> This should fix both the problems OpenMacNew was having, and the "I
> have to fiddle
> with LIBS" problems
>
> Everybody with a Mac - please test, if you have the time ;-))))
>
> greetings, Florian Pflug
> Index: acinclude.m4
> ===================================================================
> RCS file: /projects/pgadmin3/acinclude.m4,v
> retrieving revision 1.44
> diff -a -u -r1.44 acinclude.m4
> --- acinclude.m4    12 Apr 2005 07:36:41 -0000    1.44
> +++ acinclude.m4    14 Apr 2005 13:12:53 -0000
> @@ -131,7 +131,18 @@
>      AC_LANG_SAVE
>      AC_LANG_C
>      AC_CHECK_LIB(pq, PQexec, [pgsql_cv_libpq=yes],
> [pgsql_cv_libpq=no])
> -    AC_CHECK_LIB(pq, SSL_connect, [pgsql_ssl_libpq=yes],
> [pgsql_ssl_libpq=no])
> +    if test "$build_cpu-$build_vendor" = "powerpc-apple"; then
> +        echo -n "Checking if libpq links against libssl: "
> +        if test "$(otool -L ${LIBPQ_HOME}/lib/libpq.?.dylib | grep -c
> libssl)" -gt 0
> +        then
> +            pgsql_ssl_libpq="yes"
> +        else
> +            pgsql_ssl_libpq="no"
> +        fi
> +        echo $pgsql_ssl_libpq
> +    else
> +        AC_CHECK_LIB(pq, SSL_connect, [pgsql_ssl_libpq=yes],
> [pgsql_ssl_libpq=no])
> +    fi
>      AC_LANG_RESTORE
>
>      if test "$pgsql_include" != ""
> @@ -143,11 +154,18 @@
>
>      if test "$pg_static_build" = "yes"
>      then
> +        if test "$build_cpu-$build_vendor" = "powerpc-apple"
> +        then
> +            CRYPT_LIB=""
> +        else
> +            CRYPT_LIB="-lcrypt"
> +        fi
> +
>          if test "$pgsql_ssl_libpq" = "yes"
>          then
> -            LIBS="${LIBPQ_HOME}/lib/libpq.a -lcrypt $LIBS -lssl
> -lcrypto"
> +            LIBS="${LIBPQ_HOME}/lib/libpq.a $CRYPT_LIB $LIBS -lssl
> -lcrypto"
>          else
> -            LIBS="${LIBPQ_HOME}/lib/libpq.a -lcrypt $LIBS -lcrypto"
> +            LIBS="${LIBPQ_HOME}/lib/libpq.a $CRYPT_LIB $LIBS -lcrypto"
>          fi
>      else
>          if test "$pgsql_ssl_libpq" = "yes"
> @@ -253,6 +271,9 @@
>      # Which version of wxWindows is this?
>      WX_VERSION=`${WX_CONFIG} --version`
>      case "${WX_VERSION}" in
> +        2.6*)
> +            WX_VERSION="2.6"
> +            ;;
>          2.5*)
>              WX_VERSION="2.5"
>              ;;
> @@ -311,6 +332,14 @@
>                  LIBS="$LIBS
> ${WX_HOME}/lib/libwx_mac_stc-${WX_VERSION}.a
> ${WX_HOME}/lib/libwx_mac_ogl-${WX_VERSION}.a"
>                  LIBS="$LIBS $WX_NEW_LDFLAGS"
>                  ;;
> +            *libwx_macu-*)
> +                LIBS="$LIBS
> ${WX_HOME}/lib/libwx_macu_stc-${WX_VERSION}.a
> ${WX_HOME}/lib/libwx_macu_ogl-${WX_VERSION}.a"
> +                LIBS="$LIBS $WX_NEW_LDFLAGS"
> +                ;;
> +            *libwx_macu_core*)
> +                LIBS="$LIBS
> ${WX_HOME}/lib/libwx_macu_stc-${WX_VERSION}.a
> ${WX_HOME}/lib/libwx_macu_ogl-${WX_VERSION}.a"
> +                LIBS="$LIBS $WX_NEW_LDFLAGS"
> +                ;;
>              *libwx_gtk2ud-*)
>                  LIBS="$LIBS
> ${WX_HOME}/lib/libwx_gtk2ud_stc-${WX_VERSION}.a
> ${WX_HOME}/lib/libwx_gtk2ud_ogl-${WX_VERSION}.a"
>                  LIBS="$LIBS $WX_NEW_LDFLAGS"
> @@ -408,6 +437,14 @@
>                  LIBS="$LIBS -lwx_mac_stc-${WX_VERSION}
> -lwx_mac_ogl-${WX_VERSION}"
>                  LIBS="$LIBS $WX_NEW_LDFLAGS"
>                  ;;
> +            *wx_macu-*)
> +                LIBS="$LIBS -lwx_macu_stc-${WX_VERSION}
> -lwx_macu_ogl-${WX_VERSION}"
> +                LIBS="$LIBS $WX_NEW_LDFLAGS"
> +                ;;
> +            *wx_macu_core*)
> +                LIBS="$LIBS -lwx_macu_stc-${WX_VERSION}
> -lwx_macu_ogl-${WX_VERSION}"
> +                LIBS="$LIBS $WX_NEW_LDFLAGS"
> +                ;;
>              *wx_gtk2ud-*)
>                  LIBS="$LIBS -lwx_gtk2ud_stc-${WX_VERSION}
> -lwx_gtk2ud_ogl-${WX_VERSION}"
>                  LIBS="$LIBS $WX_NEW_LDFLAGS"

Attachment

Re: [PATCH] acinclude.m4 fixes for wx 2.6, wx-nondebug,

From
"Florian G. Pflug"
Date:
Chris Campbell wrote:
> I compiled CVS HEAD against a non-debug wxMac 2.5.5 (with toplevel.cpp
> patch). Compiled successfully out of the box. And it doesn't have the
> window sizing problem. However, I do get a big blank error window if I
> attempt to connect to a server and it rejects the connection (incorrect
> password, etc).
>
> I put my build up at:
>
>    http://gwenmalone.com/pgAdmin3.tar.gz (4.8 MB)
>
> if anyone wants to try it.
>
> BTW, why don't we just link against the static libpq.a? Then we don't
> need Frameworks/libpq.4.dylib, and we can probably make the whole thing
> a bit smaller. Right now, it's a total of about 18 MB, with all the docs
> and everything (executable size is about 7 MB). The description of this
> patch seems to imply that we are linking against libpq statically, but I
> see "-lpq" in the linker flags when we link the executable.

Hm.. it links libpq statically for me (that was the main reason I had
to fix the ssl-detection problem. If libpq was linked against libssl,
then each app that links _statically_ against libpq has to link
against libssl as well, because otherwise libpq has unresolved symbols.
If you link libpq dynamically, it can pull in libssl, even when the app
doesn't like against libssl)

Thats the configure options I used for pgadmin...

CPPFLAGS="-DwxUSE_DEPRECATED=0" \
./configure \
         --enable-appbundle \
         --enable-static \
         --with-wx=$WXWIDGETS_INST_DIR \
                 --with-wx-config=bin/wx-config \
         --with-pgsql=$PGSQL_INST_DIR \


greetings, Florian Pflug


Attachment