Ticket #150: configure.ac.remi

File configure.ac.remi, 32.3 KB (added by remicress, 7 years ago)
Line 
1AC_INIT([ZOO Kernel], [1.7.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([etc-dir],
71    [AS_HELP_STRING([--with-etc-dir=PATH], [Specifies an alternative path to store the main.cfg file ( default: ZOO-Kernel location) ])],
72    [ETC_DEF="#define ETC_DIR \\\"${sysconfdir}\\\""], [ETC_DEF=""])
73AC_SUBST([ETC_DEF])
74
75AC_ARG_WITH([cgi-dir],
76    [AS_HELP_STRING([--with-cgi-dir=PATH], [Specifies an alternative cgi directory path ( default: /usr/lib/cgi-bin) ])],
77    [CGI_DIR="$withval"], [CGI_DIR="/usr/lib/cgi-bin"])
78AC_SUBST([CGI_DIR])
79
80AC_ARG_WITH([db-backend],
81    [AS_HELP_STRING([--with-db-backend], [Relies on a database for storing status messages and response files ])],
82    [RELY_ON_DB="-DRELY_ON_DB"], [RELY_ON_DB=""])
83AC_SUBST([RELY_ON_DB])
84
85
86# ===========================================================================
87# Detect if libyaml is available
88# ===========================================================================
89
90AC_ARG_WITH([yaml],
91        [AS_HELP_STRING([--with-yaml=PATH], [Specifies an alternative location for the yaml library])],
92        [YAMLPATH="$withval"], [YAMLPATH=""])
93
94if test -z "$YAMLPATH"
95then
96        YAML_LDFLAGS=""
97        YAML_CPPFLAGS=""
98        YAML_FILE=""
99        YAML_FILE1=""
100else
101
102        # Extract the linker and include flags
103        YAML_LDFLAGS="-L$YAMLPATH/lib -lyaml"
104        YAML_CPPFLAGS="-I$YAMLPATH/include -DYAML"
105        YAML_FILE="service_yaml.o"
106        YAML_FILE1="zcfg2yaml"
107       
108        # Check headers file
109        CPPFLAGS_SAVE="$CPPFLAGS"
110        CPPFLAGS="$YAML_CPPFLAGS"
111        LIBS_SAVE="$LIBS"
112        LIBS="$YAML_LDFLAGS"
113        AC_CHECK_LIB([yaml], [yaml_parser_initialize,yaml_parser_set_input_file,yaml_parser_scan])
114        AC_CHECK_HEADERS([yaml.h],
115                 [], [AC_MSG_ERROR([could not find headers include related to YAML])])
116        LIBS="$LIBS_SAVE"
117fi
118AC_SUBST([YAML_CPPFLAGS])
119AC_SUBST([YAML_LDFLAGS])
120AC_SUBST([YAML_FILE])
121AC_SUBST([YAML_FILE1])
122
123# ===========================================================================
124# Detect if fastcgi is available
125# ===========================================================================
126
127AC_ARG_WITH([fastcgi],
128        [AS_HELP_STRING([--with-fastcgi=PATH], [Specifies an alternative location for the fastcgi library])],
129        [FCGIPATH="$withval"], [FCGIPATH="/usr"])
130
131# Extract the linker and include flags
132FCGI_LDFLAGS="-L$FCGIPATH/lib -lfcgi"
133FCGI_CPPFLAGS="-I$FCGIPATH/include"
134
135# Check headers file
136CPPFLAGS_SAVE="$CPPFLAGS"
137CPPFLAGS="$FCGI_CPPFLAGS"
138LIBS_SAVE="$LIBS"
139LIBS="$FCGI_LDFLAGS"
140AC_CHECK_LIB([fcgi], [main])
141AC_CHECK_HEADERS([fcgi_stdio.h],
142                 [], [AC_MSG_ERROR([could not find headers include related to fastcgi])])
143LIBS="$LIBS_SAVE"
144AC_SUBST([FCGI_CPPFLAGS])
145AC_SUBST([FCGI_LDFLAGS])
146
147# ===========================================================================
148# Detect if libxml2 is installed
149# ===========================================================================
150
151AC_ARG_WITH([xml2config],
152        [AS_HELP_STRING([--with-xml2config=FILE], [Specifies an alternative xml2-config file])],
153        [XML2CONFIG="$withval"], [XML2CONFIG=""])
154
155if test "x$XML2CONFIG" = "x"; then
156        # XML2CONFIG was not specified, so search within the current path
157        AC_PATH_PROG([XML2CONFIG], [xml2-config])
158
159        # If we couldn't find xml2-config, display a warning
160        if test "x$XML2CONFIG" = "x"; then
161                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.])
162        fi
163else
164        # XML2CONFIG was specified; display a message to the user
165        if test "x$XML2CONFIG" = "xyes"; then
166                AC_MSG_ERROR([you must Specifies a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config])
167        else
168                if test -f $XML2CONFIG; then
169                        AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG])
170                else
171                        AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist])
172                fi     
173        fi
174fi
175
176# Extract the linker and include flags
177XML2_LDFLAGS=`$XML2CONFIG --libs`
178XML2_CPPFLAGS=`$XML2CONFIG --cflags`
179
180# Check headers file
181CPPFLAGS_SAVE="$CPPFLAGS"
182CPPFLAGS="$XML2_CPPFLAGS"
183AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h],
184                 [], [AC_MSG_ERROR([could not find headers include related to libxml2])])
185
186# Ensure we can link against libxml2
187LIBS_SAVE="$LIBS"
188LIBS="$XML2_LDFLAGS"
189AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], [])
190
191AC_SUBST([XML2_CPPFLAGS])
192AC_SUBST([XML2_LDFLAGS])
193LIBS="$LIBS_SAVE"
194
195
196# ===========================================================================
197# Detect if libxslt is installed
198# ===========================================================================
199
200AC_ARG_WITH([xsltconfig],
201        [AS_HELP_STRING([--with-xsltconfig=FILE], [Specifies an alternative xslt-config file])],
202        [XSLTCONFIG="$withval"], [XSLTCONFIG=""])
203
204if test "x$XSLTCONFIG" = "x"; then
205        # XSLTCONFIG was not specified, so search within the current path
206        AC_PATH_PROG([XSLTCONFIG], [xslt-config])
207
208        # If we couldn't find xslt-config, display a warning
209        if test "x$XSLTCONFIG" = "x"; then
210                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.])
211        fi
212else
213        # XSLTCONFIG was specified; display a message to the user
214        if test "x$XSLTCONFIG" = "xyes"; then
215                AC_MSG_ERROR([you must Specifies a parameter to --with-xsltconfig, e.g. --with-xsltconfig=/path/to/xslt-config])
216        else
217                if test -f $XSLTCONFIG; then
218                        AC_MSG_RESULT([Using user-specified xslt-config file: $XSLTCONFIG])
219                else
220                        AC_MSG_ERROR([the user-specified xslt-config file $XSLTCONFIG does not exist])
221                fi     
222        fi
223fi
224
225# Extract the linker and include flags
226XSLT_LDFLAGS=`$XSLTCONFIG --libs`
227XSLT_CPPFLAGS=`$XSLTCONFIG --cflags`
228
229# Check headers file
230CPPFLAGS_SAVE="$CPPFLAGS"
231CPPFLAGS="$XSLT_CPPFLAGS"
232AC_CHECK_HEADERS([libxslt/xslt.h libxslt/xsltInternals.h libxslt/transform.h libxslt/xsltutils.h],
233                 [], [AC_MSG_ERROR([could not find headers include related to libxlst])])
234
235AC_SUBST([XSLT_CPPFLAGS])
236AC_SUBST([XSLT_LDFLAGS])
237
238#============================================================================
239# Detect if gdal is installed
240#============================================================================
241
242AC_ARG_WITH([gdal-config],
243        [AS_HELP_STRING([--with-gdal-config=FILE], [Specifies an alternative gdal-config file])],
244        [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""])
245if test -z $GDAL_CONFIG;
246then
247        AC_PATH_PROG([GDAL_CONFIG], [gdal-config])
248        if test -z $GDAL_CONFIG;
249        then
250                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.])
251        fi
252       
253else
254        if test -f $GDAL_CONFIG; then
255                AC_MSG_RESULT([Using user-specified gdal-config file: $GDAL_CONFIG])
256        else
257                AC_MSG_ERROR([the user-specified gdal-config file $GDAL_CONFIG does not exist])
258        fi
259fi
260
261GDAL_CFLAGS="`$GDAL_CONFIG --cflags`"
262GDAL_LIBS="`$GDAL_CONFIG --libs`"
263
264AC_SUBST([GDAL_CFLAGS])
265AC_SUBST([GDAL_LIBS])
266
267# ===========================================================================
268# Detect if proj is installed
269# ===========================================================================
270
271AC_ARG_WITH([proj],
272        [AS_HELP_STRING([--with-proj=PATH], [Specifies an alternative location for PROJ4 setup])],
273        [PROJPATH="$withval"], [PROJPATH=""])
274
275# Extract the linker and include flags
276PROJ_LDFLAGS="-L$PROJPATH/lib"
277PROJ_CPPFLAGS="-I$PROJPATH/include"
278
279# Check headers file
280CPPFLAGS_SAVE="$CPPFLAGS"
281CPPFLAGS="$PROJ_CPPFLAGS"
282AC_CHECK_HEADERS([proj_api.h],
283                 [], [AC_MSG_ERROR([could not find headers include related to PROJ4])])
284
285AC_SUBST([PROJ_CPPFLAGS])
286AC_SUBST([PROJ_LDFLAGS])
287
288# ===========================================================================
289# Detect if libgeos is installed
290# ===========================================================================
291
292AC_ARG_WITH([geosconfig],
293        [AS_HELP_STRING([--with-geosconfig=FILE], [Specifies an alternative geos-config file])],
294        [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
295
296if test "x$GEOSCONFIG" = "x"; then
297        # GEOSCONFIG was not specified, so search within the current path
298        AC_PATH_PROG([GEOSCONFIG], [geos-config])
299
300        # If we couldn't find geos-config, display a warning
301        if test "x$GEOSCONFIG" = "x"; then
302                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.])
303        fi
304else
305        # GEOSCONFIG was specified; display a message to the user
306        if test "x$GEOSCONFIG" = "xyes"; then
307                AC_MSG_WARN([you must Specifies a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
308        else
309                if test -f $GEOSCONFIG; then
310                        AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
311                else
312                        AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
313                fi     
314        fi
315fi
316
317GEOS_LDFLAGS=`$GEOSCONFIG --libs`
318GEOS_CPPFLAGS=`$GEOSCONFIG --cflags`
319
320# Check headers file
321CPPFLAGS_SAVE="$CPPFLAGS"
322CPPFLAGS="$GEOS_CPPFLAGS"
323AC_CHECK_HEADERS([geos_c.h],
324                 [], [AC_MSG_WARN([could not find headers include related to libgeos])])
325
326AC_SUBST([GEOS_CPPFLAGS])
327AC_SUBST([GEOS_LDFLAGS])
328
329
330# ===========================================================================
331# Detect if cgal is installed
332# ===========================================================================
333
334AC_ARG_WITH([cgal],
335        [AS_HELP_STRING([--with-cgal=PATH], [Specifies an alternative location for CGAL setup])],
336        [CGALPATH="$withval"], [CGALPATH="/usr"])
337
338
339# Check headers file
340CPPFLAGS_SAVE="$CPPFLAGS"
341CGAL_CPPFLAGS="-I$CGALPATH/include"
342CPPFLAGS="$CGAL_CPPFLAGS"
343AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
344         [], [AC_MSG_WARN([could not find headers include related to libCGAL])])
345
346# Extract the linker and include flags
347CGAL_LDFLAGS="-L$CGALPATH/lib"
348CGAL_CPPFLAGS="-I$CGALPATH/include"
349
350
351AC_SUBST([CGAL_CPPFLAGS])
352AC_SUBST([CGAL_LDFLAGS])
353#============================================================================
354# Detect if mapserver is installed
355#============================================================================
356
357AC_ARG_WITH([mapserver],
358       [AS_HELP_STRING([--with-mapserver=PATH], [Specifies the path for MapServer compiled source tree])],
359       [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""])
360
361AC_ARG_WITH([ms-version],
362       [AS_HELP_STRING([--with-ms-version=VERSION], [Specifies the MapServer version to build against])],
363       [MS_VERSION="$withval"], [MS_VERSION=""])
364
365if test -z $MS_SRC_PATH
366then
367        # path is empty
368        MS_CPPFLAGS=""
369        MS_LDFLAGS=""
370else
371        # path is not empty
372        if test "x$MS_SRC_PATH" = "xmacos"
373        then
374                # system is macos
375                MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl"
376                MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver "
377                AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree])
378                AC_MSG_RESULT([Using MacOS X Framework for MapServer])
379        else
380                # system is either win or nix
381                if test "x$MS_VERSION" = "x7"
382                then
383                        # system is win
384                        MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
385                        MS_CPPFLAGS="-DUSE_MS -I$MS_SRC_PATH/include/mapserver "
386                        AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
387                else
388                        # system is nix
389                        if test -d $MS_SRC_PATH
390                        then
391                                MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
392                                MS_CPPFLAGS="-I$MS_SRC_PATH/include/mapserver "
393               
394                                AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
395                        else
396                                AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist])
397                        fi
398                fi
399        fi
400        MS_FILE="service_internal_ms.o"
401fi
402echo "MS_LDFLAGS=$MS_LDFLAGS"
403echo "MS_CPPFLAGS=$MS_CPPFLAGS"
404
405MS_CFLAGS="$MS_CPPFLAGS"
406MS_LIBS="$MS_LDFLAGS"
407
408AC_SUBST([MS_CFLAGS])
409AC_SUBST([MS_LIBS])
410AC_SUBST([MS_FILE])
411
412# ===========================================================================
413# Detect if python is installed
414# ===========================================================================
415
416AC_ARG_WITH([python],
417        [AS_HELP_STRING([--with-python=PATH], [To enable python support or Specifies an alternative directory for python installation,  disabled by default])],
418        [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
419
420AC_ARG_WITH([pyvers],
421        [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])],
422        [PYTHON_VERS="$withval"], [PYTHON_VERS=""])
423
424
425if test -z "$PYTHON_ENABLED"
426then
427        PYTHON_FILE=""
428else
429        PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
430        PYTHON_FILE="service_internal_python.o"
431        if test  "$PYTHON_PATH" = "yes"
432        then
433                # PYTHON was not specified, so search within the current path
434                PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
435                if test -z "${PYTHONCFG_PATH}" ; then
436                AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}])
437                else
438                AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config])
439                fi
440        else
441                PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
442        fi
443
444        # Extract the linker and include flags
445        PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
446        PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
447
448        # Check headers file
449        CPPFLAGS_SAVE="$CPPFLAGS"
450        CPPFLAGS="$PYTHON_CPPFLAGS"
451        AC_CHECK_HEADERS([Python.h],
452                 [], [AC_MSG_ERROR([could not find headers include related to libpython])])
453
454        # Ensure we can link against libphp
455        LIBS_SAVE="$LIBS"
456        LIBS="$PYTHON_LDFLAGS"
457        PY_LIB=`$PYTHONCONFIG --libs | sed \
458                              -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
459        AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
460        LIBS="$LIBS_SAVE"
461fi
462
463AC_SUBST([PYTHON_CPPFLAGS])
464AC_SUBST([PYTHON_LDFLAGS])
465AC_SUBST([PYTHON_ENABLED])
466AC_SUBST([PYTHON_FILE])
467
468# ===========================================================================
469# Detect if spidermonkey is installed
470# ===========================================================================
471
472AC_ARG_WITH([js],
473        [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 ])],
474        [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""])
475
476if test -z "$JS_ENABLED"
477then
478        JS_FILE=""
479else
480        JS_FILE="service_internal_js.o"
481        if test "$JSHOME" = "yes"
482        then
483
484                #on teste si on est sous debian like
485                if test -f "/usr/bin/dpkg"
486                then
487                        if test -n "`dpkg -l | grep libmozjs185-dev`"
488                        then
489                                JS_CPPFLAGS="-I/usr/include/js/"
490                                JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm"
491                                JS_LIB="mozjs185"
492                        else
493                                XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`"
494                                if test -n "$XUL_VERSION"
495                                then
496                                        JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION"
497                                        JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm"
498                                        JS_LIB="mozjs"
499                                else
500                                        AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ])
501                                fi
502                        fi
503                else
504                        AC_MSG_ERROR([You must  specify your custom install of libmozjs185])
505                fi
506        else
507                JS_CPPFLAGS="-I$JSHOME/include/js/"
508                JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm"
509                JS_LIB="mozjs185"
510
511        fi
512        CPPFLAGS_SAVE="$CPPFLAGS"
513        CPPFLAGS="$JS_CPPFLAGS"
514        AC_LANG_PUSH([C++])
515        AC_CHECK_HEADERS([jsapi.h],
516                        [], [AC_MSG_ERROR([could not find headers include related to libjs])])
517
518        AC_LANG_POP([C++])
519        LIBS_SAVE="$LIBS"
520        LIBS="$JS_LDFLAGS"
521
522        AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])
523        LIBS="$LIBS_SAVE"
524       
525        AC_SUBST([JS_CPPFLAGS])
526        AC_SUBST([JS_LDFLAGS])
527fi
528
529AC_SUBST([JS_ENABLED])
530AC_SUBST([JS_FILE])
531
532# ===========================================================================
533# Detect if php is installed
534# ===========================================================================
535
536AC_ARG_WITH([php],
537        [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation,  disabled by default])],
538        [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
539
540AC_ARG_WITH([php-version],
541        [AS_HELP_STRING([--with-phpvers=NUM], [To use a specific php version])],
542        [PHP_VERS="$withval"], [PHP_VERS=""])
543
544
545if test -z "$PHP_ENABLED"
546then
547        PHP_FILE=""
548else
549        PHPCONFIG="$PHP_PATH/bin/php-config"
550        if test "x$PHP_VERS" = "x7"
551        then
552                PHP_FILE="service_internal_php7.o"
553        else
554                PHP_FILE="service_internal_php.o"
555        fi
556        if test  "$PHP_PATH" = "yes"
557        then
558                # PHP was not specified, so search within the current path
559                AC_PATH_PROG([PHPCONFIG], [php-config])
560        else
561                PHPCONFIG="$PHP_PATH/bin/php-config"
562        fi
563
564        # Extract the linker and include flags
565        if test "x$PHP_VERS" = "x7"
566        then
567                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib64 -lphp7"
568        else
569                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
570        fi
571        PHP_CPPFLAGS=`$PHPCONFIG --includes`
572
573        # Check headers file
574        CPPFLAGS_SAVE="$CPPFLAGS"
575        CPPFLAGS="$PHP_CPPFLAGS"
576        AC_CHECK_HEADERS([sapi/embed/php_embed.h],
577                 [], [AC_MSG_ERROR([could not find headers include related to libphp])])
578
579        # Ensure we can link against libphp
580        LIBS_SAVE="$LIBS"
581        LIBS="$PHP_LDFLAGS"
582        # Shouldn't we get php here rather than php5 :) ??
583        if test "x$PHP_VERS" = "x7"
584        then
585                echo $LIBS
586                #AC_CHECK_LIB([php7], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
587        else
588                AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
589        fi
590        LIBS="$LIBS_SAVE"
591        AC_SUBST([PHP_CPPFLAGS])
592        AC_SUBST([PHP_LDFLAGS])
593fi
594
595AC_SUBST([PHP_ENABLED])
596AC_SUBST([PHP_FILE])
597
598# ===========================================================================
599# Detect if java is installed
600# ===========================================================================
601
602AC_ARG_WITH([java],
603        [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME,  disabled by default])],
604        [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""])
605
606AC_ARG_WITH([java-rpath],
607        [AS_HELP_STRING([--with-java-rpath=yes], [To set rpath for java support, disabled by default])],
608        [JAVA_RPATH="$withval"], [JAVA_RPATH=""])
609
610if test -z "$JAVA_ENABLED"
611then
612        JAVA_FILE=""
613else
614        JAVA_FILE="service_internal_java.o"
615        if test "x$JDKHOME" = "x";
616        then
617                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.])
618        fi      # JAVA was specified; display a message to the user
619        if test "x$JDKHOME" = "xyes";
620        then
621                AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java])
622        fi
623
624        # Extract the linker and include flags
625        if test "x$JDKHOME" = "xmacos";
626        then
627                JAVA_LDFLAGS="-framework JavaVM"
628                for i in `ls /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/`; do
629                    JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/$i/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
630                done
631        else
632                if test -d "$JDKHOME/jre/lib/i386";
633                then
634                        JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread"
635                        JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
636                        if test x$JAVA_RPATH = "xyes"; then
637                           JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/i386/server/"
638                        fi
639                else
640                        if test -d "$JDKHOME/jre/lib/amd64"; then
641                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread"
642                           JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
643                           if test x$JAVA_RPATH = "xyes"; then
644                              JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/amd64/server/"
645                           fi
646                        else
647                           JAVA_LDFLAGS="-L$JDKHOME/jre/lib/server/ -ljvm -lpthread"
648                           JAVA_CPPFLAGS="-I$JDKHOME/include/ -I$JDKHOME/include/darwin"
649                           if test x$JAVA_RPATH = "xyes"; then
650                              JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/server/"
651                           fi
652                        fi
653                fi
654        fi
655
656        AC_LANG([C++])
657        echo $JAVA_CPPFLAGS
658        # Check headers file (second time we check that in fact)
659        CPPFLAGS_SAVE="$CPPFLAGS"
660        CPPFLAGS="$JAVA_CPPFLAGS"
661        AC_CHECK_HEADERS([jni.h],
662                         [], [AC_MSG_ERROR([could not find jni.h file])])
663        CPPFLAGS="$CPPFLAGS_SAVE"
664        # Ensure we can link against libjava
665        LIBS_SAVE="$LIBS"
666        LIBS="$JAVA_LDFLAGS"
667        if test "x$JDKHOME" != "xmacos";
668        then
669                AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjvm])], [])
670        fi
671        LIBS="$LIBS_SAVE"
672
673        AC_SUBST([JAVA_CPPFLAGS])
674        AC_SUBST([JAVA_LDFLAGS])
675fi
676
677AC_SUBST([JAVA_ENABLED])
678AC_SUBST([JAVA_FILE])
679
680# ===========================================================================
681# Detect if mono is installed
682# ===========================================================================
683
684AC_ARG_WITH([mono],
685        [AS_HELP_STRING([--with-mono=PATH], [To enable mono support, specify the path to find pkg-config,  disabled by default])],
686        [MONOHOME="$withval"; MONO_ENABLED="-DUSE_MONO"], [MONO_ENABLED=""])
687
688if test -z "$MONO_ENABLED"
689then
690        MONO_FILE=""
691else
692        MONO_FILE="service_internal_mono.o"
693        if test "x$MONOHOME" = "x";
694        then
695                MONOHOME="/usr"
696        fi
697        if test "x$MONOHOME" = "xyes";
698        then
699                MONOHOME="/usr"
700        fi
701
702        # Extract the linker and include flags
703        MONO_CFLAGS=`$MONOHOME/bin/pkg-config --cflags mono-2`
704        MONO_LDFLAGS=`$MONOHOME/bin/pkg-config --libs mono-2`
705
706        AC_LANG([C++])
707        echo $JAVA_CPPFLAGS
708        # Check headers file (second time we check that in fact)
709        CPPFLAGS_SAVE="$CFLAGS"
710        CPPFLAGS="$MONO_CFLAGS"
711        AC_CHECK_HEADERS([mono/jit/jit.h],
712                         [], [AC_MSG_ERROR([could not find jit.h file])])
713        CPPFLAGS="$CPPFLAGS_SAVE"
714        # Ensure we can link against libmono-2.0
715        LIBS_SAVE="$LIBS"
716        LIBS="$MONO_LDFLAGS"
717        AC_CHECK_LIB([mono-2.0], [mono_runtime_invoke], [], [AC_MSG_ERROR([could not find libmono])], [])
718        LIBS="$LIBS_SAVE"
719
720        AC_SUBST([MONO_CFLAGS])
721        AC_SUBST([MONO_LDFLAGS])
722fi
723
724AC_SUBST([MONO_ENABLED])
725AC_SUBST([MONO_FILE])
726
727# ===========================================================================
728# Detect if ruby is installed
729# ===========================================================================
730AC_ARG_WITH([ruby],
731        [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation,  disabled by default])],
732        [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""])
733
734AC_ARG_WITH([rvers],
735        [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])],
736        [RUBY_VERS="$withval"], [RUBY_VERS=""])
737
738
739if test -z "$RUBY_ENABLED"
740then
741        RUBY_FILE=""
742else
743        RUBY_FILE="service_internal_ruby.o"
744
745        # Extract the linker and include flags
746        RUBY_LDFLAGS="-lruby"
747        RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS"
748
749        # Check headers file
750        CPPFLAGS_SAVE="$CPPFLAGS"
751        CPPFLAGS="$RUBY_CPPFLAGS"
752        AC_CHECK_HEADERS([ruby.h],
753                 [], [AC_MSG_ERROR([could not find headers include related to libruby])])
754
755        # Ensure we can link against libphp
756        LIBS_SAVE="$LIBS"
757        LIBS="$RUBY_LDFLAGS"
758        # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
759        LIBS="$LIBS_SAVE"
760        AC_SUBST([RUBY_CPPFLAGS])
761        AC_SUBST([RUBY_LDFLAGS])
762fi
763
764AC_SUBST([RUBY_ENABLED])
765AC_SUBST([RUBY_FILE])
766
767# ===========================================================================
768# Detect if perl is installed
769# ===========================================================================
770
771AC_ARG_WITH([perl],
772        [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation,  disabled by default])],
773        [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""])
774
775
776if test -z "$PERL_ENABLED"
777then
778        PERL_FILE=""
779else
780        PERL_FILE="service_internal_perl.o"
781        if test  "$PERL_PATH" = "yes"
782        then
783                # Perl was not specified, so search within the current path
784                AC_PATH_PROG([PERLCONFIG], [perl])
785        else
786                PERLCONFIG="$PERL_PATH/bin/perl"
787        fi
788
789        # Extract the linker and include flags
790        PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts`
791        PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts`
792
793        # Check headers file
794        CPPFLAGS_SAVE="$CPPFLAGS"
795        CPPFLAGS="$PERL_CPPFLAGS"
796        AC_CHECK_HEADERS([EXTERN.h],
797                 [], [AC_MSG_ERROR([could not find headers include related to libperl])])
798
799        AC_SUBST([PERL_CPPFLAGS])
800        AC_SUBST([PERL_LDFLAGS])
801fi
802
803AC_SUBST([PERL_ENABLED])
804AC_SUBST([PERL_FILE])
805
806# ===========================================================================
807# Detect if otb is available
808# ===========================================================================
809
810AC_ARG_WITH([itk],
811        [AS_HELP_STRING([--with-itk=PATH], [Specifies an alternative location for the itk library])],
812        [ITKPATH="$withval"], [ITKPATH=""])
813
814AC_ARG_WITH([itk-version],
815        [AS_HELP_STRING([--with-itk-version=VERSION], [Specifies an alternative version for the itk library])],
816        [ITKVERS="$withval"], [ITKVERS=""])
817
818AC_ARG_WITH([otb],
819        [AS_HELP_STRING([--with-otb=PATH], [Specifies an alternative location for the otb library])],
820        [OTBPATH="$withval"], [OTBPATH=""])
821
822AC_ARG_WITH([otb-version],
823        [AS_HELP_STRING([--with-otb-version=PATH], [Specifies an alternative location for the otb library])],
824        [OTBVERS="$withval"], [OTBVERS=""])
825
826if test -z "$OTBPATH"
827then
828        # OTBPATH is empty
829        OTB_LDFLAGS=""
830        OTB_CPPFLAGS=""
831        OTB_FILE=""
832        OTB_ENABLED=""
833else
834        # OTBPATH is not empty
835        if test -z "$ITKVERS"
836        then
837                ITKVERS="4.5"
838        fi
839        OTB_ENABLED="-DUSE_OTB"
840        IVERS="$(echo -e '4.10\n$ITKVERS' | sort -r | head -n1)"
841        if test "$IVERS" == "$ITKVERS"
842        then
843                # For ITK version <= 4.5
844                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"
845        else
846                # For ITK version > 4.5
847                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"
848        fi
849
850        # test if otb include path exists or not
851        if test -a "${OTBPATH}/include/OTB-${OTBVERS}"
852        then
853                # include path exists
854                OTB_CPPFLAGS="-I${OTBPATH}/include/OTB-${OTBVERS} -I$ITKPATH/include/ITK-$ITKVERS $GDAL_CFLAGS"
855                OTB_LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -lOTBImageIO-$OTBVERS -lOTBCommon-$OTBVERS -lOTBApplicationEngine-$OTBVERS -L$ITKPATH/lib $ITK_LDFLAGS"
856        else
857                # include path does not exists
858                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"
859                OTB_LDFLAGS="-L$OTBPATH/lib/otb -lOTBIO -lOTBCommon -lOTBApplicationEngine -L$ITKPATH/lib $ITK_LDFLAGS"
860
861        fi
862        OTB_FILE="otbZooWatcher.o service_internal_otb.o"
863       
864        AC_LANG_PUSH([C++])
865
866        # Check headers file
867        CPPFLAGS_SAVE="$CPPFLAGS"
868        CPPFLAGS="$OTB_CPPFLAGS"
869        LDFLAGS_SAVE="$LDFLAGS"
870        LIBS="$LIBS_SAVE $OTB_LDFLAGS"
871        echo "OTB_CPPFLAGS=$OTB_CPPFLAGS"
872  echo "LIBS=$LIBS"
873        AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
874                        [], [AC_MSG_ERROR([could not find header file $ac_header related to OTB])])
875        LDFLAGS_SAVE="$LDFLAGS"
876        LDFLAGS="$OTB_LDFLAGS"
877        echo "OTB_LDFLAGS=$OTB_LDFLAGS"
878        #UVERS="$(echo -e '5.8\n$OTBVERS' | sort -r | head -n1)"
879        #if test "$OTBVERS" ==  "$UVERS" ; then
880        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplicationRegistry.h"]],[[std::vector<std::string> list = otb::Wrapper::ApplicationRegistry::GetAvailableApplications();]])],
881                        [AC_MSG_RESULT([checking for GetAvailableApplications... yes])],[AC_MSG_ERROR([checking for GetAvailableApplications... failed])])
882        #else
883        #       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplication.h"]],[[std::vector<std::string> list = otb::Wrapper::ApplicationRegistry::GetAvailableApplication();]])],
884        #                                                  [AC_MSG_RESULT([checking for GetAvailableApplication... yes])],[AC_MSG_ERROR([checking for GetAvailableApplication... failed])])
885        #fi
886                                                                               
887        LDFLAGS="$LDFLAGS_SAVE"
888        AC_LANG_POP([C++])
889        AC_LANG(C++)
890                       
891fi
892AC_SUBST([OTB_CPPFLAGS])
893AC_SUBST([OTB_LDFLAGS])
894AC_SUBST([OTB_FILE])
895AC_SUBST([OTB_ENABLED])
896
897# ===========================================================================
898# Detect if saga-gis is available
899# ===========================================================================
900
901AC_ARG_WITH([wx-config],
902        [AS_HELP_STRING([--with-wx-config=PATH], [Specifies an alternative path for the wx-config tool])],
903        [WXCFG="$withval"], [WXCFG=""])
904
905AC_ARG_WITH([saga],
906        [AS_HELP_STRING([--with-saga=PATH], [Specifies an alternative location for the SAGA-GIS library])],
907        [SAGAPATH="$withval"], [SAGAPATH=""])
908
909if test -z "$SAGAPATH"
910then
911        SAGA_LDFLAGS=""
912        SAGA_CPPFLAGS=""
913        SAGA_FILE=""
914        SAGA_ENABLED=""
915else
916        if test -z "$WXCFG" ; then
917           WXCFG="$(which wx-config)"
918        fi
919        if test "`$WXCFG --list | grep unicode`" == "" ; then
920           AC_MSG_ERROR(SAGA requires a unicode build of wxGTK)
921        fi
922        WX_ISSUE="-D_WX_WXCRTVARARG_H_"
923        SAGA_DEFS="-D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD -DMODULE_LIBRARY_PATH=\\\"$SAGAPATH/lib/saga\\\""
924        SAGA_CPPFLAGS=" -fPIC -I$SAGAPATH/include/saga/saga_core/saga_api/ `$WXCFG --unicode=yes --static=no --cxxflags` -D_SAGA_UNICODE $SAGA_DEFS $WX_ISSUE"
925        SAGA_LDFLAGS="-fPIC `$WXCFG --unicode=yes --static=no --libs` -lsaga_api"
926        SAGA_ENABLED="-DUSE_SAGA"
927        SAGA_FILE="service_internal_saga.o"
928       
929        AC_LANG_PUSH([C++])
930        # Check headers file
931        CPPFLAGS_SAVE="$CPPFLAGS"
932        CPPFLAGS="$SAGA_CPPFLAGS"
933        LIBS_SAVE="$LIBS"
934        LIBS="$SAGA_LDFLAGS"
935        AC_CHECK_HEADERS([module_library.h],
936                        [], [AC_MSG_ERROR([could not find header file $i related to SAGA-GIS])])
937        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "module_library.h"],[SG_Get_Module_Library_Manager();]])],
938                [AC_MSG_RESULT([checking for SG_Get_Module_Library_Manager... yes])],[AC_MSG_ERROR([checking for SG_Get_Module_Library_Manager... failed])])
939        LIBS="$LIBS_SAVE"
940        AC_LANG_POP([C++])
941fi
942AC_SUBST([SAGA_CPPFLAGS])
943AC_SUBST([SAGA_LDFLAGS])
944AC_SUBST([SAGA_FILE])
945AC_SUBST([SAGA_ENABLED])
946
947AC_CONFIG_FILES([Makefile])
948AC_CONFIG_FILES([ZOOMakefile.opts])
949AC_CONFIG_FILES([main.cfg])
950AC_OUTPUT

Search

Context Navigation

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