patch to build ORBit2 cleanly on MinGW

Georg Steffers <[email protected]> Thu, 02 Feb 2006 00:19:32 +0100
Newsgroups gmane.comp.gnome.orbit.general
Message-ID <1138835972l.5377l.2l@onkels>
Hi,

today i have worked a little to manage building ORBit2 on my MinGW  
installation. I created a patch to a cvs checkout that i made today.

With that patch ORBit2 builds (at least here) on both linux and mingw  
with the standard autogen.sh->configure, make, make install.

Additional the patch i created puts -Wl,--enable-runtime-pseudo-reloc  
to ORBit-2.0.pc and fixes ORBit2.m4 to use only pkg-config. With that  
change also packages that uses ORBit2 (at least my echo-example  
testcase) build without further assisten on both linux and mingw if a  
configure.[ac|in] with AM_PATH_ORBIT2 is used.

The patch changes configure.in ORBit-2.0.pc.in and ORBit2.m4 in the cvs  
source tree. I would really appreciate if someone responsibe would find  
the time to check it and perhaps approve it for a cvs checkin.

Best regards
    Georg Steffers


Here is the patch:
/* -----------------start---------------*/
diff -Naur ORBit2.cvs/ORBit-2.0.pc.in ORBit2/ORBit-2.0.pc.in
--- ORBit2.cvs/ORBit-2.0.pc.in  2005-04-12 09:39:39.000000000 +0000
+++ ORBit2/ORBit-2.0.pc.in      2006-02-01 22:32:21.120146422 +0000
@@ -9,5 +9,5 @@
  Description: High-performance CORBA Object Request Broker.
  Version: @ORBIT_VERSION@
  Requires: glib-2.0 gmodule-no-export-2.0 gthread-2.0
-Libs: -L${libdir} -lORBit-2 @LIBM@
+Libs: -L${libdir} @MINGW_LDFLAGS@ -lORBit-2 @LIBM@
  Cflags: -I${includedir}/orbit-2.0 -DORBIT2=1
diff -Naur ORBit2.cvs/ORBit2.m4 ORBit2/ORBit2.m4
--- ORBit2.cvs/ORBit2.m4        2004-01-25 02:43:24.000000000 +0000
+++ ORBit2/ORBit2.m4    2006-02-01 22:32:14.870062578 +0000
@@ -41,16 +41,24 @@
    fi

    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-  AC_PATH_PROG(ORBIT_CONFIG, orbit2-config, no)
    min_orbit_version=ifelse([$1], , 2.3.0, $1)
    AC_MSG_CHECKING(for ORBit - version >= $min_orbit_version)
    no_orbit=""
-  if test "$ORBIT_CONFIG" = "no" ; then
+  if test "$PKG_CONFIG" = "no" ; then
      no_orbit=yes
    else
-    ORBIT_CFLAGS=`$ORBIT_CONFIG $orbit_config_args --cflags`
-    ORBIT_LIBS=`$ORBIT_CONFIG $orbit_config_args --libs`
+    if $PKG_CONFIG --exists ORBit-2.0; then
+      no_orbit=""
+    else
+      no_orbit=yes
+    fi
+  fi
+
+  if test "x$no_orbit" = x ; then
      ORBIT_VERSION=`$PKG_CONFIG --modversion ORBit-2.0`
+    ORBIT_CFLAGS=`$PKG_CONFIG --cflags ORBit-2.0`
+    ORBIT_LIBS=`$PKG_CONFIG --libs ORBit-2.0`
+
      orbit_config_major_version=`echo $ORBIT_VERSION | \
            sed -e 's,[[^0-9.]],,g' -e  
's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
      orbit_config_minor_version=`echo $ORBIT_VERSION | \
diff -Naur ORBit2.cvs/configure.in ORBit2/configure.in
--- ORBit2.cvs/configure.in     2005-11-08 09:26:42.000000000 +0000
+++ ORBit2/configure.in 2006-02-01 22:32:02.357896649 +0000
@@ -43,10 +43,12 @@
    *-*-mingw*)
      os_win32=yes
      LIBM=
+    MINGW_LDFLAGS="-Wl,--enable-runtime-pseudo-reloc"
      ;;
    *)
      os_win32=no
      LIBM=-lm
+    MINGW_LDFLAGS=
      ;;
  esac
  AC_MSG_RESULT([$os_win32])
@@ -54,6 +56,8 @@
  AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])

  AC_SUBST(LIBM)
+AC_SUBST(MINGW_LDFLAGS)
+LDFLAGS=$MINGW_LDFLAGS $LDFLAGS

  if test "$os_win32" = "yes"; then
    if test x$enable_static = xyes -o x$enable_static = x; then
/* --------------------end----------------*/