~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.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
285
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
286
#--------------------------------------------------------------------
287
# Check for libevent
288
#--------------------------------------------------------------------
289
290
AC_CHECK_HEADERS(event.h)
291
if test "x$ac_cv_header_event_h" != "xyes"
292
then
293
  AC_MSG_ERROR([Couldn't find event.h. Try installing libevent development packages])
294
fi
295
AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
296
297
#--------------------------------------------------------------------
298
# Check for libpthread
299
#--------------------------------------------------------------------
300
301
AC_CHECK_HEADERS(pthread.h)
302
if test "x$ac_cv_header_pthread_h" != "xyes"
303
then
304
  AC_MSG_ERROR([Couldn't find pthread.h.])
305
fi
306
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR(could not find libpthread)])
307
308
#--------------------------------------------------------------------
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
309
# Check for tcmalloc
310
#--------------------------------------------------------------------
311
312
AC_ARG_ENABLE([tcmalloc],
313
    [AS_HELP_STRING([--enable-tcmalloc],
314
       [Enable linking with tcmalloc @<:@default=off@:>@])],
315
    [ac_warn_strict_aliasing="$enableval"],
316
    [ac_warn_strict_aliasing="no"])
317
318
if test "x$ac_warn_strict_aliasing" = "xyes"
319
then
320
  AC_CHECK_LIB(tcmalloc,malloc,[],[])
321
fi
322
323
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
324
# Check for libz
325
#--------------------------------------------------------------------
326
327
AC_CHECK_HEADERS(zlib.h)
328
if test "x$ac_cv_header_zlib_h" != "xyes"
329
then
330
  AC_MSG_ERROR([Couldn't find zlib.h. Try installing zlib development packages])
331
fi
332
AC_CHECK_LIB(z, crc32, [], [AC_MSG_ERROR(could not find libz)])
333
334
335
AC_CHECK_HEADERS([readline/readline.h])
336
if test "x$ac_cv_header_readline_readline_h" != "xyes"
337
then
338
  AC_MSG_ERROR([Couldn't find readline/readline.h. Try installing readline development packages.])
339
fi
340
341
#--------------------------------------------------------------------
342
# Check for libpcre
343
#--------------------------------------------------------------------
344
345
AC_LANG_PUSH([C++])
346
AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found.]))
347
PKG_CHECK_MODULES(PCRE, [libpcrecpp >= 3], [found_pcre="yes"],[
77.1.64 by Monty Taylor
YA fix for libpcrecpp finding...
348
  dnl Only check the header here, because autoconf can't handle
349
  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.
350
  AC_CHECK_HEADERS(pcrecpp.h)
77.1.102 by Monty Taylor
Fixed a PCRE detection bug.
351
  if test "x$ac_cv_header_pcrecpp_h" != "xyes" 
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
352
  then
353
    found_pcre="no"
77.1.64 by Monty Taylor
YA fix for libpcrecpp finding...
354
  else
355
    found_pcre="yes"
77.1.69 by Monty Taylor
Added the PCRE libs so that we can actually link against them :(
356
    # We can't search for these well, but we sure do need them!
357
    PCRE_LIBS="-lpcrecpp -lpcre"
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
358
  fi
359
  ])
360
if test "x$found_pcre" != "xyes"
361
then
362
    AC_MSG_ERROR([Couldn't find pcrecpp.h. Try installing the development package associated with libpcre on your system.])
363
fi
364
AC_LANG_POP([])
365
AC_SUBST(PCRE_LIBS)
366
AC_SUBST(PCRE_CFLAGS)
367
1 by brian
clean slate
368
dnl Find paths to some shell programs
369
AC_PATH_PROG(LN, ln, ln)
370
# This must be able to take a -f flag like normal unix ln.
371
AC_PATH_PROG(LN_CP_F, ln, ln)
372
373
AC_PATH_PROG(MV, mv, mv)
374
AC_PATH_PROG(RM, rm, rm)
375
AC_PATH_PROG(CP, cp, cp)
376
AC_PATH_PROG(SED, sed, sed)
377
AC_PATH_PROG(CMP, cmp, cmp)
378
AC_PATH_PROG(CHMOD, chmod, chmod)
379
AC_PATH_PROG(HOSTNAME, hostname, hostname)
380
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
381
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
382
AC_CHECK_PROGS(TAR, gnutar gtar tar)
383
384
dnl We use a path for perl so the script startup works
385
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
386
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
387
AC_PATH_PROG(PERL, perl, no)
388
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
389
then
390
  PERL5=$PERL
391
else
392
  AC_PATH_PROG(PERL5, perl5, no)
393
  if test "$PERL5" != no
394
  then
395
    PERL=$PERL5
396
    ac_cv_path_PERL=$ac_cv_path_PERL5
397
  fi
398
fi
399
400
AC_SUBST(HOSTNAME)
401
AC_SUBST(PERL)
402
AC_SUBST(PERL5)
403
404
# icheck, used for ABI check
405
AC_PATH_PROG(ICHECK, icheck, no)
406
# "icheck" is also the name of a file system check program on Tru64.
407
# Verify the program found is really the interface checker.
408
if test "x$ICHECK" != "xno"
409
then
410
  AC_MSG_CHECKING(if $ICHECK works as expected)
411
  echo "int foo;" > conftest.h
412
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
413
  if test -f "conftest.ic"
414
  then
415
    AC_MSG_RESULT(yes)
416
  else
417
    AC_MSG_RESULT(no)
418
    ICHECK=no
419
  fi
420
  rm -f conftest.ic conftest.h
421
fi
422
AC_SUBST(ICHECK)
423
424
# Lock for PS
425
AC_PATH_PROG(PS, ps, ps)
426
AC_MSG_CHECKING("how to check if pid exists")
427
PS=$ac_cv_path_PS
428
# Linux style
429
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
430
then
431
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
432
# Solaris
433
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
434
then
435
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
436
# BSD style
437
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
438
then
439
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
440
# SysV style
441
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
442
then
443
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
444
# Do anybody use this?
445
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
446
then
447
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
448
else
449
  case $SYSTEM_TYPE in
450
    *freebsd*|*dragonfly*)
451
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
452
      ;;
453
    *darwin*)
454
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
455
      ;;
456
    *)
457
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
458
  esac
459
fi
460
AC_SUBST(FIND_PROC)
461
AC_MSG_RESULT("$FIND_PROC")
462
463
# Check if a pid is valid
464
AC_PATH_PROG(KILL, kill, kill)
465
AC_MSG_CHECKING("for kill switches")
466
if $ac_cv_path_KILL -0 $$
467
then
468
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
469
elif kill -s 0 $$
470
then
471
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
472
else
473
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
474
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
475
fi
476
AC_SUBST(CHECK_PID)
477
AC_MSG_RESULT("$CHECK_PID")
478
479
# We need an ANSI C compiler
480
AM_PROG_CC_STDC
481
482
# We need an assembler, too
483
AM_PROG_AS
484
CCASFLAGS="$CCASFLAGS $ASFLAGS"
485
486
# Check if we need noexec stack for assembler
487
AC_CHECK_NOEXECSTACK
488
489
if test "$am_cv_prog_cc_stdc" = "no"
490
then
91 by Brian Aker
Main binary now named drizzled
491
  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
492
fi
493
494
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
495
AC_ARG_WITH([server-suffix],
496
    [AS_HELP_STRING([--with-server-suffix],
497
      [Append value to the version string.])],
1 by brian
clean slate
498
    [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
499
    [ MYSQL_SERVER_SUFFIX= ]
500
    )
501
AC_SUBST(MYSQL_SERVER_SUFFIX)
502
503
# 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)
504
AC_ARG_WITH([named-curses-libs],
505
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
506
            [Use specified curses libraries instead of those
507
		automatically found by configure.])],
1 by brian
clean slate
508
    [ with_named_curses=$withval ],
509
    [ with_named_curses=no ]
510
    )
511
512
# 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)
513
AC_ARG_ENABLE([assembler],
514
    [AS_HELP_STRING([--enable-assembler],
515
	    [Use assembler versions of some string functions if available.])],
1 by brian
clean slate
516
    [ ENABLE_ASSEMBLER=$enableval ],
517
    [ ENABLE_ASSEMBLER=no ]
518
    )
519
520
AC_MSG_CHECKING(if we should use assembler functions)
521
# For now we only support assembler on i386 and sparc systems
522
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;))
523
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
524
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
525
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
526
527
if test "$ASSEMBLER_TRUE" = ""
528
then
529
  AC_MSG_RESULT([yes])
530
else
531
  AC_MSG_RESULT([no])
532
fi
533
534
# Add query profiler
535
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)
536
AC_ARG_ENABLE([profiling],
537
    [AS_HELP_STRING([--enable-profiling], 
538
	    [Build a version with query profiling code])],
1 by brian
clean slate
539
    [ ENABLED_PROFILING=$enableval ],
540
    [ ENABLED_PROFILING=no ])
541
542
if test "$ENABLED_PROFILING" = "yes"
543
then
544
  AC_DEFINE([ENABLED_PROFILING], [1],
545
            [If SHOW PROFILE should be enabled])
546
  AC_MSG_RESULT([yes]) 
547
else
548
  AC_MSG_RESULT([no])
549
fi
550
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
551
AC_ARG_WITH([tcp-port],
552
    [AS_HELP_STRING([--with-tcp-port=port-number],
91 by Brian Aker
Main binary now named drizzled
553
            [Which port to use for Drizzle services @<:@default=3306@:>@])],
1 by brian
clean slate
554
    [ MYSQL_TCP_PORT=$withval ],
555
    [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT
556
      # if we actually defaulted (as opposed to the pathological case of
557
      # --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
558
      # happen if whole batch of servers was built from a script), set
559
      # the default to zero to indicate that; we don't lose information
560
      # that way, because 0 obviously indicates that we can get the
561
      # default value from MYSQL_TCP_PORT. this seems really evil, but
562
      # testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
563
      # a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
564
      # intend it to mean "use the default, in fact, look up a good default
565
      # from /etc/services if you can", but really, really meant 3306 when
566
      # they passed in 3306. When they pass in a specific value, let them
567
      # have it; don't second guess user and think we know better, this will
568
      # just make people cross.  this makes the the logic work like this
569
      # (which is complicated enough):
570
      #
571
      # - if a port was set during build, use that as a default.
572
      #
573
      # - otherwise, try to look up a port in /etc/services; if that fails,
574
      #   use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
575
      #
576
      # - allow the MYSQL_TCP_PORT environment variable to override that.
577
      #
578
      # - allow command-line parameters to override all of the above.
579
      #
580
      # the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
581
      # so don't mess with that.
582
      MYSQL_TCP_PORT_DEFAULT=0 ]
583
    )
584
AC_SUBST(MYSQL_TCP_PORT)
585
# We might want to document the assigned port in the manual.
586
AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
587
588
# 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)
589
AC_ARG_WITH([mysqld-user],
590
    [AS_HELP_STRING([--with-mysqld-user=username],
591
            [What user the mysqld daemon shall be run as.
592
		@<:@default=mysql@:>@])],
1 by brian
clean slate
593
    [ MYSQLD_USER=$withval ],
594
    [ MYSQLD_USER=mysql ]
595
    )
596
AC_SUBST(MYSQLD_USER)
597
598
# If we should allow LOAD DATA LOCAL
599
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
600
AC_ARG_ENABLE(local-infile,
601
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
602
    [ ENABLED_LOCAL_INFILE=$enableval ],
603
    [ ENABLED_LOCAL_INFILE=no ]
604
    )
605
if test "$ENABLED_LOCAL_INFILE" = "yes"
606
then
607
  AC_MSG_RESULT([yes])
608
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
609
            [If LOAD DATA LOCAL INFILE should be enabled by default])
610
else
611
  AC_MSG_RESULT([no])
612
fi
613
614
MYSQL_SYS_LARGEFILE
615
616
# Types that must be checked AFTER large file support is checked
617
AC_TYPE_SIZE_T
618
619
#--------------------------------------------------------------------
620
# Check for system header files
621
#--------------------------------------------------------------------
622
623
AC_HEADER_DIRENT
624
AC_HEADER_STDC
625
AC_HEADER_SYS_WAIT
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
626
AC_HEADER_STDBOOL
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
627
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
628
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
629
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
630
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.
631
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.
632
AC_CHECK_HEADERS(termio.h termios.h sched.h crypt.h alloca.h)
633
AC_CHECK_HEADERS(sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h)
634
AC_CHECK_HEADERS(sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h)
635
AC_CHECK_HEADERS(execinfo.h)
1 by brian
clean slate
636
637
AC_CHECK_HEADERS([xfs/xfs.h])
77.1.62 by Monty Taylor
Added checks for libz and readline devel files.
638
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
639
#--------------------------------------------------------------------
1 by brian
clean slate
640
# Check for system libraries. Adds the library to $LIBS
641
# and defines HAVE_LIBM etc
642
#--------------------------------------------------------------------
643
644
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
645
AC_CHECK_FUNCS(log2)
646
647
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
648
AC_CHECK_FUNC(yp_get_default_domain, ,
649
  AC_CHECK_LIB(nsl, yp_get_default_domain))
650
AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
651
# This may get things to compile even if bind-8 is installed
652
AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
653
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
654
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
655
656
# Check rt for aio_read
657
AC_CHECK_LIB(rt, aio_read)
658
659
# For the sched_yield() function on Solaris
660
AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield,
661
[AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"]))
662
663
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
664
then
665
  AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
666
fi
667
668
AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
669
                uchar, uint, ulong],[],[], [
670
#include <sys/types.h>
671
])
672
AC_CHECK_TYPES([fp_except], [], [], [
673
#include <sys/types.h>
674
#include <ieeefp.h>
675
])
676
25 by Brian Aker
Clean up of configure.in
677
678
my_save_LIBS="$LIBS"
679
LIBS=""
680
AC_CHECK_LIB(dl,dlopen)
681
LIBDL=$LIBS
682
LIBS="$my_save_LIBS"
683
AC_SUBST(LIBDL)
684
685
my_save_LIBS="$LIBS"
686
LIBS="$LIBS $LIBDL"
687
AC_CHECK_FUNCS(dlopen dlerror)
688
LIBS="$my_save_LIBS"
689
690
AC_CHECK_FUNCS(strtok_r)
1 by brian
clean slate
691
692
# Build optimized or debug version ?
693
# First check for gcc and g++
28.1.33 by Monty Taylor
Added -Wall
694
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
695
then
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
696
  SYMBOLS_CFLAGS="-ggdb3"
77.1.78 by Monty Taylor
One last bunch of warnings edits.
697
  DEBUG_OPTIMIZE_CC="-O0"
698
  OPTIMIZE_CFLAGS="-O2"
1 by brian
clean slate
699
else
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
700
  SYMBOLS_CFLAGS="-g"
1 by brian
clean slate
701
  DEBUG_OPTIMIZE_CC=""
702
  OPTIMIZE_CFLAGS="-O"
703
fi
704
if test "$ac_cv_prog_cxx_g" = "yes"
705
then
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
706
  SYMBOLS_CXXFLAGS="-ggdb3"
77.1.78 by Monty Taylor
One last bunch of warnings edits.
707
  DEBUG_OPTIMIZE_CXX="-O0"
708
  OPTIMIZE_CXXFLAGS="-O2"
1 by brian
clean slate
709
else
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
710
  SYMBOLS_CXXFLAGS="-g"
1 by brian
clean slate
711
  DEBUG_OPTIMIZE_CXX=""
712
  OPTIMIZE_CXXFLAGS="-O"
713
fi
714
715
# If the user specified CFLAGS, we won't add any optimizations
716
if test -n "$SAVE_CFLAGS"
717
then
718
  OPTIMIZE_CFLAGS=""
719
  DEBUG_OPTIMIZE_CC=""
720
fi
721
# Ditto for CXXFLAGS
722
if test -n "$SAVE_CXXFLAGS"
723
then
724
  OPTIMIZE_CXXFLAGS=""
725
  DEBUG_OPTIMIZE_CXX=""
726
fi
727
77.1.68 by Monty Taylor
Turned on -g and optimization for normal builds. -ggdb3 for gcc builds.
728
CFLAGS="${SYMBOLS_CFLAGS} ${CFLAGS}"
729
CXXFLAGS="${SYMBOLS_CXXFLAGS} ${CXXFLAGS}"
730
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
731
AC_ARG_WITH([debug],
732
    [AS_HELP_STRING([--with-debug],
733
            [Add debug code (yes|no|full) @<:@default=no@:>@ 
734
	    Full adds memory checked, very slow.])],
1 by brian
clean slate
735
    [with_debug=$withval],
736
    [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.
737
AM_CONDITIONAL(BUILD_DBUG, test "$with_debug" != "no")
1 by brian
clean slate
738
if test "$with_debug" = "yes"
739
then
740
  # Medium debug.
741
  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.
742
  CFLAGS="$DEBUG_OPTIMIZE_CC $CFLAGS"
743
  CXXFLAGS="$DEBUG_OPTIMIZE_CXX $CXXFLAGS"
1 by brian
clean slate
744
else
745
  # Optimized version. No debug
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
746
  AC_DEFINE([DBUG_OFF], [1], [Dont use libdbug])
1 by brian
clean slate
747
  CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
748
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
749
fi
750
751
# 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)
752
AC_ARG_WITH([error-inject],
753
    [AS_HELP_STRING([--with-error-inject],
91 by Brian Aker
Main binary now named drizzled
754
	    [Enable error injection in Drizzle Server @<:@default=off@:>@])],
1 by brian
clean slate
755
    [ with_error_inject=$withval ],
756
    [ with_error_inject=no ])
757
758
if test $with_debug != "no"
759
then
760
  if test "$with_error_inject" = "yes"
761
  then
762
    AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
91 by Brian Aker
Main binary now named drizzled
763
              [Enable error injection in Drizzle Server])
1 by brian
clean slate
764
  fi
765
fi
766
767
AC_ARG_WITH([fast-mutexes],
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
768
    [AS_HELP_STRING([--with-fast-mutexes],
769
	    [Compile with fast mutexes  @<:@default=off@:>@])],
770
    [with_fast_mutexes=$withval],
771
    [with_fast_mutexes=no])
1 by brian
clean slate
772
773
if test "$with_fast_mutexes" != "no"
774
then
775
  if test "$with_debug" != "no"
776
  then
777
    AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
778
  else
779
    AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
780
	      [Define to 1 if you want to use fast mutexes])
781
  fi
782
fi
783
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
784
AC_ARG_WITH([comment],
785
    [AS_HELP_STRING([--with-comment],
786
            [Comment about compilation environment. @<:@default=off@:>@])],
1 by brian
clean slate
787
    [with_comment=$withval],
788
    [with_comment=no])
789
if test "$with_comment" != "no"
790
then
791
  COMPILATION_COMMENT=$with_comment
792
else
793
  COMPILATION_COMMENT="Source distribution"
794
fi
795
AC_SUBST(COMPILATION_COMMENT)
796
77.1.96 by Monty Taylor
Removed skip-external-locking.
797
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
798
then
799
  TARGET_LINUX="true"
800
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
801
else
802
  TARGET_LINUX="false"
803
fi
804
1 by brian
clean slate
805
AC_MSG_CHECKING("need of special linking flags")
28.1.33 by Monty Taylor
Added -Wall
806
if test "$TARGET_LINUX" = "true" -a "$ac_cv_c_compiler_gnu" = "yes" -a "$all_is_static" != "yes"
1 by brian
clean slate
807
then
808
  LDFLAGS="$LDFLAGS -rdynamic"
809
  AC_MSG_RESULT("-rdynamic")
810
else
811
  case "$SYSTEM_TYPE$with_mysqld_ldflags " in
812
  *freebsd*"-all-static "*|*dragonfly*"-all-static "*)
813
    AC_MSG_RESULT("none")
814
    ;;
815
  *freebsd*|*dragonfly*)
816
    MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
817
    AC_MSG_RESULT("-export-dynamic")
818
    ;;
819
  *)
820
    AC_MSG_RESULT("none")
821
    ;;
822
  esac
823
fi
824
825
dnl Checks for typedefs, structures, and compiler characteristics.
826
AC_C_CONST
827
AC_C_INLINE
828
AC_TYPE_OFF_T
829
AC_HEADER_TIME
830
AC_STRUCT_TM
831
MYSQL_NEEDS_MYSYS_NEW
832
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
833
# type. We want a error instead.
834
AC_CHECK_SIZEOF(char, 1)
835
if test "$ac_cv_sizeof_char" -eq 0
836
then
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
837
  AC_MSG_ERROR([No size for char type.])
1 by brian
clean slate
838
fi
839
AC_CHECK_SIZEOF(char*, 4)
840
AC_CHECK_SIZEOF(short, 2)
841
AC_CHECK_SIZEOF(int, 4)
842
if test "$ac_cv_sizeof_int" -eq 0
843
then
844
  AC_MSG_ERROR("No size for int type.")
845
fi
846
AC_CHECK_SIZEOF(long, 4)
847
if test "$ac_cv_sizeof_long" -eq 0
848
then
849
  AC_MSG_ERROR("No size for long type.")
850
fi
851
AC_CHECK_SIZEOF(long long, 8)
852
if test "$ac_cv_sizeof_long_long" -eq 0
853
then
91 by Brian Aker
Main binary now named drizzled
854
  AC_MSG_ERROR("Drizzle needs a long long type.")
1 by brian
clean slate
855
fi
856
# off_t is not a builtin type
857
AC_CHECK_SIZEOF(off_t, 4)
858
if test "$ac_cv_sizeof_off_t" -eq 0
859
then
91 by Brian Aker
Main binary now named drizzled
860
  AC_MSG_ERROR("Drizzle needs a off_t type.")
1 by brian
clean slate
861
fi
862
863
dnl
864
dnl check if time_t is unsigned
865
dnl
866
867
MYSQL_CHECK_TIME_T
868
869
870
# do we need #pragma interface/#pragma implementation ?
871
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
872
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
873
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
874
# follow any standard), we'll use well-defined preprocessor macros:
28.1.33 by Monty Taylor
Added -Wall
875
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1 by brian
clean slate
876
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
877
#error USE_PRAGMA_IMPLEMENTATION
878
#endif
28.1.33 by Monty Taylor
Added -Wall
879
]])],[AC_MSG_RESULT(no) ],[AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION"])
1 by brian
clean slate
880
881
# This always gives a warning. Ignore it unless you are cross compiling
882
AC_C_BIGENDIAN
883
#---START: Used in for client configure
884
# Check base type of last arg to accept
885
MYSQL_TYPE_ACCEPT
886
#---END:
887
# Figure out what type of struct rlimit to use with setrlimit
888
MYSQL_TYPE_STRUCT_RLIMIT
889
# Find where the stack goes
890
MYSQL_STACK_DIRECTION
891
# We want to skip alloca on irix unconditionally. It may work on some version..
892
MYSQL_FUNC_ALLOCA
893
# Do struct timespec have members tv_sec or ts_sec
894
MYSQL_TIMESPEC_TS
895
# Do we have the tzname variable
896
MYSQL_TZNAME
897
# Do the c++ compiler have a bool type
898
MYSQL_CXX_BOOL
899
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
900
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
901
AC_CHECK_TYPES([u_int32_t])
902
903
MYSQL_PTHREAD_YIELD
904
905
######################################################################
906
# For readline/libedit (We simply move the mimimum amount of stuff from
907
# the readline/libedit configure.in here)
908
909
dnl Checks for header files.
910
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
911
912
dnl Checks for library functions.
913
AC_FUNC_ALLOCA
914
AC_PROG_GCC_TRADITIONAL
915
AC_TYPE_SIGNAL
916
AC_CHECK_FUNCS(re_comp regcomp strdup)
917
918
dnl Sun compilers have their own vis.h that is about something
919
dnl totally different. So, not to change the libedit source, we
920
dnl do some additional checks before we define HAVE_VIS_H.
921
AC_CHECK_HEADER(vis.h,
922
  [AC_CHECK_FUNC(strvis,
923
    [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
924
925
AC_CHECK_FUNCS(strlcat strlcpy)
926
AC_CHECK_FUNCS(issetugid)
927
AC_CHECK_FUNCS(getline flockfile)
928
929
# from old readline settting:
930
931
MAKE_SHELL=/bin/sh
932
AC_SUBST(MAKE_SHELL)
933
934
# Already-done: stdlib.h string.h unistd.h termios.h
935
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
936
 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
937
 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
938
paths.h semaphore.h)
939
940
# Already-done: strcasecmp
941
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
942
28.1.33 by Monty Taylor
Added -Wall
943
AC_HEADER_STAT
1 by brian
clean slate
944
MYSQL_SIGNAL_CHECK
945
MYSQL_CHECK_GETPW_FUNCS
946
MYSQL_HAVE_TIOCGWINSZ
947
MYSQL_HAVE_FIONREAD
948
MYSQL_HAVE_TIOCSTAT
949
MYSQL_STRUCT_DIRENT_D_INO
950
MYSQL_STRUCT_DIRENT_D_NAMLEN
951
MYSQL_TYPE_SIGHANDLER
952
MYSQL_CHECK_MULTIBYTE
953
if test "$with_named_curses" = "no"
954
then
955
  MYSQL_CHECK_LIB_TERMCAP
956
else
957
  TERMCAP_LIB="$with_named_curses"
958
fi
959
AC_SUBST(TERMCAP_LIB)
960
961
# Check if the termcap function 'tgoto' is already declared in
962
# system header files or if it need to be declared locally
963
AC_CHECK_DECLS(tgoto,,,[
964
#ifdef HAVE_CURSES_H
965
# include <curses.h>
966
#elif HAVE_NCURSES_H
967
# include <ncurses.h>
968
#endif
969
#ifdef HAVE_TERM_H
970
# include <term.h>
971
#endif
972
])
973
974
# End of readline/libedit stuff
975
#########################################################################
976
977
dnl Checks for library functions.
978
979
#
980
# The following code disables intrinsic function support while we test for
981
# library functions.  This is to avoid configure problems with Intel ecc
982
# compiler
983
984
ORG_CFLAGS="$CFLAGS"
985
if test "$GCC" != "yes"; then
986
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
987
fi
988
989
#AC_FUNC_MMAP
990
AC_TYPE_SIGNAL
991
MYSQL_TYPE_QSORT
992
AC_FUNC_UTIME_NULL
993
AC_FUNC_VPRINTF
994
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
995
AC_CHECK_FUNCS(fcntl)
996
if test "x$ac_cv_func_fcntl" != "xyes"
997
then
998
  AC_MSG_ERROR("Drizzle requires fcntl.")
999
fi
1000
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.
1001
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.
1002
  cuserid fchmod \
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
1003
  fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
1 by brian
clean slate
1004
  getcwd getpass getpassphrase getpwnam \
1005
  getpwuid getrlimit getrusage getwd index initgroups isnan \
1006
  localtime_r gethrtime gmtime_r \
1007
  locking longjmp lrand48 madvise mallinfo memcpy memmove \
1008
  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
1009
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
1010
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
1011
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
1012
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
1013
  realpath rename rint rwlock_init setupterm \
1014
  shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
1015
  sighold sigset sigthreadmask port_create sleep \
1016
  snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
6 by Brian Aker
Second pass on pthread cleanup
1017
  strtol strtoll strtoul strtoull tell tempnam vidattr \
1 by brian
clean slate
1018
  posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
1019
28.1.33 by Monty Taylor
Added -Wall
1020
# Check that isinf() is available in math.h and can be used in both C and C++
1 by brian
clean slate
1021
# code
28.1.33 by Monty Taylor
Added -Wall
1022
AC_MSG_CHECKING(for isinf in math.h)
1023
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1024
    float f = 0.0; 
1025
    int r = isinf(f); 
1026
    return r;
1027
  ]])],[
1 by brian
clean slate
1028
    AC_MSG_RESULT(yes)
28.1.33 by Monty Taylor
Added -Wall
1029
    AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1030
    AC_LANG_PUSH([C++])
1031
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1032
      float f = 0.0;
1033
      int r = isinf(f);
1034
      return r;
1035
    ]])],[
1036
      AC_MSG_RESULT(yes)
1037
      AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function])
1038
    ],[
1039
      AC_MSG_RESULT(no)
1040
    ])
1041
    AC_LANG_POP([])
1042
  ],[
1043
  AC_MSG_RESULT(no)])
1044
1045
1 by brian
clean slate
1046
CFLAGS="$ORG_CFLAGS"
1047
1048
# Sanity check: We chould not have any fseeko symbol unless
1049
# large_file_support=yes
1050
AC_CHECK_FUNC(fseeko,
1051
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
1052
then
1053
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
1054
fi]
1055
)
1056
1057
# Check definition of pthread_getspecific
1058
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
28.1.33 by Monty Taylor
Added -Wall
1059
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(_REENTRANT)
1 by brian
clean slate
1060
#define _REENTRANT
1061
#endif
1062
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1063
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
1064
pthread_getspecific((pthread_key_t) NULL); ]])],[mysql_cv_getspecific_args=POSIX],[mysql_cv_getspecific_args=other]))
1 by brian
clean slate
1065
  if test "$mysql_cv_getspecific_args" = "other"
1066
  then
1067
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1068
              [For some non posix threads])
1069
  fi
1070
1071
  # Check definition of pthread_mutex_init
1072
  AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
28.1.33 by Monty Taylor
Added -Wall
1073
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1074
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1075
#include <pthread.h> ]], [[ 
1 by brian
clean slate
1076
  pthread_mutexattr_t attr;
1077
  pthread_mutex_t mp;
28.1.33 by Monty Taylor
Added -Wall
1078
  pthread_mutex_init(&mp,&attr); ]])],[mysql_cv_mutex_init_args=POSIX],[mysql_cv_mutex_init_args=other]))
1 by brian
clean slate
1079
  if test "$mysql_cv_mutex_init_args" = "other"
1080
  then
1081
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1082
              [For some non posix threads])
1083
  fi
1084
#---END:
1085
1086
#---START: Used in for client configure
1087
# Check definition of readdir_r
1088
AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
28.1.33 by Monty Taylor
Added -Wall
1089
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1090
#define _POSIX_PTHREAD_SEMANTICS 
1091
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1092
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1093
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
1094
if test "$mysql_cv_readdir_r" = "POSIX"
1095
then
1096
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1097
fi
1098
1099
# Check definition of posix sigwait()
1100
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
28.1.33 by Monty Taylor
Added -Wall
1101
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1102
#define _POSIX_PTHREAD_SEMANTICS 
1103
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1104
#include <signal.h>]], [[#ifndef _AIX
1 by brian
clean slate
1105
sigset_t set;
1106
int sig;
1107
sigwait(&set,&sig);
28.1.33 by Monty Taylor
Added -Wall
1108
#endif]])],[mysql_cv_sigwait=POSIX],[mysql_cv_sigwait=other]))
1 by brian
clean slate
1109
if test "$mysql_cv_sigwait" = "POSIX"
1110
then
1111
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1112
fi
1113
1114
if test "$mysql_cv_sigwait" != "POSIX"
1115
then
1116
unset mysql_cv_sigwait
1117
# Check definition of posix sigwait()
1118
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
28.1.33 by Monty Taylor
Added -Wall
1119
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1120
#define _POSIX_PTHREAD_SEMANTICS 
1121
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1122
#include <signal.h>]], [[sigset_t set;
1 by brian
clean slate
1123
int sig;
28.1.33 by Monty Taylor
Added -Wall
1124
sigwait(&set);]])],[mysql_cv_sigwait=NONPOSIX],[mysql_cv_sigwait=other]))
1 by brian
clean slate
1125
if test "$mysql_cv_sigwait" = "NONPOSIX"
1126
then
1127
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1128
fi
1129
fi
1130
#---END:
1131
1132
# Check if pthread_attr_setscope() exists
1133
AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
28.1.33 by Monty Taylor
Added -Wall
1134
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1135
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1136
#include <pthread.h>]], [[pthread_attr_t thr_attr;
1137
pthread_attr_setscope(&thr_attr,0);]])],[mysql_cv_pthread_attr_setscope=yes],[mysql_cv_pthread_attr_setscope=no]))
1 by brian
clean slate
1138
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1139
then
1140
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1141
fi
1142
1143
# Check for bad includes
1144
AC_MSG_CHECKING("can netinet files be included")
28.1.33 by Monty Taylor
Added -Wall
1145
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1 by brian
clean slate
1146
#include <sys/socket.h>
1147
#include <netinet/in_systm.h>
1148
#include <netinet/in.h>
1149
#include <netinet/ip.h>
28.1.33 by Monty Taylor
Added -Wall
1150
#include <netinet/tcp.h>]], [[ printf("1\n"); ]])],[netinet_inc=yes],[netinet_inc=no])
1 by brian
clean slate
1151
if test "$netinet_inc" = "no"
1152
then
1153
  AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1154
fi
1155
AC_MSG_RESULT("$netinet_inc")
1156
28.1.33 by Monty Taylor
Added -Wall
1157
AC_LANG_PUSH([C++])
1 by brian
clean slate
1158
AC_CHECK_HEADERS(cxxabi.h)
1159
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
28.1.33 by Monty Taylor
Added -Wall
1160
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1 by brian
clean slate
1161
  char *foo= 0; int bar= 0;
1162
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
28.1.33 by Monty Taylor
Added -Wall
1163
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1164
AC_LANG_POP([])
1 by brian
clean slate
1165
1166
if test "x$mysql_cv_cxa_demangle" = xyes; then
1167
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1168
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1169
fi
1170
1171
#--------------------------------------------------------------------
1172
# Check for requested features
1173
#--------------------------------------------------------------------
1174
1175
MYSQL_CHECK_BIG_TABLES
1176
MYSQL_CHECK_MAX_INDEXES
1177
MYSQL_CHECK_VIO
1178
1179
#--------------------------------------------------------------------
1180
# Declare our plugin modules
1181
# Has to be done late, as the plugin may need to check for existence of
1182
# functions tested above
1183
#--------------------------------------------------------------------
1184
1185
MYSQL_CONFIGURE_PLUGINS([none])
1186
1187
AC_SUBST(mysql_plugin_dirs)
1188
AC_SUBST(mysql_plugin_libs)
1189
AC_SUBST(mysql_plugin_defs)
1190
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1191
AC_ARG_ENABLE([pedantic-warnings],
1192
    [AS_HELP_STRING([--disable-pedantic-warnings],
1193
       [Toggle pedanticness @<:@default=on@:>@])],
1194
    [ac_warn_pedantic="$enableval"],
1195
    [ac_warn_pedantic="yes"])
1196
1197
AC_ARG_ENABLE([fail],
153 by Brian Aker
Merging Monty's code, I did remove error on compile though (since it does
1198
    [AS_HELP_STRING([--enable-fail],
1199
       [Turn warnings into failures @<:@default=off@:>@])],
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1200
    [ac_warn_fail="$enableval"],
77.1.108 by Monty Taylor
Turn on -Werror again by default.
1201
    [ac_warn_fail="yes"])
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1202
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1203
AC_ARG_ENABLE([unreachable],
1204
    [AS_HELP_STRING([--enable-unreachable],
1205
       [Enable warnings about unreachable code @<:@default=off@:>@])],
1206
    [ac_warn_unreachable="$enableval"],
1207
    [ac_warn_unreachable="no"])
1208
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1209
AC_ARG_ENABLE([longlong-warnings],
1210
    [AS_HELP_STRING([--enable-longlong-warnings],
1211
       [Enable warnings about longlong in C++ @<:@default=off@:>@])],
1212
    [ac_warn_longlong="$enableval"],
1213
    [ac_warn_longlong="no"])
1214
1215
AC_ARG_ENABLE([strict-aliasing],
1216
    [AS_HELP_STRING([--enable-strict-aliasing],
1217
       [Enable warnings about stict-aliasing @<:@default=off@:>@])],
1218
    [ac_warn_strict_aliasing="$enableval"],
1219
    [ac_warn_strict_aliasing="no"])
1220
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1221
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1222
if test "$GCC" = "yes"
1223
then
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1224
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1225
  if test "$ac_warn_longlong" = "yes"
1226
  then
1227
    W_LONGLONG="-Wlong-long"
1228
  else
1229
    W_LONGLONG="-Wno-long-long"
1230
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
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_strict_aliasing" = "yes"
1233
  then
1234
    W_STRICT_ALIASING="-Wstrict-aliasing"
1235
  else
77.1.110 by Monty Taylor
Fixed a typo.
1236
    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.
1237
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1238
1239
  if test "$ac_warn_pedantic" = "yes"
1240
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1241
    GCC_PEDANTIC="-pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls ${W_STRICT_ALIASING}"
1242
    GXX_PEDANTIC="-pedantic -Wundef -Wredundant-decls ${W_LONGLONG} ${W_STRICT_ALIASING}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1243
  fi
1244
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1245
  if test "$ac_warn_unreachable" = "yes"
1246
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1247
    W_UNREACHABLE="-Wunreachable-code"
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1248
  fi
1249
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1250
  if test "$ac_warn_fail" = "yes"
1251
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1252
    W_FAIL="-Werror"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1253
  fi
1254
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1255
  BASE_WARNINGS="-W -Wall -Wextra"
1256
  GCC_WARNINGS="${BASE_WARNINGS} -std=gnu99 ${GCC_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL}"
1257
  GXX_WARNINGS="${BASE_WARNINGS} -std=gnu++98 ${GXX_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL}"
1258
1259
  CXXFLAGS="$CXXFLAGS ${GXX_WARNINGS}"
1260
  CFLAGS="$CFLAGS ${GCC_WARNINGS} "
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1261
fi
1262
1 by brian
clean slate
1263
# Some usefull subst
1264
AC_SUBST(CC)
1265
AC_SUBST(GXX)
1266
1267
# Set configuration options for make_binary_distribution
1268
case $SYSTEM_TYPE in
1269
  *netware*)
1270
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1271
    ;;
1272
  *)
1273
    : # no change for other platforms yet
1274
    ;;
1275
esac
1276
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1277
28.1.2 by Monty Taylor
First stab at back porting libtool convenience lib patch from telco-6.2
1278
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.
1279
 strings/Makefile strings/tests/Makefile storage/Makefile dnl
13 by brian
Incomming patch to clean up build.
1280
 vio/Makefile dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1281
 libdrizzle/Makefile client/Makefile dnl
54.1.3 by Stewart Smith
sql => server (initial patch)
1282
 server/Makefile server/share/Makefile dnl
77.1.52 by Monty Taylor
And reference to it in the configure script.
1283
 server/sql_builtin.cc dnl
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
1284
 dbug/Makefile include/Makefile dnl
28.1.31 by Monty Taylor
Deleted tons of pointless garbage from scripts.
1285
 support-files/Makefile dnl
77.1.47 by Monty Taylor
Moved test to tests...
1286
 tests/Makefile tests/install_test_db dnl
77.1.39 by Monty Taylor
More mysql->drizzle renaming.
1287
 include/drizzle_version.h plugin/Makefile dnl
54.1.6 by Stewart Smith
merge mainline
1288
 server/drizzled_safe support-files/libdrizzle.pc dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1289
 support-files/drizzle.server support-files/drizzle-log-rotate)
1 by brian
clean slate
1290
1291
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1292
1293
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
1294
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
1295
1296
AC_OUTPUT