source: configure.ac

Last change on this file was 2db0d31, checked in by www-data <www-data@…>, 4 weeks ago

ticket:000 - update version to 9.5

  • Property mode set to 100644
File size: 28.7 KB
Line 
1# This file is part of rasdaman community.
2#
3# Rasdaman community is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 3 of the License, or
6# (at your option) any later version.
7#
8# Rasdaman community is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with rasdaman community.  If not, see <http://www.gnu.org/licenses/>.
15#
16# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
17# rasdaman GmbH.
18#
19# For more information please see <http://www.rasdaman.org>
20# or contact Peter Baumann via <baumann@rasdaman.com>.
21# Top Level makefile. This points to the various modules that have to be build
22# and/or deployed
23#
24#
25# COMMENTS:
26#
27##################################################################
28
29#                                               -*- Autoconf -*-
30# Process this file with autoconf to produce a configure script.
31
32AC_PREREQ(2.61)
33# CAVEAT: in the following two lines keep version numbers in sync!
34AC_INIT(Rasdaman, 9.5.0, baumann@rasdaman.com)
35AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects -Wno-portability])
36
37AC_PREFIX_DEFAULT(/opt/rasdaman)
38if test "$prefix" = "NONE" ; then
39  prefix=/opt/rasdaman
40fi
41# Define CXXFLAGS before AC_PROG_CXX or it will automatically add -g -O2 on some systems
42USER_CFLAGS="$CFLAGS"
43USER_CXXFLAGS="$CXXFLAGS"
44CXXFLAGS=
45CFLAGS=
46# Checks for programs.
47AC_PROG_CXX
48AC_PROG_AWK
49AC_PROG_CC
50AC_PROG_CPP
51AC_PROG_LEX
52if test "$LEX" = ":"; then
53    AC_MSG_ERROR([could not find lex or flex. Please install.])
54fi
55AC_PROG_INSTALL
56AC_PROG_LN_S
57AC_PROG_MAKE_SET
58AC_PROG_RANLIB
59AC_PROG_RPCGEN
60AC_PROG_SED
61AM_PROG_CC_C_O
62AC_CHECK_PROGS(YACC, ['bison -y' byacc yacc], no)
63if test "$YACC" = "no" ; then
64   AC_MSG_ERROR([could not find bison, byacc or yacc. Please install.])
65fi
66AC_CHECK_PROG(AR, ar, ar, no)
67AS_IF([test x$AR = no],
68    AC_MSG_ERROR([Cannot find a valid 'ar' tool]))
69AC_PROG_BISON
70
71# Checks for libraries.
72AC_CHECK_LIB([crypt], [main], , [AC_MSG_FAILURE([libcrypt.a not found! Please install.])])
73AC_CHECK_LIB([crypto], [EVP_DigestFinal], , [AC_MSG_FAILURE([libcrypto.a not found! Please install.])])
74AC_CHECK_LIB([dl], [main], , [AC_MSG_FAILURE([libdl.a not found! Please install.])])
75AC_CHECK_LIB([fl], [main], , [AC_MSG_FAILURE([libfl.a not found! Please install.])])
76AC_CHECK_LIB([edit], [main], , [AC_MSG_FAILURE([libedit.a not found! Please install.])])
77AC_CHECK_LIB([tiff], [TIFFGetField], , [AC_MSG_FAILURE([libtiff.a not found! Please install.])])
78#AC_CHECK_LIB([z], [main], , [AC_MSG_FAILURE([libz.a not found! Please install.])])
79
80if test "$enable_r" = "yes"; then
81    AC_CHECK_PROG([RBIN], [R], [R])
82    AS_IF([test "x${RBIN}" = "x"], [AC_MSG_FAILURE([Could not find R. Please install.])])
83    # TODO(vliaukevich): check for needed R packages
84fi
85
86# default, changed by --enable-debug, --with-optimization
87GCC_OPTIMIZATION_FLAG="-O3"
88GCC_DEBUG_SYMBOLS_FLAG="-g0"
89
90# Checks for header files.
91AC_PATH_X
92AC_HEADER_DIRENT
93AC_HEADER_STDC
94AC_HEADER_SYS_WAIT
95AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h malloc.h memory.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h values.h hdf.h mfhdf.h hdf/hdf.h hdf/mfhdf.h netcdfcpp.h])
96
97# Checks for typedefs, structures, and compiler characteristics.
98AC_HEADER_STDBOOL
99AC_C_CONST
100AC_C_INLINE
101AC_TYPE_INT32_T
102AC_TYPE_PID_T
103AC_C_RESTRICT
104AC_TYPE_SIZE_T
105AC_HEADER_TIME
106AC_STRUCT_TM
107AC_TYPE_UINT32_T
108AC_C_VOLATILE
109
110# Checks for library functions.
111AC_FUNC_ALLOCA
112AC_FUNC_CLOSEDIR_VOID
113AC_FUNC_ERROR_AT_LINE
114AC_REPLACE_FNMATCH
115AC_FUNC_FORK
116#AC_FUNC_MALLOC
117AC_FUNC_MEMCMP
118AC_FUNC_MKTIME
119#AC_FUNC_REALLOC
120AC_FUNC_SELECT_ARGTYPES
121AC_TYPE_SIGNAL
122AC_FUNC_STAT
123AC_FUNC_STRFTIME
124AC_FUNC_STRTOD
125AC_FUNC_VPRINTF
126AC_CHECK_FUNCS([alarm bzero clock_gettime dup2 floor getcwd gethostbyaddr gethostbyname gethostname getpass gettimeofday inet_ntoa localtime_r memmove memset mkdir pathconf pow rint select socket sqrt strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol strtoul])
127
128AC_CONFIG_HEADERS([config.h])
129AC_CONFIG_FILES([third_party/Makefile
130                 third_party/jsoncpp/Makefile
131                 third_party/grpc-java/Makefile
132                 Makefile
133                 catalogmgr/Makefile         
134                 relblobif/Makefile
135                 relblobif/test/Makefile
136                 relindexif/Makefile
137                 relmddif/Makefile
138                 relcatalogif/Makefile
139                 reladminif/Makefile
140                 relstorageif/Makefile
141                 indexmgr/Makefile
142                 indexmgr/test/Makefile
143                 tilemgr/Makefile
144                 storagemgr/Makefile
145                 commline/Makefile
146                 network/Makefile
147                 raslib/Makefile
148                 raslib/test/Makefile
149                 clientcomm/Makefile
150                 servercomm/Makefile
151                 rasodmg/Makefile
152                 rasodmg/test/Makefile
153                 qlparser/Makefile
154                 conversion/Makefile
155                 mddmgr/Makefile
156                 httpserver/Makefile
157                 mymalloc/Makefile
158                 server/Makefile
159                 rasmgr/Makefile
160                 rascontrol/Makefile
161                 rasdl/Makefile
162                 lockmgr/Makefile
163                 lockmgr/test/Makefile
164                 applications/Makefile
165                 applications/rasql/Makefile
166                 applications/directql/Makefile
167                 applications/rview/Makefile
168                 applications/rasgeo/Makefile
169                 applications/raswct/Makefile
170                 applications/petascope/Makefile
171                 applications/secore/Makefile
172                 applications/RRasdaman/Makefile
173                 applications/wcst_import/Makefile
174                 bin/Makefile
175                 manuals_and_examples/Makefile
176                 manuals_and_examples/examples/c++/Makefile
177                 include/Makefile
178                 java/Makefile
179                 systemtest/Makefile
180                 common/Makefile
181                 common/src/Makefile
182                 common/test/Makefile
183                 rasnet/Makefile
184                 rasserver_x/Makefile
185                 rasserver_x/src/Makefile
186                 rasserver_x/test/Makefile
187                 rasmgr_x/Makefile
188                 rasmgr_x/src/Makefile
189                 rasmgr_x/test/Makefile
190                 rascontrol_x/Makefile
191                 rascontrol_x/src/Makefile
192                 rascontrol_x/test/Makefile
193                 rasnetprotocol/Makefile
194          ])
195
196# --------------- Header Template Definitions ----------------------
197####################################################################
198AH_TEMPLATE([DEBUG], [Enables debug functionality])
199AH_TEMPLATE([RMANDEBUG], [Enables debug functionality])
200AH_TEMPLATE([_DISABLE_TRACE_LOGS], [Disable debug functionality])
201AH_TEMPLATE([HAVE_HDF], [Checks whether HDF4 is installed])
202AH_TEMPLATE([HAVE_NETCDF], [Checks whether NetCDF is installed])
203AH_TEMPLATE([HAVE_GRIB], [Checks whether GRIB support is installed])
204AH_TEMPLATE([HAVE_GDAL], [Checks whether GDAL support is installed])
205AH_TEMPLATE([BASEDB_PGSQL], [If defined we are compiling over PostgreSQL])
206AH_TEMPLATE([BASEDB_SQLITE], [If defined we are compiling over SQLite])
207AH_TEMPLATE([PETASCOPEDB_PGSQL], [If defined we are compiling petascope over PostgreSQL])
208AH_TEMPLATE([PETASCOPEDB_SQLITE], [If defined we are compiling petascope over SQLite])
209AH_TEMPLATE([PETASCOPEDB_HSQLDB], [If defined we are compiling petascope over HSQLDB])
210AH_TEMPLATE([PETASCOPEDB], [Name of the database used in petascope])
211AH_TEMPLATE([JAVA_SERVER], [Type of Java server for deploying rasdaman's Java web applications])
212AH_TEMPLATE([JAVA_SERVER_EMBEDDED], [Embedded Java server for deploying rasdaman's Java web applications])
213AH_TEMPLATE([__NO_MATH_INLINES], [Used by some performance implementaion of math libraries.])   
214AH_TEMPLATE([EARLY_TEMPLATE], [When set allows templates to be instantiated earlier.])   
215AH_TEMPLATE([IS_BIG_ENDIAN], [The host system uses big endian encoding.])   
216AH_TEMPLATE([IS_LITTLE_ENDIAN], [The host system uses little endian encoding.])   
217AH_TEMPLATE([CPPSTDLIB], [Use the std.])   
218AH_TEMPLATE([RASARCHITECTURE], [The name of the architecture for which the system is compiling.])   
219AH_TEMPLATE([X86], [Compile for a X86 based system.])
220AH_TEMPLATE([NO_in_addr_t], [Do not use addr_t.])
221AH_TEMPLATE([COMPDATE], [Date of the build (of the configure not the actual build)])
222AH_TEMPLATE([BASEDBSTRING], [Name of the database that supports the compiled version of rasdaman.])   
223AH_TEMPLATE([RASSCHEMAVERSION], [The version of the schema the database uses.])
224AH_TEMPLATE([CONFDIR], [The directory where the installed programs will find their configuration])
225# --------------- Parameter Definition -----------------------------
226####################################################################
227AC_PRESERVE_HELP_ORDER
228AC_ARG_WITH([hdf4],
229            [AS_HELP_STRING([--with-hdf4],
230              [this feature enables the inclusion of hdf4 library during installation.])],
231            [],
232            [with_hdf4=no])
233
234AC_MSG_NOTICE(using hdf4 library...$with_hdf4)
235
236if test "$with_hdf4" == yes; then
237  AC_CHECK_LIB([df], [main], ,[AC_CHECK_LIB([dfalt], [main], ,[AC_MSG_FAILURE([--with-hdf4 was given but libhdf was not found! Please install libhdf or libhdf-alt.])])])
238  AC_CHECK_LIB([mfhdf], [main], ,[AC_CHECK_LIB([mfhdfalt], [main], ,[AC_MSG_FAILURE([--with-hdf4 was given but libhdf was not found! Please install libhdf or libhdf-alt.])])])
239  AC_DEFINE([HAVE_HDF], [1])
240fi
241
242AC_ARG_WITH([netcdf],
243            [AS_HELP_STRING([--with-netcdf],
244              [this feature enables the inclusion of netcdf library during installation.])],
245            [],
246            [with_netcdf=no])
247
248AC_MSG_NOTICE(checking for libnetcdf library...$with_netcdf)
249
250if test "$with_netcdf" == yes; then
251  AC_CHECK_LIB([netcdf], [main], ,[AC_MSG_FAILURE([libnetcdf.a was not found! Please install.])])
252  AC_CHECK_LIB([netcdf_c++], [main], , [AC_MSG_FAILURE([libnetcdf_c++.a not found! Please install.])])
253  AC_DEFINE([HAVE_NETCDF], [1])
254fi
255
256AC_ARG_WITH([grib],
257            [AS_HELP_STRING([--with-grib],
258              [this feature enables the inclusion of the GRIB library during installation.])],
259            [],
260            [with_grib=no])
261
262AC_MSG_NOTICE(checking for GRIB library...$with_grib)
263
264if test "$with_grib" == yes; then
265  AC_CHECK_LIB([grib_api], [main], ,[AC_MSG_FAILURE([libgrib_api was not found, please install.])])
266  AC_DEFINE([HAVE_GRIB], [1])
267fi
268
269AC_ARG_ENABLE([gdal],
270            [AS_HELP_STRING([--disable-gdal],
271              [this feature disables using GDAL in rasdaman.])],
272            [with_gdal=no],
273            [with_gdal=yes])
274
275AC_MSG_NOTICE(checking for GDAL library... $with_gdal)
276
277if test "$with_gdal" == yes; then
278  ### Due to a strange bug with fnmatch.h, we cannot search for libgdal with AC_CHECK_LIB.
279  ### We add the linking flags manually
280  AC_PATH_PROG(GDAL_CONFIG, gdal-config, no)
281  if test "$GDAL_CONFIG" = "no" ; then
282    AC_MSG_ERROR([could not find gdal-config. Please install libgdal-dev, and add gdal-config to your PATH variable.])
283  fi
284  GDAL_LDFLAGS=`$GDAL_CONFIG --libs`
285  GDAL_CXXFLAGS=`$GDAL_CONFIG --cflags`
286  AC_SUBST(GDAL_LDFLAGS)
287  AC_SUBST(GDAL_CXXFLAGS)
288  AC_DEFINE([HAVE_GDAL], [1])
289fi
290AM_CONDITIONAL([HAVE_GDAL], [test "$with_gdal" == yes])
291
292AC_ARG_WITH([docs],
293            [AS_HELP_STRING([--with-docs],
294              [generate doxygen documentation during installation.])],
295            [],
296            [with_docs=no])
297AM_CONDITIONAL([GENERATE_DOCS], [test "$with_docs" = yes])
298
299AC_ARG_WITH([default-rasmgr-port],
300            [AS_HELP_STRING([--with-default-rasmgr-port],
301                            [change the default RasMgr port (7001)])],
302            [RASMGR_PORT=$withval],
303            [RASMGR_PORT=7001])
304
305AC_ARG_WITH([static-libs],
306            [AS_HELP_STRING([--with-static-libs],
307                            [try to compile using statically linked DBMS libraries])],
308            [],
309            [with_static_libs=no])
310
311AC_ARG_ENABLE([pic],
312            [AS_HELP_STRING([--disable-pic],
313                            [disable generation of position independent code (PIC)])],
314            [],
315            [CXXFLAGS+=" -fPIC " CFLAGS+=" -fPIC "])
316
317# postgres is automatically defined in m4/ct_check_postgres_db.m4
318AC_ARG_WITH([default-basedb],
319            [AS_HELP_STRING([--with-default-basedb],
320                            [change the default Base DBMS (sqlite, postgresql)])],
321            [with_default_basedb=$withval],
322            [with_default_basedb=sqlite])
323
324AC_ARG_WITH([petascopedb],
325            [AS_HELP_STRING([--with-petascopedb],
326                            [change the default DBMS used by petascope (postgresql, hsqldb, sqlite)])],
327            [with_petascopedb=$withval],
328            [with_petascopedb=postgresql])
329
330AC_ARG_WITH([java-server],
331            [AS_HELP_STRING([--with-java-server],
332                            [set the Java application deployment mode (external or embedded)])],
333            [with_java_server=$withval],
334            [with_java_server=external])
335
336AC_ARG_ENABLE([debug],
337              [AS_HELP_STRING([--enable-debug],
338                              [this feature enables generation of binaries that contain extra code for debug output. The output is usually very verbose. It is not recommended for production use.])],
339              [RMANDEBUG=on GCC_OPTIMIZATION_FLAG="-O0"],
340              [RMANDEBUG=])
341AM_CONDITIONAL([ENABLE_DEBUG], [test "$RMANDEBUG" = on])
342
343AC_ARG_WITH([debug-symbols],
344            [AS_HELP_STRING([--with-debug-symbols],
345                            [compile rasdaman with debug symbols])],
346            [with_debug_symbols=yes],
347            [with_debug_symbols=no])
348AC_MSG_NOTICE(compiling with debug symbols... $with_debug_symbols)
349
350AC_ARG_WITH([optimization],
351            [AS_HELP_STRING([--with-optimization],
352                            [set GCC optimization level, allowed values 0-3.])],
353            [opt_flag=$withval],
354            [])
355AS_IF([test "x$opt_flag" == "x0" -o "x$opt_flag" == "x1" -o "x$opt_flag" == "x2" -o "x$opt_flag" == "x3"],
356      [GCC_OPTIMIZATION_FLAG="-O$opt_flag"])
357
358AC_ARG_ENABLE([benchmark],
359              [AS_HELP_STRING([--enable-benchmark],
360                              [this feature enables generation of binaries that contain extra code for benchmark output.])],
361              [CXXFLAGS+=" -DRMANBENCHMARK "],
362              [])
363
364# list from http://stackoverflow.com/a/9862800
365AC_ARG_ENABLE([strict],
366              [AS_HELP_STRING([--enable-strict],
367                              [enable compiling in strict mode: warnings terminate compilation.])],
368              [ENABLESTRICTFLAGS="-pedantic -Werror -Wall -Wextra -Wshadow -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wno-long-long -Wno-format-nonliteral "],
369              [])
370
371AC_ARG_WITH([test-server],
372            [AS_HELP_STRING([--with-test-server=ADDRESS],
373                            [server used for testing])],
374            [SERVER="$withval"],
375            [SERVER=localhost])
376AC_ARG_WITH([test-database],
377            [AS_HELP_STRING([--with-test-database=NAME],
378                            [database name used for testing])],
379            [DATABASE="$withval"],
380            [DATABASE=PEBAU])
381AC_ARG_WITH([test-port],
382            [AS_HELP_STRING([--with-test-port=PORT],
383                            [port on which the test server is listening])],
384            [PORT="$withval"],
385            [PORT="$RASMGRPORT"])
386AC_ARG_WITH([test-user],
387            [AS_HELP_STRING([--with-test-user=USERNAME],
388                            [username used for connecting to the test server])],
389            [USER="$withval"],
390            [USER=rasadmin])
391AC_ARG_WITH([test-passwd],
392            [AS_HELP_STRING([--with-test-passwd=PASSWORD],
393                            [password used for connecting to the test server])],
394            [USER="$withval"],
395            [USER=rasadmin])
396AC_ARG_WITH([logdir],
397            [AS_HELP_STRING([--with-logdir=PATH],
398                            [the path where the servers will store their logs])],
399            [logdir="$withval"],
400            [AS_IF([test "x$prefix" = "x/usr/local"],
401                   [logdir="/var/log/rasdaman"],
402                   [logdir="${prefix}/log"])])
403AC_ARG_WITH([filedatadir],
404            [AS_HELP_STRING([--with-filedatadir=PATH],
405                            [the path where the server stores blobs as files])],
406            [filedatadir="$withval"],
407            [AS_IF([test "x$prefix" = "x/usr"],
408                   [filedatadir="/var/lib/rasdaman/data"],
409                   [filedatadir="${prefix}/data"])])
410AC_ARG_WITH([wardir],
411                    [AS_HELP_STRING([--with-wardir=PATH],
412                                            [the path where the war files should be installed])],
413                        [wardir="$withval"],
414                        [wardir="\${pkgdatadir}/war"])
415AC_ARG_WITH([wps],
416                    [AS_HELP_STRING([--with-wps=PATH],
417                                            [the path to the 52n wps war file])],
418                        [wpswar="$withval"],
419                        [])
420
421AC_ARG_ENABLE([java],
422              [AS_HELP_STRING([--disable-java],
423                              [disable compilation and installation of Java-based components, including rasj and petascope.])],
424              [disable_java=yes],
425              [disable_java=no])
426AC_MSG_NOTICE(Disable java? $disable_java)
427AM_CONDITIONAL([ENABLE_JAVA], [test "$disable_java" = no])
428
429# ------------------------------------------------------------------------------
430# --enable-rasnet, --with-protocol=rnp|rasnet
431#
432
433AC_ARG_ENABLE([rasnet],
434              [AS_HELP_STRING([--enable-rasnet],
435                              [this feature enables the rasnet protocol; deprecated since v9.2])],
436              [AC_MSG_NOTICE(['--enable-rasnet' is a deprecated option since rasdaman v9.2])],
437              [])
438
439AC_ARG_WITH([protocol],
440            [AS_HELP_STRING([--with-protocol=PROTOCOL],
441                            [set network protocol used in rasdaman (rasnet or rnp).])],
442            [protocol=$withval],
443            [protocol=rasnet])
444
445if test "$protocol" != "rnp" -a "$protocol" != "rasnet"; then
446  AC_MSG_ERROR([Invalid network protocol '$protocol' has been specified, must be one of rasnet or rnp.])
447fi
448
449AM_CONDITIONAL([RMANRASNET], [test "$protocol" = "rasnet"])
450AC_MSG_NOTICE(Using network protocol: $protocol)
451
452# ------------------------------------------------------------------------------
453
454
455AC_ARG_ENABLE([r],
456              [AS_HELP_STRING([--enable-r],
457                              [compile and install R package.])],
458              [enable_r=yes],
459              [enable_r=no])
460AM_CONDITIONAL([ENABLE_R], [test "$enable_r" = yes])
461
462# check for boost
463AX_BOOST_BASE([1.48],[],[AC_MSG_FAILURE([boost library required with version >= 1.48. Please install it.])])
464AX_BOOST_SYSTEM
465AX_BOOST_THREAD
466AX_BOOST_REGEX
467AX_BOOST_PROGRAM_OPTIONS
468CXXFLAGS="$CXXFLAGS ${BOOST_CPPFLAGS}"
469
470abs_top_srcdir=`pwd`
471RMANBASE=$abs_top_srcdir
472
473### Start - Configuration of third party libraries ###
474THIRD_PARTY_DIR="$RMANBASE/third_party"
475AC_SUBST(THIRD_PARTY_DIR, "$THIRD_PARTY_DIR")
476
477# Add easylogging as a system dependency to prevent warnings
478CXXFLAGS="$CXXFLAGS -isystem $THIRD_PARTY_DIR/easyloggingpp"
479
480# GoogleTest variables
481GTEST_DIR="$THIRD_PARTY_DIR/googletest"
482AC_SUBST(GTEST_DIR, "$GTEST_DIR")
483
484# GoogleTest include flags. GoogleTest is treated as a system dependency.
485CXXFLAGS="$CXXFLAGS -isystem ${GTEST_DIR}/include -I${GTEST_DIR} "
486
487# GoogleMock variables
488GMOCK_DIR="$THIRD_PARTY_DIR/googlemock"
489AC_SUBST(GMOCK_DIR, "$GMOCK_DIR")
490
491GMOCK_BIN="$THIRD_PARTY_DIR/bin/gmock"
492AC_SUBST(GMOCK_BIN, "$GMOCK_BIN")
493
494GMOCK_LIB="$GMOCK_BIN/libgmock.a"
495AC_SUBST(GMOCK_LIB, "$GMOCK_LIB")
496
497# GoogleMock include flags. GoogleMock is treated as a system dependency.
498CXXFLAGS="$CXXFLAGS -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} "
499
500# JSON library
501JSON_DIR="$THIRD_PARTY_DIR/jsoncpp"
502AC_SUBST(JSON_DIR, "$JSON_DIR")
503
504JSON_LIB="$JSON_DIR/libjsoncpp.a"
505AC_SUBST(JSON_LIB, "$JSON_LIB")
506
507CXXFLAGS="$CXXFLAGS -isystem ${JSON_DIR} -I${JSON_DIR} "
508
509### End - Configuration of third party libraries ###
510
511CXXFLAGS="$CXXFLAGS -std=c++11"
512
513### Start - Check for rasnet ###
514if test "$protocol" = "rasnet"; then
515    AC_DEFINE([RMANRASNET], [], [Flag which is true when the rasnet protocol is enabled.])
516
517    # Configuration for Google Protobuf
518    PROTOBUF_BIN="$THIRD_PARTY_DIR/bin/protobuf"
519    AC_SUBST(PROTOBUF_BIN, "$PROTOBUF_BIN")
520    AC_SUBST(PROTOC, "$PROTOBUF_BIN/bin/protoc")
521    AC_SUBST(PROTOBUF_LIBS, "$PROTOBUF_BIN/lib/libprotobuf.a -lpthread")
522    CXXFLAGS="$CXXFLAGS -isystem $PROTOBUF_BIN/include/"
523
524    # Configuration for GRPC
525    GRPC_BIN="$THIRD_PARTY_DIR/bin/grpc"
526    CXXFLAGS="$CXXFLAGS -isystem $GRPC_BIN/include/"
527
528    AC_SUBST(GRPC_BIN, "$GRPC_BIN")
529    AC_SUBST(GRPCCPPPLUGIN, "$GRPC_BIN/bin/grpc_cpp_plugin")
530
531    AC_SUBST(GRPC_LIBS, "$GRPC_BIN/lib/libgrpc++_unsecure.a $GRPC_BIN/lib/libgrpc_unsecure.a -lz")
532
533    # Configuration for GRPC Java
534    GRPC_JAVA_BIN="$THIRD_PARTY_DIR/bin/grpc-java"
535    AC_SUBST(GRPC_JAVA_BIN, "$GRPC_JAVA_BIN")
536
537    if test "$disable_java" = "no"; then
538        AC_SUBST(GRPCJAVAPLUGIN, "$GRPC_JAVA_BIN/protoc-gen-grpc-java")
539    fi
540
541    DISABLE_PROTOBUF_WARNINGS_FLAGS="-Wno-sign-conversion -Wno-shadow -Wno-pedantic -Wno-undef"
542    AC_SUBST(DISABLE_PROTOBUF_WARNINGS_FLAGS, "$DISABLE_PROTOBUF_WARNINGS_FLAGS")
543fi
544### End - Check for rasnet :###
545
546
547# --------------- Database Specific Configuration ------------------
548####################################################################
549
550AS_IF([test "x$with_default_basedb" == x],
551      [with_default_basedb=sqlite])
552AS_IF([test "x$with_petascopedb" == x],
553      [with_petascopedb=postgresql])
554AS_IF([test "x$with_java_server" == x],
555      [with_java_server=external])
556if test "$with_java_server" != external -a "$with_java_server" != embedded; then
557  AC_MSG_ERROR([Invalid Java server defined, must be one of external or embedded.])
558fi
559
560AC_MSG_NOTICE([Using database $with_default_basedb.])
561AC_MSG_NOTICE([Using petascope database $with_petascopedb.])
562AC_MSG_NOTICE([Using Java server mode: $with_java_server.])
563
564if test "$with_default_basedb" == sqlite; then
565    SQLITE3_REQ_VERSION="3.0.0"
566    AX_LIB_SQLITE3($SQLITE3_REQ_VERSION)
567    if test "x$SQLITE3_VERSION" = "x"; then
568       AC_MSG_ERROR([not found SQLite.])
569    fi
570
571    if test "$disable_java" = "no" -a "$with_petascopedb" = "postgresql"; then
572            VERSIONDB=7.4.6
573            AX_LIB_POSTGRESQL([7.4.6])
574    fi
575fi
576
577AS_IF([test "$with_default_basedb" == postgresql],
578      # PostgreSQL definitions
579      [VERSIONDB=7.4.6
580       AX_LIB_POSTGRESQL([7.4.6])
581       AC_MSG_NOTICE([using PotgreSQL version $POSTGRESQL_VERSION])
582       AC_DEFINE([BASEDB_PGSQL])   
583
584       EMBEDDEDSQLEXT="pgc"
585       EMBEDDEDSQLOUT="cc"
586
587       BASEDBCXXFLAGS=" $POSTGRESQL_CFLAGS"
588       BASEDBLDFLAGS="$POSTGRESQL_LDFLAGS -lz -lecpg"
589       STATICBASEDBFLAGS="$BASEDBLDFLAGS"
590       LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS"
591       
592       AC_PROG_ECPG       
593       #AC_CHECK_LIB([ecpg], [main])
594       #AC_CHECK_HEADERS([ecpgerrno.h])
595       # TODO: change main to something sensible
596       AC_CHECK_LIB([pq], [main], , [AC_MSG_FAILURE([Library not found! Please install...])])
597       AC_CHECK_LIB([pgtypes], [main], , [AC_MSG_FAILURE([Library not found! Please install...])])
598       EMBEDDEDSQLPRECOMPILER="$ECPG -o"
599       BASEDBSTRING=pgsql
600      ],
601
602AS_IF([test "$with_default_basedb" == sqlite],
603      [AC_DEFINE([BASEDB_SQLITE])
604
605       EMBEDDEDSQLEXT="sc"
606       EMBEDDEDSQLOUT="cc"
607
608       BASEDBCXXFLAGS="$SQLITE3_CFLAGS"
609       BASEDBLDFLAGS="$SQLITE3_LDFLAGS"
610       STATICBASEDBFLAGS="$BASEDBLDFLAGS"
611       LDFLAGS="$LDFLAGS"
612
613       EMBEDDEDSQLPRECOMPILER="cp -a"
614       BASEDBSTRING=sqlite
615
616       # also configure postgres, needed by rasimport for connecting to petascopedb
617       # this is a copy of an earlier if block, remove once petascope is adapted to use sqlite
618       if test "$disable_java" = "no" -a "$with_petascopedb" = "postgresql"; then
619               BASEDBCXXFLAGS="$BASEDBCXXFLAGS $POSTGRESQL_CFLAGS"
620               BASEDBLDFLAGS="$BASEDBLDFLAGS $POSTGRESQL_LDFLAGS -lz -lecpg"
621               STATICBASEDBFLAGS="$STATICBASEDBFLAGS $BASEDBLDFLAGS"
622               LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS"
623               AC_CHECK_LIB([pq], [main], , [AC_MSG_FAILURE([Library not found! Please install...])])
624               AC_CHECK_LIB([pgtypes], [main], , [AC_MSG_FAILURE([Library not found! Please install...])])
625       fi
626      ],
627[AC_MSG_ERROR([unsupported base DBMS: $with_default_basedb])]))
628
629
630AM_CONDITIONAL([BASEDB_PGSQL], [test "$BASEDBSTRING" = pgsql])
631AM_CONDITIONAL([BASEDB_SQLITE], [test "$BASEDBSTRING" = sqlite])
632
633# gdal-java package for petascope
634AM_CONDITIONAL([GDAL_JAVA_DIR_CENTOS], [test -d "/usr/lib/java/gdal"])
635AM_CONDITIONAL([GDAL_JAVA_DIR_UBUNTU], [test -d "/usr/lib/jni"])
636
637PETASCOPEDB=$with_petascopedb
638AM_CONDITIONAL([PETASCOPEDB_PGSQL], [test "$with_petascopedb" = postgresql])
639AM_CONDITIONAL([PETASCOPEDB_HSQLDB], [test "$with_petascopedb" = hsqldb])
640AM_CONDITIONAL([PETASCOPEDB_SQLITE], [test "$with_petascopedb" = sqlite])
641AC_DEFINE_UNQUOTED([PETASCOPEDB], ["$PETASCOPEDB"])
642
643JAVA_SERVER=$with_java_server
644AM_CONDITIONAL([JAVA_SERVER_EMBEDDED], [test "$with_java_server" = embedded])
645AM_CONDITIONAL([JAVA_SERVER_EXTERNAL], [test "$with_java_server" = external])
646AC_DEFINE_UNQUOTED([JAVA_SERVER], ["$JAVA_SERVER"])
647
648# --------------- General Configuration ----------------------------
649####################################################################
650
651AS_IF([test "$disable_java" = no],
652  [
653    AC_PROG_JAVA
654    AC_PROG_JAVA_CC
655    AC_CHECK_PROGS(JAR_TOOL, jar, [${am_missing_run} jar])
656  ], [])
657
658AM_COND_IF([ENABLE_R], [
659  AM_COND_IF([ENABLE_JAVA], ,
660    [AC_MSG_FAILURE([Cannot enable R package build while Java compilation is disabled.
661                     Do not use --enable-r and --disable-java flags simultaneously.])
662    ])
663  ],)
664
665# General definitions.
666if [ test "x$RMANDEBUG" != "x" || test "x$with_debug_symbols" == "xyes" ]; then
667    GCC_DEBUG_SYMBOLS_FLAG="-g3 -gdwarf-2 -rdynamic"
668fi
669
670if [ test "x$RMANDEBUG" != "x" ]; then
671    AC_DEFINE([RMANDEBUG])
672    AC_DEFINE([DEBUG])
673else
674    AC_DEFINE([_DISABLE_TRACE_LOGS])
675    if [ test "x$with_debug_symbols" == "xno" ]; then
676        AC_DEFINE([__NO_MATH_INLINES])
677    fi
678fi
679
680AC_SUBST(BASEDBSTRING)
681AC_DEFINE_UNQUOTED([BASEDBSTRING], ["$BASEDBSTRING"])
682AC_DEFINE([EARLY_TEMPLATE])   
683AC_C_BIGENDIAN([AC_DEFINE([IS_BIG_ENDIAN])], [AC_DEFINE([IS_LITTLE_ENDIAN])])
684AC_DEFINE([CPPSTDLIB])
685AC_DEFINE([X86]) # Currently, but the code supports multiple platforms
686AC_DEFINE([RASARCHITECTURE], ["X86"])
687AC_DEFINE([RASSCHEMAVERSION], [5])
688AC_DEFINE([NOPRE], [], [Description])
689# if not on DEC Alpha
690BASEDBLDFLAGS+=" -lnsl -L$JSON_DIR"
691STATICBASEDBLDFLAGS+=" -lnsl"
692# endif
693AC_DEFINE([NO_in_addr_t])
694BASEDBCXXFLAGS+=" $DBIF_INC "
695
696COMPDATE=`date +"%d.%m.%Y %H:%M:%S"`
697AC_DEFINE_UNQUOTED([COMPDATE], ["$COMPDATE"])
698
699CXXFLAGS+=" -fno-stack-protector -fno-strict-overflow $GCC_OPTIMIZATION_FLAG $GCC_DEBUG_SYMBOLS_FLAG"
700CXXFLAGS+=" -I$abs_top_srcdir -I$abs_top_srcdir/debug -I$abs_top_srcdir/include $USER_CXXFLAGS"
701CFLAGS+=" $GCC_OPTIMIZATION_FLAG "
702CFLAGS+=" $USER_CFLAGS"
703
704CLIENTCXXFLAGS=$CXXFLAGS
705CLIENTLDFLAGS=$CXXLDFLAGS
706
707# --------------- System Test Settings -----------------------------
708####################################################################
709
710
711
712# --------------- Makefile Substitutions --------------------------
713####################################################################
714
715AC_SUBST(EMBEDDEDSQLPRECOMPILER)
716AC_SUBST(EMBEDDEDSQLEXT)
717AC_SUBST(EMBEDDEDSQLOUT)
718AC_SUBST(BASEDBCXXFLAGS)
719AC_SUBST(BASEDBLDFLAGS)
720AC_SUBST(CLIENTCXXFLAGS)
721AC_SUBST(CLIENTLDFLAGS)
722AC_SUBST(DB2_INC)
723AC_SUBST(DB2_INSTANCEPATH)
724AC_SUBST(DB2_CPPLIBS)
725AC_SUBST(DBIF_INC)
726AC_SUBST(INFORMIX_INC)       
727AC_SUBST(RASMGR_PORT)
728AC_SUBST(REL_STATIC_LIBS)   
729AC_SUBST(RMANBASE)
730AC_SUBST(STATICBASEDBFLAGS)
731AC_SUBST(logdir)   
732AC_SUBST(wardir)
733AC_SUBST(wpswar)
734AC_SUBST(filedatadir)
735AC_SUBST(PETASCOPEDB)
736AC_SUBST(JAVA_SERVER)
737
738#Directories used in the source-code
739CXXFLAGS="$CXXFLAGS -DSHARE_DATA_DIR=\\\"\$(pkgdatadir)/\\\""
740CXXFLAGS="$CXXFLAGS -DCONFDIR=\\\"\$(sysconfdir)/\\\""
741CXXFLAGS="$CXXFLAGS -DBINDIR=\\\"\$(bindir)/\\\""
742CXXFLAGS="$CXXFLAGS -DLOGDIR=\\\"\$(logdir)/\\\""
743CXXFLAGS="$CXXFLAGS -DINCLUDE_DIR=\\\"\$(includedir)/\\\""
744CXXFLAGS="$CXXFLAGS -DFILEDATADIR=\\\"\$(filedatadir)/\\\""
745
746#The order of the compile flag variables is: $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
747#
748#Any flag in $(CXXFLAGS) cannot be followed by any other flag. Also, CXXFLAGS should not be overridden in the Makefile.
749#
750#AM_CXXFLAGS is replaced if you add your bin/lib_CXXFLAGS. Thus overriding any flag in AM_CXXFLAGS can be accomplised by adding: bin/lib_CXXFLAGS = @AM_CXXFLAGS@ <your flags>
751
752AM_CXXFLAGS="$AM_CXXFLAGS $ENABLESTRICTFLAGS"
753AC_SUBST(AM_CXXFLAGS)
754
755AC_OUTPUT
756
757AC_MSG_NOTICE([Rasdaman successfully configured, installation path is '${prefix}'.])
Note: See TracBrowser for help on using the repository browser.