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

Last change on this file since 986 was 984, checked in by djay, 3 years ago

Take into account building ZOO-Project on ubuntu focal (cf. https://trac.osgeo.org/osgeolive/ticket/2282). Add the OTB and SAGA support to the Dockerfile to make the corresponding demos using docker WPS server. Add OGC API - Processes demo to the demos list.

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

Search

Context Navigation

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