]> www.wagner.pp.ru Git - oss/fgis.git/blob - configure.ac
Added logic to find GDAL installation.
[oss/fgis.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(fGIS, 0.0.2, dron@remotesensing.org)
3 AM_INIT_AUTOMAKE
4 AM_CONFIG_HEADER(include/config.h)
5
6 dnl Checks for programs.
7 AC_LIBTOOL_DLOPEN
8 AC_PROG_LIBTOOL
9 AC_PROG_YACC
10 AC_PROG_CC
11 AC_PROG_MAKE_SET
12
13 # Checks for libraries.
14 # FIXME: Replace `main' with a function in `-lX11':
15 # AC_CHECK_LIB([X11], [main])
16 # FIXME: Replace `main' with a function in `-ldl':
17 # AC_CHECK_LIB([dl], [main])
18 # FIXME: Replace `main' with a function in `-lefence':
19 # AC_CHECK_LIB([efence], [main])
20 # FIXME: Replace `main' with a function in `-lm':
21 # AC_CHECK_LIB([m], [main])
22 # FIXME: Replace `main' with a function in `-lproj':
23 # AC_CHECK_LIB([proj], [main])
24
25 # Checks for header files.
26 AC_PATH_X
27 AC_FUNC_ALLOCA
28 AC_HEADER_STDC
29 AC_CHECK_HEADERS([limits.h malloc.h stddef.h stdlib.h string.h strings.h unistd.h])
30
31 # Checks for typedefs, structures, and compiler characteristics.
32 AC_C_CONST
33 AC_TYPE_SIZE_T
34 AC_STRUCT_TM
35
36 # Checks for library functions.
37 AC_FUNC_ERROR_AT_LINE
38 AC_FUNC_MALLOC
39 AC_FUNC_MMAP
40 AC_TYPE_SIGNAL
41 AC_FUNC_STAT
42 AC_FUNC_STRTOD
43 AC_FUNC_VPRINTF
44 AC_CHECK_FUNCS([bzero floor ftruncate memmove memset munmap re_comp regcomp sqrt strchr strdup strrchr strtol])
45
46 dnl ---------------------------------------------------------------------------
47 dnl Handle global configuration file placement
48 dnl ---------------------------------------------------------------------------
49
50 dnl FIXME: won't works
51 dnl AC_DEFINE_DIR(FGIS_CONFDIR, "$sysconfdir", [Define this to the location of the global config file])
52 AC_SUBST_DIR(FGIS_CONFDIR,"$sysconfdir")
53 AC_DEFINE_UNQUOTED(FGIS_CONFDIR,"$FGIS_CONFDIR",[Define this to the location of the global config file])
54 AC_SUBST(FGIS_CONFDIR,$FGIS_CONFDIR)
55
56 dnl ---------------------------------------------------------------------------
57 dnl Handle placement of the engine module (fgis.so)
58 dnl ---------------------------------------------------------------------------
59
60 AC_SUBST_DIR(FGIS_LIBDIR,"$libdir")
61 AC_SUBST(FGIS_LIBDIR,$FGIS_LIBDIR)
62
63 dnl ---------------------------------------------------------------------------
64 dnl Handle placement of the fGIS Tcl/Tk modules
65 dnl ---------------------------------------------------------------------------
66
67 AC_SUBST_DIR(FGIS_SCRIPTDIR,"$libdir/fgis/tcl")
68 AC_SUBST(FGIS_SCRIPTDIR,$FGIS_SCRIPTDIR)
69
70 dnl ---------------------------------------------------------------------------
71 dnl Define path for EPPL7 library sources. Temporary hack, the whole this
72 dnl library will be removed soon
73 dnl ---------------------------------------------------------------------------
74
75 AC_SUBST(LIBEPP,../lib/libepp.la)
76
77 dnl ---------------------------------------------------------------------------
78 dnl Check for Tcl/Tk installation
79 dnl ---------------------------------------------------------------------------
80
81 CY_AC_PATH_TCLH
82
83 tcl_missing_msg="
84         ERROR: Can't find Tcl headers or library. See README for information
85         on how to obtain Tcl. If Tcl is installed, see INSTALL on how to tell
86         configure where Tcl is installed.
87 "
88
89 if test x"$no_tcl" = x"true" ; then
90         AC_MSG_ERROR([$tcl_missing_msg])
91 fi
92 CY_AC_PATH_TCLCONFIG
93 CY_AC_LOAD_TCLCONFIG
94 AC_SUBST(TCL_INC_DIR,$TCL_INC_DIR)
95 AC_SUBST(TCL_PACKAGE_PATH,$TCL_PACKAGE_PATH)
96
97 CY_AC_PATH_TKH
98 CY_AC_PATH_TKCONFIG
99 CY_AC_LOAD_TKCONFIG
100 AC_SUBST(TK_INC_DIR,$TK_INC_DIR)
101 if [[[ $TK_VERSION < "8.4" ]]]; then
102     AC_DEFINE([TK_84PREV], , [Define this variable if your Tk version less then 8.4])
103 fi
104
105 dnl ---------------------------------------------------------------------------
106 dnl Find the required GDAL libraries, and include files.
107 dnl ---------------------------------------------------------------------------
108
109 AC_ARG_WITH(gdal,[  --with-gdal[[=DIR]]       path to GDAL build tree],,)
110
111 if test "$with_gdal" != "" ; then
112   GDAL_HOME=$with_gdal
113   echo Using requested GDAL_HOME of $GDAL_HOME
114 elif test "$GDAL_HOME" != "" ; then
115   echo Using predefined GDAL_HOME=$GDAL_HOME
116 elif test -d ../gdal ; then
117   GDAL_HOME=`pwd`/../gdal
118   echo Found local GDAL_HOME=$GDAL_HOME
119 else 
120   AC_CHECK_LIB(gdal.1.1,GDALOpen,gdal_found=1,gdal_found=0)
121  
122 gdal_missing_msg="
123 fGIS requires GDAL 1.1, but libgdal.1.1.so was not found. Please download 
124 and install it. See http://www.remotesensing.org/gdal/
125 "
126
127   if test "$gdal_found" != "1" ; then
128     AC_MSG_ERROR([$gdal_missing_msg])
129   fi
130
131 gdal_h_missing_msg="
132 fGIS requires GDAL 1.1, but gdal.h was not found. Please ensure GDAL,
133 and the development include files are installed, or that you run configure
134 with --with-gdal=path_to_gdal_build_tree.  
135 See http://www.remotesensing.org/gdal/
136 "
137
138   AC_CHECK_HEADERS(gdal.h)
139   if test "$ac_cv_header_gdal_h" != "yes" ; then
140     AC_MSG_ERROR([$gdal_h_missing_msg])
141   fi
142   GDAL_LIB="-lgdal.1.1"
143   LIBS="$GDAL_LIB $LIBS"
144   GDAL_INC=""
145   AC_SUBST(GDAL_INC,$GDAL_INC)
146 fi
147
148 if test "$GDAL_HOME" != "" ; then
149   GDAL_LIB="-L$GDAL_HOME -lgdal.1.1" 
150   LIBS="$GDAL_LIB $LIBS"
151
152   GDAL_INC="-I$GDAL_HOME/port -I$GDAL_HOME/core -I$GDAL_HOME/ogr"
153
154   if test ! -d $GDAL_HOME/core ; then
155     
156     AC_MSG_ERROR([Unable to find $GDAL_HOME/core directory, are you sure a 
157 regular GDAL build tree can be found at $GDAL_HOME?])
158   fi
159
160   if test ! -f $GDAL_HOME/libgdal.1.1.so ; then
161     
162     AC_MSG_ERROR([Unable to find $GDAL_HOME/libgdal.1.1.so, are you sure a 
163 regular GDAL build tree can be found at $GDAL_HOME?])
164   fi
165
166   AC_SUBST(GDAL_INC,$GDAL_INC)
167 fi
168
169 AC_CONFIG_FILES([Makefile
170                  etc/Makefile
171                  etc/fgis.rc
172                  dll/Makefile
173                  epu/Makefile
174                  include/Makefile
175                  lib/Makefile
176                  tcl/Makefile
177                  tcl/pkgIndex.tcl])
178 AC_OUTPUT
179