[gdal-dev] Autoconf macro for gdal-config

Mateusz Łoskot mateusz at loskot.net
Wed Oct 19 18:03:34 EDT 2011


On 19 October 2011 08:44, canduc17 <candini at meeo.it> wrote:
> Compiling my gdal programs with the autotools, I would like to use
> gdal-config in my configure.ac file, in order to manage gdal path on
> different systems.
>
> The same things is made for example with the PKG_CHECK_MODULES macro for
> libraries which support pkg-config.
>
> Is there a pre built macro to do the same thing?
> Or should I write a new macro? Examples and hints on that would be really
> appreciated...

I have planned to write GDAL autoconf macro for long time, but had no motivation
since I moved to CMake :-) Anyway, thanks for reminder.
I added new ax_lib_gdal.m4 macro to my collection at
https://github.com/mloskot/autotools-modules/

(also attached to this message)

If you look at the header of this file, you can see what variables it defines.

Basic usage:

AX_LIB_GDAL([1.8.0])
GDAL_FOUND="no"
if test ! -z "$GDAL_CFLAGS" -a ! -z "$GDAL_LDFLAGS"; then
    GDAL_FOUND="yes"
fi

For debugging, you can print all variables it defines using:
    AC_MSG_WARN([$GDAL_VERSION])
    AC_MSG_WARN([$GDAL_CFLAGS])
    AC_MSG_WARN([$GDAL_LDFLAGS])
    AC_MSG_WARN([$GDAL_DEP_LDFLAGS])
    AC_MSG_WARN([$GDAL_OGR_ENABLED])


This is new macro which has not been used anywhere but during basic tests,
so expect bugs. If you notice any, don't hesitate to let me know.

I submit all the macros from my archive at GitHub to the official
Autoconf Macros Indes:
https://www.gnu.org/software/autoconf-archive/

So, once the ax_lib_gdal.m4 is well tested, I will submit it there too.

Best regards
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ax_lib_gdal.m4
Type: application/x-m4
Size: 4201 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111019/b43d0d75/ax_lib_gdal.bin


More information about the gdal-dev mailing list