[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Idiom for setting defines
From: |
Bill Moseley |
Subject: |
Re: Idiom for setting defines |
Date: |
Fri, 18 Jul 2003 10:04:12 -0700 |
User-agent: |
Mutt/1.5.4i |
[sorry for the broken thread -- forgot I had unsubscribed]
Ok, following Russ Allbery's suggestion does this look reasonable?
# ENABLE_DEFINE( variable, define variable, help message)
# Provides an --enable-foo option and a way to set an acconfig.h define switch
# e.g. ENABLE_DEFINE([memdebug], [MEM_DEBUG], [Memory Debugging])
#----------------------------------------------------------------
AC_DEFUN([ENABLE_DEFINE],
[ AC_MSG_CHECKING([config option $1 for setting $2])
AC_ARG_ENABLE([$1],
AC_HELP_STRING([--enable-$1], [$3]),
,
enableval=no)
AC_MSG_RESULT($enableval)
if test x"$enableval" != xno ; then
AC_DEFINE([$2], 1, [$3])
fi])
ENABLE_DEFINE([memdebug], [MEM_DEBUG], [Enable memory debugging code])
Ok, the name stinks.
I also saw Harlan Stenn's suggestion about using a case statement. If
that's a better way to go can someone provide an example?
Thanks,
--
Bill Moseley
address@hidden