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

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

Add support for R language and its documentation.

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