|
From: | Braden McDaniel |
Subject: | Re: Using --enable-debug and defining a macro from it...? |
Date: | Wed, 17 Jan 2007 15:22:26 -0500 |
User-agent: | Thunderbird 1.5.0.8 (Windows/20061025) |
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.
'--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.
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.
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.
==== 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.
AC_LANG_CPLUSPLUS
This is unnecessary.
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.
Braden
[Prev in Thread] | Current Thread | [Next in Thread] |