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

Last change on this file since 952 was 952, checked in by djay, 11 months ago

Fix callback activation

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