[Gdal-dev] GDAL 1.2.0 Solaris build

Frédéric Trastour support at geoimage.fr
Thu Mar 11 06:13:33 EST 2004


Hello,

I think there is a simple solution to the caching problem of AC_CHECK_LIB.

I have tested this solution with a modified configure script and it worked for me.

Here is a proposed change to configure.in ( not tested as I can't generate configure
from configure.in, but I hope to be able to do it today ) :

__________________________________________________________________________________________

dnl ---------------------------------------------------------------------------
dnl PROJ.4 related stuff.
dnl ---------------------------------------------------------------------------

AC_MSG_CHECKING([how to link PROJ.4 library])

AC_ARG_WITH(static_proj4,[  --with-static-proj4=ARG Compile with PROJ.4 statically (ARG=no or path)],,)

if test "x$with_static_proj4" = "xno" -o "x$with_static_proj4" = "x"; then

  PROJ_STATIC=no
  AC_MSG_RESULT([link dynamically.])

else

  PROJ_STATIC=yes
  AC_MSG_RESULT([link statically.])

  ORIG_LIBS="$LIBS"
  PROJ_LIB="-lproj"

  if test "x$with_static_proj4" = "xyes" ; then
    LIBS="$PROJ_LIB $ORIG_LIBS"
    AC_CHECK_LIB(proj,pj_init,PROJ_STATIC=yes,PROJ_STATIC=no,)
  else

    LIBS="-L$with_static_proj4/src $PROJ_LIB $ORIG_LIBS"
    AC_CHECK_LIB(proj,pj_init,PROJ_STATIC=yes,PROJ_STATIC=no,)

    if test "$PROJ_STATIC" = "no"; then

      dnl Disable previous value cached by the previous AC_CHECK_LIB test :
      dnl AC_CHECK_LIB caches the result value for a couple (function, library)
      dnl in a variable named "ac_cv_lib_<library name>_<function name>".
      dnl In order to try to locate the library in different locations, using
      dnl different values of LIBS, we have to 'unset' this variable after
      dnl each negative test.

      unset ac_cv_lib_proj_pj_init

      LIBS="-L$with_static_proj4/lib $PROJ_LIB $ORIG_LIBS"
      AC_CHECK_LIB(proj,pj_init,PROJ_STATIC=yes,PROJ_STATIC=no,)
    fi

    if test "$PROJ_STATIC" = "no"; then
      unset ac_cv_lib_proj_pj_init
      LIBS="-L$with_static_proj4/src/.libs $PROJ_LIB $ORIG_LIBS"
      AC_CHECK_LIB(proj,pj_init,PROJ_STATIC=yes,PROJ_STATIC=no,)
    fi

    if test "$PROJ_STATIC" = "no"; then
      unset ac_cv_lib_proj_pj_init
      LIBS="-L$with_static_proj4 $PROJ_LIB $ORIG_LIBS"
      AC_CHECK_LIB(proj,pj_init,PROJ_STATIC=yes,PROJ_STATIC=no,)
    fi

    if test "$PROJ_STATIC" = "no"; then
      unset ac_cv_lib_proj_pj_init
      LIBS="$PROJ_LIB $ORIG_LIBS"
      AC_CHECK_LIB(proj,pj_init,PROJ_STATIC=yes,PROJ_STATIC=no,)
    fi

  fi

  if test "$PROJ_STATIC" = "no"; then
    LIBS="$ORIG_LIBS"
  fi

  if test -r "$with_static_proj4/src/proj_api.h" ; then
    PROJ_INCLUDE="-I$with_static_proj4/src"
  elif test -r "$with_static_proj4/include/proj_api.h" ; then
    PROJ_INCLUDE="-I$with_static_proj4/include"
  elif test -r "$with_static_proj4/proj_api.h" ; then
    PROJ_INCLUDE="-I$with_static_proj4"
  fi

fi

AC_SUBST(PROJ_STATIC)
AC_SUBST(PROJ_INCLUDE)

_________________________________________________________________________________________________________

Regards,

Frédéric.

----- Original Message ----- 
From: "Andrey Kiselev" <dron at ak4719.spb.edu>
To: <gdal-dev at remotesensing.org>
Sent: Wednesday, March 10, 2004 6:32 PM
Subject: Re: [Gdal-dev] GDAL 1.2.0 Solaris build


> On Wed, Mar 10, 2004 at 01:23:43PM +0100, Fr?d?ric Trastour wrote:
> > The problem is that when the first test fails, the result is "cached"
> > - in a variable - and the others tests are not done.
> >
> > Perhaps there is a simple way to disable the caching mecanism used by
> > AC_CHECK_LIB ?
>
> There is an attempt to disable caching at the start of the configure.in
> script... seems it don't work for you. Autoconf manual contains the
> following section, where described, how to disable cahcing. Could you
> try whether the using .autom4te.cfg file in the GDAL root directory
> helps you? If so I shall add that file to the repository.
>
> Customizing `autom4te'
> ----------------------
>
> One can customize `autom4te' via `~/.autom4te.cfg' (i.e., as found in
> the user home directory), and `./.autom4te.cfg' (i.e., as found in the
> directory from which `autom4te' is run).  The order is first reading
> `autom4te.cfg', then `~/.autom4te.cfg', then `./.autom4te.cfg', and
> finally the command line arguments.
>
>    In these text files, comments are introduced with `#', and empty
> lines are ignored.  Customization is performed on a per-language basis,
> wrapped in between a `begin-language: "LANGUAGE"', `end-language:
> "LANGUAGE"' pair.
>
>    Customizing a language stands for appending options (*note autom4te
> Invocation::) to the current definition of the language.  Options, and
> more generally arguments, are introduced by `args: ARGUMENTS'.  You may
> use the traditional shell syntax to quote the ARGUMENTS.
>
>    As an example, to disable Autoconf caches (`autom4te.cache')
> globally, include the following lines in `~/.autom4te.cfg':
>
>
> ## ------------------ ##
> ## User Preferences.  ##
> ## ------------------ ##
>
> begin-language: "Autoconf"
> args: --no-cache
> end-language: "Autoconf"
>
> -- 
> Andrey V. Kiselev
> Home phone:  +7 812 5274898  ICQ# 26871517
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at remotesensing.org
> http://remotesensing.org/mailman/listinfo/gdal-dev





More information about the Gdal-dev mailing list