[Chris Butler <chrisb sandy force9 co uk>] Re: Bug#42459: glib.m4 is incorrect for C++ programs



Here's a patch for the aformentioned problem with glib.m4 and gtk.m4
and compiling with C++.



On Wed, Aug 04, 1999 at 10:07:47AM -0700, Ben Gertzfield wrote:
>     Daniel> Package: libglib1.2-dev Version: 1.2.3-2 Severity: normal
> 
>     Daniel>   Hello,
> 
>     Daniel>   Attempting to call AM_PATH_GLIB after executing
>     Daniel> AC_LANG_CPLUSPLUS results in a failure to find GTK+.  I
>     Daniel> suspect that the reason for this is that AC_TRY_COMPILE is
>     Daniel> compiling in C++ mode (using CPPFLAGS) and glib.m4 is
>     Daniel> setting CFLAGS for its test compiles.  Probably just
>     Daniel> setting both CFLAGS and CPPFLAGS will be adequate for most
>     Daniel> situations.
> 
> I'm not sure why this is a problem, libglib is a C library, not a C++
> library. If you need C++ stuff, shouldn't you use libgtk--?

The attached patches should fix glib.m4 and gtk.m4 respectively (they're
almost the same patch, anyway). They call the AC_LANG_* macros to make
sure they're compiling as C.

-- 
  Chris Butler                       e-mail: <chrisb@sandy.force9.co.uk>
--------------------------------------------------------------------------
PGP key 9D973385/1024 fingerprint: 047E 3689 387A 8C4B 709C 74A2 7AB3 4869
--- /usr/share/aclocal/glib.m4	Tue Jul 27 23:26:21 1999
+++ glib.m4	Thu Aug  5 13:00:46 1999
@@ -57,6 +57,8 @@
     glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
     if test "x$enable_glibtest" = "xyes" ; then
+      AC_LANG_SAVE
+      AC_LANG_C
       ac_save_CFLAGS="$CFLAGS"
       ac_save_LIBS="$LIBS"
       CFLAGS="$CFLAGS $GLIB_CFLAGS"
@@ -141,6 +143,7 @@
 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
        CFLAGS="$ac_save_CFLAGS"
        LIBS="$ac_save_LIBS"
+       AC_LANG_RESTORE
      fi
   fi
   if test "x$no_glib" = x ; then
@@ -158,6 +161,8 @@
         :
        else
           echo "*** Could not run GLIB test program, checking why..."
+          AC_LANG_SAVE
+          AC_LANG_C
           CFLAGS="$CFLAGS $GLIB_CFLAGS"
           LIBS="$LIBS $GLIB_LIBS"
           AC_TRY_LINK([
@@ -184,6 +189,7 @@
           echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
           CFLAGS="$ac_save_CFLAGS"
           LIBS="$ac_save_LIBS"
+          AC_LANG_RESTORE
        fi
      fi
      GLIB_CFLAGS=""
--- /usr/share/aclocal/gtk.m4	Tue Jul 27 23:41:28 1999
+++ gtk.m4	Thu Aug  5 13:07:21 1999
@@ -53,6 +53,8 @@
     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
     if test "x$enable_gtktest" = "xyes" ; then
+      AC_LANG_SAVE
+      AC_LANG_C
       ac_save_CFLAGS="$CFLAGS"
       ac_save_LIBS="$LIBS"
       CFLAGS="$CFLAGS $GTK_CFLAGS"
@@ -139,6 +141,7 @@
 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
        CFLAGS="$ac_save_CFLAGS"
        LIBS="$ac_save_LIBS"
+       AC_LANG_RESTORE
      fi
   fi
   if test "x$no_gtk" = x ; then
@@ -156,6 +159,8 @@
         :
        else
           echo "*** Could not run GTK test program, checking why..."
+          AC_LANG_SAVE
+          AC_LANG_C
           CFLAGS="$CFLAGS $GTK_CFLAGS"
           LIBS="$LIBS $GTK_LIBS"
           AC_TRY_LINK([
@@ -182,6 +187,7 @@
           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
           CFLAGS="$ac_save_CFLAGS"
           LIBS="$ac_save_LIBS"
+          AC_LANG_RESTORE
        fi
      fi
      GTK_CFLAGS=""

PGP signature




-- 
Brought to you by the letters Z and E and the number 9.
"Whoa. I know Kung Fu."
Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]