GNU autoconf question

GNU autoconf question

Post by SamMiller » Tue, 11 Oct 2005 21:43:40


How can I get the date and time, as well as the arguments given to
configure in my config.h file? The reason I'd like this information is
it would be beneficial for my application to respond to certain
administrative requests with this information.
 
 
 

GNU autoconf question

Post by SamMiller » Tue, 11 Oct 2005 23:51:46

I re-read my question and it didn't really make sense... This is
essentially what I'd like:

./configure --with-foo=$HOME/foo --enable-bar

Then in my config.h file I'd like to have the string "./configure
--with-foo=$HOME/foo --enable-bar" and the date and time when configure
was run.

 
 
 

GNU autoconf question

Post by Roger Leig » Wed, 12 Oct 2005 03:01:15


XXXX@XXXXX.COM writes:


Use AC_DEFINE[_UNQUOTED] with $@ or $* as you prefer.


--
Roger Leigh
Printing on GNU/Linux? http://www.yqcomputer.com/
Debian GNU/Linux http://www.yqcomputer.com/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
 
 
 

GNU autoconf question

Post by Jason Cur » Wed, 12 Oct 2005 23:09:49


I've created a package specific to getting time for my own project.

m4/package.m4

# AC_PACKAGE_TIME
# ---------------
# Get's the current time and puts that into the header file
AC_DEFUN([AC_PACKAGE_TIME],
[AC_MSG_CHECKING([for current time])
date=`date`
AC_DEFINE_UNQUOTED(PACKAGE_BUILD_DATE, "$date", [Date configure was
run])
AC_MSG_RESULT($date)
])


In configure.ac I have something like:

dnl ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
AC_ARG_ENABLE(bar,
AS_HELP_STRING([--enable-bar],
[Enables bar module]))
AM_CONDITIONAL(HAVE_BAR, test x$enable_bar = xyes)

dnl =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
dnl Special build variables for compilation, that is changed everytime
dnl we configure. The main programs can then print this as part of
dnl their help
dnl =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
AC_PACKAGE_TIME


Have a look at the autoconf manuals on the GNU homepage. It's all there.