summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: a9a18fd86a5b51186231eeaaa2cd478af1919639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(Rasdaman, 8.0.0, baumann@rasdaman.com)
RMANVERSION=8000
AM_INIT_AUTOMAKE()
# Define CXXFLAGS before AC_PROG_CXX or it will automatically add -g -O2 on some systems
CXXFLAGS=
GCJFLAGS=
# Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
#AC_PROG_YACC
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_RPCGEN
AC_PROG_SED
AM_PROG_CC_C_O
dnl we preffer java
AC_PROG_JAVA_CC
dnl we need bison not yacc
AC_CHECK_PROGS(JAR_TOOL, jar, [${am_missing_run} bison])
AC_CHECK_PROGS(YACC, bison, [${am_missing_run} bison])

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lcrypt':
AC_CHECK_LIB([crypt], [main], , [AC_MSG_FAILURE([libcrypt.a not found! Please install.])])
AC_CHECK_LIB([crypto], [EVP_DigestFinal], , [AC_MSG_FAILURE([libcrypto.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-ldf':
AC_CHECK_LIB([df], [main], , [AC_MSG_FAILURE([libdf.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-ldl':
AC_CHECK_LIB([dl], [main], , [AC_MSG_FAILURE([libdl.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lfl':
AC_CHECK_LIB([fl], [main], , [AC_MSG_FAILURE([libfl.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-ljpeg':
AC_CHECK_LIB([jpeg], [main], , [AC_MSG_FAILURE([libjpeg.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main], , [AC_MSG_FAILURE([libm.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lmfhdf':
AC_CHECK_LIB([mfhdf], [main], , [AC_MSG_FAILURE([libmfhdf.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lncurses':
AC_CHECK_LIB([ncurses], [main], , [AC_MSG_FAILURE([libncurses.a not found! Please install.])])
AC_CHECK_LIB([png], [png_write_row], , [AC_MSG_FAILURE([libpng.a not found! Please install.])])
AC_CHECK_LIB([netpbm], [ppm_readppm], , [AC_MSG_FAILURE([libnetpbm.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lreadline':
AC_CHECK_LIB([readline], [main], , [AC_MSG_FAILURE([libreadline.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lsocket':
AC_CHECK_LIB([socket], [main])
# FIXME: Replace `main' with a function in `-lssl':
AC_CHECK_LIB([storagemgr], [main])
AC_CHECK_LIB([tiff], [TIFFGetField], , [AC_MSG_FAILURE([libtiff.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lz':
AC_CHECK_LIB([z], [main], , [AC_MSG_FAILURE([libz.a not found! Please install.])])


# Checks for header files.
AC_PATH_X
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_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])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_PID_T
AC_C_RESTRICT
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UINT32_T
AC_C_VOLATILE

# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_REPLACE_FNMATCH
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_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])

AC_CONFIG_FILES([Makefile
                 catalogmgr/Makefile         
                 relblobif/Makefile
                 relindexif/Makefile
                 relmddif/Makefile
                 relcatalogif/Makefile
                 reladminif/Makefile
                 relstorageif/Makefile
                 indexmgr/Makefile
                 tilemgr/Makefile
                 storagemgr/Makefile
                 compression/Makefile
                 commline/Makefile
                 network/Makefile
                 raslib/Makefile
                 clientcomm/Makefile
                 servercomm/Makefile
                 rasodmg/Makefile
                 qlparser/Makefile
                 conversion/Makefile
                 mddmgr/Makefile
                 httpserver/Makefile
                 mymalloc/Makefile
                 server/Makefile
                 rasmgr/Makefile
                 rascontrol/Makefile
                 rasdl/Makefile
                 applications/Makefile
                 applications/rasql/Makefile
                 bin/Makefile
                 manuals_and_examples/Makefile
                 insertutils/Makefile
		 include/Makefile
		 java/Makefile
		 petascope/Makefile
		 systemtest/Makefile
          ])

# --------------- Header Template Definitions ----------------------
####################################################################
AH_TEMPLATE([DEBUG], [Enables debug functionality])
AH_TEMPLATE([RMANDEBUG], [Enables debug functionality])
AH_TEMPLATE([RMANVERSION], [The version of Rasdaman currently compiled])
AH_TEMPLATE([BASEDB_PGSQL], [If defined we are compiling over PostgreSQL])
AH_TEMPLATE([__NO_MATH_INLINES], [Used by some performance implementaion of math libraries.])   
AH_TEMPLATE([EARLY_TEMPLATE], [When set allows templates to be instantiated earlier.])    
AH_TEMPLATE([BIG_ENDIAN], [The host system uses big endian encoding.])    
AH_TEMPLATE([LITTLE_ENDIAN], [The host system uses little endian encoding.])    
AH_TEMPLATE([CPPSTDLIB], [Use the std.])    
AH_TEMPLATE([RASARCHITECTURE], [The name of the architecture for which the system is compiling.])    
AH_TEMPLATE([X86], [Compile for a X86 based system.])
AH_TEMPLATE([NO_in_addr_t], [Don't use addr_t.])
AH_TEMPLATE([COMPDATE], [Date of the build (of the configure not the actual build)])
AH_TEMPLATE([BASEDBSTRING], [Name of the database that supports the compiled version of rasdaman.])    
AH_TEMPLATE([RASSCHEMAVERSION], [The version of the schema the database uses.])
AH_TEMPLATE([CONFDIR], [The directory where the installed programs will find their configuration])
# --------------- Parameter Definition -----------------------------
####################################################################
AC_PRESERVE_HELP_ORDER
AC_ARG_WITH([default-rasmgr-port],
            [AS_HELP_STRING([--with-default-rasmgr-port], 
                            [change the default RasMgr port (7001)])],
            [RASMGR_PORT=$withval],
            [RASMGR_PORT=7001])

AC_ARG_WITH([static-libs],
            [AS_HELP_STRING([--with-static-libs],
                            [try to compile using statically linked DBMS libraries])],
            [],
            [with_static_libs=no])
# postgres is automatically defined in m4/ct_check_postgres_db.m4
AC_ARG_WITH([default-basedb],
            [AS_HELP_STRING([--with-basedb],
                            [change the default Base DBMS])],
            [], 
            [with_default_basedb=check])
AC_ARG_ENABLE([debug],
              [AS_HELP_STRING([--enable-debug],
                              [this feature enables generation of binaries that contain extra code for debug output. The output is usually very verbose. It's not recommended for production use.])],
              [RMANDEBUG=on],
              [RMANDEBUG=])

AC_ARG_ENABLE([benchmark],
              [AS_HELP_STRING([--enable-benchmark],
                              [this feature enables generation of binaries that contain extra code for benchmark output.])],
              [CXXFLAGS+=-DRMANBENCHMARK ],
              [])

AC_ARG_WITH([test-server],
            [AS_HELP_STRING([--with-test-server=ADDRESS],
                            [server used for testing])],
            [SERVER="$withval"],
            [SERVER=localhost])
AC_ARG_WITH([test-database],
            [AS_HELP_STRING([--with-test-database=NAME],
                            [database name used for testing])],
            [DATABASE="$withval"],
            [DATABASE=PEBAU])
AC_ARG_WITH([test-port],
            [AS_HELP_STRING([--with-test-port=PORT],
                            [port on which the test server is listening])],
            [PORT="$withval"],
            [PORT="$RASMGRPORT"])
AC_ARG_WITH([test-user],
            [AS_HELP_STRING([--with-test-user=USERNAME],
                            [username used for connecting to the test server])],
            [USER="$withval"],
            [USER=rasadmin])
AC_ARG_WITH([test-passwd],
            [AS_HELP_STRING([--with-test-passwd=PASSWORD],
                            [password used for connecting to the test server])],
            [USER="$withval"],
            [USER=rasadmin])
AC_ARG_WITH([logdir],
            [AS_HELP_STRING([--with-logdir=PATH],
                            [the path where the servers will store their logs])],
            [logdir="$withval"],
            [AS_IF([test "x$prefix" = "x/usr/local"],
                   [logdir="/var/log/rasdaman"],
                   [logdir="${prefix}/log"])])

# --------------- Database Specific Configuration ------------------
####################################################################

AS_IF([test "x$with_default_basedb" == xcheck],
      [with_default_basedb=postgresql])

AC_MSG_NOTICE([Using database $with_default_basedb.])

AS_IF([test "$with_default_basedb" == postgresql],
      # PostgreSQL definitions
      [VERSIONDB=7.4.6
       AX_LIB_POSTGRESQL([7.4.6])
       AC_MSG_NOTICE([using PotgreSQL version $POSTGRESQL_VERSION])
       AC_DEFINE([BASEDB_PGSQL])    

       EMBEDDEDSQLEXT="pgc"
       EMBEDDEDSQLOUT="cc"

       BASEDBCXXFLAGS=" $POSTGRESQL_CFLAGS"
       BASEDBLDFLAGS="$POSTGRESQL_LDFLAGS -lz -lecpg"
       STATICBASEDBFLAGS="$BASEDBLDFLAGS"
       LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS"
       
       AC_PROG_ECPG       
       #AC_CHECK_LIB([ecpg], [main])
       #AC_CHECK_HEADERS([ecpgerrno.h])
       # TODO: change main to something sensible
       AC_CHECK_LIB([pq], [main], , [AC_MSG_FAILURE([Library not found! Please install...])])
       AC_CHECK_LIB([pgtypes], [main], , [AC_MSG_FAILURE([Library not found! Please install...])])
       EMBEDDEDSQLPRECOMPILER="$ECPG -o"
       BASEDBSTRING=pgsql
      ],
      [AC_MSG_ERROR([unsupported base DBMS: $with_default_basedb])])

# --------------- General Configuration ----------------------------
####################################################################

abs_top_srcdir=`pwd`
RMANBASE=$abs_top_srcdir

# Optional packages

# If rasgeo is present then delegate configure to it.    
if test -d "$srcdir/rasgeo"; then
    echo rasgeo
#    AC_CONFIGURE_SUBDIRS([rasgeo])
fi    

# General definitions.
AS_IF([test "x$RMANDEBUG" != x],
      [AC_DEFINE([RMANDEBUG])
       AC_DEFINE([DEBUG])
       CXXFLAGS+=" -g"
      ], 
      [
       AC_DEFINE([__NO_MATH_INLINES])
       CXXFLAGS+=" -O2"
      ])
CXXFLAGS+= -fPIC
CFLAGS+= -fPIC
AC_DEFINE_UNQUOTED([RMANVERSION], [$RMANVERSION])
AC_DEFINE_UNQUOTED([BASEDBSTRING], ["$BASEDBSTRING"])
AC_DEFINE([EARLY_TEMPLATE])    
AC_C_BIGENDIAN([AC_DEFINE([BIG_ENDIAN])], [AC_DEFINE([LITTLE_ENDIAN])])
AC_DEFINE([CPPSTDLIB])
AC_DEFINE([X86]) # Currently, but the code supports multiple platforms
AC_DEFINE([RASARCHITECTURE], ["X86"])
AC_DEFINE([RASSCHEMAVERSION], [5])
AC_DEFINE([NOPRE])
# if not on DEC Alpha
BASEDBLDFLAGS+=" -lnsl"
STATICBASEDBLDFLAGS+=" -lnsl"
# endif
AC_DEFINE([NO_in_addr_t])
BASEDBCXXFLAGS+=" $DBIF_INC"

CLIENTCXXFLAGS=$CXXFLAGS
CLIENTLDFLAGS=$CXXLDFLAGS

COMPDATE=`date +"%d.%m.%Y %H:%M:%S"`
AC_DEFINE_UNQUOTED([COMPDATE], ["$COMPDATE"])

CXXFLAGS+=" -I$abs_top_srcdir -I$abs_top_srcdir/debug -I$abs_top_srcdir/include"

# --------------- System Test Settings -----------------------------
####################################################################



# --------------- Makefile Substitutions --------------------------
####################################################################

AC_SUBST(EMBEDDEDSQLPRECOMPILER)
AC_SUBST(EMBEDDEDSQLEXT)
AC_SUBST(EMBEDDEDSQLOUT)
AC_SUBST(BASEDBCXXFLAGS)
AC_SUBST(BASEDBLDFLAGS)
AC_SUBST(CLIENTCXXFLAGS)
AC_SUBST(CLIENTLDFLAGS)
AC_SUBST(DB2_INC)
AC_SUBST(DB2_INSTANCEPATH)
AC_SUBST(DB2_CPPLIBS)
AC_SUBST(DBIF_INC) 
AC_SUBST(INFORMIX_INC)       
AC_SUBST(ORA_INC)
AC_SUBST(ORA_PROC)
AC_SUBST(ORA_PROCPPFLAGS)
AC_SUBST(ORALDFLAGS)
AC_SUBST(RASMGR_PORT)
AC_SUBST(REL_STATIC_LIBS)   
AC_SUBST(RMANBASE)
AC_SUBST(STATICBASEDBFLAGS)
AC_SUBST(logdir)    

#Directories used in the source-code
CXXFLAGS="$CXXFLAGS -DSHARE_DATA_DIR=\\\"\$(pkgdatadir)/\\\""
CXXFLAGS="$CXXFLAGS -DCONFDIR=\\\"\$(sysconfdir)/\\\""
CXXFLAGS="$CXXFLAGS -DBINDIR=\\\"\$(bindir)/\\\""
CXXFLAGS="$CXXFLAGS -DLOGDIR=\\\"\$(logdir)/\\\""

AC_OUTPUT

AC_MSG_NOTICE([Rasdaman successfully configured, installation path is '${prefix}'.])