[Gdal-dev] Solaris build with static proj4.

Frédéric Trastour support at geoimage.fr
Wed Oct 6 10:04:03 EDT 2004


Hello,

version 1.2.3 has the same configure problem than the previous ones ( since 1.2.0 ) regarding the static link of
the PROJ4 Library.

Only the first possible directory is tested and the result is cached.

Here is a patch for the configure.in file.

Do you plan to integrate it for the future ?

Regards.
__________________________________________________________________________________________

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)

_________________________________________________________________________________________________________


_________________________________________________________________
Frédéric Trastour - SpacEyes - dev at spaceyes.fr





More information about the Gdal-dev mailing list