]> www.wagner.pp.ru Git - oss/fgis.git/blobdiff - configure.ac
Added logic to find GDAL installation.
[oss/fgis.git] / configure.ac
index 118885ee67ed0fd65d5ae82d8949c605ac11f006..35c245ad68e95dc4dcb495a9efcb13b0147ff883 100644 (file)
@@ -1,8 +1,6 @@
 # Process this file with autoconf to produce a configure script.
-AC_INIT(fGIS, 0.0.1, dron@remotesensing.org)
-# AC_CONFIG_HEADERS([config.h])
+AC_INIT(fGIS, 0.0.2, dron@remotesensing.org)
 AM_INIT_AUTOMAKE
-# AC_CONFIG_SRCDIR([include/regex.h])
 AM_CONFIG_HEADER(include/config.h)
 
 dnl Checks for programs.
@@ -49,25 +47,47 @@ dnl ---------------------------------------------------------------------------
 dnl Handle global configuration file placement
 dnl ---------------------------------------------------------------------------
 
-AC_DEFINE_DIR(FGIS_CONFIG, "$sysconfdir", [Define this to the location of the global config file])
+dnl FIXME: won't works
+dnl AC_DEFINE_DIR(FGIS_CONFDIR, "$sysconfdir", [Define this to the location of the global config file])
+AC_SUBST_DIR(FGIS_CONFDIR,"$sysconfdir")
+AC_DEFINE_UNQUOTED(FGIS_CONFDIR,"$FGIS_CONFDIR",[Define this to the location of the global config file])
+AC_SUBST(FGIS_CONFDIR,$FGIS_CONFDIR)
 
 dnl ---------------------------------------------------------------------------
 dnl Handle placement of the engine module (fgis.so)
 dnl ---------------------------------------------------------------------------
 
 AC_SUBST_DIR(FGIS_LIBDIR,"$libdir")
+AC_SUBST(FGIS_LIBDIR,$FGIS_LIBDIR)
+
+dnl ---------------------------------------------------------------------------
+dnl Handle placement of the fGIS Tcl/Tk modules
+dnl ---------------------------------------------------------------------------
+
+AC_SUBST_DIR(FGIS_SCRIPTDIR,"$libdir/fgis/tcl")
+AC_SUBST(FGIS_SCRIPTDIR,$FGIS_SCRIPTDIR)
+
+dnl ---------------------------------------------------------------------------
+dnl Define path for EPPL7 library sources. Temporary hack, the whole this
+dnl library will be removed soon
+dnl ---------------------------------------------------------------------------
+
+AC_SUBST(LIBEPP,../lib/libepp.la)
 
 dnl ---------------------------------------------------------------------------
 dnl Check for Tcl/Tk installation
 dnl ---------------------------------------------------------------------------
 
 CY_AC_PATH_TCLH
+
+tcl_missing_msg="
+        ERROR: Can't find Tcl headers or library. See README for information
+        on how to obtain Tcl. If Tcl is installed, see INSTALL on how to tell
+        configure where Tcl is installed.
+"
+
 if test x"$no_tcl" = x"true" ; then
-    echo "     ERROR: Can't find Tcl headers or library."
-    echo "     See README for information on how to obtain Tcl."
-    echo "     If Tcl is installed, see INSTALL on how to tell"
-    echo "     configure where Tcl is installed."
-    exit 1
+       AC_MSG_ERROR([$tcl_missing_msg])
 fi
 CY_AC_PATH_TCLCONFIG
 CY_AC_LOAD_TCLCONFIG
@@ -78,11 +98,77 @@ CY_AC_PATH_TKH
 CY_AC_PATH_TKCONFIG
 CY_AC_LOAD_TKCONFIG
 AC_SUBST(TK_INC_DIR,$TK_INC_DIR)
-if [[ $TK_VERSION < "8.4" ]]; then
-    AC_DEFINE([TK_84PREV], [0], [Define this variable if your Tk version less then 8.4])
+if [[[ $TK_VERSION < "8.4" ]]]; then
+    AC_DEFINE([TK_84PREV], , [Define this variable if your Tk version less then 8.4])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Find the required GDAL libraries, and include files.
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_WITH(gdal,[  --with-gdal[[=DIR]]       path to GDAL build tree],,)
+
+if test "$with_gdal" != "" ; then
+  GDAL_HOME=$with_gdal
+  echo Using requested GDAL_HOME of $GDAL_HOME
+elif test "$GDAL_HOME" != "" ; then
+  echo Using predefined GDAL_HOME=$GDAL_HOME
+elif test -d ../gdal ; then
+  GDAL_HOME=`pwd`/../gdal
+  echo Found local GDAL_HOME=$GDAL_HOME
+else 
+  AC_CHECK_LIB(gdal.1.1,GDALOpen,gdal_found=1,gdal_found=0)
+gdal_missing_msg="
+fGIS requires GDAL 1.1, but libgdal.1.1.so was not found. Please download 
+and install it. See http://www.remotesensing.org/gdal/
+"
+
+  if test "$gdal_found" != "1" ; then
+    AC_MSG_ERROR([$gdal_missing_msg])
+  fi
+
+gdal_h_missing_msg="
+fGIS requires GDAL 1.1, but gdal.h was not found. Please ensure GDAL,
+and the development include files are installed, or that you run configure
+with --with-gdal=path_to_gdal_build_tree.  
+See http://www.remotesensing.org/gdal/
+"
+
+  AC_CHECK_HEADERS(gdal.h)
+  if test "$ac_cv_header_gdal_h" != "yes" ; then
+    AC_MSG_ERROR([$gdal_h_missing_msg])
+  fi
+  GDAL_LIB="-lgdal.1.1"
+  LIBS="$GDAL_LIB $LIBS"
+  GDAL_INC=""
+  AC_SUBST(GDAL_INC,$GDAL_INC)
+fi
+
+if test "$GDAL_HOME" != "" ; then
+  GDAL_LIB="-L$GDAL_HOME -lgdal.1.1" 
+  LIBS="$GDAL_LIB $LIBS"
+
+  GDAL_INC="-I$GDAL_HOME/port -I$GDAL_HOME/core -I$GDAL_HOME/ogr"
+
+  if test ! -d $GDAL_HOME/core ; then
+    
+    AC_MSG_ERROR([Unable to find $GDAL_HOME/core directory, are you sure a 
+regular GDAL build tree can be found at $GDAL_HOME?])
+  fi
+
+  if test ! -f $GDAL_HOME/libgdal.1.1.so ; then
+    
+    AC_MSG_ERROR([Unable to find $GDAL_HOME/libgdal.1.1.so, are you sure a 
+regular GDAL build tree can be found at $GDAL_HOME?])
+  fi
+
+  AC_SUBST(GDAL_INC,$GDAL_INC)
 fi
 
 AC_CONFIG_FILES([Makefile
+                 etc/Makefile
+                 etc/fgis.rc
                  dll/Makefile
                  epu/Makefile
                  include/Makefile
@@ -90,3 +176,4 @@ AC_CONFIG_FILES([Makefile
                  tcl/Makefile
                 tcl/pkgIndex.tcl])
 AC_OUTPUT
+