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

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

Add support for SAGA-GIS 7.2.0

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