~drizzle-trunk/drizzle/development

575.4.7 by Monty Taylor
More header cleanup.
1
dnl -*- bash -*-
1 by brian
clean slate
2
dnl Process this file with autoconf to produce a configure script.
3
77.1.65 by Monty Taylor
We don't really require 2.61, 2.59 is actually fine.
4
AC_PREREQ(2.59)dnl		Minimum Autoconf version required.
1 by brian
clean slate
5
261.2.5 by Monty Taylor
Changed bug contact location to a url..
6
AC_INIT(drizzle, [7.0.0], [http://bugs.launchpad.net/drizzle])
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
7
AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
39 by Brian Aker
Move build helper files into config
8
AC_CONFIG_AUX_DIR(config)
236.1.9 by Monty Taylor
Cleaned up configure.ac line.
9
AC_CONFIG_HEADERS([config.h])
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
10
722.1.3 by Monty Taylor
Cleaned up a few build things.
11
# Setting CFLAGS here prevents AC_CANONICAL_TARGET from injecting them
12
SAVE_CFLAGS=${CFLAGS}
13
SAVE_CXXFLAGS=${CXXFLAGS}
14
CFLAGS=
15
CXXFLAGS=
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
16
28.1.33 by Monty Taylor
Added -Wall
17
AC_CANONICAL_TARGET
722.1.3 by Monty Taylor
Cleaned up a few build things.
18
19
CFLAGS=${SAVE_CFLAGS}
20
CXXFLAGS=${SAVE_CXXFLAGS}
21
722.1.1 by Monty Taylor
Removed Gnu-Make-isms, since there were only two and we really don't need them and I'm sick of having make break when I accidentally type "make" (silly me) on Solaris.
22
AM_INIT_AUTOMAKE(nostdinc -Wall -Werror)
722.1.3 by Monty Taylor
Cleaned up a few build things.
23
if test "x${enable_dependency_tracking}" = "x"
24
then
25
  enable_dependency_tracking=yes
26
fi
27
28
1 by brian
clean slate
29
# See the libtool docs for information on how to do shared lib versions.
383.1.47 by Monty Taylor
Couple of tiny changes.
30
SHARED_LIB_MAJOR_VERSION=1
1 by brian
clean slate
31
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
722.1.3 by Monty Taylor
Cleaned up a few build things.
32
AC_SUBST(SHARED_LIB_MAJOR_VERSION)
33
AC_SUBST(SHARED_LIB_VERSION)
34
528 by Monty Taylor
Re-arragned a few things in configure.ac.
35
36
dnl Checks for programs.
37
AC_PROG_CC
554 by Monty
Added impl of macro missing from old systems.
38
722.1.3 by Monty Taylor
Cleaned up a few build things.
39
ACX_USE_SYSTEM_EXTENSIONS
528 by Monty Taylor
Re-arragned a few things in configure.ac.
40
AC_PROG_CXX
41
AC_CXX_HEADER_STDCXX_98
42
if test "$ac_cv_cxx_stdcxx_98" = "no"
43
then
44
  AC_MSG_ERROR([C++ Compiler required to compile Drizzle])
45
fi
46
AC_PROG_CPP
47
AM_PROG_CC_C_O
48
520.4.37 by Monty Taylor
Added some Sun compile flags.
49
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
722.1.3 by Monty Taylor
Cleaned up a few build things.
50
ifdef([AC_PROG_CC_C99],[
51
    AC_PROG_CC_C99([$1],[$2],[$3])
52
],[
53
if "x$GCC" = "xyes"
54
then
55
  C99_SUPPORT_HACK="-std=gnu99"
56
fi
57
if "x$SUNCC" = "xyes"
58
then
59
  C99_SUPPORT_HACK="-xc99"
60
fi
61
])
520.4.37 by Monty Taylor
Added some Sun compile flags.
62
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
63
1 by brian
clean slate
64
65
# Set all version vars based on $VERSION. How do we do this more elegant ?
66
# Remember that regexps needs to quote [ and ] since this is run through m4
67
# We take some made up examples
68
#
69
#  VERSION                  5.1.40sp1-alpha     5.0.34a
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
70
#  DRIZZLE_NO_DASH_VERSION    5.1.40sp1           5.0.34a
71
#  DRIZZLE_NUMERIC_VERSION    5.1.40              5.0.34
72
#  DRIZZLE_BASE_VERSION       5.1                 5.0
73
#  DRIZZLE_VERSION_ID         50140               50034
1 by brian
clean slate
74
#
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
75
DRIZZLE_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
76
DRIZZLE_NUMERIC_VERSION=`echo $DRIZZLE_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
77
DRIZZLE_BASE_VERSION=`echo $DRIZZLE_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
78
DRIZZLE_VERSION_ID=`echo $DRIZZLE_NUMERIC_VERSION | \
1 by brian
clean slate
79
    awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
722.1.3 by Monty Taylor
Cleaned up a few build things.
80
AC_DEFINE_UNQUOTED(DRIZZLE_BASE_VERSION,["$DRIZZLE_BASE_VERSION"],
81
                   [Major and minor version])
82
AC_DEFINE_UNQUOTED([DRIZZLE_VERSION_ID],[$DRIZZLE_VERSION_ID],
83
		   [Version ID that can be easily used for numeric comparison])
1 by brian
clean slate
84
85
# The port should be constant for a LONG time
301 by Brian Aker
Clean up port startup
86
DRIZZLE_TCP_PORT_DEFAULT=4427
1 by brian
clean slate
87
475 by Monty Taylor
Added m4 files for deficient systems. Changed include mechanism to not need
88
sinclude(m4/dtrace.m4)
722.1.3 by Monty Taylor
Cleaned up a few build things.
89
202.3.14 by Monty Taylor
Moved m4 macros to top-level m4 dir, per GNU standards (and where gettext wanted it :)
90
sinclude(m4/character_sets.m4)
722.1.3 by Monty Taylor
Cleaned up a few build things.
91
AC_SUBST(AVAILABLE_LANGUAGES)
92
520.4.39 by mordred
Made a change to gettext.m4 to help building on solaris.
93
sinclude(m4/gettext.m4)
202.3.2 by Monty Taylor
Added gettext calls in to my_getopt.c and drizzle.c
94
AM_GNU_GETTEXT([external])
384 by Monty Taylor
Expanded po subdir trap to catch the case where we're setting programs to :.
95
AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"])
1 by brian
clean slate
96
722.1.3 by Monty Taylor
Cleaned up a few build things.
97
# Set this for plugins to use
98
ac_build_drizzle="yes"
441 by Monty Taylor
Move unconditional defines to config.h.
99
100
1 by brian
clean slate
101
# Canonicalize the configuration name.
102
103
# Check whether --with-system-type or --without-system-type was given.
28.1.33 by Monty Taylor
Added -Wall
104
AC_ARG_WITH([system-type],
105
    [AS_HELP_STRING([--with-system-type],
106
       [Set the system type, like "sun-solaris10"])],
1 by brian
clean slate
107
    [SYSTEM_TYPE="$withval"],
108
    [SYSTEM_TYPE="$host_vendor-$host_os"])
28.1.33 by Monty Taylor
Added -Wall
109
AC_ARG_WITH([machine-type],
110
    [AS_HELP_STRING([--with-machine-type],
111
       [Set the machine type, like "powerpc"])],
1 by brian
clean slate
112
    [MACHINE_TYPE="$withval"],
113
    [MACHINE_TYPE="$host_cpu"])
114
AC_SUBST(SYSTEM_TYPE)
115
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
116
                   [Name of system, eg sun-solaris])
117
AC_SUBST(MACHINE_TYPE)
118
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
119
                   [Machine type name, eg sparc])
120
121
# Detect intel x86 like processor
122
BASE_MACHINE_TYPE=$MACHINE_TYPE
123
case $MACHINE_TYPE in
124
  i?86) BASE_MACHINE_TYPE=i386 ;;
125
esac
126
127
AM_SANITY_CHECK
128
# This is needed is SUBDIRS is set
129
AC_PROG_MAKE_SET
130
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
131
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
132
case "$target_os" in
133
  *linux*)
134
  TARGET_LINUX="true"
135
  AC_SUBST(TARGET_LINUX)
136
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
137
    ;;
271 by Brian Aker
OSX fix
138
  *apple-darwin*)
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
139
    TARGET_OSX="true"
140
    AC_SUBST(TARGET_OSX)
271 by Brian Aker
OSX fix
141
    AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
1 by brian
clean slate
142
    ;;
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
143
  *solaris*)
144
    TARGET_SOLARIS="true"
145
    AC_SUBST(TARGET_SOLARIS)
146
    AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
147
    ;;
1 by brian
clean slate
148
  *)
149
    ;;
150
esac
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
151
152
dnl AC_CANONICAL_HOST thinks it's a good idea to just set CFLAGS to 
153
dnl -g -O2 if you're running gcc. We would like to use something else, thanks.
154
if test "x${CFLAGS}" = "x-g -O2"
155
then
156
  CFLAGS=
157
fi
158
if test "x${CXXFLAGS}" = "x-g -O2"
159
then
160
  CXXFLAGS=
161
fi
162
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
163
DRIZZLE_CHECK_C_VERSION
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
164
DRIZZLE_CHECK_CXX_VERSION
1 by brian
clean slate
165
590.2.23 by Monty Taylor
Fixed a few things for solaris builds.
166
AC_SYS_LARGEFILE
167
230.3.1 by Monty Taylor
Bug 252805: ./configure not detecting missing g++
168
AC_PROG_AWK
169
28.1.33 by Monty Taylor
Added -Wall
170
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
171
then
172
  AS="$CC -c"
173
  AC_SUBST(AS)
174
else
175
  AC_PATH_PROG(AS, as, as)
176
fi
177
446 by Monty Taylor
Moved GNU_SOURCE define to configure.
178
dnl TODO: This needs to go away and be replaced with _ISOC99_SOURCE
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
179
if test "$ac_cv_c_compiler_gnu" = "yes" -o "$target_os" = "linux-gnu"
446 by Monty Taylor
Moved GNU_SOURCE define to configure.
180
then
181
  AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
182
fi
183
445 by Monty Taylor
Moved sun defines to configure.ac.
184
dnl  Solaris 9 include file <sys/feature_tests.h> refers to X/Open document
185
186
dnl  System Interfaces and Headers, Issue 5
187
188
dnl  saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes,
189
dnl  but apparently other systems (namely FreeBSD) don't agree.
190
191
dnl  On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600.
192
dnl  Furthermore, it tests that if a program requires older standard
193
dnl  (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be
194
dnl  run on a new compiler (that defines _STDC_C99) and issues an #error.
195
dnl  It's also an #error if a program requires new standard (_XOPEN_SOURCE=600
196
dnl  or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99.
197
198
dnl  To add more to this mess, Sun Studio C compiler defines _STDC_C99 while
199
dnl  C++ compiler does not!
200
455 by Monty Taylor
Rewored Sun C99 stuff in autoconf. (Trond... will this work?)
201
dnl TODO: Can _ISOC99_SOURCE be defined on all platforms and remove the 
202
dnl       Need for all of this? 
520.9.3 by mordred
zomg. Solaris actually builds all the way!!!
203
if test "$GCC" = "yes"
204
then
205
  case "$target_os" in
206
    *solaris*)
207
    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE=600"
208
    CXXFLAGS="${CXXFLAGS} -D__C99FEATURES__"
209
    ;;
210
  esac
211
fi
445 by Monty Taylor
Moved sun defines to configure.ac.
212
1 by brian
clean slate
213
# We use libtool
214
AC_PROG_LIBTOOL
215
216
# Ensure that we have --preserve-dup-deps defines, otherwise we get link
217
# problems of 'mysql' with CXX=g++
218
LIBTOOL="$LIBTOOL --preserve-dup-deps"
219
AC_SUBST(LIBTOOL)dnl
220
221
AC_SUBST(NM)dnl
222
223
AC_PROG_INSTALL
224
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
225
579.1.1 by Toru Maesaka
Added tests for groupaad and useradd
226
# Look for "(group|user)add". 
227
# TODO: If the programs do not exist, inform the DBA that the user
228
#       was not created at the end of the install routine.
229
AC_CHECK_PROGS(GROUPADD, groupadd addgroup)
230
AC_CHECK_PROGS(USERADD, useradd adduser)
231
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
232
dnl Needed for ltmain
233
AC_PROG_RANLIB
234
235
dnl Not critical since the generated file is distributed
629.1.1 by Monty Taylor
More solaris fixes.
236
AC_CHECK_PROGS(YACC, ['bison -y'])
77.1.70 by Monty Taylor
Added a failure if you don't have bison and you're building from a .bzr branch.
237
if test -z "$YACC" && test -d ".bzr"
238
then
239
  AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
240
fi
1 by brian
clean slate
241
242
AC_PATH_PROG(uname_prog, uname, no)
243
244
# We should go through this and put all the explictly system dependent
245
# stuff in one place
246
AC_MSG_CHECKING(operating system)
247
AC_CACHE_VAL(mysql_cv_sys_os,
248
[
249
if test "$uname_prog" != "no"; then
250
  mysql_cv_sys_os="`uname`"
251
else
252
  mysql_cv_sys_os="Not Solaris"
253
fi
254
])
255
AC_MSG_RESULT($mysql_cv_sys_os)
256
257
258
# The following is required for portable results of floating point calculations
259
# on PowerPC. The same must also be done for IA-64, but this options is missing
260
# in the IA-64 gcc backend.
261
262
if test "$GCC" = "yes"
263
then
264
  case "$host_cpu" in
265
    *ppc* | *powerpc*)
287.3.28 by Monty Taylor
Expanded the move to AM_CFLAGS and AM_CXXFLAGS. Now we should be more correct.
266
      AM_CFLAGS="$CFLAGS -mno-fused-madd"
267
      AM_CXXFLAGS="$CXXFLAGS -mno-fused-madd"
1 by brian
clean slate
268
    ;;
269
  esac
270
fi
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
271
# Build optimized or debug version ?
272
# First check for gcc and g++
273
SYMBOLS_FLAGS="-g"
274
DEBUG_OPTIMIZE_CC=""
275
OPTIMIZE_CFLAGS="-O"
276
DEBUG_OPTIMIZE_CXX=""
277
OPTIMIZE_CXXFLAGS="-O"
278
if test "$GCC" = "yes"
279
then
280
  SYMBOLS_FLAGS="-ggdb3"
281
  DEBUG_OPTIMIZE_CC="-O0"
282
  OPTIMIZE_CFLAGS="-O3"
283
  DEBUG_OPTIMIZE_CXX="-O0"
284
  OPTIMIZE_CXXFLAGS="-O3"
285
fi
286
if test "$SUNCC" = "yes"
287
then
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
288
  dnl I'm cheating here and sticking C99 support in SYMBOLS_FLAGS
289
  SYMBOLS_FLAGS=""
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
290
  DEBUG_OPTIMIZE_CC=""
685.1.20 by Monty Taylor
Fixed memalign for only on sparc.
291
  if test "$target_cpu" = "sparc"
292
  then
293
    MEMALIGN_FLAGS="-xmemalign=8s"
294
  fi
295
  OPTIMIZE_CFLAGS="-xO4 -xlibmil -xdepend -Xa -mt -xstrconst -D_FORTEC_ ${MEMALIGN_FLAGS}"
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
296
  DEBUG_OPTIMIZE_CXX=""
520.9.1 by mordred
More solaris fixes.
297
  #Put back in once isnan is figured out
685.1.20 by Monty Taylor
Fixed memalign for only on sparc.
298
  OPTIMIZE_CXXFLAGS="-xO4 -xlibmil -mt -D_FORTEC_ -xlang=c99 -compat=5 -library=stlport4 ${MEMALIGN_FLAGS}"
520.4.40 by mordred
Added an option to specify --with-probuf=<location>
299
fi
300
301
dnl TODO: Remove this define once we are using 2.61 across the board.
302
# AX_HEADER_ASSERT
303
# ----------------
304
# Check whether to enable assertions.
305
AC_DEFUN([AX_HEADER_ASSERT],
306
[
307
  AC_MSG_CHECKING([whether to enable assertions])
308
  AC_ARG_ENABLE([assert],
309
    [AS_HELP_STRING([--disable-assert],
310
       [Turn off assertions])],
311
    [ac_cv_assert="no"],
312
    [ac_cv_assert="yes"])
313
  AC_MSG_RESULT([$ac_cv_assert])
314
])
315
316
AX_HEADER_ASSERT
317
318
CFLAGS="${SYMBOLS_FLAGS} ${CFLAGS}"
319
CXXFLAGS="${SYMBOLS_FLAGS} ${CXXFLAGS}"
320
321
AC_ARG_WITH([debug],
322
    [AS_HELP_STRING([--with-debug],
323
       [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
324
    [with_debug=$withval],
325
    [with_debug=no])
326
if test "$with_debug" = "yes"
327
then
328
  # Medium debug.
329
  CFLAGS="$DEBUG_OPTIMIZE_CC -DDEBUG $CFLAGS ${SAVE_CFLAGS}"
330
  CXXFLAGS="$DEBUG_OPTIMIZE_CXX -DDEBUG $CXXFLAGS ${SAVE_CXXFLAGS}"
331
else
332
  # Optimized version. No debug
333
  CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS} ${SAVE_CFLAGS}"
334
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS ${SAVE_CXXFLAGS}"
335
fi
1 by brian
clean slate
336
337
AC_SUBST(CC)
338
AC_SUBST(CFLAGS)
339
AC_SUBST(CXX)
340
AC_SUBST(CXXFLAGS)
341
AC_SUBST(ASFLAGS)
342
AC_SUBST(LD)
343
AC_SUBST(INSTALL_SCRIPT)
344
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
345
1 by brian
clean slate
346
export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
347
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
348
AC_CXX_STL_HASH
349
AC_CXX_CSTDINT
350
AC_CXX_CINTTYPES
351
AC_CXX_CMATH
1 by brian
clean slate
352
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
353
DRIZZLE_PROG_AR
1 by brian
clean slate
354
261.2.3 by Monty Taylor
Moved libdrizzle.ver.in to libdrizzle.ver.
355
# libdrizzle versioning when linked with GNU ld.
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
356
if test "x$EGREP" != "x"
357
then
358
  if test "$lt_cv_prog_gnu_ld" = "yes" -a $LD --version 2>/dev/null|${EGREP} -q GNU
359
  then
360
    LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libdrizzle/libdrizzle.ver"
361
  fi
1 by brian
clean slate
362
fi
363
AC_SUBST(LD_VERSION_SCRIPT)
364
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
365
#--------------------------------------------------------------------
366
# Check for Google Proto Buffers
367
#--------------------------------------------------------------------
368
629.2.4 by Monty Taylor
Cleaned up the lib searching - now base some searches off of the prefix.
369
AC_LANG_PUSH([C++])
370
SEARCH_FOR_LIB(protobuf, printf, google/protobuf/message.h,
371
               AC_MSG_ERROR([protobuf is required for Drizzle]))
372
373
AC_PATH_PROG([PROTOC],[protoc],[no],[$PROTOBUF_PATH])
520.4.47 by Monty Taylor
Added check for protoc to protobuf checks.
374
if test "x$PROTOC" = "xno"
375
then
376
  AC_MSG_ERROR([Couldn't find protoc. Try installing Google Protocol Buffer.])
377
fi
378
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
379
AC_LANG_POP()
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
380
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
381
#--------------------------------------------------------------------
520.4.27 by Monty Taylor
Fail if we don't find uuid/uuid.h.
382
# Check for libuuid
383
#--------------------------------------------------------------------
384
590.2.13 by Monty Taylor
Reverted libuuid check code.
385
dnl Do this by hand instead of with SEARCH_FOR_LIB, because uuid is weird.
386
AC_CHECK_HEADERS(uuid/uuid.h)
387
if test "x$ac_cv_header_uuid_uuid_h" = "xno"
388
then
389
  AC_MSG_ERROR([Couldn't find uuid/uuid.h. Try installing libuuid development packages])
390
fi
391
AC_CHECK_LIB(uuid, uuid_generate)
520.4.27 by Monty Taylor
Fail if we don't find uuid/uuid.h.
392
393
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
394
# Check for libevent
395
#--------------------------------------------------------------------
396
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
397
SEARCH_FOR_LIB(event, event_loop, event.h, 
398
               AC_MSG_ERROR([libevent is required for Drizzle]))
399
134.2.1 by Antony Curtis
Changes for proper detection of libraries
400
590.2.4 by Monty Taylor
ac_cv_libevent_works needs to be named right.
401
AC_CACHE_CHECK([for bufferevent in libevent], ac_cv_libevent_works, [
573.1.1 by mozo at mozo
Fix build and indents
402
  save_CPPFLAGS="$CPPFLAGS"
134.2.1 by Antony Curtis
Changes for proper detection of libraries
403
  save_LIBS="$LIBS"
629.2.4 by Monty Taylor
Cleaned up the lib searching - now base some searches off of the prefix.
404
  CPPFLAGS="$EVENT_CFLAGS"
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
405
  LIBS="$EVENT_LIBS"
134.2.1 by Antony Curtis
Changes for proper detection of libraries
406
  AC_TRY_LINK([
407
#include <sys/types.h>
408
#include <sys/time.h>
409
#include <stdlib.h>
410
#include <event.h>],[
411
	struct bufferevent bev;
412
	bufferevent_settimeout(&bev, 1, 1);
590.2.4 by Monty Taylor
ac_cv_libevent_works needs to be named right.
413
  ], ac_cv_libevent_works=yes, [
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
414
        AC_MSG_ERROR([you need to install a more recent version of libevent,
134.2.1 by Antony Curtis
Changes for proper detection of libraries
415
	check http://www.monkey.org/~provos/libevent/])
416
  ])
417
573.1.1 by mozo at mozo
Fix build and indents
418
  CPPFLAGS="$save_CPPFLAGS"
134.2.1 by Antony Curtis
Changes for proper detection of libraries
419
  LIBS="$save_LIBS"
420
])
421
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
422
423
#--------------------------------------------------------------------
424
# Check for libpthread
425
#--------------------------------------------------------------------
426
427
AC_CHECK_HEADERS(pthread.h)
428
if test "x$ac_cv_header_pthread_h" != "xyes"
429
then
430
  AC_MSG_ERROR([Couldn't find pthread.h.])
431
fi
432
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR(could not find libpthread)])
433
434
#--------------------------------------------------------------------
612.2.5 by Monty Taylor
Added test for mtmalloc, if we haven't explicitly asked for tcmalloc.
435
# Check for tcmalloc/mtmalloc
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
436
#--------------------------------------------------------------------
437
438
AC_ARG_ENABLE([tcmalloc],
439
    [AS_HELP_STRING([--enable-tcmalloc],
440
       [Enable linking with tcmalloc @<:@default=off@:>@])],
236.1.14 by Monty Taylor
Merged build changes from Antony.
441
    [ac_enable_tcmalloc="$enableval"],
442
    [ac_enable_tcmalloc="no"])
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
443
612.2.5 by Monty Taylor
Added test for mtmalloc, if we haven't explicitly asked for tcmalloc.
444
if test "x$ac_enable_tcmalloc" != "xno"
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
445
then
446
  AC_CHECK_LIB(tcmalloc,malloc,[],[])
447
fi
448
612.2.5 by Monty Taylor
Added test for mtmalloc, if we haven't explicitly asked for tcmalloc.
449
if test "x$ac_cv_lib_tcmalloc_malloc" != "xyes"
450
then
451
  AC_CHECK_LIB(mtmalloc,malloc,[],[])
452
fi
453
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
454
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
455
# Check for libz
456
#--------------------------------------------------------------------
457
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
458
SEARCH_FOR_LIB(z, crc32, zlib.h, 
459
               AC_MSG_ERROR([libz is required for Drizzle]))
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
460
612.2.9 by Monty Taylor
Woot. No more extra CFLAGS on the command line!
461
#--------------------------------------------------------------------
462
# Check for libncurses
463
#--------------------------------------------------------------------
464
465
635.1.4 by Elan Ruusamäe
- search for tgetent from -ltinfo too
466
SEARCH_FOR_LIB(ncurses, tgetent, ncurses/ncurses.h, [
467
	SEARCH_FOR_LIB(tinfo, tgetent, ncurses/ncurses.h,
468
		AC_MSG_ERROR([Couldn't find ncurses])
469
	)
470
	]
471
)
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
472
182.1.5 by Jim Winstead
Detect and make the Mac OS X libedit readline interface look like the
473
#--------------------------------------------------------------------
474
# Check for libreadline or compatible (libedit on Mac OS X)
475
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
476
612.2.9 by Monty Taylor
Woot. No more extra CFLAGS on the command line!
477
478
SEARCH_FOR_LIB(readline, rl_initialize, readline/readline.h,
479
               AC_MSG_ERROR([libreadline is required for Drizzle]),
480
               [$NCURSES_LIBS]) 
481
482
save_CPPFLAGS="$CPPFLAGS"
629.2.8 by Monty Taylor
Fixed a configure oops.
483
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
612.2.9 by Monty Taylor
Woot. No more extra CFLAGS on the command line!
484
AC_CHECK_HEADERS(readline/history.h)
236.1.14 by Monty Taylor
Merged build changes from Antony.
485
AC_CHECK_TYPES([HIST_ENTRY], [], [], [AC_INCLUDES_DEFAULT[
486
#ifdef HAVE_READLINE_HISTORY_H
487
#include <readline/history.h>
488
#endif
489
#include <readline/readline.h>
490
]])
491
AC_CHECK_DECLS([completion_matches], [], [], [AC_INCLUDES_DEFAULT[
492
#ifdef HAVE_READLINE_HISTORY_H
493
#include <readline/history.h>
494
#endif
495
#include <readline/readline.h>
496
]])
207.1.2 by Jim Winstead
Fix test for libreadline to test a function that exists in all usable
497
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
498
DRIZZLE_CHECK_NEW_RL_INTERFACE
612.2.9 by Monty Taylor
Woot. No more extra CFLAGS on the command line!
499
CPPFLAGS="$save_CPPFLAGS"
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
500
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
501
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
502
#--------------------------------------------------------------------
503
# Check for libpcre
504
#--------------------------------------------------------------------
505
506
AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found.]))
612.2.7 by Monty Taylor
Switched from pcrecpp to plain pcre - mainly so that we can build on OpenSolaris without dealing with G++ vs. SunStudio C++. This all goes away with new test framework - so I did not write pretty replacement code.
507
PKG_CHECK_MODULES(PCRE, [libpcre >= 3], [found_pcre="yes"],[found_pcre="no"])
236.1.18 by Monty Taylor
Put in actual PCRE linking test.
508
509
if test "$found_pcre" = "no"
510
then
612.2.7 by Monty Taylor
Switched from pcrecpp to plain pcre - mainly so that we can build on OpenSolaris without dealing with G++ vs. SunStudio C++. This all goes away with new test framework - so I did not write pretty replacement code.
511
  SEARCH_FOR_LIB(pcre, pcre_compile, pcre.h, 
512
                 AC_MSG_ERROR([libpcre is required for Drizzle]))
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
513
fi
514
AC_SUBST(PCRE_LIBS)
515
AC_SUBST(PCRE_CFLAGS)
516
1 by brian
clean slate
517
dnl Find paths to some shell programs
518
AC_PATH_PROG(LN, ln, ln)
519
# This must be able to take a -f flag like normal unix ln.
520
AC_PATH_PROG(LN_CP_F, ln, ln)
521
522
AC_PATH_PROG(MV, mv, mv)
523
AC_PATH_PROG(RM, rm, rm)
524
AC_PATH_PROG(CP, cp, cp)
525
AC_PATH_PROG(SED, sed, sed)
526
AC_PATH_PROG(CMP, cmp, cmp)
527
AC_PATH_PROG(CHMOD, chmod, chmod)
528
AC_PATH_PROG(HOSTNAME, hostname, hostname)
529
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
530
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
531
AC_CHECK_PROGS(TAR, gnutar gtar tar)
532
533
dnl We use a path for perl so the script startup works
534
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
535
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
536
AC_PATH_PROG(PERL, perl, no)
537
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
538
then
539
  PERL5=$PERL
540
else
541
  AC_PATH_PROG(PERL5, perl5, no)
542
  if test "$PERL5" != no
543
  then
544
    PERL=$PERL5
545
    ac_cv_path_PERL=$ac_cv_path_PERL5
546
  fi
547
fi
548
549
AC_SUBST(HOSTNAME)
550
AC_SUBST(PERL)
551
AC_SUBST(PERL5)
552
553
# icheck, used for ABI check
554
AC_PATH_PROG(ICHECK, icheck, no)
555
# "icheck" is also the name of a file system check program on Tru64.
556
# Verify the program found is really the interface checker.
557
if test "x$ICHECK" != "xno"
558
then
559
  AC_MSG_CHECKING(if $ICHECK works as expected)
560
  echo "int foo;" > conftest.h
561
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
562
  if test -f "conftest.ic"
563
  then
564
    AC_MSG_RESULT(yes)
565
  else
566
    AC_MSG_RESULT(no)
567
    ICHECK=no
568
  fi
569
  rm -f conftest.ic conftest.h
570
fi
571
AC_SUBST(ICHECK)
572
573
# Lock for PS
574
AC_PATH_PROG(PS, ps, ps)
575
AC_MSG_CHECKING("how to check if pid exists")
576
PS=$ac_cv_path_PS
577
# Linux style
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
578
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
1 by brian
clean slate
579
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
580
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
581
# Solaris
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
582
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
583
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
584
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
585
# BSD style
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
586
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
587
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
588
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
1 by brian
clean slate
589
# SysV style
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
590
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
591
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
592
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
1 by brian
clean slate
593
# Do anybody use this?
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
594
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
1 by brian
clean slate
595
then
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
596
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
597
else
598
  case $SYSTEM_TYPE in
394 by Monty Taylor
Fix configure problem on cygwin. Thanks awfief.
599
    *freebsd*|*dragonfly*|*cygwin*)
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
600
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
1 by brian
clean slate
601
      ;;
602
    *darwin*)
632.1.7 by Monty
Reworked grep change to work with old crappy autoconfs.
603
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
1 by brian
clean slate
604
      ;;
605
    *)
606
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
236.1.39 by Monty Taylor
autoconf warning cleanups.
607
      ;;
1 by brian
clean slate
608
  esac
609
fi
610
AC_SUBST(FIND_PROC)
611
AC_MSG_RESULT("$FIND_PROC")
612
613
# Check if a pid is valid
614
AC_PATH_PROG(KILL, kill, kill)
615
AC_MSG_CHECKING("for kill switches")
616
if $ac_cv_path_KILL -0 $$
617
then
618
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
619
elif kill -s 0 $$
620
then
621
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
622
else
623
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
624
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
625
fi
626
AC_SUBST(CHECK_PID)
627
AC_MSG_RESULT("$CHECK_PID")
628
629
# We need an ANSI C compiler
630
AM_PROG_CC_STDC
631
632
# We need an assembler, too
633
AM_PROG_AS
634
CCASFLAGS="$CCASFLAGS $ASFLAGS"
635
636
# Check if we need noexec stack for assembler
637
AC_CHECK_NOEXECSTACK
638
639
if test "$am_cv_prog_cc_stdc" = "no"
640
then
91 by Brian Aker
Main binary now named drizzled
641
  AC_MSG_ERROR([Drizzle requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
1 by brian
clean slate
642
fi
643
644
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
645
AC_ARG_WITH([server-suffix],
646
    [AS_HELP_STRING([--with-server-suffix],
647
      [Append value to the version string.])],
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
648
    [ DRIZZLE_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
649
    [ DRIZZLE_SERVER_SUFFIX= ]
1 by brian
clean slate
650
    )
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
651
AC_DEFINE_UNQUOTED([DRIZZLE_SERVER_SUFFIX],[$DRIZZLE_SERVER_SUFFIX],
652
                   [Append value to the version string])
1 by brian
clean slate
653
654
# Force use of a curses libs
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
655
AC_ARG_WITH([named-curses-libs],
656
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
657
            [Use specified curses libraries instead of those
658
		automatically found by configure.])],
1 by brian
clean slate
659
    [ with_named_curses=$withval ],
660
    [ with_named_curses=no ]
661
    )
662
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
663
AC_ARG_WITH([tcp-port],
664
    [AS_HELP_STRING([--with-tcp-port=port-number],
165.1.1 by Elliot Murphy
new port number from IANA
665
            [Which port to use for Drizzle services @<:@default=4427@:>@])],
301 by Brian Aker
Clean up port startup
666
    [ DRIZZLE_TCP_PORT=$withval ],
667
    [ DRIZZLE_TCP_PORT=$DRIZZLE_TCP_PORT_DEFAULT
1 by brian
clean slate
668
      # if we actually defaulted (as opposed to the pathological case of
301 by Brian Aker
Clean up port startup
669
      # --with-tcp-port=<DRIZZLE_TCP_PORT_DEFAULT> which might in theory
1 by brian
clean slate
670
      # happen if whole batch of servers was built from a script), set
671
      # the default to zero to indicate that; we don't lose information
672
      # that way, because 0 obviously indicates that we can get the
301 by Brian Aker
Clean up port startup
673
      # default value from DRIZZLE_TCP_PORT. this seems really evil, but
674
      # testing for DRIZZLE_TCP_PORT==DRIZZLE_TCP_PORT_DEFAULT would make a
675
      # a port of DRIZZLE_TCP_PORT_DEFAULT magic even if the builder did not
1 by brian
clean slate
676
      # intend it to mean "use the default, in fact, look up a good default
165.1.1 by Elliot Murphy
new port number from IANA
677
      # from /etc/services if you can", but really, really meant 4427 when
678
      # they passed in 4427. When they pass in a specific value, let them
1 by brian
clean slate
679
      # have it; don't second guess user and think we know better, this will
680
      # just make people cross.  this makes the the logic work like this
681
      # (which is complicated enough):
682
      #
683
      # - if a port was set during build, use that as a default.
684
      #
685
      # - otherwise, try to look up a port in /etc/services; if that fails,
301 by Brian Aker
Clean up port startup
686
      #   use DRIZZLE_TCP_PORT_DEFAULT (at the time of this writing 4427)
1 by brian
clean slate
687
      #
301 by Brian Aker
Clean up port startup
688
      # - allow the DRIZZLE_TCP_PORT environment variable to override that.
1 by brian
clean slate
689
      #
690
      # - allow command-line parameters to override all of the above.
691
      #
301 by Brian Aker
Clean up port startup
692
      # the top-most DRIZZLE_TCP_PORT_DEFAULT is read from win/configure.js,
1 by brian
clean slate
693
      # so don't mess with that.
301 by Brian Aker
Clean up port startup
694
      DRIZZLE_TCP_PORT_DEFAULT=0 ]
1 by brian
clean slate
695
    )
301 by Brian Aker
Clean up port startup
696
AC_SUBST(DRIZZLE_TCP_PORT)
1 by brian
clean slate
697
# We might want to document the assigned port in the manual.
301 by Brian Aker
Clean up port startup
698
AC_SUBST(DRIZZLE_TCP_PORT_DEFAULT)
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
699
AC_DEFINE_UNQUOTED([DRIZZLE_PORT],[$DRIZZLE_TCP_PORT],
700
                   [Drizzle port to use])
701
AC_DEFINE_UNQUOTED([DRIZZLE_PORT_DEFAULT],[$DRIZZLE_TCP_PORT_DEFAULT],
702
		   [If we defaulted to DRIZZLE_PORT, then this will be zero])
1 by brian
clean slate
703
704
# Use this to set the place used for unix socket used to local communication.
572.2.1 by ysano
Replace --with-mysqld-user configure option with --with-drizzled-user.
705
AC_ARG_WITH([drizzled-user],
706
    [AS_HELP_STRING([--with-drizzled-user=username],
707
            [What user the drizzled daemon shall be run as.
708
		@<:@default=drizzle@:>@])],
709
    [ DRIZZLED_USER=$withval ],
710
    [ DRIZZLED_USER=drizzle ]
1 by brian
clean slate
711
    )
572.2.1 by ysano
Replace --with-mysqld-user configure option with --with-drizzled-user.
712
AC_SUBST(DRIZZLED_USER)
1 by brian
clean slate
713
714
# If we should allow LOAD DATA LOCAL
715
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
716
AC_ARG_ENABLE(local-infile,
717
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
718
    [ ENABLED_LOCAL_INFILE=$enableval ],
719
    [ ENABLED_LOCAL_INFILE=no ]
720
    )
721
if test "$ENABLED_LOCAL_INFILE" = "yes"
722
then
723
  AC_MSG_RESULT([yes])
724
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
725
            [If LOAD DATA LOCAL INFILE should be enabled by default])
726
else
727
  AC_MSG_RESULT([no])
728
fi
729
730
# Types that must be checked AFTER large file support is checked
731
AC_TYPE_SIZE_T
732
733
#--------------------------------------------------------------------
734
# Check for system header files
735
#--------------------------------------------------------------------
736
737
AC_HEADER_DIRENT
738
AC_HEADER_STDC
739
AC_HEADER_SYS_WAIT
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
740
AC_HEADER_STDBOOL
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
741
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
742
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
743
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
744
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h)
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
745
AC_CHECK_HEADERS([curses.h term.h],[],[],
746
[[#ifdef HAVE_CURSES_H
747
# include <curses.h>
748
#endif
749
]])
202.1.4 by Monty Taylor
Removed openssl refs.
750
AC_CHECK_HEADERS(termio.h termios.h sched.h alloca.h)
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
751
AC_CHECK_HEADERS(sys/prctl.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
752
AC_CHECK_HEADERS(execinfo.h)
1 by brian
clean slate
753
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
754
#--------------------------------------------------------------------
1 by brian
clean slate
755
# Check for system libraries. Adds the library to $LIBS
756
# and defines HAVE_LIBM etc
757
#--------------------------------------------------------------------
758
759
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
760
236.1.39 by Monty Taylor
autoconf warning cleanups.
761
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
762
AC_CHECK_FUNC(yp_get_default_domain, [],
763
  [AC_CHECK_LIB(nsl, yp_get_default_domain)])
764
AC_CHECK_FUNC(p2open, [], [AC_CHECK_LIB(gen, p2open)])
1 by brian
clean slate
765
# This may get things to compile even if bind-8 is installed
236.1.39 by Monty Taylor
autoconf warning cleanups.
766
AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
1 by brian
clean slate
767
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
768
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
769
770
# Check rt for aio_read
771
AC_CHECK_LIB(rt, aio_read)
772
773
# For the sched_yield() function on Solaris
236.1.39 by Monty Taylor
autoconf warning cleanups.
774
AC_CHECK_FUNC(sched_yield, [],
775
  [AC_CHECK_LIB(posix4, [sched_yield],
776
    [AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"])])
1 by brian
clean slate
777
778
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
779
then
236.1.39 by Monty Taylor
autoconf warning cleanups.
780
  AC_CHECK_FUNC(gtty, [], [AC_CHECK_LIB(compat, gtty)])
1 by brian
clean slate
781
fi
782
783
AC_CHECK_TYPES([fp_except], [], [], [
784
#include <sys/types.h>
785
#include <ieeefp.h>
786
])
787
25 by Brian Aker
Clean up of configure.in
788
my_save_LIBS="$LIBS"
789
LIBS=""
790
AC_CHECK_LIB(dl,dlopen)
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
791
AC_CHECK_FUNCS(dlopen)
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
792
if test "$ac_cv_func_dlopen" != "yes"
793
then
794
  AC_MSG_ERROR([Drizzle requires dlopen])
795
fi
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
796
LIBDL_LIBS="$LIBS"
25 by Brian Aker
Clean up of configure.in
797
LIBS="$my_save_LIBS"
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
798
AC_SUBST(LIBDL_LIBS)
25 by Brian Aker
Clean up of configure.in
799
800
AC_CHECK_FUNCS(strtok_r)
1 by brian
clean slate
801
201.2.4 by Monty Taylor
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off.
802
803
1 by brian
clean slate
804
AC_ARG_WITH([fast-mutexes],
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
805
    [AS_HELP_STRING([--with-fast-mutexes],
806
	    [Compile with fast mutexes  @<:@default=off@:>@])],
807
    [with_fast_mutexes=$withval],
808
    [with_fast_mutexes=no])
1 by brian
clean slate
809
810
if test "$with_fast_mutexes" != "no"
811
then
51.3.26 by Jay Pipes
Final removal of DBUG library and cleanup of Makefiles
812
	AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
813
			[Define to 1 if you want to use fast mutexes])
1 by brian
clean slate
814
fi
815
236.1.56 by Monty Taylor
Made build of thr_mutex.c conditional on --with-fast-mutexes, since that's
816
AM_CONDITIONAL(BUILD_FAST_MUTEX,[test "$with_fast_mutexes" != "no"])
817
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
818
AC_ARG_WITH([comment],
819
    [AS_HELP_STRING([--with-comment],
820
            [Comment about compilation environment. @<:@default=off@:>@])],
1 by brian
clean slate
821
    [with_comment=$withval],
822
    [with_comment=no])
823
if test "$with_comment" != "no"
824
then
825
  COMPILATION_COMMENT=$with_comment
826
else
827
  COMPILATION_COMMENT="Source distribution"
828
fi
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
829
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
830
                   [Comment about compilation environment])
1 by brian
clean slate
831
832
dnl Checks for typedefs, structures, and compiler characteristics.
833
AC_C_CONST
834
AC_C_INLINE
590.2.2 by Monty Taylor
Configure cleanups. Added generic search_for_lib m4 macro.
835
AC_C_VOLATILE
1 by brian
clean slate
836
AC_TYPE_OFF_T
837
AC_HEADER_TIME
838
AC_STRUCT_TM
839
# off_t is not a builtin type
840
AC_CHECK_SIZEOF(off_t, 4)
841
if test "$ac_cv_sizeof_off_t" -eq 0
842
then
91 by Brian Aker
Main binary now named drizzled
843
  AC_MSG_ERROR("Drizzle needs a off_t type.")
1 by brian
clean slate
844
fi
845
846
dnl
847
dnl check if time_t is unsigned
848
dnl
849
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
850
DRIZZLE_CHECK_TIME_T
1 by brian
clean slate
851
852
853
# This always gives a warning. Ignore it unless you are cross compiling
854
AC_C_BIGENDIAN
855
#---START: Used in for client configure
856
# Check base type of last arg to accept
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
857
DRIZZLE_TYPE_ACCEPT
1 by brian
clean slate
858
#---END:
859
# Figure out what type of struct rlimit to use with setrlimit
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
860
DRIZZLE_TYPE_STRUCT_RLIMIT
1 by brian
clean slate
861
# Find where the stack goes
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
862
DRIZZLE_STACK_DIRECTION
1 by brian
clean slate
863
# We want to skip alloca on irix unconditionally. It may work on some version..
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
864
DRIZZLE_FUNC_ALLOCA
1 by brian
clean slate
865
# Do struct timespec have members tv_sec or ts_sec
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
866
DRIZZLE_TIMESPEC_TS
1 by brian
clean slate
867
# Do we have the tzname variable
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
868
DRIZZLE_TZNAME
1 by brian
clean slate
869
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
520.4.43 by mordred
A set of Solaris fixes.
870
AC_CHECK_TYPES([uint, ulong])
1 by brian
clean slate
871
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
872
DRIZZLE_PTHREAD_YIELD
1 by brian
clean slate
873
134.2.1 by Antony Curtis
Changes for proper detection of libraries
874
1 by brian
clean slate
875
dnl Checks for header files.
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
876
AC_CHECK_HEADERS(malloc.h)
1 by brian
clean slate
877
878
dnl Checks for library functions.
879
AC_FUNC_ALLOCA
880
AC_PROG_GCC_TRADITIONAL
881
AC_TYPE_SIGNAL
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
882
1 by brian
clean slate
883
AC_CHECK_FUNCS(issetugid)
884
885
# from old readline settting:
886
887
MAKE_SHELL=/bin/sh
888
AC_SUBST(MAKE_SHELL)
889
890
# Already-done: stdlib.h string.h unistd.h termios.h
398.1.9 by Monty Taylor
Cleaned up stuff out of global.h.
891
AC_CHECK_HEADERS(stdarg.h dirent.h locale.h ndir.h sys/dir.h \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
892
 sys/ndir.h sys/select.h \
893
 sys/mman.h termcap.h termio.h asm/termbits.h grp.h \
894
 paths.h)
1 by brian
clean slate
895
896
# Already-done: strcasecmp
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
897
AC_CHECK_FUNCS(lstat select)
1 by brian
clean slate
898
28.1.33 by Monty Taylor
Added -Wall
899
AC_HEADER_STAT
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
900
DRIZZLE_SIGNAL_CHECK
901
DRIZZLE_CHECK_GETPW_FUNCS
902
DRIZZLE_HAVE_TIOCGWINSZ
903
DRIZZLE_HAVE_TIOCSTAT
904
DRIZZLE_TYPE_SIGHANDLER
1 by brian
clean slate
905
if test "$with_named_curses" = "no"
906
then
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
907
  DRIZZLE_CHECK_LIB_TERMCAP
1 by brian
clean slate
908
else
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
909
  TERMCAP_LIBS="$with_named_curses"
1 by brian
clean slate
910
fi
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
911
AC_SUBST(TERMCAP_LIBS)
1 by brian
clean slate
912
913
# End of readline/libedit stuff
914
#########################################################################
915
916
dnl Checks for library functions.
917
918
#
919
# The following code disables intrinsic function support while we test for
920
# library functions.  This is to avoid configure problems with Intel ecc
921
# compiler
922
923
ORG_CFLAGS="$CFLAGS"
924
if test "$GCC" != "yes"; then
925
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
926
fi
927
928
#AC_FUNC_MMAP
929
AC_TYPE_SIGNAL
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
930
DRIZZLE_TYPE_QSORT
1 by brian
clean slate
931
AC_FUNC_UTIME_NULL
932
AC_FUNC_VPRINTF
933
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
934
AC_CHECK_FUNCS(fcntl)
935
if test "x$ac_cv_func_fcntl" != "xyes"
936
then
937
  AC_MSG_ERROR("Drizzle requires fcntl.")
938
fi
939
236.1.50 by Monty Taylor
Added automake conditional compilation of distributed system replacement functions.
940
AC_CONFIG_LIBOBJ_DIR([mystrings])
941
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
942
AC_CHECK_FUNCS( \
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
943
  cuserid fchmod \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
944
  fdatasync fpresetsticky fpsetmask fsync \
575.4.6 by Monty Taylor
Removed my_getwd.
945
  getpassphrase getpwnam \
946
  getpwuid getrlimit getrusage index initgroups isnan \
1 by brian
clean slate
947
  localtime_r gethrtime gmtime_r \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
948
  madvise \
949
  mkstemp mlockall poll pread pthread_attr_create mmap mmap64 \
1 by brian
clean slate
950
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
951
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
952
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
953
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
449 by Monty Taylor
Removed rint check - rint is part of C99.
954
  realpath rename rwlock_init setupterm \
572.1.4 by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf.
955
  sigaction \
956
  sigthreadmask \
957
  snprintf strpbrk \
958
  tell tempnam \
959
  backtrace backtrace_symbols backtrace_symbols_fd)
1 by brian
clean slate
960
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
961
AC_LANG_PUSH(C++)
962
# Test whether madvise() is declared in C++ code -- it is not on some
963
# systems, such as Solaris
373.1.3 by Monty Taylor
Fixed test for HAVE_DECL_MADVISE to actually work.
964
AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
965
#if HAVE_SYS_MMAN_H
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
966
#include <sys/types.h>
967
#include <sys/mman.h>
373.1.3 by Monty Taylor
Fixed test for HAVE_DECL_MADVISE to actually work.
968
#endif
969
]])
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
970
AC_LANG_POP()
971
972
236.1.59 by Monty Taylor
Turn thr_rwlock.c into a conditionally built source file.
973
AM_CONDITIONAL(BUILD_THR_RWLOCK,[test "$ac_cv_func_rwlock_init" -a "$ac_cv_funn_pthread_rwlock_rdlock"])
974
28.1.33 by Monty Taylor
Added -Wall
975
1 by brian
clean slate
976
CFLAGS="$ORG_CFLAGS"
977
978
# Sanity check: We chould not have any fseeko symbol unless
979
# large_file_support=yes
980
AC_CHECK_FUNC(fseeko,
520.4.41 by mordred
Fixed configure.ac to work cleanly on Solaris - and define some good compile flags.
981
[if test "$large_file_support" = no -a "x$TARGET_LINUX" = "xtrue";
1 by brian
clean slate
982
then
983
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
984
fi]
985
)
986
987
# Check definition of pthread_getspecific
236.1.39 by Monty Taylor
autoconf warning cleanups.
988
AC_CACHE_CHECK([args to pthread_getspecific], [mysql_cv_getspecific_args],
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
989
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
990
#if !defined(_REENTRANT)
1 by brian
clean slate
991
#define _REENTRANT
992
#endif
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
993
#ifndef _POSIX_PTHREAD_SEMANTICS 
1 by brian
clean slate
994
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
995
#endif
28.1.33 by Monty Taylor
Added -Wall
996
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
236.1.39 by Monty Taylor
autoconf warning cleanups.
997
pthread_getspecific((pthread_key_t) NULL); ]])],
998
    [mysql_cv_getspecific_args=POSIX],
999
    [mysql_cv_getspecific_args=other])])
1 by brian
clean slate
1000
  if test "$mysql_cv_getspecific_args" = "other"
1001
  then
1002
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1003
              [For some non posix threads])
1004
  fi
1005
1006
  # Check definition of pthread_mutex_init
236.1.39 by Monty Taylor
autoconf warning cleanups.
1007
  AC_CACHE_CHECK([args to pthread_mutex_init], [mysql_cv_mutex_init_args],
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1008
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1009
#ifndef _REENTRANT
1010
#define _REENTRANT
1011
#endif
1012
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1013
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1014
#endif
28.1.33 by Monty Taylor
Added -Wall
1015
#include <pthread.h> ]], [[ 
1 by brian
clean slate
1016
  pthread_mutexattr_t attr;
1017
  pthread_mutex_t mp;
236.1.39 by Monty Taylor
autoconf warning cleanups.
1018
  pthread_mutex_init(&mp,&attr); ]])],
1019
      [mysql_cv_mutex_init_args=POSIX],
1020
      [mysql_cv_mutex_init_args=other])])
1 by brian
clean slate
1021
  if test "$mysql_cv_mutex_init_args" = "other"
1022
  then
1023
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1024
              [For some non posix threads])
1025
  fi
1026
#---END:
1027
1028
#---START: Used in for client configure
1029
# Check definition of readdir_r
236.1.39 by Monty Taylor
autoconf warning cleanups.
1030
AC_CACHE_CHECK([args to readdir_r], [mysql_cv_readdir_r],
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1031
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1032
#ifndef _REENTRANT
1033
#define _REENTRANT
1034
#endif
1035
#ifndef _POSIX_PTHREAD_SEMANTICS 
1 by brian
clean slate
1036
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1037
#endif
1 by brian
clean slate
1038
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1039
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1040
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
1041
    [mysql_cv_readdir_r=POSIX],
1042
    [mysql_cv_readdir_r=other])])
1 by brian
clean slate
1043
if test "$mysql_cv_readdir_r" = "POSIX"
1044
then
1045
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1046
fi
1047
1048
# Check definition of posix sigwait()
236.1.39 by Monty Taylor
autoconf warning cleanups.
1049
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
1050
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1051
#ifndef _REENTRANT
236.1.39 by Monty Taylor
autoconf warning cleanups.
1052
#define _REENTRANT
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1053
#endif
1054
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1055
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1056
#endif
1 by brian
clean slate
1057
#include <pthread.h>
236.1.39 by Monty Taylor
autoconf warning cleanups.
1058
#include <signal.h>
1059
      ]], [[
1060
#ifndef _AIX
1 by brian
clean slate
1061
sigset_t set;
1062
int sig;
1063
sigwait(&set,&sig);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1064
#endif
1065
      ]])],
1066
    [mysql_cv_sigwait=POSIX],
1067
    [mysql_cv_sigwait=other])])
1 by brian
clean slate
1068
if test "$mysql_cv_sigwait" = "POSIX"
1069
then
1070
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1071
fi
1072
1073
if test "$mysql_cv_sigwait" != "POSIX"
1074
then
1075
unset mysql_cv_sigwait
1076
# Check definition of posix sigwait()
236.1.39 by Monty Taylor
autoconf warning cleanups.
1077
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
1078
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1079
#ifndef _REENTRANT
236.1.39 by Monty Taylor
autoconf warning cleanups.
1080
#define _REENTRANT
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1081
#endif
1082
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1083
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1084
#endif
1 by brian
clean slate
1085
#include <pthread.h>
236.1.39 by Monty Taylor
autoconf warning cleanups.
1086
#include <signal.h>
1087
      ]], [[
1088
sigset_t set;
1 by brian
clean slate
1089
int sig;
236.1.39 by Monty Taylor
autoconf warning cleanups.
1090
sigwait(&set);
1091
      ]])],
1092
    [mysql_cv_sigwait=NONPOSIX],
1093
    [mysql_cv_sigwait=other])])
1 by brian
clean slate
1094
if test "$mysql_cv_sigwait" = "NONPOSIX"
1095
then
1096
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1097
fi
1098
fi
1099
#---END:
1100
1101
# Check if pthread_attr_setscope() exists
236.1.39 by Monty Taylor
autoconf warning cleanups.
1102
AC_CACHE_CHECK([for pthread_attr_setscope], [mysql_cv_pthread_attr_setscope],
1103
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1104
#ifndef _REENTRANT
236.1.39 by Monty Taylor
autoconf warning cleanups.
1105
#define _REENTRANT
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1106
#endif
1107
#ifndef _POSIX_PTHREAD_SEMANTICS
1 by brian
clean slate
1108
#define _POSIX_PTHREAD_SEMANTICS 
632.1.11 by Monty Taylor
Fixed Sun Studio warnings in mysys.
1109
#endif
236.1.39 by Monty Taylor
autoconf warning cleanups.
1110
#include <pthread.h>
1111
      ]], [[
1112
pthread_attr_t thr_attr;
1113
pthread_attr_setscope(&thr_attr,0);
1114
      ]])],
1115
    [mysql_cv_pthread_attr_setscope=yes],
1116
    [mysql_cv_pthread_attr_setscope=no])])
1 by brian
clean slate
1117
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1118
then
1119
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1120
fi
1121
28.1.33 by Monty Taylor
Added -Wall
1122
AC_LANG_PUSH([C++])
1 by brian
clean slate
1123
AC_CHECK_HEADERS(cxxabi.h)
1124
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
28.1.33 by Monty Taylor
Added -Wall
1125
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1 by brian
clean slate
1126
  char *foo= 0; int bar= 0;
1127
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
28.1.33 by Monty Taylor
Added -Wall
1128
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1129
AC_LANG_POP([])
1 by brian
clean slate
1130
1131
if test "x$mysql_cv_cxa_demangle" = xyes; then
1132
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1133
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1134
fi
1135
1136
#--------------------------------------------------------------------
1137
# Check for requested features
1138
#--------------------------------------------------------------------
1139
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1140
DRIZZLE_CHECK_MAX_INDEXES
1141
DRIZZLE_CHECK_VIO
1 by brian
clean slate
1142
1143
#--------------------------------------------------------------------
1144
# Declare our plugin modules
1145
# Has to be done late, as the plugin may need to check for existence of
1146
# functions tested above
1147
#--------------------------------------------------------------------
1148
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1149
DRIZZLE_CONFIGURE_PLUGINS([none])
1 by brian
clean slate
1150
1151
AC_SUBST(mysql_plugin_dirs)
1152
AC_SUBST(mysql_plugin_libs)
1153
AC_SUBST(mysql_plugin_defs)
1154
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
1155
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1156
AC_ARG_ENABLE([profiling],
1157
    [AS_HELP_STRING([--enable-profiling],
1158
       [Toggle profiling @<:@default=off@:>@])],
1159
    [ac_profiling="$enableval"],
1160
    [ac_profiling="no"])
1161
1162
AC_ARG_ENABLE([coverage],
1163
    [AS_HELP_STRING([--enable-coverage],
1164
       [Toggle coverage @<:@default=off@:>@])],
1165
    [ac_coverage="$enableval"],
1166
    [ac_coverage="no"])
1167
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1168
AC_ARG_ENABLE([pedantic-warnings],
1169
    [AS_HELP_STRING([--disable-pedantic-warnings],
1170
       [Toggle pedanticness @<:@default=on@:>@])],
1171
    [ac_warn_pedantic="$enableval"],
1172
    [ac_warn_pedantic="yes"])
1173
1174
AC_ARG_ENABLE([fail],
77.1.112 by Monty Taylor
Fixed comment on --enable-fail -> --disable-fail.
1175
    [AS_HELP_STRING([--disable-fail],
1176
       [Turn warnings into failures @<:@default=on@:>@])],
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1177
    [ac_warn_fail="$enableval"],
77.1.108 by Monty Taylor
Turn on -Werror again by default.
1178
    [ac_warn_fail="yes"])
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1179
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1180
AC_ARG_ENABLE([unreachable],
1181
    [AS_HELP_STRING([--enable-unreachable],
1182
       [Enable warnings about unreachable code @<:@default=off@:>@])],
1183
    [ac_warn_unreachable="$enableval"],
1184
    [ac_warn_unreachable="no"])
1185
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1186
AC_ARG_ENABLE([longlong-warnings],
1187
    [AS_HELP_STRING([--enable-longlong-warnings],
1188
       [Enable warnings about longlong in C++ @<:@default=off@:>@])],
1189
    [ac_warn_longlong="$enableval"],
421 by Monty
Made including stdint.h work.
1190
    [ac_warn_longlong="no"])
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1191
1192
AC_ARG_ENABLE([strict-aliasing],
1193
    [AS_HELP_STRING([--enable-strict-aliasing],
1194
       [Enable warnings about stict-aliasing @<:@default=off@:>@])],
1195
    [ac_warn_strict_aliasing="$enableval"],
1196
    [ac_warn_strict_aliasing="no"])
1197
509.2.1 by Monty Taylor
Added some more warning options to configure.
1198
AC_ARG_ENABLE([cast-warnings],
1199
    [AS_HELP_STRING([--enable-cast-warnings],
1200
       [Enable warnings about use of old C-style casts @<:@default=off@:>@])],
1201
    [ac_warn_cast="$enableval"],
1202
    [ac_warn_cast="no"])
1203
1204
AC_ARG_ENABLE([effective-style],
1205
    [AS_HELP_STRING([--enable-effective-style],
1206
       [Enable warnings violating Effective C++ Style Guidelines @<:@default=off@:>@])],
1207
    [ac_warn_effc="$enableval"],
1208
    [ac_warn_effc="no"])
1209
509.2.2 by Monty Taylor
Added one more set of possible warnings.
1210
AC_ARG_ENABLE([go-crazy],
1211
    [AS_HELP_STRING([--enable-go-crazy],
1212
       [Enables extra little warnings that might be too much @<:@default=off@:>@])],
1213
    [ac_warn_go_crazy="$enableval"],
1214
    [ac_warn_go_crazy="no"])
1215
713.1.8 by Monty Taylor
Moved a little code...
1216
AC_ARG_ENABLE([datarace],
1217
    [AS_HELP_STRING([--enable-datarace],
1218
       [Enables Sun Studio data race detection @<:@default=off@:>@])],
1219
    [ac_datarace="$enableval"],
1220
    [ac_datarace="no"])
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1221
713.1.7 by Monty Taylor
Added support for thread data tracing to the build for Sun Studio.
1222
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1223
if test "$GCC" = "yes"
1224
then
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1225
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1226
  if test "$ac_warn_fail" = "yes"
1227
  then
1228
    W_FAIL="-Werror"
1229
  fi
722.1.4 by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values
1230
  BASE_WARNINGS="-Wall -Wextra ${W_FAIL}"
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1231
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1232
  if test "$ac_warn_longlong" = "yes"
1233
  then
1234
    W_LONGLONG="-Wlong-long"
1235
  else
1236
    W_LONGLONG="-Wno-long-long"
1237
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1238
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1239
  if test "$ac_warn_strict_aliasing" = "yes"
1240
  then
1241
    W_STRICT_ALIASING="-Wstrict-aliasing"
1242
  else
509.2.3 by Monty Taylor
Re-worked strict-aliasing again.
1243
    W_STRICT_ALIASING="-Wno-strict-aliasing"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1244
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1245
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1246
  if test "$ac_profiling" = "yes"
1247
  then
1248
    GPROF_PROFILING="-pg"
1249
  else
1250
    GPROF_PROFILING=" "
1251
  fi
1252
1253
  if test "$ac_coverage" = "yes"
1254
  then
1255
    GPROF_COVERAGE="-fprofile-arcs -ftest-coverage"
1256
  else
1257
    GPROF_COVERAGE=" "
1258
  fi
1259
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1260
  if test "$ac_warn_pedantic" = "yes"
1261
  then
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1262
    save_CXXFLAGS="${CXXFLAGS}"
1263
    CXXFLAGS="${CXXFLAGS} ${W_FAIL} -Wredundant-decls"
1264
    AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls],
1265
      [ac_cv_safe_to_use_Wredundant_decls_],
1266
      [AC_LANG_PUSH(C++)
1267
       AC_COMPILE_IFELSE(
1268
         [AC_LANG_PROGRAM([
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1269
template <typename E> struct C { void foo(); };
1270
template <typename E> void C<E>::foo() { }
1271
template <> void C<int>::foo();
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1272
            AC_INCLUDES_DEFAULT])],
1273
          [ac_cv_safe_to_use_Wredundant_decls_=yes],
1274
          [ac_cv_safe_to_use_Wredundant_decls_=no])
1275
        AC_LANG_POP()])
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1276
    if test $ac_cv_safe_to_use_Wredundant_decls_ = yes
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1277
    then
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1278
      GXX_W_REDUNDANT_DECLS="-Wredundant-decls"
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1279
    else
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1280
      GXX_W_REDUNDANT_DECLS="-Wno-redundant-decls"
558 by Monty Taylor
Added autoconf test to turn off -Wredundant-decls if it doesn't work right.
1281
    fi
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1282
    
559.1.1 by Kristian Nielsen
Fix a few problems with the -Wredundant-decls configure check.
1283
    GCC_PEDANTIC="-pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls ${W_STRICT_ALIASING}"
1284
    GXX_PEDANTIC="-pedantic -Wundef ${GXX_W_REDUNDANT_DECLS} ${W_LONGLONG} ${W_STRICT_ALIASING}"
520.4.36 by Monty Taylor
Added autoconf check for usability of __attribute__((visibility("hidden"))).
1285
1286
    AC_CACHE_CHECK([whether __attribute__ visibility "hidden" is supported],
1287
      [ac_cv_can_use_hidden_],
1288
      [AC_LANG_PUSH(C++)
1289
       AC_COMPILE_IFELSE(
1290
         [AC_LANG_PROGRAM([
1291
          AC_INCLUDES_DEFAULT
1292
__attribute__((visibility ("hidden")))
1293
void testme() {  };],[
1294
     testme();])],  
1295
         [ac_cv_can_use_hidden_=yes],
1296
         [ac_cv_can_use_hidden_=no])
1297
       AC_LANG_POP()])
1298
    if test "$ac_cv_can_use_hidden_" = "yes"
1299
    then
1300
      AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
1301
                [Define to 1 if you have support for __attribute__((visibility("hidden")))])
1302
    fi
1303
559 by Monty Taylor
Fixed syntax errors.
1304
    CXXFLAGS="${save_CXXFLAGS}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1305
  fi
1306
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1307
  if test "$ac_warn_unreachable" = "yes"
1308
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1309
    W_UNREACHABLE="-Wunreachable-code"
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1310
  fi
509.2.1 by Monty Taylor
Added some more warning options to configure.
1311
  if test "$ac_warn_cast" = "yes"
1312
  then
1313
    W_CAST="-Wold-style-cast"
1314
  fi
1315
1316
  if test "$ac_warn_effc" = "yes"
1317
  then
1318
    W_EFFC="-Weffc++"
1319
  fi
1320
509.2.2 by Monty Taylor
Added one more set of possible warnings.
1321
  if test "$ac_warn_gocrazy" = "yes"
1322
  then
1323
    W_CRAZY="-Wshadow -Wconversion -Winvalid-pch"
1324
  fi
1325
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1326
  CC_WARNINGS="${C99_SUPPORT_HACK} ${BASE_WARNINGS} ${GCC_PEDANTIC} ${W_UNREACHABLE} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${W_CRAZY}"
1327
  CXX_WARNINGS="${BASE_WARNINGS} ${GXX_PEDANTIC} ${W_UNREACHABLE} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${W_CAST} ${W_EFFC} ${W_CRAZY}"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1328
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1329
  NO_EXCEPTIONS="-fno-exceptions"
1330
  W_EXCEPTIONS="-fexceptions"
1331
  NO_UNUSED_MACROS="-Wno-unused-macros"
1332
  NO_REDUNDANT_DECLS="-Wno-redundant-decls"
1333
  # Disable exceptions as they seams to create problems with gcc and threads.
1334
  # drizzled doesn't use run-time-type-checking, so we disable it.
1335
  AM_CXXFLAGS="${AM_CXXFLAGS} -fno-rtti"
575.1.6 by Monty Taylor
Cleaned up some headers for PCH.
1336
  CPPFLAGS="${CPPFLAGS} -fpch-deps"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1337
fi
520.4.37 by Monty Taylor
Added some Sun compile flags.
1338
if test "$SUNCC" = "yes"
1339
then
713.1.7 by Monty Taylor
Added support for thread data tracing to the build for Sun Studio.
1340
  if test "$ac_datarace" = "yes"
1341
  then
713.1.9 by Monty Taylor
Fixed datarace.
1342
    CFLAGS="${CFLAGS} -xinstrument=datarace"
1343
    CXXFLAGS="${CXXFLAGS} -xinstrument=datarace"
713.1.7 by Monty Taylor
Added support for thread data tracing to the build for Sun Studio.
1344
  fi
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1345
  CC_WARNINGS="-v -xc99=all -errtags=yes"
1346
  CXX_WARNINGS="+w +w2 -xport64 -errtags=yes -erroff=attrskipunsup -compat=5"
1347
  NO_EXCEPTIONS="-features=no%except"
1348
  W_EXCEPTIONS="-features=except"
520.4.37 by Monty Taylor
Added some Sun compile flags.
1349
fi
520.4.44 by mordred
A whole bunch of solaris/sun studio compile fixes.
1350
AM_CXXFLAGS="${CXX_WARNINGS} ${NO_EXCEPTIONS}  ${AM_CXXFLAGS}"
1351
AM_CFLAGS="${CC_WARNINGS} ${AM_CFLAGS}"
1352
1353
AC_SUBST(NO_EXCEPTIONS)
1354
AC_SUBST(W_EXCEPTIONS)
1355
AC_SUBST(NO_UNUSED_MACROS)
1356
AC_SUBST(NO_REDUNDANT_DECLS)
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1357
656.1.30 by Monty Taylor
Reverted gnulib changes.
1358
AC_SUBST([GLOBAL_CPPFLAGS],['-I$(top_srcdir) -I$(top_builddir)'])
202.1.23 by Monty Taylor
Moved the includes we use everywhere to to GLOBAL_CPPFLAGS and added AM_CPPFLAGS to an AC_SUBST, so that we could take out the redundant declaration from most fof the Makefiles.
1359
AC_SUBST([AM_CPPFLAGS],['${GLOBAL_CPPFLAGS}'])
287.3.26 by Monty Taylor
Put warnings into AM_C*FLAGS so they can be overridden per lib.
1360
AC_SUBST([AM_CFLAGS])
1361
AC_SUBST([AM_CXXFLAGS])
202.1.23 by Monty Taylor
Moved the includes we use everywhere to to GLOBAL_CPPFLAGS and added AM_CPPFLAGS to an AC_SUBST, so that we could take out the redundant declaration from most fof the Makefiles.
1362
1 by brian
clean slate
1363
# Some usefull subst
1364
AC_SUBST(CC)
1365
AC_SUBST(GXX)
1366
1367
# Set configuration options for make_binary_distribution
1368
case $SYSTEM_TYPE in
1369
  *netware*)
1370
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1371
    ;;
1372
  *)
1373
    : # no change for other platforms yet
1374
    ;;
1375
esac
1376
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1377
722.1.4 by Monty Taylor
Removed all the setting of DEFS everywhere. Use configmake.h to get the values
1378
AC_SUBST(pkgplugindir,"\$(pkglibdir)/plugin")
1379
492.1.7 by Monty Taylor
Moved test() to its own file.
1380
dnl GCC Precompiled Header Support
584.4.3 by Monty Taylor
Disabled pre-compiled headers for now.
1381
dnl re-enable later
632.1.25 by Monty Taylor
Removed AM_CONDITIONAL from SEARCH_FOR_LIB. Aligned naming of AM_CONDITIONALS.
1382
dnl AM_CONDITIONAL([BUILD_GCC_PCH],[test "$GCC" = "yes"])
1383
AM_CONDITIONAL([BUILD_GCC_PCH],[test "no" = "yes"])
492.1.7 by Monty Taylor
Moved test() to its own file.
1384
287.3.1 by Monty Taylor
Removed mysys/tests.
1385
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
264.1.15 by Monty Taylor
Removed a bunch of files from mystrings that aren't build or used at all.
1386
 mystrings/Makefile storage/Makefile dnl
575.2.2 by Monty Taylor
Moved vio stuff into libdrizzle.
1387
 po/Makefile.in dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1388
 libdrizzle/Makefile client/Makefile dnl
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
1389
 drizzled/Makefile dnl
316 by Brian Aker
First pass of new sql_db.cc work
1390
 drizzled/serialize/Makefile dnl
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
1391
 drizzled/sql_builtin.cc dnl
28.1.31 by Monty Taylor
Deleted tons of pointless garbage from scripts.
1392
 support-files/Makefile dnl
77.1.47 by Monty Taylor
Moved test to tests...
1393
 tests/Makefile tests/install_test_db dnl
546 by Monty Taylor
Cleaned up version.h. (And by cleaned, I mean removed)
1394
 plugin/Makefile dnl
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
1395
 drizzled/drizzled_safe support-files/libdrizzle.pc dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1396
 support-files/drizzle.server support-files/drizzle-log-rotate)
1 by brian
clean slate
1397
1398
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1399
1400
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
287.3.28 by Monty Taylor
Expanded the move to AM_CFLAGS and AM_CXXFLAGS. Now we should be more correct.
1401
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS' AM_CFLAGS='$AM_CFLAGS' AM_CXXFLAGS='$AM_CXXFLAGS'")
1 by brian
clean slate
1402
1403
AC_OUTPUT
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1404
1405
echo "---"
1406
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
1407
echo ""
1408
echo "   * Installation prefix:       $prefix"
1409
echo "   * System type:               $SYSTEM_TYPE"
492.2.1 by C.J. Adams-Collier
* fixed --disable-assert code (thanks Monty)
1410
echo "   * Host CPU:                  $host_cpu"
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1411
echo "   * C Compiler:                $CC_VERSION"
632.1.21 by Monty Taylor
Cleaned up compiler version checking.
1412
echo "   * C++ Compiler:              $CXX_VERSION"
492.2.1 by C.J. Adams-Collier
* fixed --disable-assert code (thanks Monty)
1413
echo "   * Build auth_pam:            $ac_cv_header_security_pam_appl_h"
1414
echo "   * Assertions enabled:        $ac_cv_assert"
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1415
echo "   * Debug enabled:             $with_debug"
1416
echo "   * Profiling enabled:         $ac_profiling"
1417
echo "   * Coverage enabled:          $ac_coverage"
1418
echo "   * Warnings as failure:       $ac_warn_fail"
492.2.1 by C.J. Adams-Collier
* fixed --disable-assert code (thanks Monty)
1419
echo "   * C++ cstdint location:      $ac_cv_cxx_cstdint"
1420
echo "   * C++ hash_map location:     $ac_cv_cxx_hash_map"
1421
echo "   * C++ hash namespace:        $ac_cv_cxx_hash_namespace"
1422
echo "   * C++ cmath location:        $ac_cv_cxx_cmath"
1423
echo "   * C++ cmath namespace:       $ac_cv_cxx_cmath_namespace"
489.2.1 by C.J. Adams-Collier
2008-10-07T1437 C.J. Adams-Collier <cjac@colliertech.org>
1424
echo ""
1425
echo "---"