Hello Mick,

* mick wrote on Sun, Sep 17, 2006 at 08:36:15AM CEST:
> I am trying to make the inclusion of a module of my program an option 
> configurable in ./configure but can't get it right.
> 
> At the moment I have 
> in configure.ac
> ....
> AC_ARG_ENABLE(webcam,
>   [  --disable-webcam        disable use of webcam])
> AC_ARG_ENABLE(voice,
>   [  --disable-voice         disable use of voice])
> ....
> AC_DEFINE([USE_WEBCAM], [], [enable/disable webcam broadcaster])
> AC_DEFINE([USE_VOICE], [], [enable/disable voice chat])

Use something like
  AC_ARG_ENABLE([webcam],
    [AS_HELP_STRING([--disable-webcam], [disable use of webcam])],
    [AC_DEFINE([USE_WEBCAM], [1], [enable/disable webcam broadcaster])])

If you have some sources that don't need to be compiled at all in some
case (and you use Automake), you can follow this by

  AM_CONDITIONAL([COND_WEBCAM], [test "$enable_webcam" != no])

and put in Makefile.am something like

  bin_PROGRAMS = foo
  foo_SOURCES = foo1.c ...
  if COND_WEBCAM
  foo_SOURCES += foo_webcam.c ...
  endif

Cheers,
Ralf


Reply via email to