Re: gtk.m4 patch
- From: Owen Taylor <owt1 cornell edu>
- To: Tero Pulkkinen <terop students cc tut fi>
- Cc: gtk-list redhat com
- Subject: Re: gtk.m4 patch
- Date: 18 Mar 1998 10:28:51 -0500
Tero Pulkkinen <terop@students.cc.tut.fi> writes:
> Here's a patch for gtk.m4 that will add CXXFLAGS support for it.
>
> The gtk.m4 did not work correctly if there was AC_PROC_CC, AC_PROC_CXX and
> AC_LANG_CPLUSPLUS in the configure.in.
>
> (still, it would prolly be better if AC_SUBST(GTK_CXXFLAGS) could be used,
> but I couldnt get that one working, so it modifies CXXFLAGS directly.. )
Actually, there is no need for GTK_CXXFLAGS; GTK_CFLAGS should
work fine with a C++ compiler in the end.
The code you modified does:
* Save CFLAGS/LIBS
* Modify them
* Try running something
* Restore them to the original position.
You've just noticed that when AC_LANG is set to CPLUSPLUS, AC_TRY_RUN
uses the C++ compiler and CXXFLAGS. Your patch is mostly OK, and I
don't see any reason not to include it; though in general it might be
that case that a test written for C would work for C++, so it might be
safer to do either such tests before you call AC_LANG_CPLUSPLUS in
your configure.in, or to put them in a
AC_LANG_SAVE
AC_LANG_C
AC_LANG_RESTORE
group.
> --
> -- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --
>
> --- gtk.m4 Wed Mar 18 00:04:12 1998
> +++ /home/p150650/modeemi-b/automake/share/aclocal/gtk.m4 Wed Mar 18 01:31:28 1998
> @@ -17,7 +17,9 @@
> GTK_LIBS=`$GTK_CONFIG --libs`
> ac_save_CFLAGS="$CFLAGS"
> ac_save_LIBS="$LIBS"
> + ac_save_CXXFLAGS="$CXXFLAGS"
> CFLAGS="$CFLAGS $GTK_CFLAGS"
> + CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
> LIBS="$LIBS $GTK_LIBS"
> dnl
> dnl Now check if the installed GTK is sufficiently new. (Also sanity
> @@ -43,6 +45,7 @@
> }
> ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
> CFLAGS="$ac_save_CFLAGS"
> + CXXFLAGS="$ac_save_CXXFLAGS"
> LIBS="$ac_save_LIBS"
> else
> no_gtk=yes
> @@ -56,6 +59,9 @@
> GTK_LIBS=""
> ifelse([$3], , :, [$3])
> fi
> + CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
> + AC_SUBST(CXXFLAGS)
This part, though is incorrect. gtk.m4 has no business messing
with the callers CXXFLAGS. It leaves the caller the choice
of adding GTK_CFLAGS to CFLAGS or using it in a Makefile as
is. The caller can do the same with CXXFLAGS. [ And the
caller can use GTK_CFLAGS for that purpose ]
Also, the equivalent of AC_SUBST(CXXFLAGS) is already done
automatically.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]