[Top][All Lists]

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

this AC_ARG_ENABLE stuff works, but I suspect I'm not doing this the bes

From: Ed Hartnett
Subject: this AC_ARG_ENABLE stuff works, but I suspect I'm not doing this the best way...
Date: 24 Jan 2005 09:26:40 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Howdy all!

I'm working on netcdf, a popular freeware software library for climate
scientists and meteorologists.

I have an option in my which allows the user to build an
extra part of the package if they specify --enable-netcdf-4 during the
configure step. If they do specify it, I need an automake variable
(USE_NETCDF4) to be true, and I also need a macro (also USE_NETCDF4)
defined in config.h.

Here's how I do it, but I'm sure there must be a better way. In
particular, how do I set the macro USE_NETCDF4 to 1, when
AC_ARG_ENABLE sets ac_cv_use_netcdf4 to either "yes" or "no."

The way I do it is to introduce a new variable, ac_use_netcdf4_num,
which I set to 0 or 1. Is there a better way to do this?

# Does the user want to build netcdf-4?
AC_MSG_CHECKING([whether netCDF-4 is to be built])
                              [build with netcdf-4 (HDF5 is required)])],
AM_CONDITIONAL(USE_NETCDF4, [test x$ac_cv_use_netcdf4 != xno])
if test x$ac_cv_use_netcdf4 == xyes; 
then ac_use_netcdf4_num=1
else ac_use_netcdf4_num=0
AC_DEFINE_UNQUOTED([USE_NETCDF4], [$ac_use_netcdf4_num], 
                   [if true, build netCDF-4])



reply via email to

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