~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
dnl -*- ksh -*-
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
28.1.33 by Monty Taylor
Added -Wall
6
AC_INIT
54.1.4 by Stewart Smith
merge from mainline
7
AC_CONFIG_SRCDIR([server/drizzled.cc])
39 by Brian Aker
Move build helper files into config
8
AC_CONFIG_AUX_DIR(config)
28.1.33 by Monty Taylor
Added -Wall
9
AC_CONFIG_HEADERS([include/config.h:config.h.in])
10
AC_CANONICAL_TARGET
91 by Brian Aker
Main binary now named drizzled
11
AM_INIT_AUTOMAKE(drizzle, 7.0.0, no-define)
1 by brian
clean slate
12
13
PROTOCOL_VERSION=10
14
DOT_FRM_VERSION=6
15
# See the libtool docs for information on how to do shared lib versions.
16
SHARED_LIB_MAJOR_VERSION=16
17
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
18
19
20
21
# Set all version vars based on $VERSION. How do we do this more elegant ?
22
# Remember that regexps needs to quote [ and ] since this is run through m4
23
# We take some made up examples
24
#
25
#  VERSION                  5.1.40sp1-alpha     5.0.34a
26
#  MYSQL_NO_DASH_VERSION    5.1.40sp1           5.0.34a
27
#  MYSQL_NUMERIC_VERSION    5.1.40              5.0.34
28
#  MYSQL_BASE_VERSION       5.1                 5.0
29
#  MYSQL_VERSION_ID         50140               50034
30
#
31
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
32
MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
33
MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
34
MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
35
    awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
36
37
# The port should be constant for a LONG time
38
MYSQL_TCP_PORT_DEFAULT=3306
39
40
dnl Include m4 
41
sinclude(config/ac-macros/alloca.m4)
42
sinclude(config/ac-macros/check_cpu.m4)
43
sinclude(config/ac-macros/character_sets.m4)
44
sinclude(config/ac-macros/compiler_flag.m4)
45
sinclude(config/ac-macros/dtrace.m4)
46
sinclude(config/ac-macros/plugins.m4)
47
sinclude(config/ac-macros/large_file.m4)
48
sinclude(config/ac-macros/misc.m4)
49
sinclude(config/ac-macros/readline.m4)
50
sinclude(config/ac-macros/ssl.m4)
77.1.73 by Monty Taylor
Added sinclude of pkg.m4
51
sinclude(config/ac-macros/pkg.m4)
1 by brian
clean slate
52
54.1.3 by Stewart Smith
sql => server (initial patch)
53
# Remember to add a directory server/share/LANGUAGE
1 by brian
clean slate
54
AVAILABLE_LANGUAGES="\
55
czech danish dutch english estonian french german greek hungarian \
56
italian japanese korean norwegian norwegian-ny polish portuguese \
57
romanian russian serbian slovak spanish swedish ukrainian"
58
59
#####
60
#####
61
62
AC_SUBST(MYSQL_NO_DASH_VERSION)
63
AC_SUBST(MYSQL_BASE_VERSION)
64
AC_SUBST(MYSQL_VERSION_ID)
65
AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
66
AC_SUBST(PROTOCOL_VERSION)
67
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
68
                   [mysql client protocol version])
69
AC_SUBST(DOT_FRM_VERSION)
70
AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
71
                   [Version of .frm files])
72
AC_SUBST(SHARED_LIB_MAJOR_VERSION)
73
AC_SUBST(SHARED_LIB_VERSION)
74
AC_SUBST(AVAILABLE_LANGUAGES)
75
76
77
# Canonicalize the configuration name.
78
79
# Check whether --with-system-type or --without-system-type was given.
28.1.33 by Monty Taylor
Added -Wall
80
AC_ARG_WITH([system-type],
81
    [AS_HELP_STRING([--with-system-type],
82
       [Set the system type, like "sun-solaris10"])],
1 by brian
clean slate
83
    [SYSTEM_TYPE="$withval"],
84
    [SYSTEM_TYPE="$host_vendor-$host_os"])
28.1.33 by Monty Taylor
Added -Wall
85
AC_ARG_WITH([machine-type],
86
    [AS_HELP_STRING([--with-machine-type],
87
       [Set the machine type, like "powerpc"])],
1 by brian
clean slate
88
    [MACHINE_TYPE="$withval"],
89
    [MACHINE_TYPE="$host_cpu"])
90
AC_SUBST(SYSTEM_TYPE)
91
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
92
                   [Name of system, eg sun-solaris])
93
AC_SUBST(MACHINE_TYPE)
94
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
95
                   [Machine type name, eg sparc])
96
97
# Detect intel x86 like processor
98
BASE_MACHINE_TYPE=$MACHINE_TYPE
99
case $MACHINE_TYPE in
100
  i?86) BASE_MACHINE_TYPE=i386 ;;
101
esac
102
103
# Save some variables and the command line options for mysqlbug
104
SAVE_CC="$CC"
105
SAVE_CXX="$CXX"
106
SAVE_ASFLAGS="$ASFLAGS"
107
SAVE_CFLAGS="$CFLAGS"
108
SAVE_CXXFLAGS="$CXXFLAGS"
109
SAVE_LDFLAGS="$LDFLAGS"
110
SAVE_CXXLDFLAGS="$CXXLDFLAGS"
111
CONF_COMMAND="$0 $ac_configure_args"
112
AC_SUBST(CONF_COMMAND)
113
AC_SUBST(SAVE_CC)
114
AC_SUBST(SAVE_CXX)
115
AC_SUBST(SAVE_ASFLAGS)
116
AC_SUBST(SAVE_CFLAGS)
117
AC_SUBST(SAVE_CXXFLAGS)
118
AC_SUBST(SAVE_LDFLAGS)
119
AC_SUBST(SAVE_CXXLDFLAGS)
120
AC_SUBST(CXXLDFLAGS)
121
122
AM_SANITY_CHECK
123
# This is needed is SUBDIRS is set
124
AC_PROG_MAKE_SET
125
126
##############################################################################
127
# The below section needs to be done before AC_PROG_CC
128
##############################################################################
129
130
if test "x${CFLAGS-}" = x ; then
131
  cflags_is_set=no
132
else
133
  cflags_is_set=yes
134
fi
135
136
if test "x${CPPFLAGS-}" = x ; then
137
  cppflags_is_set=no
138
else
139
  cppflags_is_set=yes
140
fi
141
142
if test "x${LDFLAGS-}" = x ; then
143
  ldflags_is_set=no
144
else
145
  ldflags_is_set=yes
146
fi
147
148
################ End of section to be done before AC_PROG_CC #################
149
150
# The following hack should ensure that configure doesn't add optimizing
151
# or debugging flags to CFLAGS or CXXFLAGS
152
# C_EXTRA_FLAGS are flags that are automaticly added to both
153
# CFLAGS and CXXFLAGS
154
CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
155
CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
156
157
dnl Checks for programs.
158
AC_PROG_AWK
159
AC_PROG_CC
160
AC_PROG_CXX
161
AC_PROG_CPP
162
AM_PROG_CC_C_O
163
164
# Print version of CC and CXX compiler (if they support --version)
165
case $SYSTEM_TYPE in
166
  *netware*)
167
CC_VERSION=`$CC -version | grep -i version`
168
    ;;
169
  *)
170
CC_VERSION=`$CC --version | sed 1q`
171
    ;;
172
esac
173
if test $? -eq "0"
174
then
175
  AC_MSG_CHECKING("C Compiler version")
176
  AC_MSG_RESULT("$CC $CC_VERSION")
177
else
178
CC_VERSION=""
179
fi
180
AC_SUBST(CC_VERSION)
181
MYSQL_CHECK_CXX_VERSION
182
28.1.33 by Monty Taylor
Added -Wall
183
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
184
then
185
  AS="$CC -c"
186
  AC_SUBST(AS)
187
else
188
  AC_PATH_PROG(AS, as, as)
189
fi
190
191
# Still need ranlib for readline; local static use only so no libtool.
192
AC_PROG_RANLIB
193
# We use libtool
194
#AC_LIBTOOL_WIN32_DLL
195
AC_PROG_LIBTOOL
196
197
# Ensure that we have --preserve-dup-deps defines, otherwise we get link
198
# problems of 'mysql' with CXX=g++
199
LIBTOOL="$LIBTOOL --preserve-dup-deps"
200
AC_SUBST(LIBTOOL)dnl
201
202
AC_SUBST(NM)dnl
203
204
AC_PROG_INSTALL
205
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
206
207
# Not critical since the generated file is distributed
208
AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
77.1.70 by Monty Taylor
Added a failure if you don't have bison and you're building from a .bzr branch.
209
if test -z "$YACC" && test -d ".bzr"
210
then
211
  AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
212
fi
1 by brian
clean slate
213
214
AC_PATH_PROG(uname_prog, uname, no)
215
216
# We should go through this and put all the explictly system dependent
217
# stuff in one place
218
AC_MSG_CHECKING(operating system)
219
AC_CACHE_VAL(mysql_cv_sys_os,
220
[
221
if test "$uname_prog" != "no"; then
222
  mysql_cv_sys_os="`uname`"
223
else
224
  mysql_cv_sys_os="Not Solaris"
225
fi
226
])
227
AC_MSG_RESULT($mysql_cv_sys_os)
228
229
# This should be rewritten to use $target_os
230
case "$target_os" in
231
  *solaris*)
232
    TARGET_SOLARIS="true"
233
    AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
234
    AC_SUBST(TARGET_SOLARIS)
235
  ;;
236
esac
237
238
# The following is required for portable results of floating point calculations
239
# on PowerPC. The same must also be done for IA-64, but this options is missing
240
# in the IA-64 gcc backend.
241
242
if test "$GCC" = "yes"
243
then
244
  case "$host_cpu" in
245
    *ppc* | *powerpc*)
246
      CFLAGS="$CFLAGS -mno-fused-madd"
247
      CXXFLAGS="$CXXFLAGS -mno-fused-madd"
248
    ;;
249
  esac
250
fi
251
252
AC_SUBST(CC)
253
AC_SUBST(CFLAGS)
254
AC_SUBST(CXX)
255
AC_SUBST(CXXFLAGS)
256
AC_SUBST(ASFLAGS)
257
AC_SUBST(LD)
258
AC_SUBST(INSTALL_SCRIPT)
259
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
260
1 by brian
clean slate
261
export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
262
263
if test "$GCC" = "yes"
264
then
265
  # mysqld requires -fno-implicit-templates.
266
  # Disable exceptions as they seams to create problems with gcc and threads.
267
  # mysqld doesn't use run-time-type-checking, so we disable it.
268
  # We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
269
  # regarding offset() usage in C++ which are done in a safe manner in the
270
  # server
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
271
  CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
1 by brian
clean slate
272
  AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
273
    [1], [Defined by configure. Use explicit template instantiation.])
274
fi
275
276
MYSQL_PROG_AR
277
278
# libmysqlclient versioning when linked with GNU ld.
279
if $LD --version 2>/dev/null|grep -q GNU; then
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
280
  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libdrizzle/libdrizzle.ver"
281
  AC_CONFIG_FILES(libdrizzle/libdrizzle.ver)
1 by brian
clean slate
282
fi
283
AC_SUBST(LD_VERSION_SCRIPT)
284
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
285
#--------------------------------------------------------------------
286
# Check for libevent
287
#--------------------------------------------------------------------
288
289
AC_CHECK_HEADERS(event.h)
290
if test "x$ac_cv_header_event_h" != "xyes"
291
then
292
  AC_MSG_ERROR([Couldn't find event.h. Try installing libevent development packages])
293
fi
294
AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
295
296
#--------------------------------------------------------------------
297
# Check for libpthread
298
#--------------------------------------------------------------------
299
300
AC_CHECK_HEADERS(pthread.h)
301
if test "x$ac_cv_header_pthread_h" != "xyes"
302
then
303
  AC_MSG_ERROR([Couldn't find pthread.h.])
304
fi
305
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR(could not find libpthread)])
306
307
#--------------------------------------------------------------------
308
# Check for libz
309
#--------------------------------------------------------------------
310
311
AC_CHECK_HEADERS(zlib.h)
312
if test "x$ac_cv_header_zlib_h" != "xyes"
313
then
314
  AC_MSG_ERROR([Couldn't find zlib.h. Try installing zlib development packages])
315
fi
316
AC_CHECK_LIB(z, crc32, [], [AC_MSG_ERROR(could not find libz)])
317
318
319
AC_CHECK_HEADERS([readline/readline.h])
320
if test "x$ac_cv_header_readline_readline_h" != "xyes"
321
then
322
  AC_MSG_ERROR([Couldn't find readline/readline.h. Try installing readline development packages.])
323
fi
324
325
#--------------------------------------------------------------------
326
# Check for libpcre
327
#--------------------------------------------------------------------
328
329
AC_LANG_PUSH([C++])
330
AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found.]))
331
PKG_CHECK_MODULES(PCRE, [libpcrecpp >= 3], [found_pcre="yes"],[
77.1.64 by Monty Taylor
YA fix for libpcrecpp finding...
332
  dnl Only check the header here, because autoconf can't handle
333
  dnl checking for C++ methods without C linkages
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
334
  AC_CHECK_HEADERS(pcrecpp.h)
335
  if test "x$ac_cv_header_prcecpp_h" = "xno" 
336
  then
337
    found_pcre="no"
77.1.64 by Monty Taylor
YA fix for libpcrecpp finding...
338
  else
339
    found_pcre="yes"
77.1.69 by Monty Taylor
Added the PCRE libs so that we can actually link against them :(
340
    # We can't search for these well, but we sure do need them!
341
    PCRE_LIBS="-lpcrecpp -lpcre"
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
342
  fi
343
  ])
344
if test "x$found_pcre" != "xyes"
345
then
346
    AC_MSG_ERROR([Couldn't find pcrecpp.h. Try installing the development package associated with libpcre on your system.])
347
fi
348
AC_LANG_POP([])
349
AC_SUBST(PCRE_LIBS)
350
AC_SUBST(PCRE_CFLAGS)
351
1 by brian
clean slate
352
353
# Avoid bug in fcntl on some versions of linux
354
AC_MSG_CHECKING([if we should use 'skip-external-locking' as default for $target_os])
355
# Any variation of Linux
356
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
357
then
358
  MYSQLD_DEFAULT_SWITCHES="--skip-external-locking"
359
  TARGET_LINUX="true"
360
  AC_MSG_RESULT([yes])
361
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
362
else
363
  MYSQLD_DEFAULT_SWITCHES=""
364
  TARGET_LINUX="false"
365
  AC_MSG_RESULT([no])
366
fi
367
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
368
AC_SUBST(TARGET_LINUX)
369
370
dnl Find paths to some shell programs
371
AC_PATH_PROG(LN, ln, ln)
372
# This must be able to take a -f flag like normal unix ln.
373
AC_PATH_PROG(LN_CP_F, ln, ln)
374
375
AC_PATH_PROG(MV, mv, mv)
376
AC_PATH_PROG(RM, rm, rm)
377
AC_PATH_PROG(CP, cp, cp)
378
AC_PATH_PROG(SED, sed, sed)
379
AC_PATH_PROG(CMP, cmp, cmp)
380
AC_PATH_PROG(CHMOD, chmod, chmod)
381
AC_PATH_PROG(HOSTNAME, hostname, hostname)
382
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
383
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
384
AC_CHECK_PROGS(TAR, gnutar gtar tar)
385
386
dnl We use a path for perl so the script startup works
387
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
388
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
389
AC_PATH_PROG(PERL, perl, no)
390
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
391
then
392
  PERL5=$PERL
393
else
394
  AC_PATH_PROG(PERL5, perl5, no)
395
  if test "$PERL5" != no
396
  then
397
    PERL=$PERL5
398
    ac_cv_path_PERL=$ac_cv_path_PERL5
399
  fi
400
fi
401
402
AC_SUBST(HOSTNAME)
403
AC_SUBST(PERL)
404
AC_SUBST(PERL5)
405
406
# icheck, used for ABI check
407
AC_PATH_PROG(ICHECK, icheck, no)
408
# "icheck" is also the name of a file system check program on Tru64.
409
# Verify the program found is really the interface checker.
410
if test "x$ICHECK" != "xno"
411
then
412
  AC_MSG_CHECKING(if $ICHECK works as expected)
413
  echo "int foo;" > conftest.h
414
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
415
  if test -f "conftest.ic"
416
  then
417
    AC_MSG_RESULT(yes)
418
  else
419
    AC_MSG_RESULT(no)
420
    ICHECK=no
421
  fi
422
  rm -f conftest.ic conftest.h
423
fi
424
AC_SUBST(ICHECK)
425
426
# Lock for PS
427
AC_PATH_PROG(PS, ps, ps)
428
AC_MSG_CHECKING("how to check if pid exists")
429
PS=$ac_cv_path_PS
430
# Linux style
431
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
432
then
433
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
434
# Solaris
435
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
436
then
437
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
438
# BSD style
439
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
440
then
441
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
442
# SysV style
443
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
444
then
445
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
446
# Do anybody use this?
447
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
448
then
449
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
450
else
451
  case $SYSTEM_TYPE in
452
    *freebsd*|*dragonfly*)
453
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
454
      ;;
455
    *darwin*)
456
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
457
      ;;
458
    *)
459
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
460
  esac
461
fi
462
AC_SUBST(FIND_PROC)
463
AC_MSG_RESULT("$FIND_PROC")
464
465
# Check if a pid is valid
466
AC_PATH_PROG(KILL, kill, kill)
467
AC_MSG_CHECKING("for kill switches")
468
if $ac_cv_path_KILL -0 $$
469
then
470
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
471
elif kill -s 0 $$
472
then
473
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
474
else
475
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
476
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
477
fi
478
AC_SUBST(CHECK_PID)
479
AC_MSG_RESULT("$CHECK_PID")
480
481
# We need an ANSI C compiler
482
AM_PROG_CC_STDC
483
484
# We need an assembler, too
485
AM_PROG_AS
486
CCASFLAGS="$CCASFLAGS $ASFLAGS"
487
488
# Check if we need noexec stack for assembler
489
AC_CHECK_NOEXECSTACK
490
491
if test "$am_cv_prog_cc_stdc" = "no"
492
then
91 by Brian Aker
Main binary now named drizzled
493
  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
494
fi
495
496
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
497
AC_ARG_WITH([server-suffix],
498
    [AS_HELP_STRING([--with-server-suffix],
499
      [Append value to the version string.])],
1 by brian
clean slate
500
    [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
501
    [ MYSQL_SERVER_SUFFIX= ]
502
    )
503
AC_SUBST(MYSQL_SERVER_SUFFIX)
504
505
# 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)
506
AC_ARG_WITH([named-curses-libs],
507
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
508
            [Use specified curses libraries instead of those
509
		automatically found by configure.])],
1 by brian
clean slate
510
    [ with_named_curses=$withval ],
511
    [ with_named_curses=no ]
512
    )
513
514
# compile with strings functions in assembler
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
515
AC_ARG_ENABLE([assembler],
516
    [AS_HELP_STRING([--enable-assembler],
517
	    [Use assembler versions of some string functions if available.])],
1 by brian
clean slate
518
    [ ENABLE_ASSEMBLER=$enableval ],
519
    [ ENABLE_ASSEMBLER=no ]
520
    )
521
522
AC_MSG_CHECKING(if we should use assembler functions)
523
# For now we only support assembler on i386 and sparc systems
524
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
525
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
526
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
527
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
528
529
if test "$ASSEMBLER_TRUE" = ""
530
then
531
  AC_MSG_RESULT([yes])
532
else
533
  AC_MSG_RESULT([no])
534
fi
535
536
# Add query profiler
537
AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
538
AC_ARG_ENABLE([profiling],
539
    [AS_HELP_STRING([--enable-profiling], 
540
	    [Build a version with query profiling code])],
1 by brian
clean slate
541
    [ ENABLED_PROFILING=$enableval ],
542
    [ ENABLED_PROFILING=no ])
543
544
if test "$ENABLED_PROFILING" = "yes"
545
then
546
  AC_DEFINE([ENABLED_PROFILING], [1],
547
            [If SHOW PROFILE should be enabled])
548
  AC_MSG_RESULT([yes]) 
549
else
550
  AC_MSG_RESULT([no])
551
fi
552
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
553
AC_ARG_WITH([tcp-port],
554
    [AS_HELP_STRING([--with-tcp-port=port-number],
91 by Brian Aker
Main binary now named drizzled
555
            [Which port to use for Drizzle services @<:@default=3306@:>@])],
1 by brian
clean slate
556
    [ MYSQL_TCP_PORT=$withval ],
557
    [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT
558
      # if we actually defaulted (as opposed to the pathological case of
559
      # --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
560
      # happen if whole batch of servers was built from a script), set
561
      # the default to zero to indicate that; we don't lose information
562
      # that way, because 0 obviously indicates that we can get the
563
      # default value from MYSQL_TCP_PORT. this seems really evil, but
564
      # testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
565
      # a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
566
      # intend it to mean "use the default, in fact, look up a good default
567
      # from /etc/services if you can", but really, really meant 3306 when
568
      # they passed in 3306. When they pass in a specific value, let them
569
      # have it; don't second guess user and think we know better, this will
570
      # just make people cross.  this makes the the logic work like this
571
      # (which is complicated enough):
572
      #
573
      # - if a port was set during build, use that as a default.
574
      #
575
      # - otherwise, try to look up a port in /etc/services; if that fails,
576
      #   use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
577
      #
578
      # - allow the MYSQL_TCP_PORT environment variable to override that.
579
      #
580
      # - allow command-line parameters to override all of the above.
581
      #
582
      # the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
583
      # so don't mess with that.
584
      MYSQL_TCP_PORT_DEFAULT=0 ]
585
    )
586
AC_SUBST(MYSQL_TCP_PORT)
587
# We might want to document the assigned port in the manual.
588
AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
589
590
# Use this to set the place used for unix socket used to local communication.
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
591
AC_ARG_WITH([mysqld-user],
592
    [AS_HELP_STRING([--with-mysqld-user=username],
593
            [What user the mysqld daemon shall be run as.
594
		@<:@default=mysql@:>@])],
1 by brian
clean slate
595
    [ MYSQLD_USER=$withval ],
596
    [ MYSQLD_USER=mysql ]
597
    )
598
AC_SUBST(MYSQLD_USER)
599
600
# If we should allow LOAD DATA LOCAL
601
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
602
AC_ARG_ENABLE(local-infile,
603
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
604
    [ ENABLED_LOCAL_INFILE=$enableval ],
605
    [ ENABLED_LOCAL_INFILE=no ]
606
    )
607
if test "$ENABLED_LOCAL_INFILE" = "yes"
608
then
609
  AC_MSG_RESULT([yes])
610
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
611
            [If LOAD DATA LOCAL INFILE should be enabled by default])
612
else
613
  AC_MSG_RESULT([no])
614
fi
615
616
MYSQL_SYS_LARGEFILE
617
618
# Types that must be checked AFTER large file support is checked
619
AC_TYPE_SIZE_T
620
621
#--------------------------------------------------------------------
622
# Check for system header files
623
#--------------------------------------------------------------------
624
625
AC_HEADER_DIRENT
626
AC_HEADER_STDC
627
AC_HEADER_SYS_WAIT
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
628
AC_HEADER_STDBOOL
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
629
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
630
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
631
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
632
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h)
77.1.57 by Monty Taylor
Removed dual-compile needs on client.c. Get the symbols now from libdrizzle.
633
AC_CHECK_HEADERS(sys/timeb.h sys/vadvise.h sys/wait.h term.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
634
AC_CHECK_HEADERS(termio.h termios.h sched.h crypt.h alloca.h)
635
AC_CHECK_HEADERS(sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h)
636
AC_CHECK_HEADERS(sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h)
637
AC_CHECK_HEADERS(execinfo.h)
1 by brian
clean slate
638
639
AC_CHECK_HEADERS([xfs/xfs.h])
77.1.62 by Monty Taylor
Added checks for libz and readline devel files.
640
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
641
#--------------------------------------------------------------------
1 by brian
clean slate
642
# Check for system libraries. Adds the library to $LIBS
643
# and defines HAVE_LIBM etc
644
#--------------------------------------------------------------------
645
646
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
647
AC_CHECK_FUNCS(log2)
648
649
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
650
AC_CHECK_FUNC(yp_get_default_domain, ,
651
  AC_CHECK_LIB(nsl, yp_get_default_domain))
652
AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
653
# This may get things to compile even if bind-8 is installed
654
AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
655
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
656
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
657
658
# Check rt for aio_read
659
AC_CHECK_LIB(rt, aio_read)
660
661
# For the sched_yield() function on Solaris
662
AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield,
663
[AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"]))
664
665
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
666
then
667
  AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
668
fi
669
670
AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
671
                uchar, uint, ulong],[],[], [
672
#include <sys/types.h>
673
])
674
AC_CHECK_TYPES([fp_except], [], [], [
675
#include <sys/types.h>
676
#include <ieeefp.h>
677
])
678
25 by Brian Aker
Clean up of configure.in
679
680
my_save_LIBS="$LIBS"
681
LIBS=""
682
AC_CHECK_LIB(dl,dlopen)
683
LIBDL=$LIBS
684
LIBS="$my_save_LIBS"
685
AC_SUBST(LIBDL)
686
687
my_save_LIBS="$LIBS"
688
LIBS="$LIBS $LIBDL"
689
AC_CHECK_FUNCS(dlopen dlerror)
690
LIBS="$my_save_LIBS"
691
692
AC_CHECK_FUNCS(strtok_r)
1 by brian
clean slate
693
694
# Build optimized or debug version ?
695
# First check for gcc and g++
28.1.33 by Monty Taylor
Added -Wall
696
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
697
then
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
698
  SYMBOLS_CFLAGS="-ggdb3"
77.1.78 by Monty Taylor
One last bunch of warnings edits.
699
  DEBUG_OPTIMIZE_CC="-O0"
700
  OPTIMIZE_CFLAGS="-O2"
1 by brian
clean slate
701
else
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
702
  SYMBOLS_CFLAGS="-g"
1 by brian
clean slate
703
  DEBUG_OPTIMIZE_CC=""
704
  OPTIMIZE_CFLAGS="-O"
705
fi
706
if test "$ac_cv_prog_cxx_g" = "yes"
707
then
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
708
  SYMBOLS_CXXFLAGS="-ggdb3"
77.1.78 by Monty Taylor
One last bunch of warnings edits.
709
  DEBUG_OPTIMIZE_CXX="-O0"
710
  OPTIMIZE_CXXFLAGS="-O2"
1 by brian
clean slate
711
else
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
712
  SYMBOLS_CXXFLAGS="-g"
1 by brian
clean slate
713
  DEBUG_OPTIMIZE_CXX=""
714
  OPTIMIZE_CXXFLAGS="-O"
715
fi
716
717
# If the user specified CFLAGS, we won't add any optimizations
718
if test -n "$SAVE_CFLAGS"
719
then
720
  OPTIMIZE_CFLAGS=""
721
  DEBUG_OPTIMIZE_CC=""
722
fi
723
# Ditto for CXXFLAGS
724
if test -n "$SAVE_CXXFLAGS"
725
then
726
  OPTIMIZE_CXXFLAGS=""
727
  DEBUG_OPTIMIZE_CXX=""
728
fi
729
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
730
CFLAGS="${SYMBOLS_CFLAGS} ${CFLAGS}"
731
CXXFLAGS="${SYMBOLS_CXXFLAGS} ${CXXFLAGS}"
732
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
733
AC_ARG_WITH([debug],
734
    [AS_HELP_STRING([--with-debug],
735
            [Add debug code (yes|no|full) @<:@default=no@:>@ 
736
	    Full adds memory checked, very slow.])],
1 by brian
clean slate
737
    [with_debug=$withval],
738
    [with_debug=no])
53.2.24 by Monty Taylor
Added an automake conditional to not build the dbug dir, since I don't want to keep seeing errors for it while cleaning up other parts of the tree.
739
AM_CONDITIONAL(BUILD_DBUG, test "$with_debug" != "no")
1 by brian
clean slate
740
if test "$with_debug" = "yes"
741
then
742
  # Medium debug.
743
  AC_DEFINE([DBUG_ON], [1], [Use libdbug])
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
744
  CFLAGS="$DEBUG_OPTIMIZE_CC $CFLAGS"
745
  CXXFLAGS="$DEBUG_OPTIMIZE_CXX $CXXFLAGS"
1 by brian
clean slate
746
else
747
  # Optimized version. No debug
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
748
  AC_DEFINE([DBUG_OFF], [1], [Dont use libdbug])
1 by brian
clean slate
749
  CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
750
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
751
fi
752
753
# If we should allow error injection tests
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
754
AC_ARG_WITH([error-inject],
755
    [AS_HELP_STRING([--with-error-inject],
91 by Brian Aker
Main binary now named drizzled
756
	    [Enable error injection in Drizzle Server @<:@default=off@:>@])],
1 by brian
clean slate
757
    [ with_error_inject=$withval ],
758
    [ with_error_inject=no ])
759
760
if test $with_debug != "no"
761
then
762
  if test "$with_error_inject" = "yes"
763
  then
764
    AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
91 by Brian Aker
Main binary now named drizzled
765
              [Enable error injection in Drizzle Server])
1 by brian
clean slate
766
  fi
767
fi
768
769
AC_ARG_WITH([fast-mutexes],
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
770
    [AS_HELP_STRING([--with-fast-mutexes],
771
	    [Compile with fast mutexes  @<:@default=off@:>@])],
772
    [with_fast_mutexes=$withval],
773
    [with_fast_mutexes=no])
1 by brian
clean slate
774
775
if test "$with_fast_mutexes" != "no"
776
then
777
  if test "$with_debug" != "no"
778
  then
779
    AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
780
  else
781
    AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
782
	      [Define to 1 if you want to use fast mutexes])
783
  fi
784
fi
785
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
786
AC_ARG_WITH([comment],
787
    [AS_HELP_STRING([--with-comment],
788
            [Comment about compilation environment. @<:@default=off@:>@])],
1 by brian
clean slate
789
    [with_comment=$withval],
790
    [with_comment=no])
791
if test "$with_comment" != "no"
792
then
793
  COMPILATION_COMMENT=$with_comment
794
else
795
  COMPILATION_COMMENT="Source distribution"
796
fi
797
AC_SUBST(COMPILATION_COMMENT)
798
799
AC_MSG_CHECKING("need of special linking flags")
28.1.33 by Monty Taylor
Added -Wall
800
if test "$TARGET_LINUX" = "true" -a "$ac_cv_c_compiler_gnu" = "yes" -a "$all_is_static" != "yes"
1 by brian
clean slate
801
then
802
  LDFLAGS="$LDFLAGS -rdynamic"
803
  AC_MSG_RESULT("-rdynamic")
804
else
805
  case "$SYSTEM_TYPE$with_mysqld_ldflags " in
806
  *freebsd*"-all-static "*|*dragonfly*"-all-static "*)
807
    AC_MSG_RESULT("none")
808
    ;;
809
  *freebsd*|*dragonfly*)
810
    MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
811
    AC_MSG_RESULT("-export-dynamic")
812
    ;;
813
  *)
814
    AC_MSG_RESULT("none")
815
    ;;
816
  esac
817
fi
818
819
dnl Checks for typedefs, structures, and compiler characteristics.
820
AC_C_CONST
821
AC_C_INLINE
822
AC_TYPE_OFF_T
823
AC_HEADER_TIME
824
AC_STRUCT_TM
825
MYSQL_NEEDS_MYSYS_NEW
826
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
827
# type. We want a error instead.
828
AC_CHECK_SIZEOF(char, 1)
829
if test "$ac_cv_sizeof_char" -eq 0
830
then
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
831
  AC_MSG_ERROR([No size for char type.])
1 by brian
clean slate
832
fi
833
AC_CHECK_SIZEOF(char*, 4)
834
AC_CHECK_SIZEOF(short, 2)
835
AC_CHECK_SIZEOF(int, 4)
836
if test "$ac_cv_sizeof_int" -eq 0
837
then
838
  AC_MSG_ERROR("No size for int type.")
839
fi
840
AC_CHECK_SIZEOF(long, 4)
841
if test "$ac_cv_sizeof_long" -eq 0
842
then
843
  AC_MSG_ERROR("No size for long type.")
844
fi
845
AC_CHECK_SIZEOF(long long, 8)
846
if test "$ac_cv_sizeof_long_long" -eq 0
847
then
91 by Brian Aker
Main binary now named drizzled
848
  AC_MSG_ERROR("Drizzle needs a long long type.")
1 by brian
clean slate
849
fi
850
# off_t is not a builtin type
851
AC_CHECK_SIZEOF(off_t, 4)
852
if test "$ac_cv_sizeof_off_t" -eq 0
853
then
91 by Brian Aker
Main binary now named drizzled
854
  AC_MSG_ERROR("Drizzle needs a off_t type.")
1 by brian
clean slate
855
fi
856
857
dnl
858
dnl check if time_t is unsigned
859
dnl
860
861
MYSQL_CHECK_TIME_T
862
863
864
# do we need #pragma interface/#pragma implementation ?
865
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
866
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
867
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
868
# follow any standard), we'll use well-defined preprocessor macros:
28.1.33 by Monty Taylor
Added -Wall
869
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1 by brian
clean slate
870
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
871
#error USE_PRAGMA_IMPLEMENTATION
872
#endif
28.1.33 by Monty Taylor
Added -Wall
873
]])],[AC_MSG_RESULT(no) ],[AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION"])
1 by brian
clean slate
874
875
# This always gives a warning. Ignore it unless you are cross compiling
876
AC_C_BIGENDIAN
877
#---START: Used in for client configure
878
# Check base type of last arg to accept
879
MYSQL_TYPE_ACCEPT
880
#---END:
881
# Figure out what type of struct rlimit to use with setrlimit
882
MYSQL_TYPE_STRUCT_RLIMIT
883
# Find where the stack goes
884
MYSQL_STACK_DIRECTION
885
# We want to skip alloca on irix unconditionally. It may work on some version..
886
MYSQL_FUNC_ALLOCA
887
# Do struct timespec have members tv_sec or ts_sec
888
MYSQL_TIMESPEC_TS
889
# Do we have the tzname variable
890
MYSQL_TZNAME
891
# Do the c++ compiler have a bool type
892
MYSQL_CXX_BOOL
893
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
894
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
895
AC_CHECK_TYPES([u_int32_t])
896
897
MYSQL_PTHREAD_YIELD
898
899
######################################################################
900
# For readline/libedit (We simply move the mimimum amount of stuff from
901
# the readline/libedit configure.in here)
902
903
dnl Checks for header files.
904
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
905
906
dnl Checks for library functions.
907
AC_FUNC_ALLOCA
908
AC_PROG_GCC_TRADITIONAL
909
AC_TYPE_SIGNAL
910
AC_CHECK_FUNCS(re_comp regcomp strdup)
911
912
dnl Sun compilers have their own vis.h that is about something
913
dnl totally different. So, not to change the libedit source, we
914
dnl do some additional checks before we define HAVE_VIS_H.
915
AC_CHECK_HEADER(vis.h,
916
  [AC_CHECK_FUNC(strvis,
917
    [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
918
919
AC_CHECK_FUNCS(strlcat strlcpy)
920
AC_CHECK_FUNCS(issetugid)
921
AC_CHECK_FUNCS(getline flockfile)
922
923
# from old readline settting:
924
925
MAKE_SHELL=/bin/sh
926
AC_SUBST(MAKE_SHELL)
927
928
# Already-done: stdlib.h string.h unistd.h termios.h
929
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
930
 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
931
 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
932
paths.h semaphore.h)
933
934
# Already-done: strcasecmp
935
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
936
28.1.33 by Monty Taylor
Added -Wall
937
AC_HEADER_STAT
1 by brian
clean slate
938
MYSQL_SIGNAL_CHECK
939
MYSQL_CHECK_GETPW_FUNCS
940
MYSQL_HAVE_TIOCGWINSZ
941
MYSQL_HAVE_FIONREAD
942
MYSQL_HAVE_TIOCSTAT
943
MYSQL_STRUCT_DIRENT_D_INO
944
MYSQL_STRUCT_DIRENT_D_NAMLEN
945
MYSQL_TYPE_SIGHANDLER
946
MYSQL_CHECK_MULTIBYTE
947
if test "$with_named_curses" = "no"
948
then
949
  MYSQL_CHECK_LIB_TERMCAP
950
else
951
  TERMCAP_LIB="$with_named_curses"
952
fi
953
AC_SUBST(TERMCAP_LIB)
954
955
# Check if the termcap function 'tgoto' is already declared in
956
# system header files or if it need to be declared locally
957
AC_CHECK_DECLS(tgoto,,,[
958
#ifdef HAVE_CURSES_H
959
# include <curses.h>
960
#elif HAVE_NCURSES_H
961
# include <ncurses.h>
962
#endif
963
#ifdef HAVE_TERM_H
964
# include <term.h>
965
#endif
966
])
967
968
# End of readline/libedit stuff
969
#########################################################################
970
971
dnl Checks for library functions.
972
973
#
974
# The following code disables intrinsic function support while we test for
975
# library functions.  This is to avoid configure problems with Intel ecc
976
# compiler
977
978
ORG_CFLAGS="$CFLAGS"
979
if test "$GCC" != "yes"; then
980
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
981
fi
982
983
#AC_FUNC_MMAP
984
AC_TYPE_SIGNAL
985
MYSQL_TYPE_QSORT
986
AC_FUNC_UTIME_NULL
987
AC_FUNC_VPRINTF
988
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
989
AC_CHECK_FUNCS(fcntl)
990
if test "x$ac_cv_func_fcntl" != "xyes"
991
then
992
  AC_MSG_ERROR("Drizzle requires fcntl.")
993
fi
994
53.2.16 by Monty Taylor
Removed my_alarm. Made my_lock only do the non-alarm version. Moved my_lock to MyISAM where it belongs.
995
AC_CHECK_FUNCS(bcmp bfill bmove bsearch bzero \
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
996
  cuserid fchmod \
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
997
  fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
1 by brian
clean slate
998
  getcwd getpass getpassphrase getpwnam \
999
  getpwuid getrlimit getrusage getwd index initgroups isnan \
1000
  localtime_r gethrtime gmtime_r \
1001
  locking longjmp lrand48 madvise mallinfo memcpy memmove \
1002
  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
1003
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
1004
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
1005
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
1006
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
1007
  realpath rename rint rwlock_init setupterm \
1008
  shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
1009
  sighold sigset sigthreadmask port_create sleep \
1010
  snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
6 by Brian Aker
Second pass on pthread cleanup
1011
  strtol strtoll strtoul strtoull tell tempnam vidattr \
1 by brian
clean slate
1012
  posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
1013
28.1.33 by Monty Taylor
Added -Wall
1014
# Check that isinf() is available in math.h and can be used in both C and C++
1 by brian
clean slate
1015
# code
28.1.33 by Monty Taylor
Added -Wall
1016
AC_MSG_CHECKING(for isinf in math.h)
1017
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1018
    float f = 0.0; 
1019
    int r = isinf(f); 
1020
    return r;
1021
  ]])],[
1 by brian
clean slate
1022
    AC_MSG_RESULT(yes)
28.1.33 by Monty Taylor
Added -Wall
1023
    AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1024
    AC_LANG_PUSH([C++])
1025
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1026
      float f = 0.0;
1027
      int r = isinf(f);
1028
      return r;
1029
    ]])],[
1030
      AC_MSG_RESULT(yes)
1031
      AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function])
1032
    ],[
1033
      AC_MSG_RESULT(no)
1034
    ])
1035
    AC_LANG_POP([])
1036
  ],[
1037
  AC_MSG_RESULT(no)])
1038
1039
1 by brian
clean slate
1040
CFLAGS="$ORG_CFLAGS"
1041
1042
# Sanity check: We chould not have any fseeko symbol unless
1043
# large_file_support=yes
1044
AC_CHECK_FUNC(fseeko,
1045
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
1046
then
1047
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
1048
fi]
1049
)
1050
1051
# Check definition of pthread_getspecific
1052
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
28.1.33 by Monty Taylor
Added -Wall
1053
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(_REENTRANT)
1 by brian
clean slate
1054
#define _REENTRANT
1055
#endif
1056
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1057
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
1058
pthread_getspecific((pthread_key_t) NULL); ]])],[mysql_cv_getspecific_args=POSIX],[mysql_cv_getspecific_args=other]))
1 by brian
clean slate
1059
  if test "$mysql_cv_getspecific_args" = "other"
1060
  then
1061
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1062
              [For some non posix threads])
1063
  fi
1064
1065
  # Check definition of pthread_mutex_init
1066
  AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
28.1.33 by Monty Taylor
Added -Wall
1067
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1068
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1069
#include <pthread.h> ]], [[ 
1 by brian
clean slate
1070
  pthread_mutexattr_t attr;
1071
  pthread_mutex_t mp;
28.1.33 by Monty Taylor
Added -Wall
1072
  pthread_mutex_init(&mp,&attr); ]])],[mysql_cv_mutex_init_args=POSIX],[mysql_cv_mutex_init_args=other]))
1 by brian
clean slate
1073
  if test "$mysql_cv_mutex_init_args" = "other"
1074
  then
1075
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1076
              [For some non posix threads])
1077
  fi
1078
#---END:
1079
1080
#---START: Used in for client configure
1081
# Check definition of readdir_r
1082
AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
28.1.33 by Monty Taylor
Added -Wall
1083
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1084
#define _POSIX_PTHREAD_SEMANTICS 
1085
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1086
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1087
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],[mysql_cv_readdir_r=POSIX],[mysql_cv_readdir_r=other]))
1 by brian
clean slate
1088
if test "$mysql_cv_readdir_r" = "POSIX"
1089
then
1090
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1091
fi
1092
1093
# Check definition of posix sigwait()
1094
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
28.1.33 by Monty Taylor
Added -Wall
1095
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1096
#define _POSIX_PTHREAD_SEMANTICS 
1097
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1098
#include <signal.h>]], [[#ifndef _AIX
1 by brian
clean slate
1099
sigset_t set;
1100
int sig;
1101
sigwait(&set,&sig);
28.1.33 by Monty Taylor
Added -Wall
1102
#endif]])],[mysql_cv_sigwait=POSIX],[mysql_cv_sigwait=other]))
1 by brian
clean slate
1103
if test "$mysql_cv_sigwait" = "POSIX"
1104
then
1105
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1106
fi
1107
1108
if test "$mysql_cv_sigwait" != "POSIX"
1109
then
1110
unset mysql_cv_sigwait
1111
# Check definition of posix sigwait()
1112
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
28.1.33 by Monty Taylor
Added -Wall
1113
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1114
#define _POSIX_PTHREAD_SEMANTICS 
1115
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1116
#include <signal.h>]], [[sigset_t set;
1 by brian
clean slate
1117
int sig;
28.1.33 by Monty Taylor
Added -Wall
1118
sigwait(&set);]])],[mysql_cv_sigwait=NONPOSIX],[mysql_cv_sigwait=other]))
1 by brian
clean slate
1119
if test "$mysql_cv_sigwait" = "NONPOSIX"
1120
then
1121
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1122
fi
1123
fi
1124
#---END:
1125
1126
# Check if pthread_attr_setscope() exists
1127
AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
28.1.33 by Monty Taylor
Added -Wall
1128
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1129
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1130
#include <pthread.h>]], [[pthread_attr_t thr_attr;
1131
pthread_attr_setscope(&thr_attr,0);]])],[mysql_cv_pthread_attr_setscope=yes],[mysql_cv_pthread_attr_setscope=no]))
1 by brian
clean slate
1132
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1133
then
1134
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1135
fi
1136
1137
# Check for bad includes
1138
AC_MSG_CHECKING("can netinet files be included")
28.1.33 by Monty Taylor
Added -Wall
1139
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1 by brian
clean slate
1140
#include <sys/socket.h>
1141
#include <netinet/in_systm.h>
1142
#include <netinet/in.h>
1143
#include <netinet/ip.h>
28.1.33 by Monty Taylor
Added -Wall
1144
#include <netinet/tcp.h>]], [[ printf("1\n"); ]])],[netinet_inc=yes],[netinet_inc=no])
1 by brian
clean slate
1145
if test "$netinet_inc" = "no"
1146
then
1147
  AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1148
fi
1149
AC_MSG_RESULT("$netinet_inc")
1150
28.1.33 by Monty Taylor
Added -Wall
1151
AC_LANG_PUSH([C++])
1 by brian
clean slate
1152
AC_CHECK_HEADERS(cxxabi.h)
1153
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
28.1.33 by Monty Taylor
Added -Wall
1154
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1 by brian
clean slate
1155
  char *foo= 0; int bar= 0;
1156
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
28.1.33 by Monty Taylor
Added -Wall
1157
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1158
AC_LANG_POP([])
1 by brian
clean slate
1159
1160
if test "x$mysql_cv_cxa_demangle" = xyes; then
1161
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1162
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1163
fi
1164
1165
#--------------------------------------------------------------------
1166
# Check for requested features
1167
#--------------------------------------------------------------------
1168
1169
MYSQL_CHECK_BIG_TABLES
1170
MYSQL_CHECK_MAX_INDEXES
1171
MYSQL_CHECK_VIO
1172
1173
#--------------------------------------------------------------------
1174
# Declare our plugin modules
1175
# Has to be done late, as the plugin may need to check for existence of
1176
# functions tested above
1177
#--------------------------------------------------------------------
1178
1179
MYSQL_CONFIGURE_PLUGINS([none])
1180
1181
AC_SUBST(mysql_plugin_dirs)
1182
AC_SUBST(mysql_plugin_libs)
1183
AC_SUBST(mysql_plugin_defs)
1184
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1185
AC_ARG_ENABLE([pedantic-warnings],
1186
    [AS_HELP_STRING([--disable-pedantic-warnings],
1187
       [Toggle pedanticness @<:@default=on@:>@])],
1188
    [ac_warn_pedantic="$enableval"],
1189
    [ac_warn_pedantic="yes"])
1190
1191
AC_ARG_ENABLE([fail],
1192
    [AS_HELP_STRING([--enable-fail],
1193
       [Turn warnings into failures @<:@default=off@:>@])],
1194
    [ac_warn_fail="$enableval"],
1195
    [ac_warn_fail="no"])
1196
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1197
AC_ARG_ENABLE([unreachable],
1198
    [AS_HELP_STRING([--enable-unreachable],
1199
       [Enable warnings about unreachable code @<:@default=off@:>@])],
1200
    [ac_warn_unreachable="$enableval"],
1201
    [ac_warn_unreachable="no"])
1202
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1203
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1204
if test "$GCC" = "yes"
1205
then
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1206
77.1.69 by Monty Taylor
Added the PCRE libs so that we can actually link against them :(
1207
  GCC_WARNINGS="-W -Wall -Wextra"
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1208
  GXX_WARNINGS="${GCC_WARNINGS}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1209
1210
1211
  if test "$ac_warn_pedantic" = "yes"
1212
  then
77.1.77 by Monty Taylor
A crapton more warning cleanups (I turned on more warnings)
1213
    GCC_WARNINGS="${GCC_WARNINGS}  -std=gnu99 -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wno-strict-aliasing "
1214
    GXX_WARNINGS="${GXX_WARNINGS}  -std=gnu++98 -pedantic -Wundef -Wredundant-decls -Wno-long-long -Wno-strict-aliasing"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1215
  fi
1216
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1217
  if test "$ac_warn_unreachable" = "yes"
1218
  then
1219
    GCC_WARNINGS="${GCC_WARNINGS} -Wunreachable-code"
1220
    GXX_WARNINGS="${GXX_WARNINGS} -Wunreachable-code"
1221
  fi
1222
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1223
  if test "$ac_warn_fail" = "yes"
1224
  then
1225
    GCC_WARNINGS="${GCC_WARNINGS} -Werror"
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1226
    GXX_WARNINGS="${GXX_WARNINGS} -Werror"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1227
  fi
1228
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1229
    CXXFLAGS="$CXXFLAGS ${GXX_WARNINGS}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1230
    CFLAGS="$CFLAGS ${GCC_WARNINGS} "
1231
fi
1232
1 by brian
clean slate
1233
# Some usefull subst
1234
AC_SUBST(CC)
1235
AC_SUBST(GXX)
1236
1237
# Set configuration options for make_binary_distribution
1238
case $SYSTEM_TYPE in
1239
  *netware*)
1240
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1241
    ;;
1242
  *)
1243
    : # no change for other platforms yet
1244
    ;;
1245
esac
1246
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1247
28.1.2 by Monty Taylor
First stab at back porting libtool convenience lib patch from telco-6.2
1248
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile mysys/tests/Makefile dnl
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
1249
 strings/Makefile strings/tests/Makefile storage/Makefile dnl
13 by brian
Incomming patch to clean up build.
1250
 vio/Makefile dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1251
 libdrizzle/Makefile client/Makefile dnl
54.1.3 by Stewart Smith
sql => server (initial patch)
1252
 server/Makefile server/share/Makefile dnl
77.1.52 by Monty Taylor
And reference to it in the configure script.
1253
 server/sql_builtin.cc dnl
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
1254
 dbug/Makefile include/Makefile dnl
28.1.31 by Monty Taylor
Deleted tons of pointless garbage from scripts.
1255
 support-files/Makefile dnl
77.1.47 by Monty Taylor
Moved test to tests...
1256
 tests/Makefile tests/install_test_db dnl
77.1.39 by Monty Taylor
More mysql->drizzle renaming.
1257
 include/drizzle_version.h plugin/Makefile dnl
54.1.6 by Stewart Smith
merge mainline
1258
 server/drizzled_safe support-files/libdrizzle.pc dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1259
 support-files/drizzle.server support-files/drizzle-log-rotate)
1 by brian
clean slate
1260
1261
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1262
1263
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
1264
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
1265
1266
AC_OUTPUT