[GRASS5] Re: [GRASS-CVS] glynn: grass51 configure,1.73,1.74 configure.in,1.63,1.64

Huidae Cho grass4u at gmail.com
Fri Dec 10 06:02:34 EST 2004


Hi list,

I found that AC_CHECK_FUNC(gdal) doesn't work in cygwin.

gcc -o conftest -g -O2    -Wl,--export-dynamic \
	-L/usr/local/lib -L/usr/X11R6/lib -L/usr/local/lib -lgdal conftest.c

doesn't compile, but the following is fine when I changed AC_CHECK_FUNC to
AC_CHECK_LIB:

gcc -o conftest -g -O2    -Wl,--export-dynamic \
	-L/usr/local/lib -L/usr/X11R6/lib conftest.c -L/usr/local/lib -lgdal

If there is no reason to keep AC_CHECK_FUNC, I think AC_CHECK_LIB would be
better.
---<diff>---
-ac_save_ldflags="$LDFLAGS"
-LDFLAGS="$LDFLAGS $GDAL_LIBS"
-AC_CHECK_FUNC(GDALOpen,[],[
-LDFLAGS="$LDFLAGS $GDAL_DEP_LIBS"
-AC_CHECK_FUNC(GDALOpen,[GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS"],[
+AC_CHECK_LIB(gdal,GDALOpen,,[
+AC_CHECK_LIB(gdal,GDALOpen,GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS",[
     AC_MSG_ERROR([*** Unable to locate GDAL library.])
 ])
 ])
-LDFLAGS=${ac_save_ldflags}
------------

This is another issue. My autoconf doesn't include the following code snippet
in configure. Do we need this? If so, for what?
---<cut>----
-for ac_declaration in \
-   ''\
-   '#include <stdlib.h>' \
-   'extern "C" void std::exit (int) throw (); using std::exit;' \
-   'extern "C" void std::exit (int); using std::exit;' \
-   'extern "C" void exit (int) throw ();' \
-   'extern "C" void exit (int);' \
-   'void exit (int);'
-do
-  cat > conftest.$ac_ext <<EOF
-#line 12132 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-$ac_declaration
-int main() {
-exit (42);
-; return 0; }
-EOF
-if { (eval echo configure:12140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  :
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  continue
-fi
-rm -f conftest*
-  cat > conftest.$ac_ext <<EOF
-#line 12150 "configure"
-#include "confdefs.h"
-$ac_declaration
-int main() {
-exit (42);
-; return 0; }
-EOF
-if { (eval echo configure:12157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  break
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-done
-if test -n "$ac_declaration"; then
-  echo '#ifdef __cplusplus' >>confdefs.h
-  echo $ac_declaration      >>confdefs.h
-  echo '#endif'             >>confdefs.h
-fi
-
-
------------

Thank you.
Huidae Cho


On Fri, Nov 26, 2004 at 10:52:29PM +0100, grass at intevation.de wrote:
> Author: glynn
> 
> Update of /grassrepository/grass51
> In directory doto:/tmp/cvs-serv26674
> 
> Modified Files:
> 	configure configure.in 
> Log Message:
> Check whether GDAL needs --dep-libs
> 
> 
> Index: configure
> ===================================================================
> RCS file: /grassrepository/grass51/configure,v
> retrieving revision 1.73
> retrieving revision 1.74
> diff -u -d -r1.73 -r1.74
> --- configure	25 Nov 2004 10:21:43 -0000	1.73
> +++ configure	26 Nov 2004 21:52:27 -0000	1.74
> @@ -7145,6 +7145,7 @@
>  
>  if test "$GDAL_CONFIG" != "" ; then
>    GDAL_LIBS=`"$GDAL_CONFIG" --libs`
> +  GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
>    GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags`
>    USE_GDAL=1
>    if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then
> @@ -7156,6 +7157,106 @@
>    fi
>  fi
>  
> [...2500 lines suppressed...]
> -#line 12164 "configure"
> +#line 12214 "configure"
>  #include "confdefs.h"
>  #include <$ac_hdr>
>  EOF
>  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
> -{ (eval echo configure:12169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
> +{ (eval echo configure:12219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
>  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
>  if test -z "$ac_err"; then
>    rm -rf conftest*
> @@ -12199,7 +12249,7 @@
>  
>  
>  echo $ac_n "checking for location of openDWG library""... $ac_c" 1>&6
> -echo "configure:12203: checking for location of openDWG library" >&5
> +echo "configure:12253: checking for location of openDWG library" >&5
>  case "$with_opendwg_libs" in
>  y | ye | yes | n | no)
>  	{ echo "configure: error: *** You must supply a directory to --with-opendwg-libs." 1>&2; exit 1; }
> 
> Index: configure.in
> ===================================================================
> RCS file: /grassrepository/grass51/configure.in,v
> retrieving revision 1.63
> retrieving revision 1.64
> diff -u -d -r1.63 -r1.64
> --- configure.in	25 Nov 2004 10:21:43 -0000	1.63
> +++ configure.in	26 Nov 2004 21:52:27 -0000	1.64
> @@ -614,6 +614,7 @@
>  
>  if test "$GDAL_CONFIG" != "" ; then
>    GDAL_LIBS=`"$GDAL_CONFIG" --libs`
> +  GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
>    GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags`
>    USE_GDAL=1
>    if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then
> @@ -621,6 +622,16 @@
>      USE_OGR=1
>    fi
>  fi
> +
> +ac_save_ldflags="$LDFLAGS"
> +LDFLAGS="$LDFLAGS $GDAL_LIBS"
> +AC_CHECK_FUNC(GDALOpen,[],[
> +LDFLAGS="$LDFLAGS $GDAL_DEP_LIBS"
> +AC_CHECK_FUNC(GDALOpen,[GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS"],[
> +    AC_MSG_ERROR([*** Unable to locate GDAL library.])
> +])
> +])
> +LDFLAGS=${ac_save_ldflags}
>  
>  AC_SUBST(GDAL_LIBS)
>  AC_SUBST(GDAL_CFLAGS)
> 
> 
> _______________________________________________
> grass-commit mailing list
> grass-commit at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-commit




More information about the grass-dev mailing list