autoconf
[Top][All Lists]
Advanced

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

Automatic rebuilds, LIBS, and autoheader


From: Micah J. Cowan
Subject: Automatic rebuilds, LIBS, and autoheader
Date: Tue, 6 Jun 2006 20:23:26 -0700
User-agent: Mutt/1.2.5.1i

Greetings, all.

Alright, so for a project I'm working on, I need to check for some
libraries. So far, so good: I can use AC_CHECK_LIB():

  AC_CHECK_LIB(readline, readline)
  AC_CHECK_LIB(check, suite_add_tcase)
  AC_CHECK_LIB(m, sin)

Great. Only thing is, readline is used by one tiny little program,
libcheck is only needed by the tests, and lm is needed by yet another,
different program. It seems clunky to just let all of these things pile
up in LIB, so to enable /just/ the HAVE_* definitions, I use:

  AC_CHECK_LIB(readline, readline, [AC_DEFINE(HAVE_LIBREADLINE)],
        [AC_MSG_WARN([Won't build pitchcalc])])
  AC_CHECK_LIB(check, suite_add_tcase, [AC_DEFINE(HAVE_LIBCHECK)])
  AC_CHECK_LIB(m, sin, [AC_DEFINE(HAVE_LIBM)])

So far, so good.

Now, I'd rather use a single config.h file rather than post a gazillian
-DHAVE_FOOs to every compilation, so I made myself a config.h.in.
Everything's cool.

Except that when configure is run, make wants to run autoheader to build
a new config.h.in. Which is okay, except then, it doesn't like the
AC_DEFINEs that I used in the AC_CHECK_LIBs.

Sure, I could use AM_MAINTAINER_MODE, but that's discouraged, and anyway
I /like/ the rest of the rebuild rules. Is there a way to disable the
autoheader rule (as I hadn't intended on using it anyway), or /some/
less clunky way to get around this than either to simply give up and let
it bloat LIBS, or to have to write awkward rules like:

  AC_CHECK_LIB(readline, readline,
        [AC_DEFINE(HAVE_LIBREADLINE, 1,
          [Define to 1 if you have the `readline' library (libreadline).])],
        [AC_MSG_WARN([Won't build pitchcalc])])

?

I'm using autoconf 2.59 with automake 1.9.6.

-- 
Thanks in advance,

Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]