source: trunk/zoo-project/zoo-kernel/configure.ac @ 921

Last change on this file since 921 was 917, checked in by djay, 5 years ago

Merge prototype-v0 branch in trunk

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