source: branches/prototype-v0/zoo-project/zoo-kernel/configure.ac @ 867

Last change on this file since 867 was 867, checked in by djay, 6 years ago

Fix issue #163 and add support for extra cookie through definition of ecookie array map and the corresponding ecookie_lenght. This give the capability to return more than only a single Cookie.

File size: 36.4 KB
Line 
1AC_INIT([ZOO Kernel], [1.7.0], [bugs@zoo-project.org])
2
3AC_CONFIG_MACRO_DIR([macros])
4
5# Checks for programs.
6AC_PROG_YACC
7AC_PROG_CC
8AC_PROG_LEX
9AC_PROG_CXX
10AC_PROG_SED
11
12# Checks for libraries.
13AC_CHECK_LIB([curl], [curl_easy_init,curl_easy_setopt,curl_easy_cleanup,curl_easy_perform])
14AC_CHECK_LIB([dl], [dlopen,dlsym,dlerror,dlclose])
15AC_CHECK_LIB([crypto], [EVP_DigestInit,EVP_md5,EVP_DigestUpdate,BIO_f_base64,BIO_new])
16
17DEFAULT_LIBS="$LIBS"
18AC_SUBST([DEFAULT_LIBS])
19
20
21# Checks for header files.
22AC_FUNC_ALLOCA
23AC_CHECK_HEADERS([fcntl.h inttypes.h malloc.h stddef.h stdlib.h string.h unistd.h])
24
25# Checks for typedefs, structures, and compiler characteristics.
26AC_HEADER_STDBOOL
27AC_TYPE_INT16_T
28AC_TYPE_INT32_T
29AC_TYPE_INT8_T
30AC_TYPE_PID_T
31AC_TYPE_SIZE_T
32AC_TYPE_UINT16_T
33AC_TYPE_UINT32_T
34AC_TYPE_UINT8_T
35
36# Checks for library functions.
37AC_FUNC_FORK
38AC_FUNC_MALLOC
39AC_FUNC_REALLOC
40AC_CHECK_FUNCS([dup2 getcwd memset setenv strdup strstr])
41
42#============================================================================
43# Detect if uuid is available
44#============================================================================
45
46AC_ARG_WITH([uuid],
47    [AS_HELP_STRING([--with-uuid=PATH], [Specifies an alternative location for the ossp-uuid library])],
48    [UUID_DIR="$withval"], [UUID_DIR="/usr/"])
49UUID_CFLAGS="-I$UUID_DIR/include"
50UUID_LDFLAGS="-L$UUID_DIR/lib -luuid"
51CPPFLAGS_SAVE="$CPPFLAGS"
52CPPFLAGS="$UUID_CFLAGS"
53LIBS_SAVE="$LIBS"
54LIBS="$UUID_LDFLAGS"
55AC_CHECK_HEADERS([uuid/uuid.h],
56                        [], [AC_MSG_ERROR([could not find header file uuid.h])])
57AC_CHECK_LIB([uuid], [uuid_generate_time],
58                        [], [AC_MSG_ERROR([could not find function in uuid library])])
59CPPFLAGS="$CPPFLAGS_SAVE"
60AC_SUBST([UUID_CFLAGS])
61AC_SUBST([UUID_LDFLAGS])
62
63#============================================================================
64# Detect if json-c is available
65#============================================================================
66
67AC_ARG_WITH([json],
68    [AS_HELP_STRING([--with-json=PATH], [Specifies an alternative location for the json-c library])],
69    [JSON_DIR="$withval"], [JSON_DIR="/usr/"])
70JSON_CPPFLAGS="-I$JSON_DIR/include/json-c/"
71JSON_LDFLAGS="-L$JSON_DIR/lib -ljson-c"
72CPPFLAGS_SAVE="$CPPFLAGS"
73CPPFLAGS="$JSON_CPPFLAGS"
74LIBS_SAVE="$LIBS"
75LIBS="$JSON_LDFLAGS"
76echo $CPPFLAGS
77AC_CHECK_HEADERS([json_object.h],
78                        [], [AC_MSG_ERROR([could not find header file json_object.h])])
79AC_CHECK_LIB([json-c], [json_object_new_object],
80                        [], [AC_MSG_ERROR([could not find function in json-c library])])
81CPPFLAGS="$CPPFLAGS_SAVE"
82JSON_FILE="service_json.o"
83JSON_ENABLED="-DJSON"
84AC_SUBST([JSON_CPPFLAGS])
85AC_SUBST([JSON_LDFLAGS])
86AC_SUBST([JSON_FILE])
87AC_SUBST([JSON_ENABLED])
88
89#============================================================================
90# Detect if openssl is available
91#============================================================================
92
93AC_ARG_WITH([openssl],
94    [AS_HELP_STRING([--with-openssl=PATH], [Specifies an alternative location for the openssl library])],
95    [OPENSSL_DIR="$withval"], [OPENSSL_DIR="/usr/"])
96OPENSSL_CFLAGS="-I$OPENSSL_DIR/include"
97OPENSSL_LDFLAGS="-lcrypto -L$OPENSSL_DIR/lib -lssl"
98CPPFLAGS_SAVE="$CPPFLAGS"
99CPPFLAGS="$OPENSSL_CFLAGS"
100LIBS_SAVE="$LIBS"
101LIBS="$OPENSSL_LDFLAGS"
102AC_CHECK_HEADERS([openssl/md5.h openssl/hmac.h openssl/evp.h openssl/bio.h openssl/buffer.h],
103                        [], [AC_MSG_ERROR([could not find header file $i related to openssl])])
104AC_CHECK_LIB(crypto, BIO_f_base64,
105                        [], [AC_MSG_ERROR([could not find $i function in openssl library])])
106CPPFLAGS="$CPPFLAGS_SAVE"
107AC_SUBST([OPENSSL_CFLAGS])
108AC_SUBST([OPENSSL_LDFLAGS])
109
110#============================================================================
111# Detect if gettext is available
112#============================================================================
113
114#AC_ARG_WITH([gettext],
115#    [AS_HELP_STRING([--with-gettext=PATH], [Specifies an alternative location for the openssl library])],
116#    [GETTEXT_DIR="$withval"], [GETTEXT_DIR="/usr/"])
117#GETTEXT_CFLAGS="-I$GETTEXT_DIR/include"
118#GETTEXT_LDFLAGS="-L$GETTEXT_DIR/lib -lintl"
119#CFLAGS_SAVE="$CFLAGS"
120#CFLAGS="$GETTEXT_CFLAGS"
121#LIBS_SAVE="$LIBS"
122#LIBS="$GETTEXT_LDFLAGS"
123#AM_GNU_GETTEXT([external], [], [])
124#AC_CHECK_LIB(intl,
125#                       [dgettext], [] , [AC_MSG_ERROR([could not find $i function in gettext library])])
126AC_SUBST([GETTEXT_CFLAGS])
127AC_SUBST([GETTEXT_LDFLAGS])
128
129#============================================================================
130# Detect if run on debian / ubuntu
131#============================================================================
132if test -f "/usr/bin/dpkg"
133then
134        DEB_DEF=-DDEB
135fi
136AC_SUBST([DEB_DEF])
137
138AC_ARG_WITH([etc-dir],
139    [AS_HELP_STRING([--with-etc-dir=PATH], [Specifies an alternative path to store the main.cfg file ( default: ZOO-Kernel location) ])],
140    [ETC_DEF="#define ETC_DIR \\\"${sysconfdir}\\\""], [ETC_DEF=""])
141AC_SUBST([ETC_DEF])
142
143AC_ARG_WITH([cgi-dir],
144    [AS_HELP_STRING([--with-cgi-dir=PATH], [Specifies an alternative cgi directory path ( default: /usr/lib/cgi-bin) ])],
145    [CGI_DIR="$withval"], [CGI_DIR="/usr/lib/cgi-bin"])
146AC_SUBST([CGI_DIR])
147
148AC_ARG_WITH([db-backend],
149    [AS_HELP_STRING([--with-db-backend], [Relies on a database for storing status messages and response files ])],
150    [RELY_ON_DB="-DRELY_ON_DB"], [RELY_ON_DB=""])
151AC_SUBST([RELY_ON_DB])
152
153
154# ===========================================================================
155# Detect if libyaml is available
156# ===========================================================================
157
158AC_ARG_WITH([yaml],
159        [AS_HELP_STRING([--with-yaml=PATH], [Specifies an alternative location for the yaml library])],
160        [YAMLPATH="$withval"], [YAMLPATH=""])
161
162if test -z "$YAMLPATH"
163then
164        YAML_LDFLAGS=""
165        YAML_CPPFLAGS=""
166        YAML_FILE=""
167        YAML_FILE1=""
168else
169
170        # Extract the linker and include flags
171        YAML_LDFLAGS="-L$YAMLPATH/lib -lyaml"
172        YAML_CPPFLAGS="-I$YAMLPATH/include -DYAML"
173        YAML_FILE="service_yaml.o"
174        YAML_FILE1="zcfg2yaml"
175       
176        # Check headers file
177        CPPFLAGS_SAVE="$CPPFLAGS"
178        CPPFLAGS="$YAML_CPPFLAGS"
179        LIBS_SAVE="$LIBS"
180        LIBS="$YAML_LDFLAGS"
181        AC_CHECK_LIB([yaml], [yaml_parser_initialize,yaml_parser_set_input_file,yaml_parser_scan])
182        AC_CHECK_HEADERS([yaml.h],
183                 [], [AC_MSG_ERROR([could not find headers include related to YAML])])
184        LIBS="$LIBS_SAVE"
185fi
186AC_SUBST([YAML_CPPFLAGS])
187AC_SUBST([YAML_LDFLAGS])
188AC_SUBST([YAML_FILE])
189AC_SUBST([YAML_FILE1])
190
191# ===========================================================================
192# Detect if fastcgi is available
193# ===========================================================================
194
195AC_ARG_WITH([fastcgi],
196        [AS_HELP_STRING([--with-fastcgi=PATH], [Specifies an alternative location for the fastcgi library])],
197        [FCGIPATH="$withval"], [FCGIPATH="/usr"])
198
199# Extract the linker and include flags
200FCGI_LDFLAGS="-L$FCGIPATH/lib -lfcgi"
201FCGI_CPPFLAGS="-I$FCGIPATH/include"
202
203# Check headers file
204CPPFLAGS_SAVE="$CPPFLAGS"
205CPPFLAGS="$FCGI_CPPFLAGS"
206LIBS_SAVE="$LIBS"
207LIBS="$FCGI_LDFLAGS"
208AC_CHECK_LIB([fcgi], [main])
209AC_CHECK_HEADERS([fcgi_stdio.h],
210                 [], [AC_MSG_ERROR([could not find headers include related to fastcgi])])
211LIBS="$LIBS_SAVE"
212AC_SUBST([FCGI_CPPFLAGS])
213AC_SUBST([FCGI_LDFLAGS])
214
215AC_ARG_WITH([metadb],
216        [AS_HELP_STRING([--with-metadb=yes], [Activates the metadata database support])],
217        [WITHMETADB="$withval"], [WITHMETADB=""])
218
219if test "x$WITHMETADB" = "xyes"; then
220        METADB="-DMETA_DB"
221        METADB_FILE="meta_sql.o sqlapi.o"
222else
223        METADB=""
224        METADB_FILE=""
225fi
226
227AC_SUBST([METADB])
228AC_SUBST([METADB_FILE])
229
230AC_ARG_WITH([hpc],
231        [AS_HELP_STRING([--with-hpc=yes], [Specifies if you need to activate HPC support])],
232        [HPCWITH="$withval"], [HPCWITH="no"])
233
234if test "x$HPCWITH" = "xyes"; then
235        HPC_FILES="service_internal_hpc.o sshapi.o"
236        HPC_ENABLED="-DUSE_HPC"
237        HPC_CPPFLAGS=""
238        HPC_LDFLAGS=""
239fi
240
241AC_SUBST([HPC_CPPFLAGS])
242AC_SUBST([HPC_LDFLAGS])
243AC_SUBST([HPC_ENABLED])
244AC_SUBST([HPC_FILES])
245
246AC_ARG_WITH([ssh2],
247        [AS_HELP_STRING([--with-ssh2=PATH], [Specifies an alternative location for the ssh2 library])],
248        [SSH2PATH="$withval"], [SSH2PATH="/usr"])
249
250# Extract the linker and include flags
251SSH2_LDFLAGS="-L$SSH2PATH/lib -lssh2"
252SSH2_CPPFLAGS="-I$SSH2PATH/include"
253# Check headers file
254CPPFLAGS_SAVE="$CPPFLAGS"
255CPPFLAGS="$SSH2_CPPFLAGS"
256LIBS_SAVE="$LIBS"
257LIBS="$SSH2_LDFLAGS"
258echo $CPPFLAGS
259echo $LIBS
260
261AC_CHECK_HEADERS([libssh2.h],
262                 [], [AC_MSG_ERROR([could not find headers related to libssh2])])
263AC_CHECK_LIB([ssh2], [libssh2_session_init])
264
265LIBS="$LIBS_SAVE"
266AC_SUBST([SSH2_CPPFLAGS])
267AC_SUBST([SSH2_LDFLAGS])
268
269# ===========================================================================
270# Detect if libxml2 is installed
271# ===========================================================================
272
273AC_ARG_WITH([xml2config],
274        [AS_HELP_STRING([--with-xml2config=FILE], [Specifies an alternative xml2-config file])],
275        [XML2CONFIG="$withval"], [XML2CONFIG=""])
276
277if test "x$XML2CONFIG" = "x"; then
278        # XML2CONFIG was not specified, so search within the current path
279        AC_PATH_PROG([XML2CONFIG], [xml2-config])
280
281        # If we couldn't find xml2-config, display a warning
282        if test "x$XML2CONFIG" = "x"; then
283                AC_MSG_ERROR([could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.])
284        fi
285else
286        # XML2CONFIG was specified; display a message to the user
287        if test "x$XML2CONFIG" = "xyes"; then
288                AC_MSG_ERROR([you must Specifies a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config])
289        else
290                if test -f $XML2CONFIG; then
291                        AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG])
292                else
293                        AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist])
294                fi     
295        fi
296fi
297
298# Extract the linker and include flags
299XML2_LDFLAGS=`$XML2CONFIG --libs`
300XML2_CPPFLAGS=`$XML2CONFIG --cflags`
301
302# Check headers file
303CPPFLAGS_SAVE="$CPPFLAGS"
304CPPFLAGS="$XML2_CPPFLAGS"
305AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h],
306                 [], [AC_MSG_ERROR([could not find headers include related to libxml2])])
307
308# Ensure we can link against libxml2
309LIBS_SAVE="$LIBS"
310LIBS="$XML2_LDFLAGS"
311AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], [])
312
313AC_SUBST([XML2_CPPFLAGS])
314AC_SUBST([XML2_LDFLAGS])
315LIBS="$LIBS_SAVE"
316
317
318# ===========================================================================
319# Detect if libxslt is installed
320# ===========================================================================
321
322AC_ARG_WITH([xsltconfig],
323        [AS_HELP_STRING([--with-xsltconfig=FILE], [Specifies an alternative xslt-config file])],
324        [XSLTCONFIG="$withval"], [XSLTCONFIG=""])
325
326if test "x$XSLTCONFIG" = "x"; then
327        # XSLTCONFIG was not specified, so search within the current path
328        AC_PATH_PROG([XSLTCONFIG], [xslt-config])
329
330        # If we couldn't find xslt-config, display a warning
331        if test "x$XSLTCONFIG" = "x"; then
332                AC_MSG_ERROR([could not find xslt-config from libxslt within the current path. You may need to try re-running configure with a --with-xtltconfig parameter.])
333        fi
334else
335        # XSLTCONFIG was specified; display a message to the user
336        if test "x$XSLTCONFIG" = "xyes"; then
337                AC_MSG_ERROR([you must Specifies a parameter to --with-xsltconfig, e.g. --with-xsltconfig=/path/to/xslt-config])
338        else
339                if test -f $XSLTCONFIG; then
340                        AC_MSG_RESULT([Using user-specified xslt-config file: $XSLTCONFIG])
341                else
342                        AC_MSG_ERROR([the user-specified xslt-config file $XSLTCONFIG does not exist])
343                fi     
344        fi
345fi
346
347# Extract the linker and include flags
348XSLT_LDFLAGS=`$XSLTCONFIG --libs`
349XSLT_CPPFLAGS=`$XSLTCONFIG --cflags`
350
351# Check headers file
352CPPFLAGS_SAVE="$CPPFLAGS"
353CPPFLAGS="$XSLT_CPPFLAGS"
354AC_CHECK_HEADERS([libxslt/xslt.h libxslt/xsltInternals.h libxslt/transform.h libxslt/xsltutils.h],
355                 [], [AC_MSG_ERROR([could not find headers include related to libxlst])])
356
357AC_SUBST([XSLT_CPPFLAGS])
358AC_SUBST([XSLT_LDFLAGS])
359
360#============================================================================
361# Detect if gdal is installed
362#============================================================================
363
364AC_ARG_WITH([gdal-config],
365        [AS_HELP_STRING([--with-gdal-config=FILE], [Specifies an alternative gdal-config file])],
366        [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""])
367if test -z $GDAL_CONFIG;
368then
369        AC_PATH_PROG([GDAL_CONFIG], [gdal-config])
370        if test -z $GDAL_CONFIG;
371        then
372                AC_MSG_ERROR([could not find gdal-config from libgdal within the current path. You may need to try re-running configure with a --with-gdal-config parameter.])
373        fi
374       
375else
376        if test -f $GDAL_CONFIG; then
377                AC_MSG_RESULT([Using user-specified gdal-config file: $GDAL_CONFIG])
378        else
379                AC_MSG_ERROR([the user-specified gdal-config file $GDAL_CONFIG does not exist])
380        fi
381fi
382
383GDAL_CFLAGS="`$GDAL_CONFIG --cflags`"
384GDAL_LIBS="`$GDAL_CONFIG --libs`"
385
386AC_SUBST([GDAL_CFLAGS])
387AC_SUBST([GDAL_LIBS])
388
389# ===========================================================================
390# Detect if proj is installed
391# ===========================================================================
392
393AC_ARG_WITH([proj],
394        [AS_HELP_STRING([--with-proj=PATH], [Specifies an alternative location for PROJ4 setup])],
395        [PROJPATH="$withval"], [PROJPATH=""])
396
397# Extract the linker and include flags
398PROJ_LDFLAGS="-L$PROJPATH/lib"
399PROJ_CPPFLAGS="-I$PROJPATH/include"
400
401# Check headers file
402CPPFLAGS_SAVE="$CPPFLAGS"
403CPPFLAGS="$PROJ_CPPFLAGS"
404AC_CHECK_HEADERS([proj_api.h],
405                 [], [AC_MSG_ERROR([could not find headers include related to PROJ4])])
406
407AC_SUBST([PROJ_CPPFLAGS])
408AC_SUBST([PROJ_LDFLAGS])
409
410# ===========================================================================
411# Detect if libgeos is installed
412# ===========================================================================
413
414AC_ARG_WITH([geosconfig],
415        [AS_HELP_STRING([--with-geosconfig=FILE], [Specifies an alternative geos-config file])],
416        [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
417
418if test "x$GEOSCONFIG" = "x"; then
419        # GEOSCONFIG was not specified, so search within the current path
420        AC_PATH_PROG([GEOSCONFIG], [geos-config])
421
422        # If we couldn't find geos-config, display a warning
423        if test "x$GEOSCONFIG" = "x"; then
424                AC_MSG_WARN([could not find geos-config from libgeos within the current path. You may need to try re-running configure with a --with-geosconfig parameter.])
425        fi
426else
427        # GEOSCONFIG was specified; display a message to the user
428        if test "x$GEOSCONFIG" = "xyes"; then
429                AC_MSG_WARN([you must Specifies a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
430        else
431                if test -f $GEOSCONFIG; then
432                        AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
433                else
434                        AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
435                fi     
436        fi
437fi
438
439GEOS_LDFLAGS=`$GEOSCONFIG --libs`
440GEOS_CPPFLAGS=`$GEOSCONFIG --cflags`
441
442# Check headers file
443CPPFLAGS_SAVE="$CPPFLAGS"
444CPPFLAGS="$GEOS_CPPFLAGS"
445AC_CHECK_HEADERS([geos_c.h],
446                 [], [AC_MSG_WARN([could not find headers include related to libgeos])])
447
448AC_SUBST([GEOS_CPPFLAGS])
449AC_SUBST([GEOS_LDFLAGS])
450
451
452# ===========================================================================
453# Detect if cgal is installed
454# ===========================================================================
455
456AC_ARG_WITH([cgal],
457        [AS_HELP_STRING([--with-cgal=PATH], [Specifies an alternative location for CGAL setup])],
458        [CGALPATH="$withval"], [CGALPATH="/usr"])
459
460
461# Check headers file
462CPPFLAGS_SAVE="$CPPFLAGS"
463CGAL_CPPFLAGS="-I$CGALPATH/include"
464CPPFLAGS="$CGAL_CPPFLAGS"
465AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
466         [], [AC_MSG_WARN([could not find headers include related to libCGAL])])
467
468# Extract the linker and include flags
469CGAL_LDFLAGS="-L$CGALPATH/lib"
470CGAL_CPPFLAGS="-I$CGALPATH/include"
471
472
473AC_SUBST([CGAL_CPPFLAGS])
474AC_SUBST([CGAL_LDFLAGS])
475#============================================================================
476# Detect if mapserver is installed
477#============================================================================
478
479AC_ARG_WITH([mapserver],
480       [AS_HELP_STRING([--with-mapserver=PATH], [Specifies the path for MapServer compiled source tree])],
481       [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""])
482
483AC_ARG_WITH([ms-version],
484       [AS_HELP_STRING([--with-ms-version=VERSION], [Specifies the MapServer version to build against])],
485       [MS_VERSION="$withval"], [MS_VERSION=""])
486
487if test -z $MS_SRC_PATH;
488then
489        MS_CPPFLAGS=""
490        MS_LDFLAGS=""
491else
492       if test "x$MS_SRC_PATH" = "xmacos";
493       then
494               MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl"
495               MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver "
496               AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree])
497               AC_MSG_RESULT([Using MacOS X Framework for MapServer])
498       else
499        if test "x$MS_VERSION" = "x7";
500        then
501                MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
502                MS_CPPFLAGS="-DUSE_MS -I$MS_SRC_PATH/include/mapserver "
503                AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
504        else
505               if test -d $MS_SRC_PATH; then
506                       MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`"
507                       MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH "
508               
509                       AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
510               else
511                       AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist])
512               fi
513        fi
514       fi
515       MS_FILE="service_internal_ms.o"
516fi
517
518MS_CFLAGS="$MS_CPPFLAGS"
519MS_LIBS="$MS_LDFLAGS"
520
521AC_SUBST([MS_CFLAGS])
522AC_SUBST([MS_LIBS])
523AC_SUBST([MS_FILE])
524AC_SUBST([MS_VERSION])
525
526# ===========================================================================
527# Detect if python is installed
528# ===========================================================================
529
530AC_ARG_WITH([python],
531        [AS_HELP_STRING([--with-python=PATH], [To enable python support or Specifies an alternative directory for python installation,  disabled by default])],
532        [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
533
534AC_ARG_WITH([pyvers],
535        [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])],
536        [PYTHON_VERS="$withval"], [PYTHON_VERS=""])
537
538
539if test -z "$PYTHON_ENABLED"
540then
541        PYTHON_FILE=""
542else
543        PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
544        PYTHON_FILE="service_internal_python.o"
545        if test  "$PYTHON_PATH" = "yes"
546        then
547                # PYTHON was not specified, so search within the current path
548                PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
549                if test -z "${PYTHONCFG_PATH}" ; then
550                AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}])
551                else
552                AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config])
553                fi
554        else
555                PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
556        fi
557
558        # Extract the linker and include flags
559        PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
560        PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
561
562        # Check headers file
563        CPPFLAGS_SAVE="$CPPFLAGS"
564        CPPFLAGS="$PYTHON_CPPFLAGS"
565        AC_CHECK_HEADERS([Python.h],
566                 [], [AC_MSG_ERROR([could not find headers include related to libpython])])
567
568        # Ensure we can link against libphp
569        LIBS_SAVE="$LIBS"
570        LIBS="$PYTHON_LDFLAGS"
571        PY_LIB=`$PYTHONCONFIG --libs | sed \
572                              -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
573        AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
574        LIBS="$LIBS_SAVE"
575fi
576
577AC_SUBST([PYTHON_CPPFLAGS])
578AC_SUBST([PYTHON_LDFLAGS])
579AC_SUBST([PYTHON_ENABLED])
580AC_SUBST([PYTHON_FILE])
581
582# ===========================================================================
583# Detect if spidermonkey is installed
584# ===========================================================================
585
586AC_ARG_WITH([js],
587        [AS_HELP_STRING([--with-js=PATH], [Specifies --with-js=path-to-js to enable js support, specify --with-js on linux debian like, js support is disabled by default ])],
588        [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""])
589
590if test -z "$JS_ENABLED"
591then
592        JS_FILE=""
593else
594        JS_FILE="service_internal_js.o"
595        if test "$JSHOME" = "yes"
596        then
597
598                #on teste si on est sous debian like
599                if test -f "/usr/bin/dpkg"
600                then
601                        if test -n "`dpkg -l | grep libmozjs185-dev`"
602                        then
603                                JS_CPPFLAGS="-I/usr/include/js/"
604                                JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm"
605                                JS_LIB="mozjs185"
606                        else
607                                XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`"
608                                if test -n "$XUL_VERSION"
609                                then
610                                        JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION"
611                                        JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm"
612                                        JS_LIB="mozjs"
613                                else
614                                        AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ])
615                                fi
616                        fi
617                else
618                        AC_MSG_ERROR([You must  specify your custom install of libmozjs185])
619                fi
620        else
621                JS_CPPFLAGS="-I$JSHOME/include/js/"
622                JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm"
623                JS_LIB="mozjs185"
624
625        fi
626        CPPFLAGS_SAVE="$CPPFLAGS"
627        CPPFLAGS="$JS_CPPFLAGS"
628        AC_LANG_PUSH([C++])
629        AC_CHECK_HEADERS([jsapi.h],
630                        [], [AC_MSG_ERROR([could not find headers include related to libjs])])
631
632        AC_LANG_POP([C++])
633        LIBS_SAVE="$LIBS"
634        LIBS="$JS_LDFLAGS"
635
636        AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])
637        LIBS="$LIBS_SAVE"
638       
639        AC_SUBST([JS_CPPFLAGS])
640        AC_SUBST([JS_LDFLAGS])
641fi
642
643AC_SUBST([JS_ENABLED])
644AC_SUBST([JS_FILE])
645
646# ===========================================================================
647# Detect if php is installed
648# ===========================================================================
649
650AC_ARG_WITH([php],
651        [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation,  disabled by default])],
652        [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
653
654AC_ARG_WITH([php-version],
655        [AS_HELP_STRING([--with-phpvers=NUM], [To use a specific php version])],
656        [PHP_VERS="$withval"], [PHP_VERS=""])
657
658
659if test -z "$PHP_ENABLED"
660then
661        PHP_FILE=""
662else
663        PHPCONFIG="$PHP_PATH/bin/php-config"
664        if test "x$PHP_VERS" = "x7"
665        then
666                PHP_FILE="service_internal_php7.o"
667        else
668                PHP_FILE="service_internal_php.o"
669        fi
670        if test  "$PHP_PATH" = "yes"
671        then
672                # PHP was not specified, so search within the current path
673                AC_PATH_PROG([PHPCONFIG], [php-config])
674        else
675                PHPCONFIG="$PHP_PATH/bin/php-config"
676        fi
677
678        # Extract the linker and include flags
679        if test "x$PHP_VERS" = "x7"
680        then
681                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib64 -lphp7"
682        else
683                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
684        fi
685        PHP_CPPFLAGS=`$PHPCONFIG --includes`
686
687        # Check headers file
688        CPPFLAGS_SAVE="$CPPFLAGS"
689        CPPFLAGS="$PHP_CPPFLAGS"
690        AC_CHECK_HEADERS([sapi/embed/php_embed.h],
691                 [], [AC_MSG_ERROR([could not find headers include related to libphp])])
692
693        # Ensure we can link against libphp
694        LIBS_SAVE="$LIBS"
695        LIBS="$PHP_LDFLAGS"
696        # Shouldn't we get php here rather than php5 :) ??
697        if test "x$PHP_VERS" = "x7"
698        then
699                echo $LIBS
700                #AC_CHECK_LIB([php7], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
701        else
702                AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
703        fi
704        LIBS="$LIBS_SAVE"
705        AC_SUBST([PHP_CPPFLAGS])
706        AC_SUBST([PHP_LDFLAGS])
707fi
708
709AC_SUBST([PHP_ENABLED])
710AC_SUBST([PHP_FILE])
711
712# ===========================================================================
713# Detect if java is installed
714# ===========================================================================
715
716AC_ARG_WITH([java],
717        [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME,  disabled by default])],
718        [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""])
719
720AC_ARG_WITH([java-rpath],
721        [AS_HELP_STRING([--with-java-rpath=yes], [To set rpath for java support, disabled by default])],
722        [JAVA_RPATH="$withval"], [JAVA_RPATH=""])
723
724if test -z "$JAVA_ENABLED"
725then
726        JAVA_FILE=""
727else
728        JAVA_FILE="service_internal_java.o"
729        if test "x$JDKHOME" = "x";
730        then
731                AC_MSG_ERROR([could not find java installation path within the current path. You may need to try re-running configure with a --with-java parameter.])
732        fi      # JAVA was specified; display a message to the user
733        if test "x$JDKHOME" = "xyes";
734        then
735                AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java])
736        fi
737
738        # Extract the linker and include flags
739        if test "x$JDKHOME" = "xmacos";
740        then
741                JAVA_LDFLAGS="-framework JavaVM"
742                for i in `ls /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/`; do
743                    JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/$i/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
744                done
745        else
746                if test -d "$JDKHOME/jre/lib/i386";
747                then
748                        JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread"
749                        JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
750                        if test x$JAVA_RPATH = "xyes"; then
751                           JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/i386/server/"
752                        fi
753                else
754                        if test -d "$JDKHOME/jre/lib/amd64"; then
755                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread"
756                           JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
757                           if test x$JAVA_RPATH = "xyes"; then
758                              JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/amd64/server/"
759                           fi
760                        else
761                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/server/ -ljvm -lpthread"
762                           JAVA_CPPFLAGS="-I$JDKHOME/include/ -I$JDKHOME/include/darwin"
763                           if test x$JAVA_RPATH = "xyes"; then
764                              JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/server/"
765                           fi
766                        fi
767                fi
768        fi
769
770        AC_LANG([C++])
771        echo $JAVA_CPPFLAGS
772        # Check headers file (second time we check that in fact)
773        CPPFLAGS_SAVE="$CPPFLAGS"
774        CPPFLAGS="$JAVA_CPPFLAGS"
775        AC_CHECK_HEADERS([jni.h],
776                         [], [AC_MSG_ERROR([could not find jni.h file])])
777        CPPFLAGS="$CPPFLAGS_SAVE"
778        # Ensure we can link against libjava
779        LIBS_SAVE="$LIBS"
780        LIBS="$JAVA_LDFLAGS"
781        if test "x$JDKHOME" != "xmacos";
782        then
783                AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjvm])], [])
784        fi
785        LIBS="$LIBS_SAVE"
786
787        AC_SUBST([JAVA_CPPFLAGS])
788        AC_SUBST([JAVA_LDFLAGS])
789fi
790
791AC_SUBST([JAVA_ENABLED])
792AC_SUBST([JAVA_FILE])
793
794# ===========================================================================
795# Detect if mono is installed
796# ===========================================================================
797
798AC_ARG_WITH([mono],
799        [AS_HELP_STRING([--with-mono=PATH], [To enable mono support, specify the path to find pkg-config,  disabled by default])],
800        [MONOHOME="$withval"; MONO_ENABLED="-DUSE_MONO"], [MONO_ENABLED=""])
801
802if test -z "$MONO_ENABLED"
803then
804        MONO_FILE=""
805else
806        MONO_FILE="service_internal_mono.o"
807        if test "x$MONOHOME" = "x";
808        then
809                MONOHOME="/usr"
810        fi
811        if test "x$MONOHOME" = "xyes";
812        then
813                MONOHOME="/usr"
814        fi
815
816        # Extract the linker and include flags
817        MONO_CFLAGS=`$MONOHOME/bin/pkg-config --cflags mono-2`
818        MONO_LDFLAGS=`$MONOHOME/bin/pkg-config --libs mono-2`
819
820        AC_LANG([C++])
821        echo $JAVA_CPPFLAGS
822        # Check headers file (second time we check that in fact)
823        CPPFLAGS_SAVE="$CFLAGS"
824        CPPFLAGS="$MONO_CFLAGS"
825        AC_CHECK_HEADERS([mono/jit/jit.h],
826                         [], [AC_MSG_ERROR([could not find jit.h file])])
827        CPPFLAGS="$CPPFLAGS_SAVE"
828        # Ensure we can link against libmono-2.0
829        LIBS_SAVE="$LIBS"
830        LIBS="$MONO_LDFLAGS"
831        AC_CHECK_LIB([mono-2.0], [mono_runtime_invoke], [], [AC_MSG_ERROR([could not find libmono])], [])
832        LIBS="$LIBS_SAVE"
833
834        AC_SUBST([MONO_CFLAGS])
835        AC_SUBST([MONO_LDFLAGS])
836fi
837
838AC_SUBST([MONO_ENABLED])
839AC_SUBST([MONO_FILE])
840
841# ===========================================================================
842# Detect if ruby is installed
843# ===========================================================================
844AC_ARG_WITH([ruby],
845        [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation,  disabled by default])],
846        [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""])
847
848AC_ARG_WITH([rvers],
849        [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])],
850        [RUBY_VERS="$withval"], [RUBY_VERS=""])
851
852
853if test -z "$RUBY_ENABLED"
854then
855        RUBY_FILE=""
856else
857        RUBY_FILE="service_internal_ruby.o"
858
859        # Extract the linker and include flags
860        RUBY_LDFLAGS="-lruby"
861        RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS"
862
863        # Check headers file
864        CPPFLAGS_SAVE="$CPPFLAGS"
865        CPPFLAGS="$RUBY_CPPFLAGS"
866        AC_CHECK_HEADERS([ruby.h],
867                 [], [AC_MSG_ERROR([could not find headers include related to libruby])])
868
869        # Ensure we can link against libphp
870        LIBS_SAVE="$LIBS"
871        LIBS="$RUBY_LDFLAGS"
872        # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
873        LIBS="$LIBS_SAVE"
874        AC_SUBST([RUBY_CPPFLAGS])
875        AC_SUBST([RUBY_LDFLAGS])
876fi
877
878AC_SUBST([RUBY_ENABLED])
879AC_SUBST([RUBY_FILE])
880
881# ===========================================================================
882# Detect if perl is installed
883# ===========================================================================
884
885AC_ARG_WITH([perl],
886        [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation,  disabled by default])],
887        [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""])
888
889
890if test -z "$PERL_ENABLED"
891then
892        PERL_FILE=""
893else
894        PERL_FILE="service_internal_perl.o"
895        if test  "$PERL_PATH" = "yes"
896        then
897                # Perl was not specified, so search within the current path
898                AC_PATH_PROG([PERLCONFIG], [perl])
899        else
900                PERLCONFIG="$PERL_PATH/bin/perl"
901        fi
902
903        # Extract the linker and include flags
904        PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts`
905        PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts`
906
907        # Check headers file
908        CPPFLAGS_SAVE="$CPPFLAGS"
909        CPPFLAGS="$PERL_CPPFLAGS"
910        AC_CHECK_HEADERS([EXTERN.h],
911                 [], [AC_MSG_ERROR([could not find headers include related to libperl])])
912
913        AC_SUBST([PERL_CPPFLAGS])
914        AC_SUBST([PERL_LDFLAGS])
915fi
916
917AC_SUBST([PERL_ENABLED])
918AC_SUBST([PERL_FILE])
919
920# ===========================================================================
921# Detect if otb is available
922# ===========================================================================
923
924AC_ARG_WITH([itk],
925        [AS_HELP_STRING([--with-itk=PATH], [Specifies an alternative location for the itk library])],
926        [ITKPATH="$withval"], [ITKPATH=""])
927
928AC_ARG_WITH([itk-version],
929        [AS_HELP_STRING([--with-itk-version=VERSION], [Specifies an alternative version for the itk library])],
930        [ITKVERS="$withval"], [ITKVERS=""])
931
932AC_ARG_WITH([otb],
933        [AS_HELP_STRING([--with-otb=PATH], [Specifies an alternative location for the otb library])],
934        [OTBPATH="$withval"], [OTBPATH=""])
935
936AC_ARG_WITH([otb-version],
937        [AS_HELP_STRING([--with-otb-version=PATH], [Specifies an alternative location for the otb library])],
938        [OTBVERS="$withval"], [OTBVERS=""])
939
940if test -z "$OTBPATH"
941then
942        OTB_LDFLAGS=""
943        OTB_CPPFLAGS=""
944        OTB_FILE=""
945        OTB_ENABLED=""
946else
947        if test -z "$ITKVERS"
948        then
949                ITKVERS="4.5"
950        fi
951        OTB_ENABLED="-DUSE_OTB"
952        IVERS="$(echo -e '4.10\n$ITKVERS' | sort -r | head -n1)"
953        if test "$IVERS" == "$ITKVERS"; then
954           ITK_LDFLAGS="-lITKBiasCorrection-$ITKVERS -lITKCommon-$ITKVERS -lITKIOImageBase-$ITKVERS -lITKKLMRegionGrowing-$ITKVERS -lITKLabelMap-$ITKVERS -lITKMesh-$ITKVERS -lITKMetaIO-$ITKVERS -lITKOptimizers-$ITKVERS -lITKPath-$ITKVERS -lITKPolynomials-$ITKVERS -lITKQuadEdgeMesh-$ITKVERS -lITKSpatialObjects-$ITKVERS -lITKStatistics-$ITKVERS -lITKVNLInstantiation-$ITKVERS -lITKWatersheds-$ITKVERS -litkNetlibSlatec-$ITKVERS -litksys-$ITKVERS -litkv3p_netlib-$ITKVERS -litkvcl-$ITKVERS -litkvnl-$ITKVERS"
955        else
956                ITK_LDFLAGS="-lITKBiasCorrection-$ITKVERS -lITKCommon-$ITKVERS -lITKIOImageBase-$ITKVERS -lITKKLMRegionGrowing-$ITKVERS -lITKLabelMap-$ITKVERS -lITKMesh-$ITKVERS -lITKMetaIO-$ITKVERS -lITKOptimizers-$ITKVERS -lITKPath-$ITKVERS -lITKPolynomials-$ITKVERS -lITKQuadEdgeMesh-$ITKVERS -lITKSpatialObjects-$ITKVERS -lITKStatistics-$ITKVERS -lITKVNLInstantiation-$ITKVERS -lITKWatersheds-$ITKVERS -litkNetlibSlatec-$ITKVERS -litksys-$ITKVERS -litkv3p_lsqr-$ITKVERS -litkv3p_netlib-$ITKVERS -litkvcl-$ITKVERS -litkvnl-$ITKVERS -litkvnl_algo-$ITKVERS"
957        fi
958
959        if test -a "${OTBPATH}/include/OTB-${OTBVERS}" ; then
960                OTB_RPATH="$OTBPATH/include/OTB-${OTBVERS}/"
961                OTB_CPPFLAGS="-I${OTB_RPATH}ApplicationEngine -I$OTB_RPATH/Common -I$ITKPATH/include/ITK-$ITKVERS -I$OTB_RPATH/Utilities/ITK -I$OTB_RPATH/ -I$OTB_RPATH/IO -I$OTB_RPATH/UtilitiesAdapters/OssimAdapters -I$OTB_RPATH/UtilitiesAdapters/CurlAdapters -I$OTB_RPATH/Utilities/BGL -I$OTB_RPATH/UtilitiesAdapters/ITKPendingPatches -I$OTB_RPATH/Utilities/otbconfigfile $GDAL_CFLAGS"
962                OTB_LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -lOTBImageIO-$OTBVERS -lOTBCommon-$OTBVERS -lOTBApplicationEngine-$OTBVERS -L$ITKPATH/lib $ITK_LDFLAGS"
963        else
964                OTB_CPPFLAGS="-I$OTBPATH/include/otb/ApplicationEngine -I$OTBPATH/include/otb/Common -I$ITKPATH/include/ITK-$ITKVERS -I$OTBPATH/include/otb/Utilities/ITK -I$OTBPATH/include/otb/ -I$OTBPATH/include/otb/IO -I$OTBPATH/include/otb/UtilitiesAdapters/OssimAdapters -I$OTBPATH/include/otb/UtilitiesAdapters/CurlAdapters -I$OTBPATH/include/otb/Utilities/BGL -I$OTBPATH/include/otb/UtilitiesAdapters/ITKPendingPatches -I$OTBPATH/include/otb/Utilities/otbconfigfile $GDAL_CFLAGS"
965                OTB_LDFLAGS="-L$OTBPATH/lib/otb -lOTBIO -lOTBCommon -lOTBApplicationEngine -L$ITKPATH/lib $ITK_LDFLAGS"
966
967        fi
968        OTB_FILE="otbZooWatcher.o service_internal_otb.o"
969       
970        AC_LANG_PUSH([C++])
971        # Check headers file
972        CPPFLAGS_SAVE="$CPPFLAGS"
973        CPPFLAGS="$OTB_CPPFLAGS"
974        LDFLAGS_SAVE="$LDFLAGS"
975        LIBS="$LIBS_SAVE $OTB_LDFLAGS"
976        #echo $OTB_CPPFLAGS
977        AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
978                        [], [AC_MSG_ERROR([could not find header file $i related to OTB])])
979        LDFLAGS_SAVE="$LDFLAGS"
980        LDFLAGS="$OTB_LDFLAGS"
981        #echo $OTB_LDFLAGS
982        #UVERS="$(echo -e '5.8\n$OTBVERS' | sort -r | head -n1)"
983        #if test "$OTBVERS" ==  "$UVERS" ; then
984        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplicationRegistry.h"]],[[std::vector<std::string> list = otb::Wrapper::ApplicationRegistry::GetAvailableApplications();]])],
985                        [AC_MSG_RESULT([checking for GetAvailableApplications... yes])],[AC_MSG_ERROR([checking for GetAvailableApplications... failed])])
986        #else
987        #       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplication.h"]],[[std::vector<std::string> list = otb::Wrapper::ApplicationRegistry::GetAvailableApplication();]])],
988        #                                                  [AC_MSG_RESULT([checking for GetAvailableApplication... yes])],[AC_MSG_ERROR([checking for GetAvailableApplication... failed])])
989        #fi
990                                                                               
991        LDFLAGS="$LDFLAGS_SAVE"
992        AC_LANG_POP([C++])
993        AC_LANG(C++)
994                       
995fi
996AC_SUBST([OTB_CPPFLAGS])
997AC_SUBST([OTB_LDFLAGS])
998AC_SUBST([OTB_FILE])
999AC_SUBST([OTB_ENABLED])
1000
1001# ===========================================================================
1002# Detect if saga-gis is available
1003# ===========================================================================
1004
1005AC_ARG_WITH([wx-config],
1006        [AS_HELP_STRING([--with-wx-config=PATH], [Specifies an alternative path for the wx-config tool])],
1007        [WXCFG="$withval"], [WXCFG=""])
1008
1009AC_ARG_WITH([saga],
1010        [AS_HELP_STRING([--with-saga=PATH], [Specifies an alternative location for the SAGA-GIS library])],
1011        [SAGAPATH="$withval"], [SAGAPATH=""])
1012
1013if test -z "$SAGAPATH"
1014then
1015        SAGA_LDFLAGS=""
1016        SAGA_CPPFLAGS=""
1017        SAGA_FILE=""
1018        SAGA_ENABLED=""
1019else
1020        if test -z "$WXCFG" ; then
1021           WXCFG="$(which wx-config)"
1022        fi
1023        if test "`$WXCFG --list | grep unicode`" == "" ; then
1024           AC_MSG_ERROR(SAGA requires a unicode build of wxGTK)
1025        fi
1026        WX_ISSUE="-D_WX_WXCRTVARARG_H_"
1027        SAGA_DEFS="-D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD -DMODULE_LIBRARY_PATH=\\\"$SAGAPATH/lib/saga\\\""
1028        SAGA_CPPFLAGS=" -fPIC -I$SAGAPATH/include/saga/saga_core/saga_api/ `$WXCFG --unicode=yes --static=no --cxxflags` -D_SAGA_UNICODE $SAGA_DEFS $WX_ISSUE"
1029        SAGA_LDFLAGS="-fPIC `$WXCFG --unicode=yes --static=no --libs` -lsaga_api"
1030        SAGA_ENABLED="-DUSE_SAGA"
1031        SAGA_FILE="service_internal_saga.o"
1032       
1033        AC_LANG_PUSH([C++])
1034        # Check headers file
1035        CPPFLAGS_SAVE="$CPPFLAGS"
1036        CPPFLAGS="$SAGA_CPPFLAGS"
1037        LIBS_SAVE="$LIBS"
1038        LIBS="$SAGA_LDFLAGS"
1039        AC_CHECK_HEADERS([module_library.h],
1040                        [], [AC_MSG_ERROR([could not find header file $i related to SAGA-GIS])])
1041        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "module_library.h"],[SG_Get_Module_Library_Manager();]])],
1042                [AC_MSG_RESULT([checking for SG_Get_Module_Library_Manager... yes])],[AC_MSG_ERROR([checking for SG_Get_Module_Library_Manager... failed])])
1043        LIBS="$LIBS_SAVE"
1044        AC_LANG_POP([C++])
1045fi
1046AC_SUBST([SAGA_CPPFLAGS])
1047AC_SUBST([SAGA_LDFLAGS])
1048AC_SUBST([SAGA_FILE])
1049AC_SUBST([SAGA_ENABLED])
1050
1051AC_CONFIG_FILES([Makefile])
1052AC_CONFIG_FILES([ZOOMakefile.opts])
1053AC_CONFIG_FILES([main.cfg])
1054AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png