autoconf
[Top][All Lists]
Advanced

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

Re: Using --enable-debug and defining a macro from it...?


From: Matthew Woehlke
Subject: Re: Using --enable-debug and defining a macro from it...?
Date: Wed, 17 Jan 2007 16:05:42 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20061206 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0

Braden McDaniel wrote:
Matthew Woehlke wrote:
(If this isn't the place for 'how do I...?' questions, please re-direct me, but I do see it isn't the -bugs list.)

First off, I have a very skeleton configure.in (see below). How do I add

The name "configure.ac" is preferred for autoconf >= 2.5x.

Eh, well blame KDevelop. :-) Say, can I borrow some of you to beat them (KDE) over the head with their various anachronisms? ;-)

'--enable-debug' to this? (I see AC_ARG_ENABLE, but is there not a standard one for debug? I can't find one, but it seems to be a standard.)

There isn't and it's not. AC_ARG_ENABLE is what you would use for such an option.

Hmm, ok KDE must have one buried somewhere. I'll make one up; thanks!

Unless you have some unusual debugging requirements, I find that it's generally simpler to apply debugging-related options via the CPPFLAGS, CFLAGS, and CXXFLAGS user variables at configure time. Many useful debugging options will be compiler-specific.

Well, KDevelop wants to use '--enable-debug=full', although I will probably change this. Mostly because of the second question; I want to combine CXXFLAGS tweaking with tinkering with adding a define to turn on internal debugging. (Actually I guess I could do this via CXXFLAGS too, but... well, since I still don't get AC_DEFINE, I guess I will just use CXXFLAGS.)

Hmm, apparently KDE's acinclude.m4 is floating around all over the place (and I mean outside of KDE).

Second, I want to add a define to config.h based on the value of --enable-debug. How do I do this?

You use AC_DEFINE to specify preprocessor definitions that will appear in your config header. Note that the config header is not intended to be installed; as such, using it to toggle things that impact your ABI is typically unwise.

Don't worry, I'm not... I'm using it to toggle if debugging output is produced.

====
AC_INIT(<...>)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(<pkg>, 0.1)

Refer to the documention for a (at least somewhat) recent version of automake for the preferred form of AM_INIT_AUTOMAKE invocation.

I'll assume you meant "AM_INIT_AUTOMAKE" (no args).

AC_LANG_CPLUSPLUS

This is unnecessary.

See my first comment. :-)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_INSTALL

AC_OUTPUT(Makefile src/Makefile <...>)

The preferred way to do this with modern autoconf is to use AC_CONFIG_FILES and invoke AC_OUTPUT with no arguments.

Thanks. Again, see my first comment. Ack, and I can't change this, KDevelop updates it automatically and will probably be confused if I do.

--
Matthew
HIPPOS feel unacknowledged. HIPPOS get angry.
> PRAISE HIPPOS
HIPPOS seem somewhat placated.





reply via email to

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