On 19 October 2011 08:44, canduc17 <[email protected]> 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

Attachment: ax_lib_gdal.m4
Description: application/m4

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to