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