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

Last change on this file since 974 was 968, checked in by djay, 4 years ago

Add websocketd container to docker-compose and make the OGC API - Processes and it basic UI available.

File size: 38.5 KB
Line 
1AC_INIT([ZOO Kernel], [1.8.0-rc1], [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"
417AC_CHECK_HEADERS([proj_api.h],
418                 [], [AC_MSG_ERROR([could not find headers include related to PROJ4])])
419
420AC_SUBST([PROJ_CPPFLAGS])
421AC_SUBST([PROJ_LDFLAGS])
422
423# ===========================================================================
424# Detect if libgeos is installed
425# ===========================================================================
426
427AC_ARG_WITH([geosconfig],
428        [AS_HELP_STRING([--with-geosconfig=FILE], [Specifies an alternative geos-config file])],
429        [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
430
431if test "x$GEOSCONFIG" = "x"; then
432        # GEOSCONFIG was not specified, so search within the current path
433        AC_PATH_PROG([GEOSCONFIG], [geos-config])
434
435        # If we couldn't find geos-config, display a warning
436        if test "x$GEOSCONFIG" = "x"; then
437                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.])
438        fi
439else
440        # GEOSCONFIG was specified; display a message to the user
441        if test "x$GEOSCONFIG" = "xyes"; then
442                AC_MSG_WARN([you must Specifies a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
443        else
444                if test -f $GEOSCONFIG; then
445                        AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
446                else
447                        AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
448                fi     
449        fi
450fi
451
452GEOS_LDFLAGS=`$GEOSCONFIG --libs`
453GEOS_CPPFLAGS=`$GEOSCONFIG --cflags`
454
455# Check headers file
456CPPFLAGS_SAVE="$CPPFLAGS"
457CPPFLAGS="$GEOS_CPPFLAGS"
458AC_CHECK_HEADERS([geos_c.h],
459                 [], [AC_MSG_WARN([could not find headers include related to libgeos])])
460
461AC_SUBST([GEOS_CPPFLAGS])
462AC_SUBST([GEOS_LDFLAGS])
463
464
465# ===========================================================================
466# Detect if cgal is installed
467# ===========================================================================
468
469AC_ARG_WITH([cgal],
470        [AS_HELP_STRING([--with-cgal=PATH], [Specifies an alternative location for CGAL setup])],
471        [CGALPATH="$withval"], [CGALPATH="/usr"])
472
473
474# Check headers file
475CPPFLAGS_SAVE="$CPPFLAGS"
476CGAL_CPPFLAGS="-I$CGALPATH/include"
477CPPFLAGS="$CGAL_CPPFLAGS"
478AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
479         [], [AC_MSG_WARN([could not find headers include related to libCGAL])])
480
481# Extract the linker and include flags
482CGAL_LDFLAGS="-L$CGALPATH/lib"
483CGAL_CPPFLAGS="-I$CGALPATH/include"
484
485
486AC_SUBST([CGAL_CPPFLAGS])
487AC_SUBST([CGAL_LDFLAGS])
488#============================================================================
489# Detect if mapserver is installed
490#============================================================================
491
492AC_ARG_WITH([mapserver],
493       [AS_HELP_STRING([--with-mapserver=PATH], [Specifies the path for MapServer compiled source tree])],
494       [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""])
495
496AC_ARG_WITH([ms-version],
497       [AS_HELP_STRING([--with-ms-version=VERSION], [Specifies the MapServer version to build against])],
498       [MS_VERSION="$withval"], [MS_VERSION=""])
499
500if test -z $MS_SRC_PATH;
501then
502        MS_CPPFLAGS=""
503        MS_LDFLAGS=""
504else
505       if test "x$MS_SRC_PATH" = "xmacos";
506       then
507               MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl"
508               MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver "
509               AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree])
510               AC_MSG_RESULT([Using MacOS X Framework for MapServer])
511       else
512        if test "x$MS_VERSION" = "x7";
513        then
514                MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
515                MS_CPPFLAGS="-DUSE_MS -I$MS_SRC_PATH/include/mapserver "
516                AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
517        else
518               if test -d $MS_SRC_PATH; then
519                       MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`"
520                       MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH "
521               
522                       AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
523               else
524                       AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist])
525               fi
526        fi
527       fi
528       MS_FILE="service_internal_ms.o"
529fi
530
531MS_CFLAGS="$MS_CPPFLAGS"
532MS_LIBS="$MS_LDFLAGS"
533
534AC_SUBST([MS_CFLAGS])
535AC_SUBST([MS_LIBS])
536AC_SUBST([MS_FILE])
537AC_SUBST([MS_VERSION])
538
539# ===========================================================================
540# Detect if R is installed
541# ===========================================================================
542
543AC_ARG_WITH([r],
544        [AS_HELP_STRING([--with-r=PATH], [To enable R support or Specifies an alternative directory for R installation,  disabled by default])],
545        [R_PATH="$withval"; R_ENABLED="-DUSE_R"], [R_ENABLED=""])
546
547if test -z "$R_ENABLED"
548then
549        R_FILE=""
550else
551        R_FILE="service_internal_r.o"
552        # Extract the linker and include flags
553        R_LDFLAGS="-L$R_PATH/lib/ -lR"
554        R_CPPFLAGS="-I$R_PATH/include/ -I$R_PATH/share/R/include/"
555
556        # Check headers file
557        CPPFLAGS_SAVE="$CPPFLAGS"
558        CPPFLAGS="$R_CPPFLAGS"
559        AC_CHECK_HEADERS([Rinternals.h],
560                 [], [AC_MSG_ERROR([could not find headers include related to R])])
561
562        # Ensure we can link against libphp
563        #LIBS_SAVE="$LIBS"
564        #LIBS="$R_LDFLAGS"
565        #AC_CHECK_LIB([$LIBS], [R_tryEval], [], [AC_MSG_ERROR([could not find libR])], [])
566        #LIBS="$LIBS_SAVE"
567fi
568
569AC_SUBST([R_CPPFLAGS])
570AC_SUBST([R_LDFLAGS])
571AC_SUBST([R_ENABLED])
572AC_SUBST([R_FILE])
573
574
575# ===========================================================================
576# Detect if python is installed
577# ===========================================================================
578
579AC_ARG_WITH([python],
580        [AS_HELP_STRING([--with-python=PATH], [To enable python support or Specifies an alternative directory for python installation,  disabled by default])],
581        [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
582
583AC_ARG_WITH([pyvers],
584        [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])],
585        [PYTHON_VERS="$withval"], [PYTHON_VERS=""])
586
587
588if test -z "$PYTHON_ENABLED"
589then
590        PYTHON_FILE=""
591else
592        PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
593        PYTHON_FILE="service_internal_python.o"
594        if test  "$PYTHON_PATH" = "yes"
595        then
596                # PYTHON was not specified, so search within the current path
597                PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
598                if test -z "${PYTHONCFG_PATH}" ; then
599                AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}])
600                else
601                AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config])
602                fi
603        else
604                PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
605        fi
606
607        echo $PYTHONCONFIG
608        # Extract the linker and include flags
609        PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
610        PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
611
612        # Check headers file
613        CPPFLAGS_SAVE="$CPPFLAGS"
614        CPPFLAGS="$PYTHON_CPPFLAGS"
615        AC_CHECK_HEADERS([Python.h],
616                 [], [AC_MSG_ERROR([could not find headers include related to libpython])])
617
618        # Ensure we can link against libphp
619        LIBS_SAVE="$LIBS"
620        LIBS="$PYTHON_LDFLAGS"
621        PY_LIB=`$PYTHONCONFIG --libs | sed \
622                              -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
623        AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
624        LIBS="$LIBS_SAVE"
625fi
626
627AC_SUBST([PYTHON_CPPFLAGS])
628AC_SUBST([PYTHON_LDFLAGS])
629AC_SUBST([PYTHON_ENABLED])
630AC_SUBST([PYTHON_FILE])
631
632# ===========================================================================
633# Detect if spidermonkey is installed
634# ===========================================================================
635
636AC_ARG_WITH([js],
637        [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 ])],
638        [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""])
639
640if test -z "$JS_ENABLED"
641then
642        JS_FILE=""
643else
644        JS_FILE="service_internal_js.o"
645        if test "$JSHOME" = "yes"
646        then
647
648                #on teste si on est sous debian like
649                if test -f "/usr/bin/dpkg"
650                then
651                        if test -n "`dpkg -l | grep libmozjs185-dev`"
652                        then
653                                JS_CPPFLAGS="-I/usr/include/js/"
654                                JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm"
655                                JS_LIB="mozjs185"
656                        else
657                                XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`"
658                                if test -n "$XUL_VERSION"
659                                then
660                                        JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION"
661                                        JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm"
662                                        JS_LIB="mozjs"
663                                else
664                                        AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ])
665                                fi
666                        fi
667                else
668                        AC_MSG_ERROR([You must  specify your custom install of libmozjs185])
669                fi
670        else
671                JS_CPPFLAGS="-I$JSHOME/include/js/"
672                JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm"
673                JS_LIB="mozjs185"
674
675        fi
676        CPPFLAGS_SAVE="$CPPFLAGS"
677        CPPFLAGS="$JS_CPPFLAGS"
678        AC_LANG_PUSH([C++])
679        AC_CHECK_HEADERS([jsapi.h],
680                        [], [AC_MSG_ERROR([could not find headers include related to libjs])])
681
682        AC_LANG_POP([C++])
683        LIBS_SAVE="$LIBS"
684        LIBS="$JS_LDFLAGS"
685
686        AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])
687        LIBS="$LIBS_SAVE"
688       
689        AC_SUBST([JS_CPPFLAGS])
690        AC_SUBST([JS_LDFLAGS])
691fi
692
693AC_SUBST([JS_ENABLED])
694AC_SUBST([JS_FILE])
695
696# ===========================================================================
697# Detect if php is installed
698# ===========================================================================
699
700AC_ARG_WITH([php],
701        [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation,  disabled by default])],
702        [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
703
704AC_ARG_WITH([php-version],
705        [AS_HELP_STRING([--with-phpvers=NUM], [To use a specific php version])],
706        [PHP_VERS="$withval"], [PHP_VERS=""])
707
708
709if test -z "$PHP_ENABLED"
710then
711        PHP_FILE=""
712else
713        PHPCONFIG="$PHP_PATH/bin/php-config"
714        if test "x$PHP_VERS" = "x7"
715        then
716                PHP_FILE="service_internal_php7.o"
717        else
718                PHP_FILE="service_internal_php.o"
719        fi
720        if test  "$PHP_PATH" = "yes"
721        then
722                # PHP was not specified, so search within the current path
723                AC_PATH_PROG([PHPCONFIG], [php-config])
724        else
725                PHPCONFIG="$PHP_PATH/bin/php-config"
726        fi
727
728        # Extract the linker and include flags
729        if test "x$PHP_VERS" = "x7"
730        then
731                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib64 -lphp7"
732        else
733                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
734        fi
735        PHP_CPPFLAGS=`$PHPCONFIG --includes`
736
737        # Check headers file
738        CPPFLAGS_SAVE="$CPPFLAGS"
739        CPPFLAGS="$PHP_CPPFLAGS"
740        AC_CHECK_HEADERS([sapi/embed/php_embed.h],
741                 [], [AC_MSG_ERROR([could not find headers include related to libphp])])
742
743        # Ensure we can link against libphp
744        LIBS_SAVE="$LIBS"
745        LIBS="$PHP_LDFLAGS"
746        # Shouldn't we get php here rather than php5 :) ??
747        if test "x$PHP_VERS" = "x7"
748        then
749                echo $LIBS
750                #AC_CHECK_LIB([php7], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
751        else
752                AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
753        fi
754        LIBS="$LIBS_SAVE"
755        AC_SUBST([PHP_CPPFLAGS])
756        AC_SUBST([PHP_LDFLAGS])
757fi
758
759AC_SUBST([PHP_ENABLED])
760AC_SUBST([PHP_FILE])
761
762# ===========================================================================
763# Detect if java is installed
764# ===========================================================================
765
766AC_ARG_WITH([java],
767        [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME,  disabled by default])],
768        [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""])
769
770AC_ARG_WITH([java-rpath],
771        [AS_HELP_STRING([--with-java-rpath=yes], [To set rpath for java support, disabled by default])],
772        [JAVA_RPATH="$withval"], [JAVA_RPATH=""])
773
774if test -z "$JAVA_ENABLED"
775then
776        JAVA_FILE=""
777else
778        JAVA_FILE="service_internal_java.o"
779        if test "x$JDKHOME" = "x";
780        then
781                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.])
782        fi      # JAVA was specified; display a message to the user
783        if test "x$JDKHOME" = "xyes";
784        then
785                AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java])
786        fi
787
788        # Extract the linker and include flags
789        if test "x$JDKHOME" = "xmacos";
790        then
791                JAVA_LDFLAGS="-framework JavaVM"
792                for i in `ls /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/`; do
793                    JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/$i/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
794                done
795        else
796                if test -d "$JDKHOME/jre/lib/i386";
797                then
798                        JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread"
799                        JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
800                        if test x$JAVA_RPATH = "xyes"; then
801                           JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/i386/server/"
802                        fi
803                else
804                        if test -d "$JDKHOME/jre/lib/amd64"; then
805                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread"
806                           JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
807                           if test x$JAVA_RPATH = "xyes"; then
808                              JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/amd64/server/"
809                           fi
810                        else
811                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/server/ -ljvm -lpthread"
812                           JAVA_CPPFLAGS="-I$JDKHOME/include/ -I$JDKHOME/include/darwin"
813                           if test x$JAVA_RPATH = "xyes"; then
814                              JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/server/"
815                           fi
816                        fi
817                fi
818        fi
819
820        AC_LANG([C++])
821        #echo $JAVA_CPPFLAGS
822        # Check headers file (second time we check that in fact)
823        CPPFLAGS_SAVE="$CPPFLAGS"
824        CPPFLAGS="$JAVA_CPPFLAGS"
825        AC_CHECK_HEADERS([jni.h],
826                         [], [AC_MSG_ERROR([could not find jni.h file])])
827        CPPFLAGS="$CPPFLAGS_SAVE"
828        # Ensure we can link against libjava
829        LIBS_SAVE="$LIBS"
830        LIBS="$JAVA_LDFLAGS"
831        if test "x$JDKHOME" != "xmacos";
832        then
833                AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjvm])], [])
834        fi
835        LIBS="$LIBS_SAVE"
836
837        AC_SUBST([JAVA_CPPFLAGS])
838        AC_SUBST([JAVA_LDFLAGS])
839fi
840
841AC_SUBST([JAVA_ENABLED])
842AC_SUBST([JAVA_FILE])
843
844# ===========================================================================
845# Detect if mono is installed
846# ===========================================================================
847
848AC_ARG_WITH([mono],
849        [AS_HELP_STRING([--with-mono=PATH], [To enable mono support, specify the path to find pkg-config,  disabled by default])],
850        [MONOHOME="$withval"; MONO_ENABLED="-DUSE_MONO"], [MONO_ENABLED=""])
851
852if test -z "$MONO_ENABLED"
853then
854        MONO_FILE=""
855else
856        MONO_FILE="service_internal_mono.o"
857        if test "x$MONOHOME" = "x";
858        then
859                MONOHOME="/usr"
860        fi
861        if test "x$MONOHOME" = "xyes";
862        then
863                MONOHOME="/usr"
864        fi
865
866        # Extract the linker and include flags
867        MONO_CFLAGS=`$MONOHOME/bin/pkg-config --cflags mono-2`
868        MONO_LDFLAGS=`$MONOHOME/bin/pkg-config --libs mono-2`
869
870        AC_LANG([C++])
871        #echo $JAVA_CPPFLAGS
872        # Check headers file (second time we check that in fact)
873        CPPFLAGS_SAVE="$CFLAGS"
874        CPPFLAGS="$MONO_CFLAGS"
875        AC_CHECK_HEADERS([mono/jit/jit.h],
876                         [], [AC_MSG_ERROR([could not find jit.h file])])
877        CPPFLAGS="$CPPFLAGS_SAVE"
878        # Ensure we can link against libmono-2.0
879        LIBS_SAVE="$LIBS"
880        LIBS="$MONO_LDFLAGS"
881        AC_CHECK_LIB([mono-2.0], [mono_runtime_invoke], [], [AC_MSG_ERROR([could not find libmono])], [])
882        LIBS="$LIBS_SAVE"
883
884        AC_SUBST([MONO_CFLAGS])
885        AC_SUBST([MONO_LDFLAGS])
886fi
887
888AC_SUBST([MONO_ENABLED])
889AC_SUBST([MONO_FILE])
890
891# ===========================================================================
892# Detect if ruby is installed
893# ===========================================================================
894AC_ARG_WITH([ruby],
895        [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation,  disabled by default])],
896        [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""])
897
898AC_ARG_WITH([rvers],
899        [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])],
900        [RUBY_VERS="$withval"], [RUBY_VERS=""])
901
902
903if test -z "$RUBY_ENABLED"
904then
905        RUBY_FILE=""
906else
907        RUBY_FILE="service_internal_ruby.o"
908
909        # Extract the linker and include flags
910        RUBY_LDFLAGS="-lruby"
911        RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS"
912
913        # Check headers file
914        CPPFLAGS_SAVE="$CPPFLAGS"
915        CPPFLAGS="$RUBY_CPPFLAGS"
916        AC_CHECK_HEADERS([ruby.h],
917                 [], [AC_MSG_ERROR([could not find headers include related to libruby])])
918
919        # Ensure we can link against libphp
920        LIBS_SAVE="$LIBS"
921        LIBS="$RUBY_LDFLAGS"
922        # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
923        LIBS="$LIBS_SAVE"
924        AC_SUBST([RUBY_CPPFLAGS])
925        AC_SUBST([RUBY_LDFLAGS])
926fi
927
928AC_SUBST([RUBY_ENABLED])
929AC_SUBST([RUBY_FILE])
930
931# ===========================================================================
932# Detect if perl is installed
933# ===========================================================================
934
935AC_ARG_WITH([perl],
936        [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation,  disabled by default])],
937        [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""])
938
939
940if test -z "$PERL_ENABLED"
941then
942        PERL_FILE=""
943else
944        PERL_FILE="service_internal_perl.o"
945        if test  "$PERL_PATH" = "yes"
946        then
947                # Perl was not specified, so search within the current path
948                AC_PATH_PROG([PERLCONFIG], [perl])
949        else
950                PERLCONFIG="$PERL_PATH/bin/perl"
951        fi
952
953        # Extract the linker and include flags
954        PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts`
955        PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts`
956
957        # Check headers file
958        CPPFLAGS_SAVE="$CPPFLAGS"
959        CPPFLAGS="$PERL_CPPFLAGS"
960        AC_CHECK_HEADERS([EXTERN.h],
961                 [], [AC_MSG_ERROR([could not find headers include related to libperl])])
962
963        AC_SUBST([PERL_CPPFLAGS])
964        AC_SUBST([PERL_LDFLAGS])
965fi
966
967AC_SUBST([PERL_ENABLED])
968AC_SUBST([PERL_FILE])
969
970# ===========================================================================
971# Detect if otb is available
972# ===========================================================================
973
974AC_ARG_WITH([itk],
975        [AS_HELP_STRING([--with-itk=PATH], [Specifies an alternative location for the itk library])],
976        [ITKPATH="$withval"], [ITKPATH=""])
977
978AC_ARG_WITH([itk-version],
979        [AS_HELP_STRING([--with-itk-version=VERSION], [Specifies an alternative version for the itk library])],
980        [ITKVERS="$withval"], [ITKVERS=""])
981
982AC_ARG_WITH([otb],
983        [AS_HELP_STRING([--with-otb=PATH], [Specifies an alternative location for the otb library])],
984        [OTBPATH="$withval"], [OTBPATH=""])
985
986AC_ARG_WITH([otb-version],
987        [AS_HELP_STRING([--with-otb-version=PATH], [Specifies an alternative location for the otb library])],
988        [OTBVERS="$withval"], [OTBVERS=""])
989
990if test -z "$OTBPATH"
991then
992        OTB_LDFLAGS=""
993        OTB_CPPFLAGS=""
994        OTB_FILE=""
995        OTB_ENABLED=""
996else
997        if test -z "$ITKVERS"
998        then
999                ITKVERS="4.5"
1000        fi
1001        OTB_ENABLED="-DUSE_OTB"
1002        IVERS="$(echo -e '4.10\n$ITKVERS' | sort -r | head -n1)"
1003        if test "$IVERS" == "$ITKVERS"; then
1004           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"
1005        else
1006                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"
1007        fi
1008
1009        if test -a "${OTBPATH}/include/OTB-${OTBVERS}" ; then
1010                OTB_RPATH="$OTBPATH/include/OTB-${OTBVERS}/"
1011                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"
1012                OTB_LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -lOTBImageIO-$OTBVERS -lOTBCommon-$OTBVERS -lOTBApplicationEngine-$OTBVERS -L$ITKPATH/lib $ITK_LDFLAGS"
1013        else
1014                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"
1015                OTB_LDFLAGS="-L$OTBPATH/lib/otb -lOTBIO -lOTBCommon -lOTBApplicationEngine -L$ITKPATH/lib $ITK_LDFLAGS"
1016
1017        fi
1018        OTB_FILE="otbZooWatcher.o service_internal_otb.o"
1019       
1020        AC_LANG_PUSH([C++])
1021        # Check headers file
1022        CPPFLAGS_SAVE="$CPPFLAGS"
1023        CPPFLAGS="$OTB_CPPFLAGS"
1024        LDFLAGS_SAVE="$LDFLAGS"
1025        LIBS="$LIBS_SAVE $OTB_LDFLAGS"
1026        #echo $OTB_CPPFLAGS
1027        AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
1028                        [], [AC_MSG_ERROR([could not find header file $i related to OTB])])
1029        LDFLAGS_SAVE="$LDFLAGS"
1030        LDFLAGS="$OTB_LDFLAGS"
1031        #echo $OTB_LDFLAGS
1032        #UVERS="$(echo -e '5.8\n$OTBVERS' | sort -r | head -n1)"
1033        #if test "$OTBVERS" ==  "$UVERS" ; then
1034        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplicationRegistry.h"]],[[std::vector<std::string> list = otb::Wrapper::ApplicationRegistry::GetAvailableApplications();]])],
1035                        [AC_MSG_RESULT([checking for GetAvailableApplications... yes])],[AC_MSG_ERROR([checking for GetAvailableApplications... failed])])
1036        #else
1037        #       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplication.h"]],[[std::vector<std::string> list = otb::Wrapper::ApplicationRegistry::GetAvailableApplication();]])],
1038        #                                                  [AC_MSG_RESULT([checking for GetAvailableApplication... yes])],[AC_MSG_ERROR([checking for GetAvailableApplication... failed])])
1039        #fi
1040                                                                               
1041        LDFLAGS="$LDFLAGS_SAVE"
1042        AC_LANG_POP([C++])
1043        AC_LANG(C++)
1044                       
1045fi
1046AC_SUBST([OTB_CPPFLAGS])
1047AC_SUBST([OTB_LDFLAGS])
1048AC_SUBST([OTB_FILE])
1049AC_SUBST([OTB_ENABLED])
1050
1051# ===========================================================================
1052# Detect if saga-gis is available
1053# ===========================================================================
1054
1055AC_ARG_WITH([wx-config],
1056        [AS_HELP_STRING([--with-wx-config=PATH], [Specifies an alternative path for the wx-config tool])],
1057        [WXCFG="$withval"], [WXCFG=""])
1058
1059AC_ARG_WITH([saga],
1060        [AS_HELP_STRING([--with-saga=PATH], [Specifies an alternative location for the SAGA-GIS library])],
1061        [SAGAPATH="$withval"], [SAGAPATH=""])
1062
1063AC_ARG_WITH([saga-version],
1064        [AS_HELP_STRING([--with-saga-version=VERSION], [Specifies the SAGA-GIS version number])],
1065        [SAGAVERS="$withval"], [SAGAVERS="2"])
1066
1067if test -z "$SAGAPATH"
1068then
1069        SAGA_LDFLAGS=""
1070        SAGA_CPPFLAGS=""
1071        SAGA_FILE=""
1072        SAGA_ENABLED=""
1073else
1074        if test -z "$WXCFG" ; then
1075           WXCFG="$(which wx-config)"
1076        fi
1077        if test "`$WXCFG --list | grep unicode`" == "" ; then
1078           AC_MSG_ERROR(SAGA requires a unicode build of wxGTK)
1079        fi
1080        WX_ISSUE="-D_WX_WXCRTVARARG_H_"
1081        SAGA_DEFS="-D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD -DMODULE_LIBRARY_PATH=\\\"$SAGAPATH/lib/saga\\\""
1082        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"
1083        SAGA_LDFLAGS="-fPIC `$WXCFG --unicode=yes --static=no --libs` -lsaga_api"
1084        SAGA_ENABLED="-DUSE_SAGA"
1085        SAGA_FILE="service_internal_saga.o"
1086       
1087        AC_LANG_PUSH([C++])
1088        # Check headers file
1089        CPPFLAGS_SAVE="$CPPFLAGS"
1090        CPPFLAGS="$SAGA_CPPFLAGS"
1091        LIBS_SAVE="$LIBS"
1092        LIBS="$SAGA_LDFLAGS"
1093        if test "$SAGAVERS" == "2"; then
1094        AC_CHECK_HEADERS([module_library.h],
1095                        [], [AC_MSG_ERROR([could not find header file $i related to SAGA-GIS])])
1096        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "module_library.h"],[SG_Get_Module_Library_Manager();]])],
1097                [AC_MSG_RESULT([checking for SG_Get_Module_Library_Manager... yes])],[AC_MSG_ERROR([checking for SG_Get_Module_Library_Manager... failed])])
1098        else
1099        AC_CHECK_HEADERS([tool_library.h],
1100                        [], [AC_MSG_ERROR([could not find header file $i related to SAGA-GIS])])
1101        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "tool_library.h"],[SG_Get_Tool_Library_Manager();]])],
1102                [AC_MSG_RESULT([checking for SG_Get_Tool_Library_Manager... yes])],[AC_MSG_ERROR([checking for SG_Get_Tool_Library_Manager... failed])])
1103        fi
1104       
1105        LIBS="$LIBS_SAVE"
1106        AC_LANG_POP([C++])
1107fi
1108AC_SUBST([SAGA_CPPFLAGS])
1109AC_SUBST([SAGA_LDFLAGS])
1110AC_SUBST([SAGA_FILE])
1111AC_SUBST([SAGA_ENABLED])
1112
1113AC_CONFIG_FILES([Makefile])
1114AC_CONFIG_FILES([ZOOMakefile.opts])
1115AC_CONFIG_FILES([main.cfg])
1116AC_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