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

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

Fix issue with headers located in extern C. Define java.library.path at runtime to search for libZOO.so from the Java zoo-api.

File size: 28.1 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"
336CPPFLAGS="$CGAL_CPPFLAGS"
337AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
338         [], [AC_MSG_WARN([could not find headers include related to libCGAL])])
339
340# Extract the linker and include flags
341CGAL_LDFLAGS="-L$CGALPATH/lib"
342CGAL_CPPFLAGS="-I$CGALPATH/include"
343
344
345AC_SUBST([CGAL_CPPFLAGS])
346AC_SUBST([CGAL_LDFLAGS])
347#============================================================================
348# Detect if mapserver is installed
349#============================================================================
350
351AC_ARG_WITH([mapserver],
352       [AS_HELP_STRING([--with-mapserver=PATH], [Specifies the path for MapServer compiled source tree])],
353       [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""])
354
355AC_ARG_WITH([ms-version],
356       [AS_HELP_STRING([--with-ms-version=VERSION], [Specifies the MapServer version to build against])],
357       [MS_VERSION="$withval"], [MS_VERSION=""])
358
359if test -z $MS_SRC_PATH;
360then
361        MS_CPPFLAGS=""
362        MS_LDFLAGS=""
363else
364       if test "x$MS_SRC_PATH" = "xmacos";
365       then
366               MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl"
367               MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver "
368               AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree])
369               AC_MSG_RESULT([Using MacOS X Framework for MapServer])
370       else
371        if test "x$MS_VERSION" = "x7";
372        then
373                MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
374                MS_CPPFLAGS="-DUSE_MS -I$MS_SRC_PATH/include/mapserver "
375                AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
376        else
377               if test -d $MS_SRC_PATH; then
378                       MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`"
379                       MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH "
380               
381                       AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
382               else
383                       AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist])
384               fi
385        fi
386       fi
387       MS_FILE="service_internal_ms.o"
388fi
389
390MS_CFLAGS="$MS_CPPFLAGS"
391MS_LIBS="$MS_LDFLAGS"
392
393AC_SUBST([MS_CFLAGS])
394AC_SUBST([MS_LIBS])
395AC_SUBST([MS_FILE])
396
397# ===========================================================================
398# Detect if python is installed
399# ===========================================================================
400
401AC_ARG_WITH([python],
402        [AS_HELP_STRING([--with-python=PATH], [To enable python support or Specifies an alternative directory for python installation,  disabled by default])],
403        [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
404
405AC_ARG_WITH([pyvers],
406        [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])],
407        [PYTHON_VERS="$withval"], [PYTHON_VERS=""])
408
409
410if test -z "$PYTHON_ENABLED"
411then
412        PYTHON_FILE=""
413else
414        PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
415        PYTHON_FILE="service_internal_python.o"
416        if test  "$PYTHON_PATH" = "yes"
417        then
418                # PHP was not specified, so search within the current path
419                PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
420                if test -z "${PYTHONCFG_PATH}" ; then
421                AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}])
422                else
423                AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config])
424                fi
425        else
426                PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
427        fi
428
429        # Extract the linker and include flags
430        PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
431        PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
432
433        # Check headers file
434        CPPFLAGS_SAVE="$CPPFLAGS"
435        CPPFLAGS="$PYTHON_CPPFLAGS"
436        AC_CHECK_HEADERS([Python.h],
437                 [], [AC_MSG_ERROR([could not find headers include related to libpython])])
438
439        # Ensure we can link against libphp
440        LIBS_SAVE="$LIBS"
441        LIBS="$PYTHON_LDFLAGS"
442        PY_LIB=`$PYTHONCONFIG --libs | sed \
443                              -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
444        AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
445        LIBS="$LIBS_SAVE"
446fi
447
448AC_SUBST([PYTHON_CPPFLAGS])
449AC_SUBST([PYTHON_LDFLAGS])
450AC_SUBST([PYTHON_ENABLED])
451AC_SUBST([PYTHON_FILE])
452
453# ===========================================================================
454# Detect if spidermonkey is installed
455# ===========================================================================
456
457AC_ARG_WITH([js],
458        [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 ])],
459        [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""])
460
461if test -z "$JS_ENABLED"
462then
463        JS_FILE=""
464else
465        JS_FILE="service_internal_js.o"
466        if test "$JSHOME" = "yes"
467        then
468
469                #on teste si on est sous debian like
470                if test -f "/usr/bin/dpkg"
471                then
472                        if test -n "`dpkg -l | grep libmozjs185-dev`"
473                        then
474                                JS_CPPFLAGS="-I/usr/include/js/"
475                                JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm"
476                                JS_LIB="mozjs185"
477                        else
478                                XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`"
479                                if test -n "$XUL_VERSION"
480                                then
481                                        JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION"
482                                        JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm"
483                                        JS_LIB="mozjs"
484                                else
485                                        AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ])
486                                fi
487                        fi
488                else
489                        AC_MSG_ERROR([You must  specify your custom install of libmozjs185])
490                fi
491        else
492                JS_CPPFLAGS="-I$JSHOME/include/js/"
493                JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm"
494                JS_LIB="mozjs185"
495
496        fi
497        CPPFLAGS_SAVE="$CPPFLAGS"
498        CPPFLAGS="$JS_CPPFLAGS"
499        AC_LANG_PUSH([C++])
500        AC_CHECK_HEADERS([jsapi.h],
501                        [], [AC_MSG_ERROR([could not find headers include related to libjs])])
502
503        AC_LANG_POP([C++])
504        LIBS_SAVE="$LIBS"
505        LIBS="$JS_LDFLAGS"
506
507        AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])
508        LIBS="$LIBS_SAVE"
509       
510        AC_SUBST([JS_CPPFLAGS])
511        AC_SUBST([JS_LDFLAGS])
512fi
513
514AC_SUBST([JS_ENABLED])
515AC_SUBST([JS_FILE])
516
517# ===========================================================================
518# Detect if php is installed
519# ===========================================================================
520
521AC_ARG_WITH([php],
522        [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation,  disabled by default])],
523        [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
524
525
526if test -z "$PHP_ENABLED"
527then
528        PHP_FILE=""
529else
530        PHPCONFIG="$PHP_PATH/bin/php-config"
531        PHP_FILE="service_internal_php.o"
532        if test  "$PHP_PATH" = "yes"
533        then
534                # PHP was not specified, so search within the current path
535                AC_PATH_PROG([PHPCONFIG], [php-config])
536        else
537                PHPCONFIG="$PHP_PATH/bin/php-config"
538        fi
539
540        # Extract the linker and include flags
541        PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
542        PHP_CPPFLAGS=`$PHPCONFIG --includes`
543
544        # Check headers file
545        CPPFLAGS_SAVE="$CPPFLAGS"
546        CPPFLAGS="$PHP_CPPFLAGS"
547        AC_CHECK_HEADERS([sapi/embed/php_embed.h],
548                 [], [AC_MSG_ERROR([could not find headers include related to libphp])])
549
550        # Ensure we can link against libphp
551        LIBS_SAVE="$LIBS"
552        LIBS="$PHP_LDFLAGS"
553        # Shouldn't we get php here rather than php5 :) ??
554        AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
555        LIBS="$LIBS_SAVE"
556        AC_SUBST([PHP_CPPFLAGS])
557        AC_SUBST([PHP_LDFLAGS])
558fi
559
560AC_SUBST([PHP_ENABLED])
561AC_SUBST([PHP_FILE])
562
563# ===========================================================================
564# Detect if java is installed
565# ===========================================================================
566
567AC_ARG_WITH([java],
568        [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME,  disabled by default])],
569        [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""])
570
571if test -z "$JAVA_ENABLED"
572then
573        JAVA_FILE=""
574else
575        JAVA_FILE="service_internal_java.o"
576        if test "x$JDKHOME" = "x";
577        then
578                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.])
579        fi      # JAVA was specified; display a message to the user
580        if test "x$JDKHOME" = "xyes";
581        then
582                AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java])
583        fi
584
585        # Extract the linker and include flags
586        if test "x$JDKHOME" = "xmacos";
587        then
588                JAVA_LDFLAGS="-framework JavaVM"
589                for i in `ls /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/`; do
590                    JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/$i/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
591                done
592        else
593                if test -d "$JDKHOME/jre/lib/i386";
594                then
595                        JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread"
596                        JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
597                else
598                        if test -d "$JDKHOME/jre/lib/amd64"; then
599                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread"
600                           JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
601                        else
602                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/server/ -ljvm -lpthread"
603                           JAVA_CPPFLAGS="-I$JDKHOME/include/ -I$JDKHOME/include/darwin"
604                        fi
605                fi
606        fi
607
608        AC_LANG([C++])
609        echo $JAVA_CPPFLAGS
610        # Check headers file (second time we check that in fact)
611        CPPFLAGS_SAVE="$CPPFLAGS"
612        CPPFLAGS="$JAVA_CPPFLAGS"
613        AC_CHECK_HEADERS([jni.h],
614                         [], [AC_MSG_ERROR([could not find jni.h file])])
615        CPPFLAGS="$CPPFLAGS_SAVE"
616        # Ensure we can link against libjava
617        LIBS_SAVE="$LIBS"
618        LIBS="$JAVA_LDFLAGS"
619        if test "x$JDKHOME" != "xmacos";
620        then
621                AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjvm])], [])
622        fi
623        LIBS="$LIBS_SAVE"
624
625        AC_SUBST([JAVA_CPPFLAGS])
626        AC_SUBST([JAVA_LDFLAGS])
627fi
628
629AC_SUBST([JAVA_ENABLED])
630AC_SUBST([JAVA_FILE])
631
632# ===========================================================================
633# Detect if ruby is installed
634# ===========================================================================
635AC_ARG_WITH([ruby],
636        [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation,  disabled by default])],
637        [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""])
638
639AC_ARG_WITH([rvers],
640        [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])],
641        [RUBY_VERS="$withval"], [RUBY_VERS=""])
642
643
644if test -z "$RUBY_ENABLED"
645then
646        RUBY_FILE=""
647else
648        RUBY_FILE="service_internal_ruby.o"
649
650        # Extract the linker and include flags
651        RUBY_LDFLAGS="-lruby"
652        RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS"
653
654        # Check headers file
655        CPPFLAGS_SAVE="$CPPFLAGS"
656        CPPFLAGS="$RUBY_CPPFLAGS"
657        AC_CHECK_HEADERS([ruby.h],
658                 [], [AC_MSG_ERROR([could not find headers include related to libruby])])
659
660        # Ensure we can link against libphp
661        LIBS_SAVE="$LIBS"
662        LIBS="$RUBY_LDFLAGS"
663        # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
664        LIBS="$LIBS_SAVE"
665        AC_SUBST([RUBY_CPPFLAGS])
666        AC_SUBST([RUBY_LDFLAGS])
667fi
668
669AC_SUBST([RUBY_ENABLED])
670AC_SUBST([RUBY_FILE])
671
672# ===========================================================================
673# Detect if perl is installed
674# ===========================================================================
675
676AC_ARG_WITH([perl],
677        [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation,  disabled by default])],
678        [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""])
679
680
681if test -z "$PERL_ENABLED"
682then
683        PERL_FILE=""
684else
685        PERL_FILE="service_internal_perl.o"
686        if test  "$PERL_PATH" = "yes"
687        then
688                # Perl was not specified, so search within the current path
689                AC_PATH_PROG([PERLCONFIG], [perl])
690        else
691                PERLCONFIG="$PERL_PATH/bin/perl"
692        fi
693
694        # Extract the linker and include flags
695        PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts`
696        PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts`
697
698        # Check headers file
699        CPPFLAGS_SAVE="$CPPFLAGS"
700        CPPFLAGS="$PERL_CPPFLAGS"
701        AC_CHECK_HEADERS([EXTERN.h],
702                 [], [AC_MSG_ERROR([could not find headers include related to libperl])])
703
704        AC_SUBST([PERL_CPPFLAGS])
705        AC_SUBST([PERL_LDFLAGS])
706fi
707
708AC_SUBST([PERL_ENABLED])
709AC_SUBST([PERL_FILE])
710
711# ===========================================================================
712# Detect if otb is available
713# ===========================================================================
714
715AC_ARG_WITH([itk],
716        [AS_HELP_STRING([--with-itk=PATH], [Specifies an alternative location for the itk library])],
717        [ITKPATH="$withval"], [ITKPATH=""])
718
719AC_ARG_WITH([itk-version],
720        [AS_HELP_STRING([--with-itk-version=VERSION], [Specifies an alternative version for the itk library])],
721        [ITKVERS="$withval"], [ITKVERS=""])
722
723AC_ARG_WITH([otb],
724        [AS_HELP_STRING([--with-otb=PATH], [Specifies an alternative location for the otb library])],
725        [OTBPATH="$withval"], [OTBPATH=""])
726
727if test -z "$OTBPATH"
728then
729        OTB_LDFLAGS=""
730        OTB_CPPFLAGS=""
731        OTB_FILE=""
732        OTB_ENABLED=""
733else
734        if test -z "$ITKVERS"
735        then
736                ITKVERS="4.5"
737        fi
738        OTB_ENABLED="-DUSE_OTB"
739        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"
740        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"
741        OTB_FILE="otbZooWatcher.o service_internal_otb.o"
742       
743        AC_LANG_PUSH([C++])
744        # Check headers file
745        CPPFLAGS_SAVE="$CPPFLAGS"
746        CPPFLAGS="$OTB_CPPFLAGS"
747        LDFLAGS_SAVE="$LDFLAGS"
748        LIBS="$LIBS_SAVE $OTB_LDFLAGS"
749        AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
750                        [], [AC_MSG_ERROR([could not find header file $i related to OTB])])
751        AC_LANG_POP([C++])
752        AC_LANG(C++)
753        LDFLAGS_SAVE="$LDFLAGS"
754        LDFLAGS="$OTB_LDFLAGS"
755        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplication.h"],[std::vector<std::string> list = otb::Wrapwper::ApplicationRegistry::GetAvailableApplication();]])],
756                [AC_MSG_RESULT([checking for GetAvailableApplication... yes])],[AC_MSG_ERROR([checking for GetAvailableApplication... failed])])
757        LDFLAGS="$LDFLAGS_SAVE"
758                       
759fi
760AC_SUBST([OTB_CPPFLAGS])
761AC_SUBST([OTB_LDFLAGS])
762AC_SUBST([OTB_FILE])
763AC_SUBST([OTB_ENABLED])
764
765# ===========================================================================
766# Detect if saga-gis is available
767# ===========================================================================
768
769AC_ARG_WITH([wx-config],
770        [AS_HELP_STRING([--with-wx-config=PATH], [Specifies an alternative path for the wx-config tool])],
771        [WXCFG="$withval"], [WXCFG=""])
772
773AC_ARG_WITH([saga],
774        [AS_HELP_STRING([--with-saga=PATH], [Specifies an alternative location for the SAGA-GIS library])],
775        [SAGAPATH="$withval"], [SAGAPATH=""])
776
777if test -z "$SAGAPATH"
778then
779        SAGA_LDFLAGS=""
780        SAGA_CPPFLAGS=""
781        SAGA_FILE=""
782        SAGA_ENABLED=""
783else
784        if test -z "$WXCFG" ; then
785           WXCFG="$(which wx-config)"
786        fi
787        if test "`$WXCFG --list | grep unicode`" == "" ; then
788           AC_MSG_ERROR(SAGA requires a unicode build of wxGTK)
789        fi
790        WX_ISSUE="-D_WX_WXCRTVARARG_H_"
791        SAGA_DEFS="-D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD -DMODULE_LIBRARY_PATH=\\\"$SAGAPATH/lib/saga\\\""
792        SAGA_CPPFLAGS=" -fPIC -I$SAGAPATH/include/saga/saga_core/saga_api/ `$WXCFG --unicode=yes --static=no --cxxflags` -D_SAGA_UNICODE $SAGA_DEFS $WX_ISSUE"
793        SAGA_LDFLAGS="-fPIC `$WXCFG --unicode=yes --static=no --libs` -lsaga_api"
794        SAGA_ENABLED="-DUSE_SAGA"
795        SAGA_FILE="service_internal_saga.o"
796       
797        AC_LANG_PUSH([C++])
798        # Check headers file
799        CPPFLAGS_SAVE="$CPPFLAGS"
800        CPPFLAGS="$SAGA_CPPFLAGS"
801        LIBS_SAVE="$LIBS"
802        LIBS="$SAGA_LDFLAGS"
803        AC_CHECK_HEADERS([module_library.h],
804                        [], [AC_MSG_ERROR([could not find header file $i related to SAGA-GIS])])
805        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "module_library.h"],[SG_Get_Module_Library_Manager();]])],
806                [AC_MSG_RESULT([checking for SG_Get_Module_Library_Manager... yes])],[AC_MSG_ERROR([checking for SG_Get_Module_Library_Manager... failed])])
807        LIBS="$LIBS_SAVE"
808        AC_LANG_POP([C++])
809fi
810AC_SUBST([SAGA_CPPFLAGS])
811AC_SUBST([SAGA_LDFLAGS])
812AC_SUBST([SAGA_FILE])
813AC_SUBST([SAGA_ENABLED])
814
815AC_CONFIG_FILES([Makefile])
816AC_CONFIG_FILES([ZOOMakefile.opts])
817AC_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