is this a good way to use AC_CHECK_HEADERS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

is this a good way to use AC_CHECK_HEADERS

Ed Hartnett
Howdy all!

I have the following in configure.ac, to kill the configure if the
hdf5 header file isn't found.

Problem is, I also have a --with-hdf5=<DIRECTORY> configure argument
to allow the user to specify the location of the hdf5 library.

# If the user wants netcdf-4, we need hdf5.
if test "x$enable_netcdf_4" = xyes; then
   CPPFLAGS="${CPPFLAGS} -I${with_hdf5}/include"
   AC_CHECK_HEADERS([hdf5.h], [], [nc_hdf5_h_missing=yes])
   if test "x$nc_hdf5_h_missing" = xyes; then
      AC_MSG_ERROR([Can't find the hdf5 header and/or library. Specify
      the HDF5 prefix with the --with-hdf5 option to config\
ure.])
   fi
fi

I have to append -I${with_hdf5}/include to the CPPFLAGS. Is this the
usual way to do such a thing?

Or is there a better way?

THanks!

Ed



--
Ed Hartnett  -- [hidden email]



_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is this a good way to use AC_CHECK_HEADERS

Bob Friesenhahn
On Fri, 3 Jun 2005, Ed Hartnett wrote:
>
> I have to append -I${with_hdf5}/include to the CPPFLAGS. Is this the
> usual way to do such a thing?
>
> Or is there a better way?

Another way is to define a new variable "HDF5INCLUDES" and export for
substitution so it may be substituted in the Makefile.  The
substitution on the Makefile may be used to pass it to a CPPFLAGS
definition.

Bob
======================================
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is this a good way to use AC_CHECK_HEADERS

Ed Hartnett
Bob Friesenhahn <[hidden email]> writes:

> On Fri, 3 Jun 2005, Ed Hartnett wrote:
>>
>> I have to append -I${with_hdf5}/include to the CPPFLAGS. Is this the
>> usual way to do such a thing?
>>
>> Or is there a better way?
>
> Another way is to define a new variable "HDF5INCLUDES" and export for
> substitution so it may be substituted in the Makefile.  The
> substitution on the Makefile may be used to pass it to a CPPFLAGS
> definition.
>

Yes, but the AC_CHECK_HEADERS program doesn't compile with it, and
that's done by configure, not a makefile.

Ed

--
Ed Hartnett  -- [hidden email]



_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is this a good way to use AC_CHECK_HEADERS

Bob Friesenhahn
On Fri, 3 Jun 2005, Ed Hartnett wrote:
>>
>> Another way is to define a new variable "HDF5INCLUDES" and export for
>> substitution so it may be substituted in the Makefile.  The
>> substitution on the Makefile may be used to pass it to a CPPFLAGS
>> definition.
>>
>
> Yes, but the AC_CHECK_HEADERS program doesn't compile with it, and
> that's done by configure, not a makefile.

What I do for my own application is to build up CPPFLAGS, LDFLAGS,
etc., for configure's benefit, but then export much of this data
explictly for use in the Makefile depending on how the software is
actually built.  For example, when building loadable modules, only
certain modules need particular flags and libraries.  There is a
"common" part and a "difference" part.

The value of CPPFLAGS that configure saves is whatever it ends up
being at the end of the configure run (at the time config.status is
output) so you can overwrite it with whatever abbreviated version you
like.

Bob
======================================
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


_______________________________________________
Autoconf mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/autoconf
Loading...