autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conditionally compiling C++ code


From: Patrick Welche
Subject: Re: conditionally compiling C++ code
Date: Tue, 29 Apr 2003 17:04:10 +0100
User-agent: Mutt/1.3.19i

On Tue, Apr 29, 2003 at 02:31:54PM +0200, Sander Niemeijer wrote:
> I was just wondering, but aren't the --with-PACKAGE/--enable-FEATURE 
> options of configure meant for this?
> 
> I have a package that can optionally make use of the HDF4 library 
> (which, if included, provides extra functionality to import/export data 
> in HDF4 format). I dealt with this in my configure.ac as follows:
> 
> ---
> AC_ARG_WITH([hdf4],
>   [AC_HELP_STRING([--with-hdf4],[build HDF4 support into this 
> package])],
>   [ac_cv_with_hdf4=$withval],
>   [AC_CACHE_CHECK([use HDF4],ac_cv_with_hdf4,ac_cv_with_hdf4=no)])
> 
> if test $ac_cv_with_hdf4 = yes ; then
>   ... <Check for HDF4 libs and headers via environment variables that 
> specify their location and set HAVE_HDF4 definition and 
> ac_cv_have_hdf4> ...
>   if test $ac_cv_have_hdf4 = no ; then
>     AC_MSG_ERR([HDF4 libraries and/or header files are not found. Try 
> setting the appropriate environment variables.])
>   fi
> fi
> ---
> This approach forces you to explicitly say that you want to make use of 
> the HDF4 functionality and if so it will give an error if it could not 
> find the HDF4 libs/headers.

Exactly, and I was suggesting that part should become part of say the
AC_CHECK_LIB macro, so you wouldn't have to write it (yet again) in your
configure.ac.

Cheers,

Patrick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]