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

Re: autoconf macros and C++



Checking for C++ libs with autoconf is indeed a bit tricky. My usual
solution is just to check for the function "main" and avoid all the
other problems. :-)

But you might want to try out the following. Note how one line starts
with a comma - weird, but it has to be that way for autoconf to
swallow it:

AC_INIT(.)
AC_LANG_C
AC_PROG_CC
AC_LANG_CPLUSPLUS
AC_PROG_CXX
AC_MSG_CHECKING(for -lgtkmm)
AC_TRY_COMPILE(#include <gtk--/object.h>
               , Gtk_Object::isGtkObject(0), have_lib=yes, have_lib=no)
AC_MSG_RESULT($have_lib)
if test $have_lib = no; then
    AC_MSG_WARN([
   * Please install lib, it is needed by the program.])
fi
AC_OUTPUT(Makefile)

There's another thing I'd like to point out: Configure scripts should
IMNSHO *never ever* abort with an error, they should *always* generate
the Makefiles, and just let the compilation fail.

Reason: Many people compiling the program will know about Makefiles,
but few will know about autoconf internals. If compilation fails,
they'd usually know a simple solution, e.g. adding an
"-L/path/to/library" switch to LDFLAGS. What they would rather *not*
do is to poke around in "configure", trying to work out how on earth
to make it continue and create those Makefiles.

I think configure scripts which abort with an error are the reason why
some people develop such a strong dislike for autoconf.

HTH,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer           | CS student at the Technische | GPG key:
  | \/¯|  http://atterer.net        | Universität München, Germany | 888354F7
  ¯ ´` ¯

Attachment: pgplLYVyEHE79.pgp
Description: PGP signature


Reply to: