Thread: 8.0.0b1: configure.in cygipc

8.0.0b1: configure.in cygipc

From
Reini Urban
Date:
Attached is a cygipc patch against 8.0.0p1 and 7.4.5:

The cygipc patch should also be applied to the 7.4.x branch (if there
will be some more releases):

   cygipc is deprecated in cygwin, replaced by cygserver
   added test to check for running cygserver and the required
   server in $CYGWIN. Otherwise build for cygipc, but print a warning.

   replaced
   AC_CHECK_LIB(cygipc, shmget)
   by a better logic to detect cygserver, and only use cygipc if
   cygserver fails.


******************************

BTW: My current set of CYGWIN-PATCHES I'm working on is at
http://xarch.tu-graz.ac.at/home/rurban/software/cygwin/postgresql/postgresql-7.4.5-1/
and
http://xarch.tu-graz.ac.at/home/rurban/software/cygwin/postgresql/postgresql-8.0.0beta1-1/
but the 8.0.0b1 patchset is not finished yet.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

2004-08-26 00:15:41 rurban@x-ray.at
    cygipc is deprecated in cygwin, replaced by cygserver
    added test to check for running cygserver and the required
    server in $CYGWIN. Otherwise build for cygipc, but print a warning.

--- postgresql-8.0.0beta1/configure.in~    2004-08-09 00:27:12.000000000 +0100
+++ postgresql-8.0.0beta1/configure.in    2004-08-25 22:57:24.984375000 +0100
@@ -622,7 +622,26 @@
 # Solaris:
 AC_SEARCH_LIBS(fdatasync, [rt posix4])
 # Cygwin:
-AC_CHECK_LIB(cygipc, shmget)
+# Cygwin:
+# TODO: check for early version where only cygipc was supported
+if test "$PORTNAME" = "cygwin"
+then
+    if test -z "`ps -W |grep cygserver`"
+    then
+    AC_MSG_WARN([
+*** cygserver not running! Checking for cygipc, but this is deprecated.])
+    AC_CHECK_LIB(cygipc, shmget, [],
+               [AC_MSG_ERROR([cygipc library not found and cygserver not running.
+And be sure to run cygserver and have "server" in the CYGWIN environment variable.])])
+    else
+    if ! test "`echo $CYGWIN|grep server`"
+    then
+        AC_MSG_ERROR([cygserver is running, but the CYGWIN environment variable
+does not contain "server"])
+    fi
+    fi
+fi
+ # WIN32:
 if test "$PORTNAME" = "win32"
 then
--- postgresql-8.0.0beta1/configure~    2004-08-09 00:27:10.000000000 +0100
+++ postgresql-8.0.0beta1/configure    2004-08-25 23:12:25.359375000 +0100
@@ -5681,6 +6265,15 @@
 fi

 # Cygwin:
+# TODO: check for early version where only cygipc was supported
+if test "$PORTNAME" = "cygwin"
+then
+    if test -z "`ps -W |grep cygserver`"
+    then
+    { echo "$as_me:$LINENO: WARNING:
+*** cygserver not running! Checking for cygipc, but this is deprecated." >&5
+echo "$as_me: WARNING:
+*** cygserver not running! Checking for cygipc, but this is deprecated." >&2;}

 echo "$as_me:$LINENO: checking for shmget in -lcygipc" >&5
 echo $ECHO_N "checking for shmget in -lcygipc... $ECHO_C" >&6
@@ -5690,8 +6283,11 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcygipc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */

 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -5700,12 +6296,6 @@
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
 char shmget ();
-#ifdef F77_DUMMY_MAIN
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-#endif
 int
 main ()
 {
@@ -5716,10 +6306,20 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
+     { ac_try='test -z "$ac_c_werror_flag"
+             || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
          { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -5729,10 +6329,12 @@
   ac_cv_lib_cygipc_shmget=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_lib_cygipc_shmget=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_cygipc_shmget" >&5
@@ -5744,8 +6346,25 @@

   LIBS="-lcygipc $LIBS"

+else
+  { { echo "$as_me:$LINENO: error: cygipc library not found and cygserver not running.
+And be sure to run cygserver and have \"server\" in the CYGWIN environment variable." >&5
+echo "$as_me: error: cygipc library not found and cygserver not running.
+And be sure to run cygserver and have \"server\" in the CYGWIN environment variable." >&2;}
+   { (exit 1); exit 1; }; }
 fi

+    else
+    if ! test "`echo $CYGWIN|grep server`"
+    then
+        { { echo "$as_me:$LINENO: error: cygserver is running, but the CYGWIN environment variable
+does not contain \"server\"" >&5
+echo "$as_me: error: cygserver is running, but the CYGWIN environment variable
+does not contain \"server\"" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    fi
+fi
 # WIN32:
 if test "$PORTNAME" = "win32"
 then

Re: [PATCHES] 8.0.0b1: configure.in cygipc

From
Peter Eisentraut
Date:
Reini Urban wrote:
>    cygipc is deprecated in cygwin, replaced by cygserver
>    added test to check for running cygserver and the required
>    server in $CYGWIN. Otherwise build for cygipc, but print a
> warning.

configure checks the build environment, not the run time environment.
It's completely irrelevant whether cygserver is running when building
PostgreSQL.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: [PATCHES] 8.0.0b1: configure.in cygipc

From
Reini Urban
Date:
Peter Eisentraut schrieb:
> Reini Urban wrote:
>>   cygipc is deprecated in cygwin, replaced by cygserver
>>   added test to check for running cygserver and the required
>>   server in $CYGWIN. Otherwise build for cygipc, but print a
>>warning.
>
> configure checks the build environment, not the run time environment.
> It's completely irrelevant whether cygserver is running when building
> PostgreSQL.

I know, but I didn't want to indroduce yet another --with-cygipc
configure switch, and the run-time detection is just decent a helper.
But my patch is still valid:
   The current cygipc check is wrong when cygserver is running. If
cygserver is not running, it displays a warning when using the cygipc
library.

Later we really should check the cygwin release version and decide on
that. That will require `uname -r` parsing.
Ok?
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Re: [PATCHES] 8.0.0b1: configure.in cygipc

From
Peter Eisentraut
Date:
Reini Urban wrote:
> But my patch is still valid:
>    The current cygipc check is wrong when cygserver is running. If
> cygserver is not running, it displays a warning when using the cygipc
> library.

What would be wrong with using cygserver when available (!= when
running), else cygipc?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: [PATCHES] 8.0.0b1: configure.in cygipc

From
Reini Urban
Date:
Peter Eisentraut schrieb:
> Reini Urban wrote:
>>But my patch is still valid:
>>   The current cygipc check is wrong when cygserver is running. If
>>cygserver is not running, it displays a warning when using the cygipc
>>library.
>
> What would be wrong with using cygserver when available (!= when
> running), else cygipc?

I did that in my patch.
The problem is how to detect cygserver. I did it with checking against a
running cygserver. The other possibility would be to check against an
installed cygserver binary.

I favored the first.
Of course one should de-install cygipc, but I forgot that. Maybe others
will also.
It does not harm to build against the old cygipc daemon, but only if
cygserver is NOT running.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/