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

Last change on this file since 775 was 775, checked in by djay, 9 years ago

Add GDAL 2 support to the cgal services. Updadte otb support to build against OTB 5.4.

File size: 29.5 KB
Line 
1AC_INIT([ZOO Kernel], [1.5.0], [bugs@zoo-project.org])
2
3# Checks for programs.
4AC_PROG_YACC
5AC_PROG_CC
6AC_PROG_LEX
7AC_PROG_CXX
8AC_PROG_SED
9
10# Checks for libraries.
11AC_CHECK_LIB([curl], [curl_easy_init,curl_easy_setopt,curl_easy_cleanup,curl_easy_perform])
12AC_CHECK_LIB([dl], [dlopen,dlsym,dlerror,dlclose])
13AC_CHECK_LIB([crypto], [EVP_DigestInit,EVP_md5,EVP_DigestUpdate,BIO_f_base64,BIO_new])
14AC_CHECK_LIB([uuid], [uuid_generate_time])
15
16DEFAULT_LIBS="$LIBS"
17AC_SUBST([DEFAULT_LIBS])
18
19
20# Checks for header files.
21AC_FUNC_ALLOCA
22AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h malloc.h stddef.h stdlib.h string.h unistd.h])
23
24# Checks for typedefs, structures, and compiler characteristics.
25AC_HEADER_STDBOOL
26AC_TYPE_INT16_T
27AC_TYPE_INT32_T
28AC_TYPE_INT8_T
29AC_TYPE_PID_T
30AC_TYPE_SIZE_T
31AC_TYPE_UINT16_T
32AC_TYPE_UINT32_T
33AC_TYPE_UINT8_T
34
35# Checks for library functions.
36AC_FUNC_FORK
37AC_FUNC_MALLOC
38AC_FUNC_REALLOC
39AC_CHECK_FUNCS([dup2 getcwd memset setenv strdup strstr])
40
41#============================================================================
42# Detect if openssl is available
43#============================================================================
44
45AC_ARG_WITH([openssl],
46    [AS_HELP_STRING([--with-openssl=PATH], [Specifies an alternative location for the openssl library])],
47    [OPENSSL_DIR="$withval"], [OPENSSL_DIR="/usr/"])
48OPENSSL_CFLAGS="-I$OPENSSL_DIR/include"
49OPENSSL_LDFLAGS="-lcrypto -L$OPENSSL_DIR/lib -lssl"
50CPPFLAGS_SAVE="$CPPFLAGS"
51CPPFLAGS="$OPENSSL_CFLAGS"
52LIBS_SAVE="$LIBS"
53LIBS="$OPENSSL_LDFLAGS"
54AC_CHECK_HEADERS([openssl/md5.h openssl/hmac.h openssl/evp.h openssl/bio.h openssl/buffer.h],
55                        [], [AC_MSG_ERROR([could not find header file $i related to openssl])])
56AC_CHECK_LIB(crypto, BIO_f_base64,
57                        [], [AC_MSG_ERROR([could not find $i function in openssl library])])
58AC_SUBST([OPENSSL_CFLAGS])
59AC_SUBST([OPENSSL_LDFLAGS])
60
61#============================================================================
62# Detect if run on debian / ubuntu
63#============================================================================
64if test -f "/usr/bin/dpkg"
65then
66        DEB_DEF=-DDEB
67fi
68AC_SUBST([DEB_DEF])
69
70AC_ARG_WITH([cgi-dir],
71    [AS_HELP_STRING([--with-cgi-dir=PATH], [Specifies an alternative cgi directory path ( default: /usr/lib/cgi-bin) ])],
72    [CGI_DIR="$withval"], [CGI_DIR="/usr/lib/cgi-bin"])
73AC_SUBST([CGI_DIR])
74
75AC_ARG_WITH([db-backend],
76    [AS_HELP_STRING([--with-db-backend], [Relies on a database for storing status messages and response files ])],
77    [RELY_ON_DB="-DRELY_ON_DB"], [RELY_ON_DB=""])
78AC_SUBST([RELY_ON_DB])
79
80
81# ===========================================================================
82# Detect if libyaml is available
83# ===========================================================================
84
85AC_ARG_WITH([yaml],
86        [AS_HELP_STRING([--with-yaml=PATH], [Specifies an alternative location for the yaml library])],
87        [YAMLPATH="$withval"], [YAMLPATH=""])
88
89if test -z "$YAMLPATH"
90then
91        YAML_LDFLAGS=""
92        YAML_CPPFLAGS=""
93        YAML_FILE=""
94        YAML_FILE1=""
95else
96
97        # Extract the linker and include flags
98        YAML_LDFLAGS="-L$YAMLPATH/lib -lyaml"
99        YAML_CPPFLAGS="-I$YAMLPATH/include -DYAML"
100        YAML_FILE="service_yaml.o"
101        YAML_FILE1="zcfg2yaml"
102       
103        # Check headers file
104        CPPFLAGS_SAVE="$CPPFLAGS"
105        CPPFLAGS="$YAML_CPPFLAGS"
106        LIBS_SAVE="$LIBS"
107        LIBS="$YAML_LDFLAGS"
108        AC_CHECK_LIB([yaml], [yaml_parser_initialize,yaml_parser_set_input_file,yaml_parser_scan])
109        AC_CHECK_HEADERS([yaml.h],
110                 [], [AC_MSG_ERROR([could not find headers include related to YAML])])
111        LIBS="$LIBS_SAVE"
112fi
113AC_SUBST([YAML_CPPFLAGS])
114AC_SUBST([YAML_LDFLAGS])
115AC_SUBST([YAML_FILE])
116AC_SUBST([YAML_FILE1])
117
118# ===========================================================================
119# Detect if fastcgi is available
120# ===========================================================================
121
122AC_ARG_WITH([fastcgi],
123        [AS_HELP_STRING([--with-fastcgi=PATH], [Specifies an alternative location for the fastcgi library])],
124        [FCGIPATH="$withval"], [FCGIPATH="/usr"])
125
126# Extract the linker and include flags
127FCGI_LDFLAGS="-L$FCGIPATH/lib -lfcgi"
128FCGI_CPPFLAGS="-I$FCGIPATH/include"
129
130# Check headers file
131CPPFLAGS_SAVE="$CPPFLAGS"
132CPPFLAGS="$FCGI_CPPFLAGS"
133LIBS_SAVE="$LIBS"
134LIBS="$FCGI_LDFLAGS"
135AC_CHECK_LIB([fcgi], [main])
136AC_CHECK_HEADERS([fcgi_stdio.h],
137                 [], [AC_MSG_ERROR([could not find headers include related to fastcgi])])
138LIBS="$LIBS_SAVE"
139AC_SUBST([FCGI_CPPFLAGS])
140AC_SUBST([FCGI_LDFLAGS])
141
142# ===========================================================================
143# Detect if libxml2 is installed
144# ===========================================================================
145
146AC_ARG_WITH([xml2config],
147        [AS_HELP_STRING([--with-xml2config=FILE], [Specifies an alternative xml2-config file])],
148        [XML2CONFIG="$withval"], [XML2CONFIG=""])
149
150if test "x$XML2CONFIG" = "x"; then
151        # XML2CONFIG was not specified, so search within the current path
152        AC_PATH_PROG([XML2CONFIG], [xml2-config])
153
154        # If we couldn't find xml2-config, display a warning
155        if test "x$XML2CONFIG" = "x"; then
156                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.])
157        fi
158else
159        # XML2CONFIG was specified; display a message to the user
160        if test "x$XML2CONFIG" = "xyes"; then
161                AC_MSG_ERROR([you must Specifies a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config])
162        else
163                if test -f $XML2CONFIG; then
164                        AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG])
165                else
166                        AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist])
167                fi     
168        fi
169fi
170
171# Extract the linker and include flags
172XML2_LDFLAGS=`$XML2CONFIG --libs`
173XML2_CPPFLAGS=`$XML2CONFIG --cflags`
174
175# Check headers file
176CPPFLAGS_SAVE="$CPPFLAGS"
177CPPFLAGS="$XML2_CPPFLAGS"
178AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h],
179                 [], [AC_MSG_ERROR([could not find headers include related to libxml2])])
180
181# Ensure we can link against libxml2
182LIBS_SAVE="$LIBS"
183LIBS="$XML2_LDFLAGS"
184AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], [])
185
186AC_SUBST([XML2_CPPFLAGS])
187AC_SUBST([XML2_LDFLAGS])
188LIBS="$LIBS_SAVE"
189
190
191# ===========================================================================
192# Detect if libxslt is installed
193# ===========================================================================
194
195AC_ARG_WITH([xsltconfig],
196        [AS_HELP_STRING([--with-xsltconfig=FILE], [Specifies an alternative xslt-config file])],
197        [XSLTCONFIG="$withval"], [XSLTCONFIG=""])
198
199if test "x$XSLTCONFIG" = "x"; then
200        # XSLTCONFIG was not specified, so search within the current path
201        AC_PATH_PROG([XSLTCONFIG], [xslt-config])
202
203        # If we couldn't find xslt-config, display a warning
204        if test "x$XSLTCONFIG" = "x"; then
205                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.])
206        fi
207else
208        # XSLTCONFIG was specified; display a message to the user
209        if test "x$XSLTCONFIG" = "xyes"; then
210                AC_MSG_ERROR([you must Specifies a parameter to --with-xsltconfig, e.g. --with-xsltconfig=/path/to/xslt-config])
211        else
212                if test -f $XSLTCONFIG; then
213                        AC_MSG_RESULT([Using user-specified xslt-config file: $XSLTCONFIG])
214                else
215                        AC_MSG_ERROR([the user-specified xslt-config file $XSLTCONFIG does not exist])
216                fi     
217        fi
218fi
219
220# Extract the linker and include flags
221XSLT_LDFLAGS=`$XSLTCONFIG --libs`
222XSLT_CPPFLAGS=`$XSLTCONFIG --cflags`
223
224# Check headers file
225CPPFLAGS_SAVE="$CPPFLAGS"
226CPPFLAGS="$XSLT_CPPFLAGS"
227AC_CHECK_HEADERS([libxslt/xslt.h libxslt/xsltInternals.h libxslt/transform.h libxslt/xsltutils.h],
228                 [], [AC_MSG_ERROR([could not find headers include related to libxlst])])
229
230AC_SUBST([XSLT_CPPFLAGS])
231AC_SUBST([XSLT_LDFLAGS])
232
233#============================================================================
234# Detect if gdal is installed
235#============================================================================
236
237AC_ARG_WITH([gdal-config],
238        [AS_HELP_STRING([--with-gdal-config=FILE], [Specifies an alternative gdal-config file])],
239        [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""])
240if test -z $GDAL_CONFIG;
241then
242        AC_PATH_PROG([GDAL_CONFIG], [gdal-config])
243        if test -z $GDAL_CONFIG;
244        then
245                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.])
246        fi
247       
248else
249        if test -f $GDAL_CONFIG; then
250                AC_MSG_RESULT([Using user-specified gdal-config file: $GDAL_CONFIG])
251        else
252                AC_MSG_ERROR([the user-specified gdal-config file $GDAL_CONFIG does not exist])
253        fi
254fi
255
256GDAL_CFLAGS="`$GDAL_CONFIG --cflags`"
257GDAL_LIBS="`$GDAL_CONFIG --libs`"
258
259AC_SUBST([GDAL_CFLAGS])
260AC_SUBST([GDAL_LIBS])
261
262# ===========================================================================
263# Detect if proj is installed
264# ===========================================================================
265
266AC_ARG_WITH([proj],
267        [AS_HELP_STRING([--with-proj=PATH], [Specifies an alternative location for PROJ4 setup])],
268        [PROJPATH="$withval"], [PROJPATH=""])
269
270# Extract the linker and include flags
271PROJ_LDFLAGS="-L$PROJPATH/lib"
272PROJ_CPPFLAGS="-I$PROJPATH/include"
273
274# Check headers file
275CPPFLAGS_SAVE="$CPPFLAGS"
276CPPFLAGS="$PROJ_CPPFLAGS"
277AC_CHECK_HEADERS([proj_api.h],
278                 [], [AC_MSG_ERROR([could not find headers include related to PROJ4])])
279
280AC_SUBST([PROJ_CPPFLAGS])
281AC_SUBST([PROJ_LDFLAGS])
282
283# ===========================================================================
284# Detect if libgeos is installed
285# ===========================================================================
286
287AC_ARG_WITH([geosconfig],
288        [AS_HELP_STRING([--with-geosconfig=FILE], [Specifies an alternative geos-config file])],
289        [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
290
291if test "x$GEOSCONFIG" = "x"; then
292        # GEOSCONFIG was not specified, so search within the current path
293        AC_PATH_PROG([GEOSCONFIG], [geos-config])
294
295        # If we couldn't find geos-config, display a warning
296        if test "x$GEOSCONFIG" = "x"; then
297                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.])
298        fi
299else
300        # GEOSCONFIG was specified; display a message to the user
301        if test "x$GEOSCONFIG" = "xyes"; then
302                AC_MSG_WARN([you must Specifies a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
303        else
304                if test -f $GEOSCONFIG; then
305                        AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
306                else
307                        AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
308                fi     
309        fi
310fi
311
312GEOS_LDFLAGS=`$GEOSCONFIG --libs`
313GEOS_CPPFLAGS=`$GEOSCONFIG --cflags`
314
315# Check headers file
316CPPFLAGS_SAVE="$CPPFLAGS"
317CPPFLAGS="$GEOS_CPPFLAGS"
318AC_CHECK_HEADERS([geos_c.h],
319                 [], [AC_MSG_WARN([could not find headers include related to libgeos])])
320
321AC_SUBST([GEOS_CPPFLAGS])
322AC_SUBST([GEOS_LDFLAGS])
323
324
325# ===========================================================================
326# Detect if cgal is installed
327# ===========================================================================
328
329AC_ARG_WITH([cgal],
330        [AS_HELP_STRING([--with-cgal=PATH], [Specifies an alternative location for CGAL setup])],
331        [CGALPATH="$withval"], [CGALPATH="/usr"])
332
333
334# Check headers file
335CPPFLAGS_SAVE="$CPPFLAGS"
336CGAL_CPPFLAGS="-I$CGALPATH/include"
337CPPFLAGS="$CGAL_CPPFLAGS"
338AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
339         [], [AC_MSG_WARN([could not find headers include related to libCGAL])])
340
341# Extract the linker and include flags
342CGAL_LDFLAGS="-L$CGALPATH/lib"
343CGAL_CPPFLAGS="-I$CGALPATH/include"
344
345
346AC_SUBST([CGAL_CPPFLAGS])
347AC_SUBST([CGAL_LDFLAGS])
348#============================================================================
349# Detect if mapserver is installed
350#============================================================================
351
352AC_ARG_WITH([mapserver],
353       [AS_HELP_STRING([--with-mapserver=PATH], [Specifies the path for MapServer compiled source tree])],
354       [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""])
355
356AC_ARG_WITH([ms-version],
357       [AS_HELP_STRING([--with-ms-version=VERSION], [Specifies the MapServer version to build against])],
358       [MS_VERSION="$withval"], [MS_VERSION=""])
359
360if test -z $MS_SRC_PATH;
361then
362        MS_CPPFLAGS=""
363        MS_LDFLAGS=""
364else
365       if test "x$MS_SRC_PATH" = "xmacos";
366       then
367               MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl"
368               MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver "
369               AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree])
370               AC_MSG_RESULT([Using MacOS X Framework for MapServer])
371       else
372        if test "x$MS_VERSION" = "x7";
373        then
374                MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
375                MS_CPPFLAGS="-DUSE_MS -I$MS_SRC_PATH/include/mapserver "
376                AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
377        else
378               if test -d $MS_SRC_PATH; then
379                       MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`"
380                       MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH "
381               
382                       AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
383               else
384                       AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist])
385               fi
386        fi
387       fi
388       MS_FILE="service_internal_ms.o"
389fi
390
391MS_CFLAGS="$MS_CPPFLAGS"
392MS_LIBS="$MS_LDFLAGS"
393
394AC_SUBST([MS_CFLAGS])
395AC_SUBST([MS_LIBS])
396AC_SUBST([MS_FILE])
397
398# ===========================================================================
399# Detect if python is installed
400# ===========================================================================
401
402AC_ARG_WITH([python],
403        [AS_HELP_STRING([--with-python=PATH], [To enable python support or Specifies an alternative directory for python installation,  disabled by default])],
404        [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
405
406AC_ARG_WITH([pyvers],
407        [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])],
408        [PYTHON_VERS="$withval"], [PYTHON_VERS=""])
409
410
411if test -z "$PYTHON_ENABLED"
412then
413        PYTHON_FILE=""
414else
415        PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
416        PYTHON_FILE="service_internal_python.o"
417        if test  "$PYTHON_PATH" = "yes"
418        then
419                # PHP was not specified, so search within the current path
420                PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
421                if test -z "${PYTHONCFG_PATH}" ; then
422                AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}])
423                else
424                AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config])
425                fi
426        else
427                PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
428        fi
429
430        # Extract the linker and include flags
431        PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
432        PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
433
434        # Check headers file
435        CPPFLAGS_SAVE="$CPPFLAGS"
436        CPPFLAGS="$PYTHON_CPPFLAGS"
437        AC_CHECK_HEADERS([Python.h],
438                 [], [AC_MSG_ERROR([could not find headers include related to libpython])])
439
440        # Ensure we can link against libphp
441        LIBS_SAVE="$LIBS"
442        LIBS="$PYTHON_LDFLAGS"
443        PY_LIB=`$PYTHONCONFIG --libs | sed \
444                              -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
445        AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
446        LIBS="$LIBS_SAVE"
447fi
448
449AC_SUBST([PYTHON_CPPFLAGS])
450AC_SUBST([PYTHON_LDFLAGS])
451AC_SUBST([PYTHON_ENABLED])
452AC_SUBST([PYTHON_FILE])
453
454# ===========================================================================
455# Detect if spidermonkey is installed
456# ===========================================================================
457
458AC_ARG_WITH([js],
459        [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 ])],
460        [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""])
461
462if test -z "$JS_ENABLED"
463then
464        JS_FILE=""
465else
466        JS_FILE="service_internal_js.o"
467        if test "$JSHOME" = "yes"
468        then
469
470                #on teste si on est sous debian like
471                if test -f "/usr/bin/dpkg"
472                then
473                        if test -n "`dpkg -l | grep libmozjs185-dev`"
474                        then
475                                JS_CPPFLAGS="-I/usr/include/js/"
476                                JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm"
477                                JS_LIB="mozjs185"
478                        else
479                                XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`"
480                                if test -n "$XUL_VERSION"
481                                then
482                                        JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION"
483                                        JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm"
484                                        JS_LIB="mozjs"
485                                else
486                                        AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ])
487                                fi
488                        fi
489                else
490                        AC_MSG_ERROR([You must  specify your custom install of libmozjs185])
491                fi
492        else
493                JS_CPPFLAGS="-I$JSHOME/include/js/"
494                JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm"
495                JS_LIB="mozjs185"
496
497        fi
498        CPPFLAGS_SAVE="$CPPFLAGS"
499        CPPFLAGS="$JS_CPPFLAGS"
500        AC_LANG_PUSH([C++])
501        AC_CHECK_HEADERS([jsapi.h],
502                        [], [AC_MSG_ERROR([could not find headers include related to libjs])])
503
504        AC_LANG_POP([C++])
505        LIBS_SAVE="$LIBS"
506        LIBS="$JS_LDFLAGS"
507
508        AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])
509        LIBS="$LIBS_SAVE"
510       
511        AC_SUBST([JS_CPPFLAGS])
512        AC_SUBST([JS_LDFLAGS])
513fi
514
515AC_SUBST([JS_ENABLED])
516AC_SUBST([JS_FILE])
517
518# ===========================================================================
519# Detect if php is installed
520# ===========================================================================
521
522AC_ARG_WITH([php],
523        [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation,  disabled by default])],
524        [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
525
526
527if test -z "$PHP_ENABLED"
528then
529        PHP_FILE=""
530else
531        PHPCONFIG="$PHP_PATH/bin/php-config"
532        PHP_FILE="service_internal_php.o"
533        if test  "$PHP_PATH" = "yes"
534        then
535                # PHP was not specified, so search within the current path
536                AC_PATH_PROG([PHPCONFIG], [php-config])
537        else
538                PHPCONFIG="$PHP_PATH/bin/php-config"
539        fi
540
541        # Extract the linker and include flags
542        PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
543        PHP_CPPFLAGS=`$PHPCONFIG --includes`
544
545        # Check headers file
546        CPPFLAGS_SAVE="$CPPFLAGS"
547        CPPFLAGS="$PHP_CPPFLAGS"
548        AC_CHECK_HEADERS([sapi/embed/php_embed.h],
549                 [], [AC_MSG_ERROR([could not find headers include related to libphp])])
550
551        # Ensure we can link against libphp
552        LIBS_SAVE="$LIBS"
553        LIBS="$PHP_LDFLAGS"
554        # Shouldn't we get php here rather than php5 :) ??
555        AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
556        LIBS="$LIBS_SAVE"
557        AC_SUBST([PHP_CPPFLAGS])
558        AC_SUBST([PHP_LDFLAGS])
559fi
560
561AC_SUBST([PHP_ENABLED])
562AC_SUBST([PHP_FILE])
563
564# ===========================================================================
565# Detect if java is installed
566# ===========================================================================
567
568AC_ARG_WITH([java],
569        [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME,  disabled by default])],
570        [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""])
571
572if test -z "$JAVA_ENABLED"
573then
574        JAVA_FILE=""
575else
576        JAVA_FILE="service_internal_java.o"
577        if test "x$JDKHOME" = "x";
578        then
579                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.])
580        fi      # JAVA was specified; display a message to the user
581        if test "x$JDKHOME" = "xyes";
582        then
583                AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java])
584        fi
585
586        # Extract the linker and include flags
587        if test "x$JDKHOME" = "xmacos";
588        then
589                JAVA_LDFLAGS="-framework JavaVM"
590                for i in `ls /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/`; do
591                    JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/$i/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
592                done
593        else
594                if test -d "$JDKHOME/jre/lib/i386";
595                then
596                        JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread"
597                        JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
598                else
599                        if test -d "$JDKHOME/jre/lib/amd64"; then
600                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread"
601                           JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
602                        else
603                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/server/ -ljvm -lpthread"
604                           JAVA_CPPFLAGS="-I$JDKHOME/include/ -I$JDKHOME/include/darwin"
605                        fi
606                fi
607        fi
608
609        AC_LANG([C++])
610        echo $JAVA_CPPFLAGS
611        # Check headers file (second time we check that in fact)
612        CPPFLAGS_SAVE="$CPPFLAGS"
613        CPPFLAGS="$JAVA_CPPFLAGS"
614        AC_CHECK_HEADERS([jni.h],
615                         [], [AC_MSG_ERROR([could not find jni.h file])])
616        CPPFLAGS="$CPPFLAGS_SAVE"
617        # Ensure we can link against libjava
618        LIBS_SAVE="$LIBS"
619        LIBS="$JAVA_LDFLAGS"
620        if test "x$JDKHOME" != "xmacos";
621        then
622                AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjvm])], [])
623        fi
624        LIBS="$LIBS_SAVE"
625
626        AC_SUBST([JAVA_CPPFLAGS])
627        AC_SUBST([JAVA_LDFLAGS])
628fi
629
630AC_SUBST([JAVA_ENABLED])
631AC_SUBST([JAVA_FILE])
632
633# ===========================================================================
634# Detect if ruby is installed
635# ===========================================================================
636AC_ARG_WITH([ruby],
637        [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation,  disabled by default])],
638        [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""])
639
640AC_ARG_WITH([rvers],
641        [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])],
642        [RUBY_VERS="$withval"], [RUBY_VERS=""])
643
644
645if test -z "$RUBY_ENABLED"
646then
647        RUBY_FILE=""
648else
649        RUBY_FILE="service_internal_ruby.o"
650
651        # Extract the linker and include flags
652        RUBY_LDFLAGS="-lruby"
653        RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS"
654
655        # Check headers file
656        CPPFLAGS_SAVE="$CPPFLAGS"
657        CPPFLAGS="$RUBY_CPPFLAGS"
658        AC_CHECK_HEADERS([ruby.h],
659                 [], [AC_MSG_ERROR([could not find headers include related to libruby])])
660
661        # Ensure we can link against libphp
662        LIBS_SAVE="$LIBS"
663        LIBS="$RUBY_LDFLAGS"
664        # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
665        LIBS="$LIBS_SAVE"
666        AC_SUBST([RUBY_CPPFLAGS])
667        AC_SUBST([RUBY_LDFLAGS])
668fi
669
670AC_SUBST([RUBY_ENABLED])
671AC_SUBST([RUBY_FILE])
672
673# ===========================================================================
674# Detect if perl is installed
675# ===========================================================================
676
677AC_ARG_WITH([perl],
678        [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation,  disabled by default])],
679        [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""])
680
681
682if test -z "$PERL_ENABLED"
683then
684        PERL_FILE=""
685else
686        PERL_FILE="service_internal_perl.o"
687        if test  "$PERL_PATH" = "yes"
688        then
689                # Perl was not specified, so search within the current path
690                AC_PATH_PROG([PERLCONFIG], [perl])
691        else
692                PERLCONFIG="$PERL_PATH/bin/perl"
693        fi
694
695        # Extract the linker and include flags
696        PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts`
697        PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts`
698
699        # Check headers file
700        CPPFLAGS_SAVE="$CPPFLAGS"
701        CPPFLAGS="$PERL_CPPFLAGS"
702        AC_CHECK_HEADERS([EXTERN.h],
703                 [], [AC_MSG_ERROR([could not find headers include related to libperl])])
704
705        AC_SUBST([PERL_CPPFLAGS])
706        AC_SUBST([PERL_LDFLAGS])
707fi
708
709AC_SUBST([PERL_ENABLED])
710AC_SUBST([PERL_FILE])
711
712# ===========================================================================
713# Detect if otb is available
714# ===========================================================================
715
716AC_ARG_WITH([itk],
717        [AS_HELP_STRING([--with-itk=PATH], [Specifies an alternative location for the itk library])],
718        [ITKPATH="$withval"], [ITKPATH=""])
719
720AC_ARG_WITH([itk-version],
721        [AS_HELP_STRING([--with-itk-version=VERSION], [Specifies an alternative version for the itk library])],
722        [ITKVERS="$withval"], [ITKVERS=""])
723
724AC_ARG_WITH([otb],
725        [AS_HELP_STRING([--with-otb=PATH], [Specifies an alternative location for the otb library])],
726        [OTBPATH="$withval"], [OTBPATH=""])
727
728AC_ARG_WITH([otb-version],
729        [AS_HELP_STRING([--with-otb-version=PATH], [Specifies an alternative location for the otb library])],
730        [OTBVERS="$withval"], [OTBVERS=""])
731
732if test -z "$OTBPATH"
733then
734        OTB_LDFLAGS=""
735        OTB_CPPFLAGS=""
736        OTB_FILE=""
737        OTB_ENABLED=""
738else
739        if test -z "$ITKVERS"
740        then
741                ITKVERS="4.5"
742        fi
743        OTB_ENABLED="-DUSE_OTB"
744        if test -a "${OTBPATH}/include/OTB-${OTBVERS}" ; then
745                OTB_RPATH="$OTBPATH/include/OTB-${OTBVERS}/"
746                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"
747                OTB_LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -lOTBImageIO-$OTBVERS -lOTBCommon-$OTBVERS -lOTBApplicationEngine-$OTBVERS -L$ITKPATH/lib -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 "
748        else
749                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"
750                OTB_LDFLAGS="-L$OTBPATH/lib/otb -lOTBIO -lOTBCommon -lOTBApplicationEngine -L$ITKPATH/lib -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 -litkdouble-conversion-$ITKVERS -litkv3p_lsqr-$ITKVERS -litkv3p_netlib-$ITKVERS -litkvcl-$ITKVERS -litkvnl-$ITKVERS -litkvnl_algo-$ITKVERS -litkzlib-$ITKVERS"
751
752        fi
753        OTB_FILE="otbZooWatcher.o service_internal_otb.o"
754       
755        AC_LANG_PUSH([C++])
756        # Check headers file
757        CPPFLAGS_SAVE="$CPPFLAGS"
758        CPPFLAGS="$OTB_CPPFLAGS"
759        LDFLAGS_SAVE="$LDFLAGS"
760        LIBS="$LIBS_SAVE $OTB_LDFLAGS"
761        echo $OTB_CPPFLAGS
762        #AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
763        #               [], [AC_MSG_ERROR([could not find header file $i related to OTB])])
764        LDFLAGS_SAVE="$LDFLAGS"
765        LDFLAGS="$OTB_LDFLAGS"
766        echo $OTB_LDFLAGS
767        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplication.h"],[std::vector<std::string> list = otb::Wrapwper::ApplicationRegistry::GetAvailableApplication();]])],
768                [AC_MSG_RESULT([checking for GetAvailableApplication... yes])],[AC_MSG_ERROR([checking for GetAvailableApplication... failed])])
769        LDFLAGS="$LDFLAGS_SAVE"
770        AC_LANG_POP([C++])
771        AC_LANG(C++)
772                       
773fi
774AC_SUBST([OTB_CPPFLAGS])
775AC_SUBST([OTB_LDFLAGS])
776AC_SUBST([OTB_FILE])
777AC_SUBST([OTB_ENABLED])
778
779# ===========================================================================
780# Detect if saga-gis is available
781# ===========================================================================
782
783AC_ARG_WITH([wx-config],
784        [AS_HELP_STRING([--with-wx-config=PATH], [Specifies an alternative path for the wx-config tool])],
785        [WXCFG="$withval"], [WXCFG=""])
786
787AC_ARG_WITH([saga],
788        [AS_HELP_STRING([--with-saga=PATH], [Specifies an alternative location for the SAGA-GIS library])],
789        [SAGAPATH="$withval"], [SAGAPATH=""])
790
791if test -z "$SAGAPATH"
792then
793        SAGA_LDFLAGS=""
794        SAGA_CPPFLAGS=""
795        SAGA_FILE=""
796        SAGA_ENABLED=""
797else
798        if test -z "$WXCFG" ; then
799           WXCFG="$(which wx-config)"
800        fi
801        if test "`$WXCFG --list | grep unicode`" == "" ; then
802           AC_MSG_ERROR(SAGA requires a unicode build of wxGTK)
803        fi
804        WX_ISSUE="-D_WX_WXCRTVARARG_H_"
805        SAGA_DEFS="-D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD -DMODULE_LIBRARY_PATH=\\\"$SAGAPATH/lib/saga\\\""
806        SAGA_CPPFLAGS=" -fPIC -I$SAGAPATH/include/saga/saga_core/saga_api/ `$WXCFG --unicode=yes --static=no --cxxflags` -D_SAGA_UNICODE $SAGA_DEFS $WX_ISSUE"
807        SAGA_LDFLAGS="-fPIC `$WXCFG --unicode=yes --static=no --libs` -lsaga_api"
808        SAGA_ENABLED="-DUSE_SAGA"
809        SAGA_FILE="service_internal_saga.o"
810       
811        AC_LANG_PUSH([C++])
812        # Check headers file
813        CPPFLAGS_SAVE="$CPPFLAGS"
814        CPPFLAGS="$SAGA_CPPFLAGS"
815        LIBS_SAVE="$LIBS"
816        LIBS="$SAGA_LDFLAGS"
817        AC_CHECK_HEADERS([module_library.h],
818                        [], [AC_MSG_ERROR([could not find header file $i related to SAGA-GIS])])
819        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "module_library.h"],[SG_Get_Module_Library_Manager();]])],
820                [AC_MSG_RESULT([checking for SG_Get_Module_Library_Manager... yes])],[AC_MSG_ERROR([checking for SG_Get_Module_Library_Manager... failed])])
821        LIBS="$LIBS_SAVE"
822        AC_LANG_POP([C++])
823fi
824AC_SUBST([SAGA_CPPFLAGS])
825AC_SUBST([SAGA_LDFLAGS])
826AC_SUBST([SAGA_FILE])
827AC_SUBST([SAGA_ENABLED])
828
829AC_CONFIG_FILES([Makefile])
830AC_CONFIG_FILES([ZOOMakefile.opts])
831AC_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