Re: [gtk-list] [Daniel Burrows <Daniel_Burrows brown edu>] Re:Bug#42459: glib.m4 is incorrect for C++ programs
- From: Havoc Pennington <hp redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] [Daniel Burrows <Daniel_Burrows@brown.edu>] Re:Bug#42459: glib.m4 is incorrect for C++ programs
- Date: Wed, 4 Aug 1999 22:43:36 -0700 (PDT)
> Actually, glib is compatible with C++ (as far as I know -- at least
> I've used it in C++ programs :) ) In fact, the header has an explicit
> 'extern "C"' to allow C++ programs to compile against it, and I
> believe libgtk-- does exactly that. The only problem is that the
> aclocal macro AM_PATH_GLIB in glib.m4 is incorrect in situations where
> AC_LANG_CPLUSPLUS has been given. All I had to do to fix it was to
> move AM_PATH_GLIB to before AC_LANG_CPLUSPLUS,
This is the correct solution for your program, really, according to my
reading of the autoconf manual. It says AC_LANG_CPLUSPLUS means "Do
compilation tests using `CXX' and `CXXCPP' and use extension `.C' for test
programs. Set the shell variable `cross_compiling' to the value computed
by `AC_PROG_CXX' if it has been run, empty otherwise."
So, if you set the lang to C++ it will use the C++ compiler. To detect a C
library I think you want to use the C compiler. There's even a language
stack, AC_LANG_SAVE and AC_LANG_RESTORE.
> but a 'nicer' solution is to fix AM_PATH_GLIB by altering both CFLAGS
> and CPPFLAGS prior to calling AC_TRY_COMPILE.
<nitpick>CPPFLAGS is the preprocessor, you want CXXFLAGS</nitpick>
This is probably a good idea, in case people do want to check for glib
with the C++ compiler, your point is taken.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]