~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
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
633
then
634
  AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
635
fi
636
637
# We make a special variable for non-threaded version of LIBS to avoid
638
# including thread libs into non-threaded version of MySQL client library.
639
# Later in this script LIBS will be augmented with a threads library.
640
NON_THREADED_LIBS="$LIBS"
641
642
AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
643
                uchar, uint, ulong],[],[], [
644
#include <sys/types.h>
645
])
646
AC_CHECK_TYPES([fp_except], [], [], [
647
#include <sys/types.h>
648
#include <ieeefp.h>
649
])
650
25 by Brian Aker
Clean up of configure.in
651
652
my_save_LIBS="$LIBS"
653
LIBS=""
654
AC_CHECK_LIB(dl,dlopen)
655
LIBDL=$LIBS
656
LIBS="$my_save_LIBS"
657
AC_SUBST(LIBDL)
658
659
my_save_LIBS="$LIBS"
660
LIBS="$LIBS $LIBDL"
661
AC_CHECK_FUNCS(dlopen dlerror)
662
LIBS="$my_save_LIBS"
663
664
AC_CHECK_FUNCS(strtok_r)
1 by brian
clean slate
665
666
667
# System characteristics
668
case $SYSTEM_TYPE in
669
  *)
670
AC_SYS_RESTARTABLE_SYSCALLS
671
    ;;
672
esac
673
674
# Build optimized or debug version ?
675
# First check for gcc and g++
676
if test "$ac_cv_prog_gcc" = "yes"
677
then
678
  DEBUG_CFLAGS="-g"
679
  DEBUG_OPTIMIZE_CC="-O"
680
  OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
681
else
682
  DEBUG_CFLAGS="-g"
683
  DEBUG_OPTIMIZE_CC=""
684
  OPTIMIZE_CFLAGS="-O"
685
fi
686
if test "$ac_cv_prog_cxx_g" = "yes"
687
then
688
  DEBUG_CXXFLAGS="-g"
689
  DEBUG_OPTIMIZE_CXX="-O"
690
  OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
691
else
692
  DEBUG_CXXFLAGS="-g"
693
  DEBUG_OPTIMIZE_CXX=""
694
  OPTIMIZE_CXXFLAGS="-O"
695
fi
696
697
# If the user specified CFLAGS, we won't add any optimizations
698
if test -n "$SAVE_CFLAGS"
699
then
700
  OPTIMIZE_CFLAGS=""
701
  DEBUG_OPTIMIZE_CC=""
702
fi
703
# Ditto for CXXFLAGS
704
if test -n "$SAVE_CXXFLAGS"
705
then
706
  OPTIMIZE_CXXFLAGS=""
707
  DEBUG_OPTIMIZE_CXX=""
708
fi
709
710
AC_ARG_WITH(debug,
711
    [  --with-debug            Add debug code
712
  --with-debug=full       Add debug code (adds memory checker, very slow)],
713
    [with_debug=$withval],
714
    [with_debug=no])
715
if test "$with_debug" = "yes"
716
then
717
  # Medium debug.
718
  AC_DEFINE([DBUG_ON], [1], [Use libdbug])
7 by Brian Aker
Further cleanup on pthreads.
719
  CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC $CFLAGS"
720
  CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX $CXXFLAGS"
1 by brian
clean slate
721
elif test "$with_debug" = "full"
722
then
723
  # Full debug. Very slow in some cases
724
  AC_DEFINE([DBUG_ON], [1], [Use libdbug])
7 by Brian Aker
Further cleanup on pthreads.
725
  CFLAGS="$DEBUG_CFLAGS $CFLAGS"
726
  CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS"
1 by brian
clean slate
727
else
728
  # Optimized version. No debug
729
  AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
730
  CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
731
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
732
fi
733
734
# If we should allow error injection tests
735
AC_ARG_WITH(error-inject,
736
    AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
737
    [ with_error_inject=$withval ],
738
    [ with_error_inject=no ])
739
740
if test $with_debug != "no"
741
then
742
  if test "$with_error_inject" = "yes"
743
  then
744
    AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
745
              [Enable error injection in MySQL Server])
746
  fi
747
fi
748
749
AC_ARG_WITH([fast-mutexes],
750
	    AC_HELP_STRING([--with-fast-mutexes], 
751
	    [Compile with fast mutexes (default is disabled)]),
752
	    [with_fast_mutexes=$withval], [with_fast_mutexes=no])
753
754
if test "$with_fast_mutexes" != "no"
755
then
756
  if test "$with_debug" != "no"
757
  then
758
    AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
759
  else
760
    AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
761
	      [Define to 1 if you want to use fast mutexes])
762
  fi
763
fi
764
765
AC_ARG_WITH(comment,
766
    [  --with-comment          Comment about compilation environment.],
767
    [with_comment=$withval],
768
    [with_comment=no])
769
if test "$with_comment" != "no"
770
then
771
  COMPILATION_COMMENT=$with_comment
772
else
773
  COMPILATION_COMMENT="Source distribution"
774
fi
775
AC_SUBST(COMPILATION_COMMENT)
776
777
AC_MSG_CHECKING("need of special linking flags")
778
if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
779
then
780
  LDFLAGS="$LDFLAGS -rdynamic"
781
  AC_MSG_RESULT("-rdynamic")
782
else
783
  case "$SYSTEM_TYPE$with_mysqld_ldflags " in
784
  *freebsd*"-all-static "*|*dragonfly*"-all-static "*)
785
    AC_MSG_RESULT("none")
786
    ;;
787
  *freebsd*|*dragonfly*)
788
    MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
789
    AC_MSG_RESULT("-export-dynamic")
790
    ;;
791
  *)
792
    AC_MSG_RESULT("none")
793
    ;;
794
  esac
795
fi
796
797
dnl Checks for typedefs, structures, and compiler characteristics.
798
AC_C_CONST
799
AC_C_INLINE
800
AC_TYPE_OFF_T
801
AC_STRUCT_ST_RDEV
802
AC_HEADER_TIME
803
AC_STRUCT_TM
804
MYSQL_NEEDS_MYSYS_NEW
805
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
806
# type. We want a error instead.
807
AC_CHECK_SIZEOF(char, 1)
808
if test "$ac_cv_sizeof_char" -eq 0
809
then
810
  AC_MSG_ERROR([No size for char type.
811
A likely cause for this could be that there isn't any
812
static libraries installed. You can verify this by checking if you have libm.a
813
in /lib, /usr/lib or some other standard place.  If this is the problem,
814
install the static libraries and try again.  If this isn't the problem,
815
examine config.log for possible errors.  If you want to report this, use
816
'scripts/mysqlbug' and include at least the last 20 rows from config.log!])
817
fi
818
AC_CHECK_SIZEOF(char*, 4)
819
AC_CHECK_SIZEOF(short, 2)
820
AC_CHECK_SIZEOF(int, 4)
821
if test "$ac_cv_sizeof_int" -eq 0
822
then
823
  AC_MSG_ERROR("No size for int type.")
824
fi
825
AC_CHECK_SIZEOF(long, 4)
826
if test "$ac_cv_sizeof_long" -eq 0
827
then
828
  AC_MSG_ERROR("No size for long type.")
829
fi
830
AC_CHECK_SIZEOF(long long, 8)
831
if test "$ac_cv_sizeof_long_long" -eq 0
832
then
833
  AC_MSG_ERROR("MySQL needs a long long type.")
834
fi
835
# off_t is not a builtin type
836
AC_CHECK_SIZEOF(off_t, 4)
837
if test "$ac_cv_sizeof_off_t" -eq 0
838
then
839
  AC_MSG_ERROR("MySQL needs a off_t type.")
840
fi
841
842
dnl
843
dnl check if time_t is unsigned
844
dnl
845
846
MYSQL_CHECK_TIME_T
847
848
849
# do we need #pragma interface/#pragma implementation ?
850
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
851
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
852
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
853
# follow any standard), we'll use well-defined preprocessor macros:
854
AC_TRY_CPP([
855
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
856
#error USE_PRAGMA_IMPLEMENTATION
857
#endif
858
],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
859
860
# This always gives a warning. Ignore it unless you are cross compiling
861
AC_C_BIGENDIAN
862
#---START: Used in for client configure
863
# Check base type of last arg to accept
864
MYSQL_TYPE_ACCEPT
865
#---END:
866
# Figure out what type of struct rlimit to use with setrlimit
867
MYSQL_TYPE_STRUCT_RLIMIT
868
# Find where the stack goes
869
MYSQL_STACK_DIRECTION
870
# We want to skip alloca on irix unconditionally. It may work on some version..
871
MYSQL_FUNC_ALLOCA
872
# Do struct timespec have members tv_sec or ts_sec
873
MYSQL_TIMESPEC_TS
874
# Do we have the tzname variable
875
MYSQL_TZNAME
876
# Do the c++ compiler have a bool type
877
MYSQL_CXX_BOOL
878
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
879
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
880
AC_CHECK_TYPES([u_int32_t])
881
882
MYSQL_PTHREAD_YIELD
883
884
######################################################################
885
# For readline/libedit (We simply move the mimimum amount of stuff from
886
# the readline/libedit configure.in here)
887
888
dnl Checks for header files.
889
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
890
891
dnl Checks for library functions.
892
AC_FUNC_ALLOCA
893
AC_PROG_GCC_TRADITIONAL
894
AC_TYPE_SIGNAL
895
AC_CHECK_FUNCS(re_comp regcomp strdup)
896
897
dnl Sun compilers have their own vis.h that is about something
898
dnl totally different. So, not to change the libedit source, we
899
dnl do some additional checks before we define HAVE_VIS_H.
900
AC_CHECK_HEADER(vis.h,
901
  [AC_CHECK_FUNC(strvis,
902
    [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
903
904
AC_CHECK_FUNCS(strlcat strlcpy)
905
AC_CHECK_FUNCS(issetugid)
906
AC_CHECK_FUNCS(fgetln)
907
AC_CHECK_FUNCS(getline flockfile)
908
909
# from old readline settting:
910
911
MAKE_SHELL=/bin/sh
912
AC_SUBST(MAKE_SHELL)
913
914
# Already-done: stdlib.h string.h unistd.h termios.h
915
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
916
 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
917
 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
918
paths.h semaphore.h)
919
920
# Already-done: strcasecmp
921
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
922
923
AC_STAT_MACROS_BROKEN
924
MYSQL_SIGNAL_CHECK
925
MYSQL_CHECK_GETPW_FUNCS
926
MYSQL_HAVE_TIOCGWINSZ
927
MYSQL_HAVE_FIONREAD
928
MYSQL_HAVE_TIOCSTAT
929
MYSQL_STRUCT_DIRENT_D_INO
930
MYSQL_STRUCT_DIRENT_D_NAMLEN
931
MYSQL_TYPE_SIGHANDLER
932
MYSQL_CHECK_MULTIBYTE
933
if test "$with_named_curses" = "no"
934
then
935
  MYSQL_CHECK_LIB_TERMCAP
936
else
937
  TERMCAP_LIB="$with_named_curses"
938
fi
939
AC_SUBST(TERMCAP_LIB)
940
941
# Check if the termcap function 'tgoto' is already declared in
942
# system header files or if it need to be declared locally
943
AC_CHECK_DECLS(tgoto,,,[
944
#ifdef HAVE_CURSES_H
945
# include <curses.h>
946
#elif HAVE_NCURSES_H
947
# include <ncurses.h>
948
#endif
949
#ifdef HAVE_TERM_H
950
# include <term.h>
951
#endif
952
])
953
954
LIBEDIT_LOBJECTS=""
955
AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
956
AC_CHECK_FUNC(strvis,   ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
957
AC_CHECK_FUNC(strlcpy,  ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcpy.o"])
958
AC_CHECK_FUNC(strlcat,  ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcat.o"])
959
AC_CHECK_FUNC(fgetln,   ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS fgetln.o"])
960
AC_SUBST(LIBEDIT_LOBJECTS)
961
enable_readline="yes"
962
963
# End of readline/libedit stuff
964
#########################################################################
965
966
dnl Checks for library functions.
967
968
#
969
# The following code disables intrinsic function support while we test for
970
# library functions.  This is to avoid configure problems with Intel ecc
971
# compiler
972
973
ORG_CFLAGS="$CFLAGS"
974
if test "$GCC" != "yes"; then
975
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
976
fi
977
978
#AC_FUNC_MMAP
979
AC_TYPE_SIGNAL
980
MYSQL_TYPE_QSORT
981
AC_FUNC_UTIME_NULL
982
AC_FUNC_VPRINTF
983
984
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
985
  chsize cuserid fchmod fcntl \
986
  fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
987
  getcwd getpass getpassphrase getpwnam \
988
  getpwuid getrlimit getrusage getwd index initgroups isnan \
989
  localtime_r gethrtime gmtime_r \
990
  locking longjmp lrand48 madvise mallinfo memcpy memmove \
991
  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
992
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
993
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
994
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
995
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
996
  realpath rename rint rwlock_init setupterm \
997
  shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
998
  sighold sigset sigthreadmask port_create sleep \
999
  snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
6 by Brian Aker
Second pass on pthread cleanup
1000
  strtol strtoll strtoul strtoull tell tempnam vidattr \
1 by brian
clean slate
1001
  posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
1002
1003
# Check that isinf() is available in math.h and can be used in both C and C++ 
1004
# code
1005
AC_MSG_CHECKING(for isinf in <math.h>)
1006
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
1007
  AC_MSG_RESULT(yes)
1008
  AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1009
  AC_LANG_SAVE
1010
  AC_LANG_CPLUSPLUS
1011
  AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
1012
    AC_MSG_RESULT(yes)
1013
    AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
1014
    AC_MSG_RESULT(no))
1015
  AC_LANG_RESTORE,
1016
  AC_MSG_RESULT(no))
1017
 
1018
CFLAGS="$ORG_CFLAGS"
1019
1020
# Sanity check: We chould not have any fseeko symbol unless
1021
# large_file_support=yes
1022
AC_CHECK_FUNC(fseeko,
1023
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
1024
then
1025
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
1026
fi]
1027
)
1028
1029
# Check definition of pthread_getspecific
1030
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
1031
AC_TRY_COMPILE(
1032
[#if !defined(_REENTRANT)
1033
#define _REENTRANT
1034
#endif
1035
#define _POSIX_PTHREAD_SEMANTICS 
1036
#include <pthread.h> ],
1037
[ void *pthread_getspecific(pthread_key_t key);
1038
pthread_getspecific((pthread_key_t) NULL); ],
1039
mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
1040
  if test "$mysql_cv_getspecific_args" = "other"
1041
  then
1042
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1043
              [For some non posix threads])
1044
  fi
1045
1046
  # Check definition of pthread_mutex_init
1047
  AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
1048
  AC_TRY_COMPILE(
1049
[#define _REENTRANT
1050
#define _POSIX_PTHREAD_SEMANTICS 
1051
#include <pthread.h> ],
1052
[ 
1053
  pthread_mutexattr_t attr;
1054
  pthread_mutex_t mp;
1055
  pthread_mutex_init(&mp,&attr); ],
1056
mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
1057
  if test "$mysql_cv_mutex_init_args" = "other"
1058
  then
1059
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1060
              [For some non posix threads])
1061
  fi
1062
#---END:
1063
1064
#---START: Used in for client configure
1065
# Check definition of readdir_r
1066
AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
1067
AC_TRY_LINK(
1068
[#define _REENTRANT
1069
#define _POSIX_PTHREAD_SEMANTICS 
1070
#include <pthread.h>
1071
#include <dirent.h>],
1072
[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1073
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
1074
mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
1075
if test "$mysql_cv_readdir_r" = "POSIX"
1076
then
1077
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1078
fi
1079
1080
# Check definition of posix sigwait()
1081
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
1082
AC_TRY_LINK(
1083
[#define _REENTRANT
1084
#define _POSIX_PTHREAD_SEMANTICS 
1085
#include <pthread.h>
1086
#include <signal.h>],
1087
[#ifndef _AIX
1088
sigset_t set;
1089
int sig;
1090
sigwait(&set,&sig);
1091
#endif],
1092
mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
1093
if test "$mysql_cv_sigwait" = "POSIX"
1094
then
1095
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1096
fi
1097
1098
if test "$mysql_cv_sigwait" != "POSIX"
1099
then
1100
unset mysql_cv_sigwait
1101
# Check definition of posix sigwait()
1102
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
1103
AC_TRY_LINK(
1104
[#define _REENTRANT
1105
#define _POSIX_PTHREAD_SEMANTICS 
1106
#include <pthread.h>
1107
#include <signal.h>],
1108
[sigset_t set;
1109
int sig;
1110
sigwait(&set);],
1111
mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
1112
if test "$mysql_cv_sigwait" = "NONPOSIX"
1113
then
1114
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1115
fi
1116
fi
1117
#---END:
1118
1119
# Check if pthread_attr_setscope() exists
1120
AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
1121
AC_TRY_LINK(
1122
[#define _REENTRANT
1123
#define _POSIX_PTHREAD_SEMANTICS 
1124
#include <pthread.h>],
1125
[pthread_attr_t thr_attr;
1126
pthread_attr_setscope(&thr_attr,0);],
1127
mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
1128
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1129
then
1130
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1131
fi
1132
1133
# Check for bad includes
1134
AC_MSG_CHECKING("can netinet files be included")
1135
AC_TRY_COMPILE(
1136
[#include <sys/types.h>
1137
#include <sys/socket.h>
1138
#include <netinet/in_systm.h>
1139
#include <netinet/in.h>
1140
#include <netinet/ip.h>
1141
#include <netinet/tcp.h>],
1142
[ printf("1\n"); ],
1143
netinet_inc=yes, netinet_inc=no)
1144
if test "$netinet_inc" = "no"
1145
then
1146
  AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1147
fi
1148
AC_MSG_RESULT("$netinet_inc")
1149
1150
AC_LANG_SAVE
1151
AC_LANG_CPLUSPLUS
1152
AC_CHECK_HEADERS(cxxabi.h)
1153
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
1154
[AC_TRY_LINK([#include <cxxabi.h>], [
1155
  char *foo= 0; int bar= 0;
1156
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
1157
], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])])
1158
AC_LANG_RESTORE
1159
1160
if test "x$mysql_cv_cxa_demangle" = xyes; then
1161
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1162
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1163
fi
1164
1165
#--------------------------------------------------------------------
1166
# Check for requested features
1167
#--------------------------------------------------------------------
1168
1169
MYSQL_CHECK_BIG_TABLES
1170
MYSQL_CHECK_MAX_INDEXES
1171
MYSQL_CHECK_VIO
1172
1173
#--------------------------------------------------------------------
1174
# Declare our plugin modules
1175
# Has to be done late, as the plugin may need to check for existence of
1176
# functions tested above
1177
#--------------------------------------------------------------------
1178
1179
MYSQL_CONFIGURE_PLUGINS([none])
1180
1181
# Only build client code?
1182
AC_ARG_WITH(server,
1183
    [  --without-server        Only build the client.],
1184
    [with_server=$withval],
1185
    [with_server=yes]
1186
)
1187
1188
#MYSQL_CHECK_CPU
1189
1190
# If we have threads generate some library functions and test programs
1191
sql_server_dirs=
1192
sql_server=
1193
server_scripts=
1194
1195
dnl This probably should be cleaned up more - for now the threaded
1196
dnl client is just using plain-old libs.
1197
sql_client_dirs="strings regex mysys libmysql"
1198
1199
sql_client_dirs="$sql_client_dirs client"
1200
1201
CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
1202
1203
AC_SUBST(CLIENT_LIBS)
1204
AC_SUBST(CLIENT_THREAD_LIBS)
1205
AC_SUBST(NON_THREADED_LIBS)
1206
AC_SUBST(STATIC_NSS_FLAGS)
1207
AC_SUBST(sql_client_dirs)
1208
12.4.3 by Stewart Smith
remove non-thread safe client library. client lib is now *always* thread safe.
1209
if test "$with_server" = "yes"
1 by brian
clean slate
1210
then
1211
  AC_DEFINE([THREAD], [1],
1212
            [Define if you want to have threaded code. This may be undef on client code])
1213
  # Avoid _PROGRAMS names
8 by Brian Aker
Pstack removal. Cleanup around final my_pthread.c removal.
1214
  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
1215
  AC_SUBST(THREAD_LOBJECTS)
1216
  server_scripts="mysqld_safe mysql_install_db"
1217
  sql_server_dirs="strings mysys dbug extra regex"
1218
28.1.7 by Monty Taylor
Put errmsg.c in sql-common since it can be built only once and used twice.
1219
  sql_server="sql"
1 by brian
clean slate
1220
fi
1221
1222
# IMPORTANT - do not modify LIBS past this line - this hack is the only way
1223
# I know to add the static NSS magic if we have static NSS libraries with
1224
# glibc - Sasha
1225
1226
LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
1227
LIBS="$LIBS $STATIC_NSS_FLAGS"
1228
1229
AC_SUBST(sql_server_dirs)
1230
AC_SUBST(sql_server)
1231
AC_SUBST(server_scripts)
1232
1233
AC_SUBST(mysql_plugin_dirs)
1234
AC_SUBST(mysql_plugin_libs)
1235
AC_SUBST(mysql_plugin_defs)
1236
1237
1238
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
1239
# Start with the (longer) server list, add each client item not yet present.
1240
sql_union_dirs=" $sql_server_dirs "
1241
for DIR in $sql_client_dirs
1242
do
1243
  if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
1244
  then
1245
    :  # already present, skip
1246
  else
1247
    sql_union_dirs="$sql_union_dirs $DIR "
1248
  fi
1249
done
1250
AC_SUBST(sql_union_dirs)
1251
1252
# Some usefull subst
1253
AC_SUBST(CC)
1254
AC_SUBST(GXX)
1255
1256
# Set configuration options for make_binary_distribution
1257
case $SYSTEM_TYPE in
1258
  *netware*)
1259
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1260
    ;;
1261
  *)
1262
    : # no change for other platforms yet
1263
    ;;
1264
esac
1265
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1266
28.1.2 by Monty Taylor
First stab at back porting libtool convenience lib patch from telco-6.2
1267
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile mysys/tests/Makefile dnl
1 by brian
clean slate
1268
 unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
1269
 unittest/mysys/Makefile unittest/examples/Makefile dnl
28.1.18 by Monty Taylor
Added reference to strings/tests
1270
 strings/Makefile strings/tests/Makefile regex/Makefile storage/Makefile dnl
13 by brian
Incomming patch to clean up build.
1271
 vio/Makefile dnl
12.4.3 by Stewart Smith
remove non-thread safe client library. client lib is now *always* thread safe.
1272
 libmysql/Makefile client/Makefile dnl
1 by brian
clean slate
1273
 sql/Makefile sql/share/Makefile dnl
1274
 sql/sql_builtin.cc sql-common/Makefile dnl
1275
 dbug/Makefile scripts/Makefile include/Makefile dnl
1276
 tests/Makefile support-files/Makefile dnl
1277
 mysql-test/Makefile dnl
1278
 include/mysql_version.h plugin/Makefile)
1279
1280
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1281
1282
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
1283
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
1284
1285
AC_OUTPUT