[Xastir-dev] set #DEFINE with configure?

Tom Russo russo at bogodyn.org
Tue Mar 8 12:16:26 EST 2005


On Tue, Mar 08, 2005 at 11:58:27AM -0500, we recorded a bogon-computron collision of the <brown at brauhaus.org> flavor, containing:
> 
> Is there a quick way to sent a #DEFINE - one which isn't yet existing
> in the code - using configure? 
> 
> Like, if I was working on some code that I wanted to wrap in #ifdefs? 
> 
> 
> 
> #ifdef USE_PID_FILE_CHECK
> 
> ... 
> 
> #endif
> 
> 
> 
> 
> (yes, i may just drop it into one of the .h files) 

Easiest way to do this while debugging is to add a CPPFLAGS to your configure 
line:

  ./configure CPPFLAGS="-DUSE_PID_FILE_CHECK"

When configure sets CPPFLAGS itself it always appends what it wants to the
existing CPPFLAGS.


If you want to add it as a user configurable option like "--with-pid_file_check"
you have to add something like:

 use_pid_file_check=no
 AC_ARG_WITH(pid_file_check,[  --with-pid_file_check       enable pid file check.],[use_pid_file_check=$withval])
 if test "${use_pid_file_check}" = "yes" ; then
   AC_DEFINE([USE_PID_FILE_CHECK],1,[PID file checking])
 fi

In my copious spare time I ought to adapt the macro we use at work to do all
of this in one line instead of having tons of identical blocks scattered
willy-nilly over configure.ac.  But that's for another day.

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 
 "When life gives you lemons, find someone with a paper cut."



More information about the Xastir-dev mailing list