Develop and Download Open Source Software

Browse Subversion Repository

Contents of /tags/tritonn-1.0.9-mysql-5.0.51/configure.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (show annotations) (download)
Fri Jan 18 03:00:49 2008 UTC (16 years, 2 months ago) by mir
File size: 96406 byte(s)
moved from topdir to tags
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 change ndb version below and update version.c in ndb
10 AM_INIT_AUTOMAKE(mysql, 5.0.51)
11 AM_CONFIG_HEADER([include/config.h:config.h.in])
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=15
17 SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
18
19 NDB_SHARED_LIB_MAJOR_VERSION=2
20 NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
21
22
23 # ndb version
24 NDB_VERSION_MAJOR=5
25 NDB_VERSION_MINOR=0
26 NDB_VERSION_BUILD=51
27 NDB_VERSION_STATUS=""
28
29 # Set all version vars based on $VERSION. How do we do this more elegant ?
30 # Remember that regexps needs to quote [ and ] since this is run through m4
31 MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
32 MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"`
33 MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION | sed -e 's|[[^0-9.]].*$||;s|$|.|' | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'`
34
35 # Add previous major version for debian package upgrade path
36 MYSQL_PREVIOUS_BASE_VERSION=4.1
37
38 # The port should be constant for a LONG time
39 MYSQL_TCP_PORT_DEFAULT=3306
40 MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
41
42 dnl Include m4
43 sinclude(config/ac-macros/alloca.m4)
44 sinclude(config/ac-macros/check_cpu.m4)
45 sinclude(config/ac-macros/character_sets.m4)
46 sinclude(config/ac-macros/compiler_flag.m4)
47 sinclude(config/ac-macros/ha_archive.m4)
48 sinclude(config/ac-macros/ha_berkeley.m4)
49 sinclude(config/ac-macros/ha_blackhole.m4)
50 sinclude(config/ac-macros/ha_example.m4)
51 sinclude(config/ac-macros/ha_federated.m4)
52 sinclude(config/ac-macros/ha_innodb.m4)
53 sinclude(config/ac-macros/ha_ndbcluster.m4)
54 sinclude(config/ac-macros/ha_tina.m4)
55 sinclude(config/ac-macros/large_file.m4)
56 sinclude(config/ac-macros/misc.m4)
57 sinclude(config/ac-macros/openssl.m4)
58 sinclude(config/ac-macros/readline.m4)
59 sinclude(config/ac-macros/yassl.m4)
60 sinclude(config/ac-macros/zlib.m4)
61
62 # Remember to add a directory sql/share/LANGUAGE
63 AVAILABLE_LANGUAGES="\
64 czech danish dutch english estonian french german greek hungarian \
65 italian japanese korean norwegian norwegian-ny polish portuguese \
66 romanian russian serbian slovak spanish swedish ukrainian"
67
68 #####
69 #####
70
71 AC_SUBST(MYSQL_NO_DASH_VERSION)
72 AC_SUBST(MYSQL_BASE_VERSION)
73 AC_SUBST(MYSQL_VERSION_ID)
74 AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
75 AC_SUBST(PROTOCOL_VERSION)
76 AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
77 [mysql client protocol version])
78 AC_SUBST(DOT_FRM_VERSION)
79 AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
80 [Version of .frm files])
81 AC_SUBST(SHARED_LIB_MAJOR_VERSION)
82 AC_SUBST(SHARED_LIB_VERSION)
83 AC_SUBST(NDB_SHARED_LIB_MAJOR_VERSION)
84 AC_SUBST(NDB_SHARED_LIB_VERSION)
85
86 AC_SUBST(AVAILABLE_LANGUAGES)
87
88 AC_SUBST([NDB_VERSION_MAJOR])
89 AC_SUBST([NDB_VERSION_MINOR])
90 AC_SUBST([NDB_VERSION_BUILD])
91 AC_SUBST([NDB_VERSION_STATUS])
92 AC_DEFINE_UNQUOTED([NDB_VERSION_MAJOR], [$NDB_VERSION_MAJOR],
93 [NDB major version])
94 AC_DEFINE_UNQUOTED([NDB_VERSION_MINOR], [$NDB_VERSION_MINOR],
95 [NDB minor version])
96 AC_DEFINE_UNQUOTED([NDB_VERSION_BUILD], [$NDB_VERSION_BUILD],
97 [NDB build version])
98 AC_DEFINE_UNQUOTED([NDB_VERSION_STATUS], ["$NDB_VERSION_STATUS"],
99 [NDB status version])
100
101
102 # Canonicalize the configuration name.
103
104 # Check whether --with-system-type or --without-system-type was given.
105 AC_ARG_WITH(system-type,
106 [ --with-system-type Set the system type, like "sun-solaris10"],
107 [SYSTEM_TYPE="$withval"],
108 [SYSTEM_TYPE="$host_vendor-$host_os"])
109 AC_ARG_WITH(machine-type,
110 [ --with-machine-type Set the machine type, like "powerpc"],
111 [MACHINE_TYPE="$withval"],
112 [MACHINE_TYPE="$host_cpu"])
113 AC_SUBST(SYSTEM_TYPE)
114 AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
115 [Name of system, eg sun-solaris])
116 AC_SUBST(MACHINE_TYPE)
117 AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
118 [Machine type name, eg sparc])
119
120 # Detect intel x86 like processor
121 BASE_MACHINE_TYPE=$MACHINE_TYPE
122 case $MACHINE_TYPE in
123 i?86) BASE_MACHINE_TYPE=i386 ;;
124 esac
125
126 # Save some variables and the command line options for mysqlbug
127 SAVE_ASFLAGS="$ASFLAGS"
128 SAVE_CFLAGS="$CFLAGS"
129 SAVE_CXXFLAGS="$CXXFLAGS"
130 SAVE_LDFLAGS="$LDFLAGS"
131 SAVE_CXXLDFLAGS="$CXXLDFLAGS"
132 CONF_COMMAND="$0 $ac_configure_args"
133 AC_SUBST(CONF_COMMAND)
134 AC_SUBST(SAVE_ASFLAGS)
135 AC_SUBST(SAVE_CFLAGS)
136 AC_SUBST(SAVE_CXXFLAGS)
137 AC_SUBST(SAVE_LDFLAGS)
138 AC_SUBST(SAVE_CXXLDFLAGS)
139 AC_SUBST(CXXLDFLAGS)
140
141 #AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE
142
143 AM_SANITY_CHECK
144 # This is needed is SUBDIRS is set
145 AC_PROG_MAKE_SET
146
147 ##############################################################################
148 # The below section needs to be done before AC_PROG_CC
149 ##############################################################################
150
151 # Hack for OS X/Darwin and Metrowerks CodeWarrior
152 AC_ARG_WITH(darwin-mwcc,
153 [ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS X/Darwin],[
154 if [ "with_darwin_mwcc" = yes ] ; then
155 builddir=`pwd`
156 ccwrapper="$builddir/support-files/MacOSX/mwcc-wrapper"
157 arwrapper="$builddir/support-files/MacOSX/mwar-wrapper"
158 CC="$ccwrapper"
159 CXX="$ccwrapper"
160 LD="$ccwrapper"
161 AR="$arwrapper"
162 RANLIB=:
163 export CC CXX LD AR RANLIB
164 AC_SUBST(AR)
165 AC_SUBST(RANLIB)
166 fi
167 ])
168
169 AM_CONDITIONAL(DARWIN_MWCC, test x$with_darwin_mwcc = xyes)
170
171 if test "x${CFLAGS-}" = x ; then
172 cflags_is_set=no
173 else
174 cflags_is_set=yes
175 fi
176
177 if test "x${CPPFLAGS-}" = x ; then
178 cppflags_is_set=no
179 else
180 cppflags_is_set=yes
181 fi
182
183 if test "x${LDFLAGS-}" = x ; then
184 ldflags_is_set=no
185 else
186 ldflags_is_set=yes
187 fi
188
189 ################ End of section to be done before AC_PROG_CC #################
190
191 # The following hack should ensure that configure doesn't add optimizing
192 # or debugging flags to CFLAGS or CXXFLAGS
193 # C_EXTRA_FLAGS are flags that are automaticly added to both
194 # CFLAGS and CXXFLAGS
195 CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
196 CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
197
198 dnl Checks for programs.
199 AC_PROG_AWK
200 AC_PROG_CC
201 AC_PROG_CXX
202 AC_PROG_CPP
203
204 # Print version of CC and CXX compiler (if they support --version)
205 case $SYSTEM_TYPE in
206 *netware*)
207 CC_VERSION=`$CC -version | grep -i version`
208 ;;
209 *)
210 CC_VERSION=`$CC --version | sed 1q`
211 ;;
212 esac
213 if test $? -eq "0"
214 then
215 AC_MSG_CHECKING("C Compiler version");
216 AC_MSG_RESULT("$CC $CC_VERSION")
217 else
218 CC_VERSION=""
219 fi
220 AC_SUBST(CC_VERSION)
221 MYSQL_CHECK_CXX_VERSION
222
223 # Fix for sgi gcc / sgiCC which tries to emulate gcc
224 if test "$CC" = "sgicc"
225 then
226 ac_cv_prog_gcc="no"
227 fi
228 if test "$CXX" = "sgi++"
229 then
230 GXX="no"
231 fi
232
233 if test "$ac_cv_prog_gcc" = "yes"
234 then
235 AS="$CC -c"
236 AC_SUBST(AS)
237 else
238 AC_PATH_PROG(AS, as, as)
239 fi
240
241 # Still need ranlib for readline; local static use only so no libtool.
242 AC_PROG_RANLIB
243 # We use libtool
244 #AC_LIBTOOL_WIN32_DLL
245 AC_PROG_LIBTOOL
246
247 # Ensure that we have --preserve-dup-deps defines, otherwise we get link
248 # problems of 'mysql' with CXX=g++
249 LIBTOOL="$LIBTOOL --preserve-dup-deps"
250 AC_SUBST(LIBTOOL)dnl
251
252 AC_SUBST(NM)dnl
253
254 # NM= "$NM -X64"
255 #archive_expsym_cmds= `echo "$archive_expsym_cmds" | sed -e '/"$(CC)"//'`
256 #archive_expsym_cmds= "$CC -q64 $archive_expsym_cmds"
257 # CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
258
259 #AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC
260
261 # AC_PROG_INSTALL
262 AC_PROG_INSTALL
263 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
264
265 # Not critical since the generated file is distributed
266 AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
267 AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
268 AC_CHECK_PROG(DVIS, tex, manual.dvi)
269
270 AC_MSG_CHECKING("return type of sprintf")
271
272 #check the return type of sprintf
273 case $SYSTEM_TYPE in
274 *netware*)
275 AC_DEFINE(SPRINTF_RETURNS_INT, [1]) AC_MSG_RESULT("int")
276 ;;
277 *)
278 AC_TRY_RUN([
279 int main()
280 {
281 char* s = "hello";
282 char buf[6];
283 if((int)sprintf(buf, s) == strlen(s))
284 return 0;
285
286 return -1;
287 }
288 ],
289 [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
290 AC_MSG_RESULT("int")],
291 [AC_TRY_RUN([
292 int main()
293 {
294 char* s = "hello";
295 char buf[6];
296 if((char*)sprintf(buf,s) == buf + strlen(s))
297 return 0;
298 return -1;
299 } ],
300 [AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
301 AC_MSG_RESULT("ptr")],
302 [AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
303 AC_MSG_RESULT("garbage")])
304 ])
305 ;;
306 esac
307
308 AC_PATH_PROG(uname_prog, uname, no)
309
310 # We should go through this and put all the explictly system dependent
311 # stuff in one place
312 AC_MSG_CHECKING(operating system)
313 AC_CACHE_VAL(mysql_cv_sys_os,
314 [
315 if test "$uname_prog" != "no"; then
316 mysql_cv_sys_os="`uname`"
317 else
318 mysql_cv_sys_os="Not Solaris"
319 fi
320 ])
321 AC_MSG_RESULT($mysql_cv_sys_os)
322
323 # This should be rewritten to use $target_os
324 case "$target_os" in
325 sco3.2v5*)
326 CFLAGS="$CFLAGS -DSCO"
327 CXXFLAGS="$CXXFLAGS -DSCO"
328 LD='$(CC) $(CFLAGS)'
329 case "$CFLAGS" in
330 *-belf*)
331 AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
332 case "$LDFLAGS" in
333 *-belf*) ;;
334 *) AC_MSG_WARN([Adding -belf option to ldflags.])
335 LDFLAGS="$LDFLAGS -belf"
336 ;;
337 esac
338 ])
339 ;;
340 *)
341 AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
342 case "$LDFLAGS" in
343 *-belf*) ;;
344 *)
345 AC_MSG_WARN([Adding -belf option to ldflags.])
346 LDFLAGS="$LDFLAGS -belf"
347 ;;
348 esac
349 ])
350 ;;
351 esac
352 ;;
353 sysv5UnixWare* | sysv5OpenUNIX8*)
354 if test "$GCC" != "yes"; then
355 # Use the built-in alloca()
356 CFLAGS="$CFLAGS -Kalloca"
357 fi
358 CXXFLAGS="$CXXFLAGS -DNO_CPLUSPLUS_ALLOCA"
359 ;;
360 sysv5SCO_SV6.0.0*)
361 if test "$GCC" != "yes"; then
362 # Use the built-in alloca()
363 CFLAGS="$CFLAGS -Kalloca"
364 CXXFLAGS="$CFLAGS -Kalloca"
365 # Use no_implicit for templates
366 CXXFLAGS="$CXXFLAGS -Tno_implicit"
367 AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
368 [1], [Defined by configure. Use explicit template instantiation.])
369 fi
370 ;;
371 esac
372 AC_SUBST(CC)
373 AC_SUBST(CFLAGS)
374 AC_SUBST(CXX)
375 AC_SUBST(CXXFLAGS)
376 AC_SUBST(LD)
377 AC_SUBST(INSTALL_SCRIPT)
378
379 export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
380
381 if test "$GCC" = "yes"
382 then
383 # mysqld requires -fno-implicit-templates.
384 # Disable exceptions as they seams to create problems with gcc and threads.
385 # mysqld doesn't use run-time-type-checking, so we disable it.
386 # We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
387 # regarding offset() usage in C++ which are done in a safe manner in the
388 # server
389 CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
390 AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
391 [1], [Defined by configure. Use explicit template instantiation.])
392 fi
393
394 MYSQL_PROG_AR
395
396 # libmysqlclient versioning when linked with GNU ld.
397 if $LD --version 2>/dev/null|grep -q GNU; then
398 LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
399 AC_CONFIG_FILES(libmysql/libmysql.ver)
400 fi
401 AC_SUBST(LD_VERSION_SCRIPT)
402
403
404 # Avoid bug in fcntl on some versions of linux
405 AC_MSG_CHECKING([if we should use 'skip-external-locking' as default for $target_os])
406 # Any variation of Linux
407 if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
408 then
409 MYSQLD_DEFAULT_SWITCHES="--skip-external-locking"
410 TARGET_LINUX="true"
411 AC_MSG_RESULT([yes])
412 AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
413 else
414 MYSQLD_DEFAULT_SWITCHES=""
415 TARGET_LINUX="false"
416 AC_MSG_RESULT([no])
417 fi
418 AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
419 AC_SUBST(TARGET_LINUX)
420
421 dnl Find paths to some shell programs
422 AC_PATH_PROG(LN, ln, ln)
423 # This must be able to take a -f flag like normal unix ln.
424 AC_PATH_PROG(LN_CP_F, ln, ln)
425 if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
426 # If ln -f does not exists use -s (AFS systems)
427 if test -n "$LN_CP_F"; then
428 LN_CP_F="$LN_CP_F -s"
429 fi
430 fi
431
432 AC_PATH_PROG(MV, mv, mv)
433 AC_PATH_PROG(RM, rm, rm)
434 AC_PATH_PROG(CP, cp, cp)
435 AC_PATH_PROG(SED, sed, sed)
436 AC_PATH_PROG(CMP, cmp, cmp)
437 AC_PATH_PROG(CHMOD, chmod, chmod)
438 AC_PATH_PROG(HOSTNAME, hostname, hostname)
439 # Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
440 # fall back to 'tar' otherwise and hope that it's a GNU tar as well
441 AC_CHECK_PROGS(TAR, gnutar gtar tar)
442
443 dnl We use a path for perl so the script startup works
444 dnl We make sure to use perl, not perl5, in hopes that the RPMs will
445 dnl not depend on the perl5 binary being installed (probably a bug in RPM)
446 AC_PATH_PROG(PERL, perl, no)
447 if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
448 then
449 PERL5=$PERL
450 else
451 AC_PATH_PROG(PERL5, perl5, no)
452 if test "$PERL5" != no
453 then
454 PERL=$PERL5
455 ac_cv_path_PERL=$ac_cv_path_PERL5
456 fi
457 fi
458
459 AC_SUBST(HOSTNAME)
460 AC_SUBST(PERL)
461 AC_SUBST(PERL5)
462
463 # for build ndb docs
464
465 AC_PATH_PROG(DOXYGEN, doxygen, no)
466 AC_PATH_PROG(PDFLATEX, pdflatex, no)
467 AC_PATH_PROG(MAKEINDEX, makeindex, no)
468 AC_SUBST(DOXYGEN)
469 AC_SUBST(PDFLATEX)
470 AC_SUBST(MAKEINDEX)
471
472 # icheck, used for ABI check
473 AC_PATH_PROG(ICHECK, icheck, no)
474 # "icheck" is also the name of a file system check program on Tru64.
475 # Verify the program found is really the interface checker.
476 if test "x$ICHECK" != "xno"
477 then
478 AC_MSG_CHECKING(if $ICHECK works as expected)
479 echo "int foo;" > conftest.h
480 $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
481 if test -f "conftest.ic"
482 then
483 AC_MSG_RESULT(yes)
484 else
485 AC_MSG_RESULT(no)
486 ICHECK=no
487 fi
488 rm -f conftest.ic conftest.h
489 fi
490 AC_SUBST(ICHECK)
491
492 # Lock for PS
493 AC_PATH_PROG(PS, ps, ps)
494 AC_MSG_CHECKING("how to check if pid exists")
495 PS=$ac_cv_path_PS
496 # Linux style
497 if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
498 then
499 FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
500 # Solaris
501 elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
502 then
503 FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
504 # BSD style
505 elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
506 then
507 FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
508 # SysV style
509 elif $PS -ef 2> /dev/null | grep $0 > /dev/null
510 then
511 FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
512 # Do anybody use this?
513 elif $PS $$ 2> /dev/null | grep $0 > /dev/null
514 then
515 FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
516 else
517 case $SYSTEM_TYPE in
518 *freebsd*|*dragonfly*)
519 FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
520 ;;
521 *darwin*)
522 FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
523 ;;
524 *cygwin*)
525 FIND_PROC="$PS -e | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
526 ;;
527 *netware*)
528 FIND_PROC=
529 ;;
530 *)
531 AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
532 esac
533 fi
534 AC_SUBST(FIND_PROC)
535 AC_MSG_RESULT("$FIND_PROC")
536
537 # Check if a pid is valid
538 AC_PATH_PROG(KILL, kill, kill)
539 AC_MSG_CHECKING("for kill switches")
540 if $ac_cv_path_KILL -0 $$
541 then
542 CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
543 elif kill -s 0 $$
544 then
545 CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
546 else
547 AC_MSG_WARN([kill -0 to check for pid seems to fail])
548 CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
549 fi
550 AC_SUBST(CHECK_PID)
551 AC_MSG_RESULT("$CHECK_PID")
552
553 # We need an ANSI C compiler
554 AM_PROG_CC_STDC
555
556 # We need an assembler, too
557 AM_PROG_AS
558 CCASFLAGS="$CCASFLAGS $ASFLAGS"
559
560 # Check if we need noexec stack for assembler
561 AC_CHECK_NOEXECSTACK
562
563 if test "$am_cv_prog_cc_stdc" = "no"
564 then
565 AC_MSG_ERROR([MySQL requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
566 fi
567
568 NOINST_LDFLAGS="-static"
569
570 static_nss=""
571 STATIC_NSS_FLAGS=""
572 OTHER_LIBC_LIB=""
573 AC_ARG_WITH(other-libc,
574 [ --with-other-libc=DIR Link against libc and other standard libraries
575 installed in the specified non-standard location
576 overriding default. Originally added to be able to
577 link against glibc 2.2 without making the user
578 upgrade the standard libc installation.],
579 [
580 other_libc_include="$withval/include"
581 other_libc_lib="$withval/lib"
582 with_other_libc="yes"
583 enable_shared="no"
584 all_is_static="yes"
585 CFLAGS="$CFLAGS -I$other_libc_include"
586 # There seems to be a feature in gcc that treats system and libc headers
587 # silently when they violatate ANSI C++ standard, but it is strict otherwise
588 # since gcc cannot now recognize that our headers are libc, we work around
589 # by telling it to be permissive. Note that this option only works with
590 # new versions of gcc (2.95.x and above)
591 CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include"
592 if test -f "$other_libc_lib/libnss_files.a"
593 then
594 # libc has been compiled with --enable-static-nss
595 # we need special flags, but we will have to add those later
596 STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
597 STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
598 OTHER_LIBC_LIB="-static -L$other_libc_lib"
599 static_nss=1
600 else
601 # this is a dirty hack. We if we detect static nss glibc in the special
602 # location, we do not re-direct the linker to get libraries from there
603 # during check. The reason is that if we did, we would have to find a
604 # way to append the special static nss flags to LIBS every time we do
605 # any check - this is definitely feasible, but not worthwhile the risk
606 # of breaking other things. So for our purposes it would be sufficient
607 # to assume that whoever is using static NSS knows what he is doing and
608 # has sensible libraries in the regular location
609 LDFLAGS="$LDFLAGS -static -L$other_libc_lib "
610 fi
611
612 # When linking against custom libc installed separately, we want to force
613 # all binary builds to be static, including the build done by configure
614 # itself to test for system features.
615 with_mysqld_ldflags="-all-static"
616 with_client_ldflags="-all-static"
617 NOINST_LDFLAGS="-all-static"
618 ],
619 [
620 other_libc_include=
621 other_libc_lib=
622 with_other_libc="no"
623 ]
624 )
625 AC_SUBST(NOINST_LDFLAGS)
626
627 #
628 # Check if we are using Linux and a glibc compiled with static nss
629 # (this is true on the MySQL build machines to avoid NSS problems)
630 #
631
632 if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
633 then
634 tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
635 if test -n "$tmp"
636 then
637 STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
638 STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
639 static_nss=1
640 fi
641 fi
642
643
644 AC_ARG_WITH(server-suffix,
645 [ --with-server-suffix Append value to the version string.],
646 [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ],
647 [ MYSQL_SERVER_SUFFIX= ]
648 )
649 AC_SUBST(MYSQL_SERVER_SUFFIX)
650
651 # Set flags if we want to force to use pthreads
652 AC_ARG_WITH(pthread,
653 [ --with-pthread Force use of pthread library.],
654 [ with_pthread=$withval ],
655 [ with_pthread=no ]
656 )
657
658 # Force use of thread libs LIBS
659 AC_ARG_WITH(named-thread-libs,
660 [ --with-named-thread-libs=ARG
661 Use specified thread libraries instead of
662 those automatically found by configure.],
663 [ with_named_thread=$withval ],
664 [ with_named_thread=no ]
665 )
666
667 # Force use of a curses libs
668 AC_ARG_WITH(named-curses-libs,
669 [ --with-named-curses-libs=ARG
670 Use specified curses libraries instead of
671 those automatically found by configure.],
672 [ with_named_curses=$withval ],
673 [ with_named_curses=no ]
674 )
675
676 # Make thread safe client
677 AC_ARG_ENABLE(thread-safe-client,
678 [ --enable-thread-safe-client
679 Compile the client with threads.],
680 [ THREAD_SAFE_CLIENT=$enableval ],
681 [ THREAD_SAFE_CLIENT=no ]
682 )
683
684 # compile with strings functions in assembler
685 AC_ARG_ENABLE(assembler,
686 [ --enable-assembler Use assembler versions of some string
687 functions if available.],
688 [ ENABLE_ASSEMBLER=$enableval ],
689 [ ENABLE_ASSEMBLER=no ]
690 )
691
692 AC_MSG_CHECKING(if we should use assembler functions)
693 # For now we only support assembler on i386 and sparc systems
694 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;))
695 AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
696 AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
697 AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
698
699 if test "$ASSEMBLER_TRUE" = ""
700 then
701 AC_MSG_RESULT([yes])
702 else
703 AC_MSG_RESULT([no])
704 fi
705
706 # Add query profiler
707 AC_ARG_ENABLE(profiling,
708 AS_HELP_STRING([--disable-profiling], [Build a version without query profiling code]),
709 [ ENABLED_PROFILING=$enableval ],
710 [ ENABLED_PROFILING=yes ])
711
712 if test "$ENABLED_PROFILING" = "yes"
713 then
714 AC_DEFINE([ENABLED_PROFILING], [1],
715 [If SHOW PROFILE should be enabled])
716 AC_MSG_RESULT([yes])
717 else
718 AC_MSG_RESULT([no])
719 fi
720
721 # Use this to set the place used for unix socket used to local communication.
722 AC_ARG_WITH(unix-socket-path,
723 [ --with-unix-socket-path=SOCKET
724 Where to put the unix-domain socket. SOCKET must be
725 an absolute file name.],
726 [ MYSQL_UNIX_ADDR=$withval ],
727 [ MYSQL_UNIX_ADDR=$MYSQL_UNIX_ADDR_DEFAULT ]
728 )
729 AC_SUBST(MYSQL_UNIX_ADDR)
730
731 AC_ARG_WITH(tcp-port,
732 [ --with-tcp-port=port-number
733 Which port to use for MySQL services (default 3306)],
734 [ MYSQL_TCP_PORT=$withval ],
735 [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT ]
736 )
737 AC_SUBST(MYSQL_TCP_PORT)
738 # We might want to document the assigned port in the manual.
739 AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
740
741 # Use this to set the place used for unix socket used to local communication.
742 AC_ARG_WITH(mysqld-user,
743 [ --with-mysqld-user=username
744 What user the mysqld daemon shall be run as.],
745 [ MYSQLD_USER=$withval ],
746 [ MYSQLD_USER=mysql ]
747 )
748 AC_SUBST(MYSQLD_USER)
749
750 # If we should allow LOAD DATA LOCAL
751 AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
752 AC_ARG_ENABLE(local-infile,
753 [ --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)],
754 [ ENABLED_LOCAL_INFILE=$enableval ],
755 [ ENABLED_LOCAL_INFILE=no ]
756 )
757 if test "$ENABLED_LOCAL_INFILE" = "yes"
758 then
759 AC_MSG_RESULT([yes])
760 AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
761 [If LOAD DATA LOCAL INFILE should be enabled by default])
762 else
763 AC_MSG_RESULT([no])
764 fi
765
766 # If we should allow init-file, skip-grant-table and bootstrap options
767 AC_MSG_CHECKING(If we should should enable init-file, skip-grant-table options and bootstrap)
768 AC_ARG_ENABLE(grant-options,
769 [ --disable-grant-options Disables the use of --init-file, --skip-grant-tables and --bootstrap options],
770 [ mysql_grant_options_enabled=$enableval ],
771 [ mysql_grant_options_enabled=yes ]
772 )
773 if test "$mysql_grant_options_enabled" = "yes"
774 then
775 AC_MSG_RESULT([yes])
776 else
777 AC_DEFINE([DISABLE_GRANT_OPTIONS], [1],
778 [Disables the use of --init-file, --skip-grant-tables and --bootstrap options])
779 AC_MSG_RESULT([no])
780 fi
781
782 MYSQL_SYS_LARGEFILE
783
784 # Types that must be checked AFTER large file support is checked
785 AC_TYPE_SIZE_T
786
787 # For senna
788 MECAB_INCLUDES=
789 MECAB_LIBS=
790
791 AC_ARG_WITH(mecab,
792 [ --with-mecab[=DIR] Specify install prefix of mecab], [
793 if test "$withval" = "yes"; then
794 MECAB_PREFIX=""
795 else
796 MECAB_PREFIX="$withval"
797 fi
798 AC_DEFINE([ENABLE_MECAB], [1], [Define to 1 if MeCab is enabled])
799
800 if test -z "$MECAB_PREFIX"; then
801 if eval 'mecab-config --prefix 2>&1 >/dev/null'; then
802 MECAB_CONFIG='mecab-config'
803 MECAB_PREFIX='mecab-config --prefix'
804 MECAB_INCLUDES="`\"$MECAB_CONFIG\" --cflags`"
805 MECAB_LIBS="${LDFLAGS} `\"$MECAB_CONFIG\" --libs`"
806 fi
807 else
808 MECAB_CONFIG="$MECAB_PREFIX/bin/mecab-config"
809
810 if test -x "$MECAB_CONFIG"; then
811 MECAB_INCLUDES="`\"$MECAB_CONFIG\" --cflags`"
812 MECAB_LIBS="`\"$MECAB_CONFIG\" --libs`"
813 else
814 MECAB_INCLUDES="-I$MECAB_PREFIX/include"
815 MECAB_LIBS="-L$MECAB_PREFIX/lib"
816 fi
817 fi
818 ], [
819 MECAB_PREFIX=""
820 ])
821
822 _CPPFLAGS="${CPPFLAGS}"
823 _LIBS="${LIBS}"
824 CPPFLAGS="${CPPFLAGS} ${MECAB_INCLUDES}"
825 LIBS="${LIBS} ${MECAB_LIBS}"
826
827 AC_CHECK_FUNC(mecab_new, [
828 AC_DEFINE([HAVE_MECAB], [1], [Define to 1 if libmecab is available])
829 HAVE_MECAB=1
830 ], [
831 HAVE_MECAB=
832 MECAB_INCLUDES=
833 MECAB_LIBS=
834 ])
835
836 CPPFLAGS="${_CPPFLAGS}"
837 LIBS="${_LIBS}"
838
839 AC_SUBST(MECAB_INCLUDES)
840 AC_SUBST(MECAB_LIBS)
841
842 SENNA_INCLUDES=
843 SENNA_LIBS=
844
845 AC_ARG_WITH(senna,
846 [ --with-senna[=DIR] Enable Senna fulltext search support], [
847 case "$withval" in
848 no) : ;;
849 yes|*)
850 if test "$withval" = "yes"; then
851 if eval 'senna-cfg --cflags 2>&1 >/dev/null'; then
852 SENNA_CFG="senna-cfg"
853 SENNA_PREFIX="senna-cfg --prefix"
854 SENNA_INCLUDES="`\"$SENNA_CFG\" --cflags` $MECAB_INCLUDES"
855 SENNA_LIBS="`\"$SENNA_CFG\" --libs` -lsenna $MECAB_LIBS"
856 else
857 SENNA_INCLUDES="$MECAB_INCLUDES"
858 SENNA_LIBS="-lsenna $MECAB_LIBS"
859 fi
860 else
861 SENNA_PREFIX="$withval"
862 SENNA_CFG="$SENNA_PREFIX/bin/senna-cfg"
863 if test -x "$SENNA_CFG"; then
864 SENNA_INCLUDES="`\"$SENNA_CFG\" --cflags` $MECAB_INCLUDES"
865 SENNA_LIBS="`\"$SENNA_CFG\" --libs` -lsenna $MECAB_LIBS"
866 else
867 SENNA_INCLUDES="-I$SENNA_PREFIX/include $MECAB_INCLUDES"
868 SENNA_LIBS="-L$SENNA_PREFIX/lib -lsenna $MECAB_LIBS"
869 fi
870 fi
871
872 _CPPFLAGS="${CPPFLAGS}"
873 _LIBS="${LIBS}"
874 CPPFLAGS="${CPPFLAGS} ${SENNA_INCLUDES}"
875 LIBS="${LIBS} ${SENNA_LIBS}"
876
877 AC_CHECK_FUNC(sen_init, [
878 AC_DEFINE([ENABLE_SENNA], [1], [Define to 1 if Senna is enabled])
879 ], [
880 AC_MSG_ERROR([Could not find libsenna. Check your Senna installation.])
881 ])
882
883 CPPFLAGS="${_CPPFLAGS}"
884 LIBS="${_LIBS}"
885 ;;
886 esac
887 ])
888
889 AC_SUBST([SENNA_INCLUDES])
890 AC_SUBST([SENNA_LIBS])
891
892 #--------------------------------------------------------------------
893 # Check for system header files
894 #--------------------------------------------------------------------
895
896 AC_HEADER_DIRENT
897 AC_HEADER_STDC
898 AC_HEADER_SYS_WAIT
899 AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
900 memory.h pwd.h select.h \
901 stdlib.h stddef.h \
902 strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
903 sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
904 unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
905 sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
906 sys/prctl.h \
907 sys/resource.h sys/param.h)
908
909 #--------------------------------------------------------------------
910 # Check for system libraries. Adds the library to $LIBS
911 # and defines HAVE_LIBM etc
912 #--------------------------------------------------------------------
913
914 AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
915
916 AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
917 AC_CHECK_LIB(nsl, gethostbyname_r))
918 AC_CHECK_FUNC(gethostbyname_r)
919
920 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
921 AC_CHECK_FUNC(yp_get_default_domain, ,
922 AC_CHECK_LIB(nsl, yp_get_default_domain))
923 AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
924 # This may get things to compile even if bind-8 is installed
925 AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
926 # Check if crypt() exists in libc or libcrypt, sets LIBS if needed
927 AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
928 AC_SEARCH_LIBS(inet_aton, [socket nsl resolv])
929
930 # For the sched_yield() function on Solaris
931 AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield))
932
933 MYSQL_CHECK_ZLIB_WITH_COMPRESS
934
935 # For large pages support
936 if test "$TARGET_LINUX" = "true"
937 then
938 # For SHM_HUGETLB on Linux
939 AC_CHECK_DECLS(SHM_HUGETLB,
940 AC_DEFINE([HAVE_LARGE_PAGES], [1],
941 [Define if you have large pages support])
942 AC_DEFINE([HUGETLB_USE_PROC_MEMINFO], [1],
943 [Define if /proc/meminfo shows the huge page size (Linux only)])
944 , ,
945 [
946 #include <sys/shm.h>
947 ]
948 )
949 fi
950
951 #--------------------------------------------------------------------
952 # Check for TCP wrapper support
953 #--------------------------------------------------------------------
954
955 AC_ARG_WITH(libwrap,
956 [ --with-libwrap[=DIR] Compile in libwrap (tcp_wrappers) support],[
957 case "$with_libwrap" in
958 no) : ;;
959 yes|*)
960 _cppflags=${CPPFLAGS}
961 _ldflags=${LDFLAGS}
962
963 if test "$with_libwrap" != "yes"; then
964 CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
965 LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
966 fi
967
968 _libs=${LIBS}
969 AC_CHECK_HEADER(tcpd.h,
970 LIBS="-lwrap $LIBS"
971 AC_MSG_CHECKING(for TCP wrappers library -lwrap)
972 AC_TRY_LINK([#include <tcpd.h>
973 int allow_severity = 0;
974 int deny_severity = 0;
975
976 struct request_info *req;
977 ],[hosts_access (req)],
978 AC_MSG_RESULT(yes)
979 AC_DEFINE([LIBWRAP], [1], [Define if you have -lwrap])
980 AC_DEFINE([HAVE_LIBWRAP], [1], [Define if have -lwrap])
981 if test "$with_libwrap" != "yes"; then
982 WRAPLIBS="-L${with_libwrap}/lib"
983 fi
984 WRAPLIBS="${WRAPLIBS} -lwrap",
985 AC_MSG_RESULT(no)
986 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
987 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
988 LDFLAGS=${_ldflags} LIBS=${_libs}
989 ;;
990 esac
991 ])
992 AC_SUBST(WRAPLIBS)
993
994 if test "$TARGET_LINUX" = "true"; then
995 AC_MSG_CHECKING([for atomic operations])
996
997 AC_LANG_SAVE
998 AC_LANG_CPLUSPLUS
999
1000 atom_ops=
1001 AC_TRY_RUN([
1002 #include <asm/atomic.h>
1003 int main()
1004 {
1005 atomic_t v;
1006
1007 atomic_set(&v, 23);
1008 atomic_add(5, &v);
1009 return atomic_read(&v) == 28 ? 0 : -1;
1010 }
1011 ],
1012 [AC_DEFINE([HAVE_ATOMIC_ADD], [1],
1013 [atomic_add() from <asm/atomic.h> (Linux only)])
1014 atom_ops="${atom_ops}atomic_add "],
1015 )
1016 AC_TRY_RUN([
1017 #include <asm/atomic.h>
1018 int main()
1019 {
1020 atomic_t v;
1021
1022 atomic_set(&v, 23);
1023 atomic_sub(5, &v);
1024 return atomic_read(&v) == 18 ? 0 : -1;
1025 }
1026 ],
1027 [AC_DEFINE([HAVE_ATOMIC_SUB], [1],
1028 [atomic_sub() from <asm/atomic.h> (Linux only)])
1029 atom_ops="${atom_ops}atomic_sub "],
1030 )
1031
1032 if test -z "$atom_ops"; then atom_ops="no"; fi
1033 AC_MSG_RESULT($atom_ops)
1034
1035 AC_LANG_RESTORE
1036
1037 AC_ARG_WITH(pstack,
1038 [ --with-pstack Use the pstack backtrace library],
1039 [ USE_PSTACK=$withval ],
1040 [ USE_PSTACK=no ])
1041 pstack_libs=
1042 pstack_dirs=
1043 if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386"
1044 then
1045 have_libiberty= have_libbfd=
1046 my_save_LIBS="$LIBS"
1047 dnl I have no idea if this is a good test - can not find docs for libiberty
1048 AC_CHECK_LIB([iberty], [fdmatch],
1049 [have_libiberty=yes
1050 AC_CHECK_LIB([bfd], [bfd_openr], [have_libbfd=yes], , [-liberty])])
1051 LIBS="$my_save_LIBS"
1052
1053 if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes
1054 then
1055 pstack_dirs='$(top_srcdir)'/pstack
1056 pstack_libs="../pstack/libpstack.a -lbfd -liberty"
1057 # We must link staticly when using pstack
1058 with_mysqld_ldflags="-all-static"
1059 AC_SUBST([pstack_dirs])
1060 AC_SUBST([pstack_libs])
1061 AC_DEFINE([USE_PSTACK], [1], [the pstack backtrace library])
1062 dnl This check isn't needed, but might be nice to give some feedback....
1063 dnl AC_CHECK_HEADER(libiberty.h,
1064 dnl have_libiberty_h=yes,
1065 dnl have_libiberty_h=no)
1066 else
1067 USE_PSTACK="no"
1068 fi
1069 else
1070 USE_PSTACK="no"
1071 fi
1072 fi
1073 AM_CONDITIONAL(COMPILE_PSTACK, test "$USE_PSTACK" = "yes")
1074 AC_MSG_CHECKING([if we should use pstack])
1075 AC_MSG_RESULT([$USE_PSTACK])
1076
1077 # Check for gtty if termio.h doesn't exists
1078 if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
1079 then
1080 AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
1081 fi
1082
1083 # We make a special variable for non-threaded version of LIBS to avoid
1084 # including thread libs into non-threaded version of MySQL client library.
1085 # Later in this script LIBS will be augmented with a threads library.
1086 NON_THREADED_LIBS="$LIBS"
1087
1088 AC_MSG_CHECKING([for int8])
1089 case $SYSTEM_TYPE in
1090 *netware)
1091 AC_MSG_RESULT([no])
1092 ;;
1093 *)
1094 AC_TRY_RUN([
1095 #ifdef HAVE_STDLIB_H
1096 #include <stdlib.h>
1097 #endif
1098
1099 #ifdef HAVE_STDDEF_H
1100 #include <stddef.h>
1101 #endif
1102
1103 #ifdef HAVE_SYS_TYPES_H
1104 #include <sys/types.h>
1105 #endif
1106
1107 int main()
1108 {
1109 int8 i;
1110 return 0;
1111 }
1112 ],
1113 [AC_DEFINE([HAVE_INT_8_16_32], [1],
1114 [whether int8, int16 and int32 types exist])
1115 AC_MSG_RESULT([yes])],
1116 [AC_MSG_RESULT([no])]
1117 )
1118 ;;
1119 esac
1120
1121 #
1122 # Some system specific hacks
1123 #
1124
1125 MAX_C_OPTIMIZE="-O3"
1126 MAX_CXX_OPTIMIZE="-O3"
1127
1128 ndb_cxxflags_fix=
1129 case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in
1130 # workaround for Sun Forte/x86 see BUG#4681
1131 *solaris*-i?86-no)
1132 CFLAGS="$CFLAGS -DBIG_TABLES"
1133 CXXFLAGS="$CXXFLAGS -DBIG_TABLES"
1134 ;;
1135 *) ;;
1136 esac
1137 case $SYSTEM_TYPE-$ac_cv_prog_gcc in
1138 # workaround for Sun Forte compile problem for ndb
1139 *solaris*-no)
1140 ndb_cxxflags_fix="$ndb_cxxflags_fix -instances=static"
1141 ;;
1142 *) ;;
1143 esac
1144
1145
1146 case $SYSTEM_TYPE in
1147 *solaris2.7*)
1148 # Solaris 2.7 has a broken /usr/include/widec.h
1149 # Make a fixed copy in ./include
1150 AC_MSG_WARN([Fixing broken include files for $SYSTEM_TYPE])
1151 echo " - Creating local copy of widec.h"
1152 if test ! -d include
1153 then
1154 mkdir ./include
1155 fi
1156 builddir=`pwd`
1157 sed -e "s|^#if[ ]*!defined(lint) && !defined(__lint)|#if !defined\(lint\) \&\& !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h
1158 CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
1159 CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
1160 ;;
1161 *solaris2.8*)
1162 # Solaris 2.8 has a broken /usr/include/widec.h
1163 # Make a fixed copy in ./include
1164 AC_MSG_WARN([Fixing broken include files for $SYSTEM_TYPE])
1165 echo " - Creating local copy of widec.h"
1166 if test ! -d include
1167 then
1168 mkdir ./include
1169 fi
1170 builddir=`pwd`
1171 sed -e "s|^#if[ ]*!defined(__lint)|#if !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h
1172 CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
1173 CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
1174 ;;
1175 *solaris2.5.1*)
1176 AC_MSG_WARN([Enabling getpass() workaround for Solaris 2.5.1])
1177 CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS -DHAVE_RWLOCK_T";
1178 CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T -DSOLARIS"
1179 ;;
1180 *solaris*)
1181 CFLAGS="$CFLAGS -DHAVE_RWLOCK_T"
1182 CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T"
1183 ;;
1184 *SunOS*)
1185 AC_MSG_WARN([Enabling getpass() workaround for SunOS])
1186 CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS";
1187 ;;
1188 *hpux10.20*)
1189 AC_MSG_WARN([Enabling workarounds for hpux 10.20])
1190 CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
1191 CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
1192 if test "$with_named_thread" = "no"
1193 then
1194 AC_MSG_WARN([Using --with-named-thread=-lpthread])
1195 with_named_thread="-lcma"
1196 fi
1197 ;;
1198 *hpux11.*)
1199 AC_MSG_WARN([Enabling workarounds for hpux 11])
1200 CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
1201 CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
1202 if test "$with_named_thread" = "no"
1203 then
1204 AC_MSG_WARN([Using --with-named-thread=-lpthread])
1205 with_named_thread="-lpthread"
1206 fi
1207 # Fixes for HPUX 11.0 compiler
1208 if test "$ac_cv_prog_gcc" = "no"
1209 then
1210 CFLAGS="$CFLAGS -DHAVE_BROKEN_INLINE"
1211 # set working flags first in line, letting override it (i. e. for debug):
1212 CXXFLAGS="+O2 $CXXFLAGS"
1213 MAX_C_OPTIMIZE=""
1214 MAX_CXX_OPTIMIZE=""
1215 ndb_cxxflags_fix="$ndb_cxxflags_fix -Aa"
1216 fi
1217 ;;
1218 *rhapsody*)
1219 if test "$ac_cv_prog_gcc" = "yes"
1220 then
1221 CPPFLAGS="$CPPFLAGS -traditional-cpp "
1222 CFLAGS="-DHAVE_CTHREADS_WRAPPER -DDO_NOT_REMOVE_THREAD_WRAPPERS"
1223 CXXFLAGS="-DHAVE_CTHREADS_WRAPPER"
1224 if test $with_named_curses = "no"
1225 then
1226 with_named_curses=""
1227 fi
1228 fi
1229 ;;
1230 *darwin5*)
1231 if test "$ac_cv_prog_gcc" = "yes"
1232 then
1233 FLAGS="-traditional-cpp -DHAVE_DARWIN5_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
1234 CFLAGS="$CFLAGS $FLAGS"
1235 CXXFLAGS="$CXXFLAGS $FLAGS"
1236 MAX_C_OPTIMIZE="-O"
1237 with_named_curses=""
1238 fi
1239 ;;
1240 *darwin6*)
1241 if test "$ac_cv_prog_gcc" = "yes"
1242 then
1243 FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DDONT_DECLARE_CXA_PURE_VIRTUAL "
1244 CFLAGS="$CFLAGS $FLAGS"
1245 CXXFLAGS="$CXXFLAGS $FLAGS"
1246 MAX_C_OPTIMIZE="-O"
1247 fi
1248 ;;
1249 *darwin*)
1250 if test "$ac_cv_prog_gcc" = "yes"
1251 then
1252 FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
1253 CFLAGS="$CFLAGS $FLAGS"
1254 CXXFLAGS="$CXXFLAGS $FLAGS"
1255 MAX_C_OPTIMIZE="-O"
1256 fi
1257 ;;
1258 *freebsd*|*dragonfly*)
1259 AC_MSG_WARN([Adding fix for interrupted reads])
1260 OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
1261 if test "$OSVERSION" -gt "480100" && \
1262 test "$OSVERSION" -lt "500000" || \
1263 test "$OSVERSION" -gt "500109"
1264 then
1265 CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
1266 else
1267 CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
1268 CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
1269 fi
1270 ;;
1271 *netbsd*)
1272 AC_MSG_WARN([Adding flag -Dunix])
1273 CFLAGS="$CFLAGS -Dunix"
1274 CXXFLAGS="$CXXFLAGS -Dunix"
1275 OVERRIDE_MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a"
1276 ;;
1277 *bsdi*)
1278 AC_MSG_WARN([Adding fix for BSDI])
1279 CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH"
1280 AC_DEFINE_UNQUOTED([SOCKOPT_OPTLEN_TYPE], [size_t],
1281 [Last argument to get/setsockopt])
1282 ;;
1283 *sgi-irix6*)
1284 if test "$with_named_thread" = "no"
1285 then
1286 AC_MSG_WARN([Using --with-named-thread=-lpthread])
1287 with_named_thread="-lpthread"
1288 fi
1289 CXXFLAGS="$CXXFLAGS -D_BOOL"
1290 ;;
1291 *aix4.3*)
1292 AC_MSG_WARN([Adding defines for AIX])
1293 CFLAGS="$CFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ"
1294 CXXFLAGS="$CXXFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ"
1295 ;;
1296 dnl Is this the right match for DEC OSF on alpha?
1297 *dec-osf*)
1298 if test "$ac_cv_prog_gcc" = "yes" && test "$host_cpu" = "alpha"
1299 then
1300 AC_MSG_WARN([Adding defines for DEC OSF on alpha])
1301 CFLAGS="$CFLAGS -mieee"
1302 CXXFLAGS="$CXXFLAGS -mieee"
1303 fi
1304 AC_MSG_WARN([Adding defines for OSF1])
1305 # gethostbyname_r is deprecated and doesn't work ok on OSF1
1306 CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
1307 CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
1308 # fix to handle include of <stdint.h> correctly on OSF1 with cxx compiler
1309 CXXFLAGS="$CXXFLAGS -I/usr/include/cxx -I/usr/include/cxx_cname -I/usr/include -I/usr/include.dtk"
1310 ;;
1311 *netware*)
1312 # No need for curses library so set it to null
1313 with_named_curses=""
1314
1315 # No thread library - in LibC
1316 with_named_thread=""
1317
1318 #
1319 # Edit Makefile.in files.
1320 #
1321 echo -n "configuring Makefile.in files for NetWare... "
1322 for file in sql/Makefile.in libmysql/Makefile.in libmysql_r/Makefile.in extra/Makefile.in strings/Makefile.in client/Makefile.in
1323 do
1324 # echo "#### $file ####"
1325 filedir="`dirname $file`"
1326 filebase="`basename $file`"
1327 filesed=$filedir/$filebase.sed
1328 #
1329 # Backup and always use original file
1330 #
1331 if test -f $file.bk
1332 then
1333 cp -fp $file.bk $file
1334 else
1335 cp -fp $file $file.bk
1336 fi
1337 case $file in
1338 sql/Makefile.in)
1339 # Use gen_lex_hash.linux instead of gen_lex_hash
1340 # Add library dependencies to mysqld_DEPENDENCIES
1341 lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(ndbcluster_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs) \$(yassl_libs)"
1342 cat > $filesed << EOF
1343 s,\(^.*\$(MAKE) gen_lex_hash\)\$(EXEEXT),#\1,
1344 s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
1345 s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES %
1346 EOF
1347 ;;
1348 extra/Makefile.in)
1349 cat > $filesed << EOF
1350 s,\(extra/comp_err\)\$(EXEEXT),\1.linux,
1351 EOF
1352 ;;
1353 libmysql/Makefile.in)
1354 cat > $filesed << EOF
1355 s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2,
1356 s,\(: conf_to_src\),\1.linux,
1357 s,libyassl.la,.libs/libyassl.a,
1358 s,libtaocrypt.la,.libs/libtaocrypt.a,
1359 EOF
1360 ;;
1361 libmysql_r/Makefile.in)
1362 cat > $filesed << EOF
1363 s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2,
1364 s,\(: conf_to_src\),\1.linux,
1365 s,libyassl.la,.libs/libyassl.a,
1366 s,libtaocrypt.la,.libs/libtaocrypt.a,
1367 EOF
1368 ;;
1369 strings/Makefile.in)
1370 cat > $filesed << EOF
1371 s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2,
1372 s,\(: conf_to_src\),\1.linux,
1373 EOF
1374 ;;
1375 client/Makefile.in)
1376 #
1377 cat > $filesed << EOF
1378 s,libmysqlclient.la,.libs/libmysqlclient.a,
1379 EOF
1380 ;;
1381 esac
1382 if `sed -f $filesed $file > $file.nw`;\
1383 then
1384 mv -f $file.nw $file
1385 rm -f $filesed
1386 else
1387 exit 1
1388 fi
1389 # wait for file system changes to complete
1390 sleep 1
1391 done
1392 echo "done"
1393
1394 #
1395 # Make sure the following files are writable.
1396 #
1397 # When the files are retrieved from some source code control systems they are read-only.
1398 #
1399 echo -n "making sure specific build files are writable... "
1400 for file in \
1401 Docs/manual.chm \
1402 Docs/mysql.info \
1403 Docs/INSTALL-BINARY \
1404 INSTALL-SOURCE \
1405 COPYING
1406 do
1407 if test -e $file; then
1408 chmod +w $file
1409 fi
1410 done
1411 echo "done"
1412
1413 ;;
1414 esac
1415
1416
1417 #---START: Used in for client configure
1418 # Check if we threads are in libc or if we should use
1419 # -lpthread, -lpthreads or mit-pthreads
1420 # We have to check libc last because else it fails on Solaris 2.6
1421
1422 with_posix_threads="no"
1423 # Search thread lib on Linux
1424 if test "$with_named_thread" = "no"
1425 then
1426 AC_MSG_CHECKING("Linux threads")
1427 if test "$TARGET_LINUX" = "true"
1428 then
1429 AC_MSG_RESULT("starting")
1430 # use getconf to check glibc contents
1431 AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
1432 case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
1433 NPTL* )
1434 AC_MSG_RESULT("NPTL")
1435 AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
1436 with_named_thread="-lpthread"
1437 ;;
1438 LINUXTHREADS* )
1439 AC_MSG_RESULT("Linuxthreads")
1440 AC_DEFINE([HAVE_LINUXTHREADS], [1],
1441 [Whether we are using Xavier Leroy's LinuxThreads])
1442 with_named_thread="-lpthread"
1443 ;;
1444 * )
1445 AC_MSG_RESULT("unknown")
1446 ;;
1447 esac
1448 if test "$with_named_thread" = "no"
1449 then
1450 # old method, check headers
1451 # Look for LinuxThreads.
1452 AC_MSG_CHECKING("LinuxThreads in header file comment")
1453 res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
1454 if test "$res" -gt 0
1455 then
1456 AC_MSG_RESULT("Found")
1457 AC_DEFINE([HAVE_LINUXTHREADS], [1],
1458 [Whether we are using Xavier Leroy's LinuxThreads])
1459 # Linux 2.0 sanity check
1460 AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
1461 AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
1462 # RedHat 5.0 does not work with dynamic linking of this. -static also
1463 # gives a speed increase in linux so it does not hurt on other systems.
1464 with_named_thread="-lpthread"
1465 else
1466 AC_MSG_RESULT("Not found")
1467 # If this is a linux machine we should barf
1468 AC_MSG_ERROR([This is a Linux system without a working getconf,
1469 and Linuxthreads was not found. Please install it (or a new glibc) and try again.
1470 See the Installation chapter in the Reference Manual for more information.])
1471 fi
1472 else
1473 AC_MSG_RESULT("no need to check headers")
1474 fi
1475
1476 AC_MSG_CHECKING("for pthread_create in -lpthread");
1477 ac_save_LIBS="$LIBS"
1478 LIBS="$LIBS -lpthread"
1479 AC_TRY_LINK( [#include <pthread.h>],
1480 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1481 AC_MSG_RESULT("yes"),
1482 [ AC_MSG_RESULT("no")
1483 AC_MSG_ERROR([
1484 This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
1485 Please install one of these (or a new glibc) and try again.
1486 See the Installation chapter in the Reference Manual for more information.]) ]
1487 )
1488 LIBS="$ac_save_LIBS"
1489 else
1490 AC_MSG_RESULT("no")
1491 fi # "$TARGET_LINUX"
1492 fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
1493
1494
1495 # Hack for DEC-UNIX (OSF1 -> Tru64)
1496 if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
1497 then
1498 AC_MSG_CHECKING("DEC threads post OSF/1 3.2")
1499 if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
1500 then
1501 with_named_thread="-lpthread -lmach -lexc"
1502 CFLAGS="$CFLAGS -D_REENTRANT"
1503 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
1504 AC_DEFINE(HAVE_DEC_THREADS, [1], [Whether we are using DEC threads])
1505 AC_MSG_RESULT("yes")
1506 else
1507 AC_MSG_RESULT("no")
1508 fi # DEC threads
1509 fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
1510
1511
1512 dnl This is needed because -lsocket has to come after the thread
1513 dnl library on SCO.
1514 AC_DEFUN([MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK], [
1515 LIBS=`echo " $LIBS " | sed -e 's/ -lsocket / /g'`
1516 ])
1517 # Hack for SCO UNIX
1518 if test "$with_named_thread" = "no"
1519 then
1520 AC_MSG_CHECKING("SCO threads")
1521 if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
1522 then
1523 if test -f /usr/lib/libgthreads.a -o -f /usr/lib/libgthreads.so
1524 then
1525 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1526 with_named_thread="-lgthreads -lsocket -lgthreads"
1527 # sched.h conflicts with fsu-threads
1528 touch ./include/sched.h
1529 touch ./include/semaphore.h
1530
1531 # We must have gcc
1532 if expr "$CC" : ".*gcc.*"
1533 then
1534 AC_MSG_RESULT("yes")
1535 else
1536 AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]);
1537 fi
1538 AC_MSG_RESULT("yes")
1539 elif test -f /usr/local/lib/libpthread.a -o -f /usr/local/lib/libpthread.so
1540 then
1541 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1542 with_named_thread="-lpthread -lsocket"
1543 # sched.h conflicts with fsu-threads
1544 # touch ./include/sched.h
1545
1546 AC_MSG_CHECKING("for gcc")
1547 # We must have gcc
1548 if expr "$CC" : ".*gcc.*"
1549 then
1550 AC_MSG_RESULT("yes")
1551 else
1552 AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]);
1553 fi
1554 AC_MSG_RESULT("yes")
1555 # Hack for SCO UnixWare 7.1.x
1556 #
1557 elif test "$with_named_thread" = "no"
1558 then
1559 AC_MSG_RESULT("no")
1560 AC_MSG_CHECKING("SCO UnixWare 7.1.x native threads")
1561 if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
1562 then
1563 if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
1564 then
1565 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1566 if expr "$CC" : ".*gcc.*"
1567 then
1568 with_named_thread="-pthread -lsocket -lnsl"
1569 else
1570 with_named_thread="-Kthread -lsocket -lnsl"
1571 fi
1572 if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
1573 then
1574 AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1])
1575 fi
1576 AC_MSG_RESULT("yes")
1577 # We must have cc
1578 AC_MSG_CHECKING("for gcc")
1579 if expr "$CC" : ".*gcc.*"
1580 then
1581 CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1582 CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1583 else
1584 CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1585 CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1586 fi
1587 else
1588 AC_MSG_ERROR([configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual.])
1589 fi
1590 else
1591 AC_MSG_RESULT("no")
1592 fi
1593 else
1594 AC_MSG_ERROR([On SCO UNIX MySQL requires that the FSUThreads package is installed. See the Installation chapter in the Reference Manual.])
1595 fi
1596 else
1597 AC_MSG_RESULT("no")
1598 fi
1599 fi
1600
1601 #
1602 # Check for SCO threading libraries
1603 #
1604 if test "$with_named_thread" = "no"
1605 then
1606 AC_MSG_CHECKING([SCO OpenServer 6, UnixWare 7 or OpenUNIX 8 native threads])
1607 if expr "$SYSTEM_TYPE" : ".*UnixWare.*" > /dev/null || \
1608 expr "$SYSTEM_TYPE" : ".*SCO_SV6.*" > /dev/null || \
1609 expr "$SYSTEM_TYPE" : ".*OpenUNIX.*" > /dev/null
1610 then
1611 if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
1612 then
1613 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1614 if expr "$CC" : ".*gcc.*" > /dev/null
1615 then
1616 with_named_thread="-pthread -lsocket -lnsl"
1617 CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1618 CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1619 else
1620 with_named_thread="-Kthread -lsocket -lnsl"
1621 CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1622 CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1623 fi
1624 if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
1625 then
1626 AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1], [Have UnixWare 7 (or similar) almost-POSIX threading library])
1627 fi
1628 AC_MSG_RESULT(yes)
1629 else
1630 AC_MSG_ERROR([configure: error: Can't find thread library on SCO/Caldera system. See the Installation chapter in the Reference Manual.])
1631 fi
1632 else
1633 AC_MSG_RESULT(no)
1634 fi
1635 fi
1636
1637 # Hack for Siemens UNIX
1638 if test "$with_named_thread" = "no"
1639 then
1640 AC_MSG_CHECKING("Siemens threads")
1641 if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4"
1642 then
1643 LIBS="-lxnet $LIBS"
1644 NON_THREADED_LIBS="-lxnet $NON_THREADED_LIBS"
1645 with_named_thread="-Kthread $LDFLAGS -lxnet"
1646 LD_FLAGS=""
1647 CFLAGS="-Kthread $CFLAGS"
1648 CXXFLAGS="-Kthread $CXXFLAGS"
1649 AC_MSG_RESULT("yes")
1650 else
1651 AC_MSG_RESULT("no")
1652 fi
1653 fi
1654
1655 # Use library named -lpthread
1656 if test "$with_named_thread" = "no" -a "$with_pthread" = "yes"
1657 then
1658 with_named_thread="-lpthread"
1659 fi
1660
1661 #---END:
1662
1663 # Hack for Solaris >= 2.5
1664 # We want both the new and the old interface
1665
1666 if test "$with_named_thread" = "no"
1667 then
1668 AC_MSG_CHECKING("Solaris threads")
1669 if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
1670 then
1671 with_named_thread="-lpthread -lthread"
1672 AC_MSG_RESULT("yes")
1673 else
1674 AC_MSG_RESULT("no")
1675 fi
1676 fi
1677
1678 # Should we use named pthread library ?
1679 AC_MSG_CHECKING("named thread libs:")
1680 if test "$with_named_thread" != "no"
1681 then
1682 LIBS="$with_named_thread $LIBS $with_named_thread"
1683 with_posix_threads="yes"
1684 AC_MSG_RESULT("$with_named_thread")
1685 else
1686 AC_MSG_RESULT("no")
1687 # pthread_create is in standard libraries (As in BSDI 3.0)
1688 AC_MSG_CHECKING("for pthread_create in -libc");
1689 AC_TRY_LINK(
1690 [#include <pthread.h>],
1691 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1692 with_posix_threads=yes, with_posix_threads=no)
1693 AC_MSG_RESULT("$with_posix_threads")
1694 if test "$with_posix_threads" = "no"
1695 then
1696 AC_MSG_CHECKING("for pthread_create in -lpthread");
1697 ac_save_LIBS="$LIBS"
1698 LIBS="$LIBS -lpthread"
1699 AC_TRY_LINK(
1700 [#include <pthread.h>],
1701 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1702 with_posix_threads=yes, with_posix_threads=no)
1703 AC_MSG_RESULT("$with_posix_threads")
1704 if test "$with_posix_threads" = "no"
1705 then
1706 LIBS=" $ac_save_LIBS -lpthreads"
1707 AC_MSG_CHECKING("for pthread_create in -lpthreads");
1708 AC_TRY_LINK(
1709 [#include <pthread.h>],
1710 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1711 with_posix_threads=yes, with_posix_threads=no)
1712 AC_MSG_RESULT("$with_posix_threads")
1713 if test "$with_posix_threads" = "no"
1714 then
1715 # This is for FreeBSD
1716 LIBS="$ac_save_LIBS -pthread"
1717 AC_MSG_CHECKING("for pthread_create in -pthread");
1718 AC_TRY_LINK(
1719 [#include <pthread.h>],
1720 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1721 with_posix_threads=yes, with_posix_threads=no)
1722 AC_MSG_RESULT("$with_posix_threads")
1723 fi
1724 fi
1725 fi
1726 fi
1727
1728 #---START: Used in for client configure
1729 # Must be checked after, because strtok_r may be in -lpthread
1730 # On AIX strtok_r is in libc_r
1731
1732 my_save_LIBS="$LIBS"
1733 AC_CHECK_LIB(pthread,strtok_r)
1734 LIBS="$my_save_LIBS"
1735 if test "$ac_cv_lib_pthread_strtok_r" = "no"
1736 then
1737 AC_CHECK_LIB(c_r,strtok_r)
1738 case "$with_osf32_threads---$target_os" in
1739 # Don't keep -lc_r in LIBS; -pthread handles it magically
1740 yes---* | *---freebsd* | *---hpux*) LIBS="$my_save_LIBS" ;;
1741
1742 esac
1743 AC_CHECK_FUNCS(strtok_r pthread_init)
1744 else
1745 AC_CHECK_FUNCS(strtok_r)
1746 fi
1747 #---END:
1748
1749 # dlopen, dlerror
1750 case "$with_mysqld_ldflags " in
1751
1752 *"-all-static "*)
1753 # No need to check for dlopen when mysqld is linked with
1754 # -all-static as it won't be able to load any functions.
1755 # NOTE! It would be better if it was possible to test if dlopen
1756 # can be used, but a good way to test it couldn't be found
1757
1758 ;;
1759
1760 *)
1761 # Check for dlopen, needed for user definable functions
1762 # This must be checked after threads on AIX
1763 # We only need this for mysqld, not for the clients.
1764
1765 my_save_LIBS="$LIBS"
1766 LIBS=""
1767 AC_CHECK_LIB(dl,dlopen)
1768 LIBDL=$LIBS
1769 LIBS="$my_save_LIBS"
1770 AC_SUBST(LIBDL)
1771
1772 my_save_LIBS="$LIBS"
1773 LIBS="$LIBS $LIBDL"
1774 AC_CHECK_FUNCS(dlopen dlerror)
1775 LIBS="$my_save_LIBS"
1776
1777 ;;
1778 esac
1779
1780
1781 # System characteristics
1782 case $SYSTEM_TYPE in
1783 *netware*) ;;
1784 *)
1785 AC_SYS_RESTARTABLE_SYSCALLS
1786 ;;
1787 esac
1788
1789 # Build optimized or debug version ?
1790 # First check for gcc and g++
1791 if test "$ac_cv_prog_gcc" = "yes"
1792 then
1793 DEBUG_CFLAGS="-g"
1794 DEBUG_OPTIMIZE_CC="-O"
1795 OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
1796 else
1797 DEBUG_CFLAGS="-g"
1798 DEBUG_OPTIMIZE_CC=""
1799 OPTIMIZE_CFLAGS="-O"
1800 fi
1801 if test "$ac_cv_prog_cxx_g" = "yes"
1802 then
1803 DEBUG_CXXFLAGS="-g"
1804 DEBUG_OPTIMIZE_CXX="-O"
1805 OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
1806 else
1807 DEBUG_CXXFLAGS="-g"
1808 DEBUG_OPTIMIZE_CXX=""
1809 OPTIMIZE_CXXFLAGS="-O"
1810 fi
1811
1812 if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
1813 DEBUG_CFLAGS="-g -DDEBUG -sym internal,codeview4"
1814 DEBUG_CXXFLAGS="-g -DDEBUG -sym internal,codeview4"
1815 DEBUG_OPTIMIZE_CC="-DDEBUG"
1816 DEBUG_OPTIMIZE_CXX="-DDEBUG"
1817 OPTIMIZE_CFLAGS="-O3 -DNDEBUG"
1818 OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG"
1819 fi
1820
1821 # If the user specified CFLAGS, we won't add any optimizations
1822 if test -n "$SAVE_CFLAGS"
1823 then
1824 OPTIMIZE_CFLAGS=""
1825 DEBUG_OPTIMIZE_CC=""
1826 fi
1827 # Ditto for CXXFLAGS
1828 if test -n "$SAVE_CXXFLAGS"
1829 then
1830 OPTIMIZE_CXXFLAGS=""
1831 DEBUG_OPTIMIZE_CXX=""
1832 fi
1833
1834 AC_ARG_WITH(debug,
1835 [ --without-debug Build a production version without debugging code],
1836 [with_debug=$withval],
1837 [with_debug=no])
1838 if test "$with_debug" = "yes"
1839 then
1840 # Medium debug.
1841 CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
1842 CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS"
1843 elif test "$with_debug" = "full"
1844 then
1845 # Full debug. Very slow in some cases
1846 CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
1847 CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
1848 else
1849 # Optimized version. No debug
1850 CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
1851 CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
1852 fi
1853
1854 # Force static compilation to avoid linking problems/get more speed
1855 AC_ARG_WITH(mysqld-ldflags,
1856 [ --with-mysqld-ldflags Extra linking arguments for mysqld],
1857 [MYSQLD_EXTRA_LDFLAGS=$withval],
1858 [MYSQLD_EXTRA_LDFLAGS=])
1859 AC_SUBST(MYSQLD_EXTRA_LDFLAGS)
1860
1861 AC_ARG_WITH(client-ldflags,
1862 [ --with-client-ldflags Extra linking arguments for clients],
1863 [CLIENT_EXTRA_LDFLAGS=$withval],
1864 [CLIENT_EXTRA_LDFLAGS=])
1865 AC_SUBST(CLIENT_EXTRA_LDFLAGS)
1866
1867 AC_ARG_WITH(mysqld-libs,
1868 [ --with-mysqld-libs Extra libraries to link with for mysqld],
1869 [MYSQLD_EXTRA_LIBS=$withval],
1870 [MYSQLD_EXTRA_LIBS=])
1871 AC_SUBST(MYSQLD_EXTRA_LIBS)
1872
1873 AC_ARG_WITH(lib-ccflags,
1874 [ --with-lib-ccflags Extra CC options for libraries],
1875 [LIB_EXTRA_CCFLAGS=$withval],
1876 [LIB_EXTRA_CCFLAGS=])
1877 AC_SUBST(LIB_EXTRA_CCFLAGS)
1878
1879 # Avoid stupid bug on some OS
1880 AC_ARG_WITH(low-memory,
1881 [ --with-low-memory Try to use less memory to compile to avoid
1882 memory limitations.],
1883 [with_lowmem=$withval],
1884 [with_lowmem=no])
1885 if test "$with_lowmem" = "yes"
1886 then
1887 if test "$ac_cv_prog_gcc" = "yes"
1888 then
1889 LM_CFLAGS="-fno-inline"
1890 else
1891 LM_CFLAGS="-O0"
1892 fi
1893 else
1894 LM_CFLAGS=""
1895 fi
1896 AC_SUBST(LM_CFLAGS)
1897
1898 AC_ARG_WITH(comment,
1899 [ --with-comment Comment about compilation environment.],
1900 [with_comment=$withval],
1901 [with_comment=no])
1902 if test "$with_comment" != "no"
1903 then
1904 COMPILATION_COMMENT=$with_comment
1905 else
1906 COMPILATION_COMMENT="Source distribution"
1907 fi
1908 AC_SUBST(COMPILATION_COMMENT)
1909
1910 AC_MSG_CHECKING("need of special linking flags")
1911 if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
1912 then
1913 LDFLAGS="$LDFLAGS -rdynamic"
1914 AC_MSG_RESULT("-rdynamic")
1915 else
1916 AC_MSG_RESULT("none")
1917 fi
1918
1919 dnl Checks for typedefs, structures, and compiler characteristics.
1920 AC_C_CONST
1921 AC_C_INLINE
1922 AC_TYPE_OFF_T
1923 AC_STRUCT_ST_RDEV
1924 AC_HEADER_TIME
1925 AC_STRUCT_TM
1926 MYSQL_NEEDS_MYSYS_NEW
1927 # AC_CHECK_SIZEOF return 0 when it does not find the size of a
1928 # type. We want a error instead.
1929 AC_CHECK_SIZEOF(char, 1)
1930 if test "$ac_cv_sizeof_char" -eq 0
1931 then
1932 AC_MSG_ERROR([No size for char type.
1933 A likely cause for this could be that there isn't any
1934 static libraries installed. You can verify this by checking if you have libm.a
1935 in /lib, /usr/lib or some other standard place. If this is the problem,
1936 install the static libraries and try again. If this isn't the problem,
1937 examine config.log for possible errors. If you want to report this, use
1938 'scripts/mysqlbug' and include at least the last 20 rows from config.log!])
1939 fi
1940 AC_CHECK_SIZEOF(char*, 4)
1941 AC_CHECK_SIZEOF(short, 2)
1942 AC_CHECK_SIZEOF(int, 4)
1943 if test "$ac_cv_sizeof_int" -eq 0
1944 then
1945 AC_MSG_ERROR("No size for int type.")
1946 fi
1947 AC_CHECK_SIZEOF(long, 4)
1948 if test "$ac_cv_sizeof_long" -eq 0
1949 then
1950 AC_MSG_ERROR("No size for long type.")
1951 fi
1952 AC_CHECK_SIZEOF(long long, 8)
1953 if test "$ac_cv_sizeof_long_long" -eq 0
1954 then
1955 AC_MSG_ERROR("MySQL needs a long long type.")
1956 fi
1957 # off_t is not a builtin type
1958 MYSQL_CHECK_SIZEOF(off_t, 4)
1959 if test "$ac_cv_sizeof_off_t" -eq 0
1960 then
1961 AC_MSG_ERROR("MySQL needs a off_t type.")
1962 fi
1963
1964 dnl
1965 dnl check if time_t is unsigned
1966 dnl
1967
1968 MYSQL_CHECK_TIME_T
1969
1970
1971 # do we need #pragma interface/#pragma implementation ?
1972 # yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
1973 AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
1974 # instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
1975 # follow any standard), we'll use well-defined preprocessor macros:
1976 AC_TRY_CPP([
1977 #if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
1978 #error USE_PRAGMA_IMPLEMENTATION
1979 #endif
1980 ],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
1981
1982 # This always gives a warning. Ignore it unless you are cross compiling
1983 AC_C_BIGENDIAN
1984 #---START: Used in for client configure
1985 # Check base type of last arg to accept
1986 MYSQL_TYPE_ACCEPT
1987 #---END:
1988 # Figure out what type of struct rlimit to use with setrlimit
1989 MYSQL_TYPE_STRUCT_RLIMIT
1990 # Find where the stack goes
1991 MYSQL_STACK_DIRECTION
1992 # We want to skip alloca on irix unconditionally. It may work on some version..
1993 MYSQL_FUNC_ALLOCA
1994 # Do struct timespec have members tv_sec or ts_sec
1995 MYSQL_TIMESPEC_TS
1996 # Do we have the tzname variable
1997 MYSQL_TZNAME
1998 # Do the system files define ulong
1999 MYSQL_CHECK_ULONG
2000 # Do the system files define uchar
2001 MYSQL_CHECK_UCHAR
2002 # Do the system files define uint
2003 MYSQL_CHECK_UINT
2004 # Check for fp_except in ieeefp.h
2005 MYSQL_CHECK_FP_EXCEPT
2006 # Check for IN_ADDR_T
2007 MYSQL_CHECK_IN_ADDR_T
2008 # Do the c++ compiler have a bool type
2009 MYSQL_CXX_BOOL
2010 # Check some common bugs with gcc 2.8.# on sparc
2011 if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
2012 MYSQL_CHECK_LONGLONG_TO_FLOAT
2013 if test "$ac_cv_conv_longlong_to_float" != "yes"
2014 then
2015 AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float!
2016 If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try
2017 again]);
2018 fi
2019 fi
2020 AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
2021 AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
2022 AC_CHECK_TYPES([u_int32_t])
2023
2024 MYSQL_PTHREAD_YIELD
2025
2026 ######################################################################
2027 # For readline/libedit (We simply move the mimimum amount of stuff from
2028 # the readline/libedit configure.in here)
2029
2030 dnl Checks for header files.
2031 AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
2032
2033 dnl Checks for library functions.
2034 AC_FUNC_ALLOCA
2035 AC_PROG_GCC_TRADITIONAL
2036 AC_TYPE_SIGNAL
2037 AC_CHECK_FUNCS(re_comp regcomp strdup)
2038
2039 dnl Sun compilers have their own vis.h that is about something
2040 dnl totally different. So, not to change the libedit source, we
2041 dnl do some additional checks before we define HAVE_VIS_H.
2042 AC_CHECK_HEADER(vis.h,
2043 [AC_CHECK_FUNC(strvis,
2044 [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
2045
2046 AC_CHECK_FUNCS(strlcat strlcpy)
2047 AC_CHECK_FUNCS(issetugid)
2048 AC_CHECK_FUNCS(fgetln)
2049 AC_CHECK_FUNCS(getline flockfile)
2050
2051 # from old readline settting:
2052
2053 MAKE_SHELL=/bin/sh
2054 AC_SUBST(MAKE_SHELL)
2055
2056 # Already-done: stdlib.h string.h unistd.h termios.h
2057 AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
2058 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
2059 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
2060 paths.h semaphore.h)
2061
2062 # Already-done: strcasecmp
2063 AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
2064
2065 AC_STAT_MACROS_BROKEN
2066 MYSQL_SIGNAL_CHECK
2067 MYSQL_CHECK_GETPW_FUNCS
2068 MYSQL_HAVE_TIOCGWINSZ
2069 MYSQL_HAVE_FIONREAD
2070 MYSQL_HAVE_TIOCSTAT
2071 MYSQL_STRUCT_DIRENT_D_INO
2072 MYSQL_STRUCT_DIRENT_D_NAMLEN
2073 MYSQL_TYPE_SIGHANDLER
2074 MYSQL_CHECK_MULTIBYTE
2075 if test "$with_named_curses" = "no"
2076 then
2077 MYSQL_CHECK_LIB_TERMCAP
2078 else
2079 TERMCAP_LIB="$with_named_curses"
2080 fi
2081 AC_SUBST(TERMCAP_LIB)
2082
2083 # Check if the termcap function 'tgoto' is already declared in
2084 # system header files or if it need to be declared locally
2085 AC_CHECK_DECLS(tgoto,,,[
2086 #ifdef HAVE_CURSES_H
2087 # include <curses.h>
2088 #elif HAVE_NCURSES_H
2089 # include <ncurses.h>
2090 #endif
2091 #ifdef HAVE_TERM_H
2092 # include <term.h>
2093 #endif
2094 ])
2095
2096 LIBEDIT_LOBJECTS=""
2097 AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
2098 AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
2099 AC_CHECK_FUNC(strlcpy, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcpy.o"])
2100 AC_CHECK_FUNC(strlcat, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcat.o"])
2101 AC_CHECK_FUNC(fgetln, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS fgetln.o"])
2102 AC_SUBST(LIBEDIT_LOBJECTS)
2103 enable_readline="yes"
2104
2105 # End of readline/libedit stuff
2106 #########################################################################
2107
2108 dnl Checks for library functions.
2109
2110 #
2111 # The following code disables intrinsic function support while we test for
2112 # library functions. This is to avoid configure problems with Intel ecc
2113 # compiler
2114
2115 ORG_CFLAGS="$CFLAGS"
2116 if test "$GCC" != "yes"; then
2117 AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
2118 fi
2119
2120 #AC_FUNC_MMAP
2121 AC_TYPE_SIGNAL
2122 MYSQL_TYPE_QSORT
2123 AC_FUNC_UTIME_NULL
2124 AC_FUNC_VPRINTF
2125
2126 AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
2127 fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
2128 getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
2129 getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
2130 localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
2131 mkstemp mlockall perror poll pread pthread_attr_create mmap getpagesize \
2132 pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
2133 pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
2134 pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
2135 pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
2136 realpath rename rint rwlock_init setupterm \
2137 shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
2138 sighold sigset sigthreadmask \
2139 snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr strtol \
2140 strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
2141
2142 #
2143 #
2144 #
2145 case "$target" in
2146 *-*-aix4* | *-*-sco*)
2147 # (grr) aix 4.3 has a stub for clock_gettime, (returning ENOSYS)
2148 # and using AC_TRY_RUN is hard when cross-compiling
2149 # We also disable for SCO for the time being, the headers for the
2150 # thread library we use conflicts with other headers.
2151 ;;
2152 *) AC_CHECK_FUNCS(clock_gettime)
2153 ;;
2154 esac
2155
2156 # Check that isinf() is available in math.h and can be used in both C and C++
2157 # code
2158 AC_MSG_CHECKING(for isinf in <math.h>)
2159 AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
2160 AC_MSG_RESULT(yes)
2161 AC_MSG_CHECKING(whether isinf() can be used in C++ code)
2162 AC_LANG_SAVE
2163 AC_LANG_CPLUSPLUS
2164 AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
2165 AC_MSG_RESULT(yes)
2166 AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
2167 AC_MSG_RESULT(no))
2168 AC_LANG_RESTORE,
2169 AC_MSG_RESULT(no))
2170
2171 CFLAGS="$ORG_CFLAGS"
2172
2173 # Sanity check: We chould not have any fseeko symbol unless
2174 # large_file_support=yes
2175 AC_CHECK_FUNC(fseeko,
2176 [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
2177 then
2178 AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
2179 fi]
2180 )
2181
2182 # Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments)
2183 ac_save_CXXFLAGS="$CXXFLAGS"
2184 AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
2185 AC_LANG_SAVE
2186 AC_LANG_CPLUSPLUS
2187
2188 # Test whether madvise() is declared in C++ code -- it is not on some
2189 # systems, such as Solaris
2190 AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
2191 #include <sys/types.h>
2192 #include <sys/mman.h>
2193 #endif])
2194
2195 # Do not treat warnings as errors if we are linking against other libc
2196 # this is to work around gcc not being permissive on non-system includes
2197 # with respect to ANSI C++
2198 # We also remove the -fbranch-probabilities option as this will give warnings
2199 # about not profiled code, which confuses configure
2200 # We also must remove -W and -Wcheck which on icc produces warnings that
2201 # we don't want to catch with -Werror
2202
2203 if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
2204 then
2205 CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
2206 fi
2207
2208 AC_TRY_COMPILE(
2209 [#undef inline
2210 #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2211 #define _REENTRANT
2212 #endif
2213 #include <pthread.h>
2214 #include <sys/types.h>
2215 #include <sys/socket.h>
2216 #include <netinet/in.h>
2217 #include <arpa/inet.h>
2218 #include <netdb.h>],
2219 [int skr;
2220 struct hostent *foo = gethostbyaddr_r((const char *) 0,
2221 0, 0, (struct hostent *) 0, (char *) NULL, 0, &skr); return (foo == 0);],
2222 mysql_cv_gethost_style=solaris, mysql_cv_gethost_style=other))
2223 AC_LANG_RESTORE
2224 CXXFLAGS="$ac_save_CXXFLAGS"
2225 if test "$mysql_cv_gethost_style" = "solaris"
2226 then
2227 AC_DEFINE([HAVE_SOLARIS_STYLE_GETHOST], [1],
2228 [Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines this with 8 arguments])
2229 fi
2230
2231 #---START: Used in for client configure
2232
2233 # Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris)
2234 ac_save_CXXFLAGS="$CXXFLAGS"
2235 AC_CACHE_CHECK([style of gethostname_r routines], mysql_cv_gethostname_style,
2236 AC_LANG_SAVE
2237 AC_LANG_CPLUSPLUS
2238 if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
2239 then
2240 CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
2241 fi
2242 AC_TRY_COMPILE(
2243 [#undef inline
2244 #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2245 #define _REENTRANT
2246 #endif
2247 #include <pthread.h>
2248 #include <sys/types.h>
2249 #include <sys/socket.h>
2250 #include <netinet/in.h>
2251 #include <arpa/inet.h>
2252 #include <netdb.h>],
2253 [int skr;
2254
2255 skr = gethostbyname_r((const char *) 0,
2256 (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);],
2257 mysql_cv_gethostname_style=glibc2, mysql_cv_gethostname_style=other))
2258 AC_LANG_RESTORE
2259 CXXFLAGS="$ac_save_CXXFLAGS"
2260 if test "$mysql_cv_gethostname_style" = "glibc2"
2261 then
2262 AC_DEFINE([HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE], [1],
2263 [Solaris define gethostbyname_r with 5 arguments. glibc2 defines this with 6 arguments])
2264 fi
2265
2266 # Check 3rd argument of getthostbyname_r
2267 ac_save_CXXFLAGS="$CXXFLAGS"
2268 AC_CACHE_CHECK([3 argument to gethostname_r routines], mysql_cv_gethostname_arg,
2269 AC_LANG_SAVE
2270 AC_LANG_CPLUSPLUS
2271 if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
2272 then
2273 CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
2274 fi
2275 AC_TRY_COMPILE(
2276 [#undef inline
2277 #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2278 #define _REENTRANT
2279 #endif
2280 #include <pthread.h>
2281 #include <sys/types.h>
2282 #include <sys/socket.h>
2283 #include <netinet/in.h>
2284 #include <arpa/inet.h>
2285 #include <netdb.h>],
2286 [int skr;
2287
2288 skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);],
2289 mysql_cv_gethostname_arg=hostent_data, mysql_cv_gethostname_arg=char))
2290 AC_LANG_RESTORE
2291 CXXFLAGS="$ac_save_CXXFLAGS"
2292 if test "$mysql_cv_gethostname_arg" = "hostent_data"
2293 then
2294 AC_DEFINE([HAVE_GETHOSTBYNAME_R_RETURN_INT], [1],
2295 [In OSF 4.0f the 3'd argument to gethostname_r is hostent_data *])
2296 fi
2297
2298
2299 # Check definition of pthread_getspecific
2300 AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
2301 AC_TRY_COMPILE(
2302 [#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2303 #define _REENTRANT
2304 #endif
2305 #define _POSIX_PTHREAD_SEMANTICS
2306 #include <pthread.h> ],
2307 [ void *pthread_getspecific(pthread_key_t key);
2308 pthread_getspecific((pthread_key_t) NULL); ],
2309 mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
2310 if test "$mysql_cv_getspecific_args" = "other"
2311 then
2312 AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
2313 [For some non posix threads])
2314 fi
2315
2316 # Check definition of pthread_mutex_init
2317 AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
2318 AC_TRY_COMPILE(
2319 [#if !defined(SCO) && !defined(__osf__)
2320 #define _REENTRANT
2321 #endif
2322 #define _POSIX_PTHREAD_SEMANTICS
2323 #include <pthread.h> ],
2324 [
2325 pthread_mutexattr_t attr;
2326 pthread_mutex_t mp;
2327 pthread_mutex_init(&mp,&attr); ],
2328 mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
2329 if test "$mysql_cv_mutex_init_args" = "other"
2330 then
2331 AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
2332 [For some non posix threads])
2333 fi
2334 #---END:
2335
2336 #---START: Used in for client configure
2337 # Check definition of readdir_r
2338 AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
2339 AC_TRY_LINK(
2340 [#if !defined(SCO) && !defined(__osf__)
2341 #define _REENTRANT
2342 #endif
2343 #define _POSIX_PTHREAD_SEMANTICS
2344 #include <pthread.h>
2345 #include <dirent.h>],
2346 [ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
2347 readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
2348 mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
2349 if test "$mysql_cv_readdir_r" = "POSIX"
2350 then
2351 AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
2352 fi
2353
2354 # Check definition of posix sigwait()
2355 AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
2356 AC_TRY_LINK(
2357 [#if !defined(SCO) && !defined(__osf__)
2358 #define _REENTRANT
2359 #endif
2360 #define _POSIX_PTHREAD_SEMANTICS
2361 #include <pthread.h>
2362 #include <signal.h>],
2363 [#ifndef _AIX
2364 sigset_t set;
2365 int sig;
2366 sigwait(&set,&sig);
2367 #endif],
2368 mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
2369 if test "$mysql_cv_sigwait" = "POSIX"
2370 then
2371 AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
2372 fi
2373
2374 if test "$mysql_cv_sigwait" != "POSIX"
2375 then
2376 unset mysql_cv_sigwait
2377 # Check definition of posix sigwait()
2378 AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
2379 AC_TRY_LINK(
2380 [#if !defined(SCO) && !defined(__osf__)
2381 #define _REENTRANT
2382 #endif
2383 #define _POSIX_PTHREAD_SEMANTICS
2384 #include <pthread.h>
2385 #include <signal.h>],
2386 [sigset_t set;
2387 int sig;
2388 sigwait(&set);],
2389 mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
2390 if test "$mysql_cv_sigwait" = "NONPOSIX"
2391 then
2392 AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
2393 fi
2394 fi
2395 #---END:
2396
2397 # Check if pthread_attr_setscope() exists
2398 AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
2399 AC_TRY_LINK(
2400 [#if !defined(SCO) && !defined(__osf__)
2401 #define _REENTRANT
2402 #endif
2403 #define _POSIX_PTHREAD_SEMANTICS
2404 #include <pthread.h>],
2405 [pthread_attr_t thr_attr;
2406 pthread_attr_setscope(&thr_attr,0);],
2407 mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
2408 if test "$mysql_cv_pthread_attr_setscope" = "yes"
2409 then
2410 AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
2411 fi
2412
2413 # Check for bad includes
2414 AC_MSG_CHECKING("can netinet files be included")
2415 AC_TRY_COMPILE(
2416 [#include <sys/types.h>
2417 #include <sys/socket.h>
2418 #include <netinet/in_systm.h>
2419 #include <netinet/in.h>
2420 #include <netinet/ip.h>
2421 #include <netinet/tcp.h>],
2422 [ printf("1\n"); ],
2423 netinet_inc=yes, netinet_inc=no)
2424 if test "$netinet_inc" = "no"
2425 then
2426 AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
2427 fi
2428 AC_MSG_RESULT("$netinet_inc")
2429
2430 # Only build client code?
2431 AC_ARG_WITH(server,
2432 [ --without-server Only build the client.],
2433 [with_server=$withval],
2434 [with_server=yes]
2435 )
2436
2437 AC_ARG_WITH(embedded-server,
2438 [ --with-embedded-server Build the embedded server (libmysqld).],
2439 [with_embedded_server=$withval],
2440 [with_embedded_server=no]
2441 )
2442
2443 AC_ARG_WITH(query_cache,
2444 [ --without-query-cache Do not build query cache.],
2445 [with_query_cache=$withval],
2446 [with_query_cache=yes]
2447 )
2448
2449 if test "$with_query_cache" = "yes"
2450 then
2451 AC_DEFINE([HAVE_QUERY_CACHE], [1], [If we want to have query cache])
2452 fi
2453
2454 AC_ARG_WITH(geometry,
2455 [ --without-geometry Do not build geometry-related parts.],
2456 [with_geometry=$withval],
2457 [with_geometry=yes]
2458 )
2459
2460 if test "$with_geometry" = "yes"
2461 then
2462 AC_DEFINE([HAVE_SPATIAL], [1], [Spatial extentions])
2463 AC_DEFINE([HAVE_RTREE_KEYS], [1], [RTree keys])
2464 fi
2465
2466 AC_ARG_WITH(embedded_privilege_control,
2467 [ --with-embedded-privilege-control
2468 Build parts to check user's privileges.
2469 Only affects embedded library.],
2470 [with_embedded_privilege_control=$withval],
2471 [with_embedded_privilege_control=no]
2472 )
2473
2474 if test "$with_embedded_privilege_control" = "yes"
2475 then
2476 AC_DEFINE([HAVE_EMBEDDED_PRIVILEGE_CONTROL], [1],
2477 [Access checks in embedded library])
2478 fi
2479
2480 AC_ARG_WITH(extra-tools,
2481 [ --without-extra-tools Skip building utilites in the tools directory.],
2482 [with_tools=$withval],
2483 [with_tools=yes]
2484 )
2485
2486 tools_dirs=""
2487 if test "$with_tools" = "yes"
2488 then
2489 if test "$THREAD_SAFE_CLIENT" = "no"
2490 then
2491 AC_MSG_WARN([extra-tools disabled because --enable-thread-safe-client wasn't used])
2492 else
2493 tools_dirs="tools"
2494 AC_CONFIG_FILES(tools/Makefile)
2495 fi
2496 fi
2497
2498 AC_ARG_WITH([mysqlmanager],
2499 AC_HELP_STRING([--with-mysqlmanager], [Build the mysqlmanager binary: yes/no (default: build if server is built.)]),
2500 [if test "x${withval}" != "xno"; then
2501 tools_dirs="$tools_dirs server-tools"
2502 fi],
2503 [if test "x${with_server}" = "xyes"; then
2504 tools_dirs="$tools_dirs server-tools"
2505 fi]
2506 )
2507
2508 AC_SUBST(tools_dirs)
2509
2510 #MYSQL_CHECK_CPU
2511 MYSQL_CHECK_VIO
2512 MYSQL_CHECK_OPENSSL
2513 MYSQL_CHECK_YASSL
2514
2515 libmysqld_dirs=
2516 linked_libmysqld_targets=
2517 if test "$with_embedded_server" = "yes"
2518 then
2519 libmysqld_dirs=libmysqld
2520 linked_libmysqld_targets="linked_libmysqld_sources linked_libmysqldex_sources"
2521 AC_CONFIG_FILES(libmysqld/Makefile libmysqld/examples/Makefile)
2522 # We can't build embedded library without building the server, because
2523 # we depend on libmysys, libmystrings, libmyisam, etc.
2524 with_server=yes
2525 fi
2526 # XXX: We need to add @libmysqld_extra_libs@ (or whatever) so that
2527 # mysql_config --libmysqld-libs will print out something like
2528 # -L/path/to/lib/mysql -lmysqld -lmyisam -lmysys -lmystrings -ldbug ...
2529 AC_SUBST([libmysqld_dirs])
2530 AC_SUBST([linked_libmysqld_targets])
2531
2532 # Shall we build the docs?
2533 AC_ARG_WITH(docs,
2534 [ --without-docs Skip building of the documentation.],
2535 [with_docs=$withval],
2536 [with_docs=yes]
2537 )
2538
2539 if test "$with_docs" = "yes"
2540 then
2541 docs_dirs="Docs"
2542 else
2543 docs_dirs=""
2544 fi
2545 AC_SUBST(docs_dirs)
2546
2547 # Shall we build the man pages?
2548 AC_ARG_WITH(man,
2549 [ --without-man Skip building of the man pages.],
2550 [with_man=$withval],
2551 [with_man=yes]
2552 )
2553
2554 # Shall we build the bench code?
2555 AC_ARG_WITH(bench,
2556 [ --without-bench Skip building of the benchmark suite.],
2557 [with_bench=$withval],
2558 [with_bench=yes]
2559 )
2560
2561 if test "$with_bench" = "yes"
2562 then
2563 bench_dirs="sql-bench"
2564 else
2565 bench_dirs=""
2566 fi
2567 bench_dirs="$bench_dirs mysql-test"
2568 AC_SUBST(bench_dirs)
2569
2570 # Don't build readline, i have it already
2571 AC_ARG_WITH(readline,
2572 [ --without-readline Use system readline instead of bundled copy.],
2573 [ with_readline=$withval ],
2574 [ with_readline=undefined ]
2575 )
2576
2577 AC_ARG_WITH(libedit,
2578 [ --without-libedit Use system libedit instead of bundled copy.],
2579 [ with_libedit=$withval ],
2580 [ with_libedit=undefined ]
2581 )
2582
2583 #
2584 # We support next variants of compilation:
2585 # --with-readline
2586 # | yes | no | undefined
2587 # --with-libedit | | |
2588 # ---------------+----------------+------+----------------------------------
2589 # yes | ERROR! | use libedit from mysql sources
2590 # ---------------+----------------+------+----------------------------------
2591 # no | use readline | use system readline or external libedit
2592 # | from mysql | according to results of m4 tests
2593 # ---------------+ sources (if it + +----------------------------------
2594 # undefined | is presented) | | use libedit from mysql sources
2595
2596
2597 compile_readline="no"
2598 compile_libedit="no"
2599
2600 if [test "$with_libedit" = "yes"] && [test "$with_readline" = "yes"]
2601 then
2602 AC_MSG_ERROR([You can not use --with-readline and --with-libedit at the same time, please choose one of it])
2603 fi
2604
2605 readline_topdir=""
2606 readline_basedir=""
2607 readline_dir=""
2608 readline_h_ln_cmd=""
2609 readline_link=""
2610 want_to_use_readline="no"
2611
2612 if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
2613 # For NetWare, do not need readline
2614 echo "Skipping readline"
2615 else
2616
2617 if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
2618 then
2619 readline_topdir="cmd-line-utils"
2620 readline_basedir="libedit"
2621 readline_dir="$readline_topdir/$readline_basedir"
2622 readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a"
2623 readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline"
2624 compile_libedit=yes
2625 AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1)
2626 AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
2627 elif test "$with_readline" = "yes"
2628 then
2629 readline_topdir="cmd-line-utils"
2630 readline_basedir="readline"
2631 readline_dir="$readline_topdir/$readline_basedir"
2632 readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
2633 readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
2634 compile_readline=yes
2635 want_to_use_readline="yes"
2636 AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
2637 else
2638 # Use system readline library
2639 AC_LANG_SAVE
2640 AC_LANG_CPLUSPLUS
2641 MYSQL_CHECK_LIBEDIT_INTERFACE
2642 MYSQL_CHECK_NEW_RL_INTERFACE
2643 MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
2644 AC_LANG_RESTORE
2645 if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "./cmd-line-utils/readline"]
2646 then
2647 # Use the new readline interface, but only if the package includes a bundled libreadline
2648 # this way we avoid linking commercial source with GPL readline
2649 readline_link="-lreadline"
2650 want_to_use_readline="yes"
2651 elif [test "$mysql_cv_libedit_interface" = "yes"]; then
2652 # Use libedit
2653 readline_link="-ledit"
2654 else
2655 AC_MSG_ERROR([Could not find system readline or libedit libraries
2656 Use --with-readline or --with-libedit to use the bundled
2657 versions of libedit or readline])
2658 fi
2659 fi
2660
2661 # if there is no readline, but we want to build with readline, we fail
2662 if [test "$want_to_use_readline" = "yes"] && [test ! -d "./cmd-line-utils/readline"]
2663 then
2664 AC_MSG_ERROR([This commercially licensed MySQL source package can't
2665 be built with libreadline. Please use --with-libedit to use
2666 the bundled version of libedit instead.])
2667 fi
2668
2669 fi
2670
2671 AC_SUBST(readline_dir)
2672 AC_SUBST(readline_topdir)
2673 AC_SUBST(readline_basedir)
2674 AC_SUBST(readline_link)
2675 AC_SUBST(readline_h_ln_cmd)
2676
2677 MYSQL_CHECK_BIG_TABLES
2678 MYSQL_CHECK_MAX_INDEXES
2679 MYSQL_CHECK_BDB
2680 MYSQL_CHECK_INNODB
2681 MYSQL_CHECK_EXAMPLEDB
2682 MYSQL_CHECK_ARCHIVEDB
2683 MYSQL_CHECK_CSVDB
2684 MYSQL_CHECK_BLACKHOLEDB
2685 MYSQL_CHECK_NDBCLUSTER
2686 MYSQL_CHECK_FEDERATED
2687
2688 # Include man pages, if desired, adapted to the configured parts.
2689 if test X"$with_man" = Xyes
2690 then
2691 # First, create the list of all man pages present.
2692 MANLISTFIL=manlist.$$
2693 TMPLISTFIL=`echo $MANLISTFIL | sed -e 's/manlist/tmplist/'`
2694 if test -f $MANLISTFIL -o -f $TMPLISTFIL
2695 then
2696 echo "Temp file '$MANLISTFIL' or '$TMPLISTFIL' already exists in '`pwd`' - aborting"
2697 exit 1
2698 fi
2699 touch $MANLISTFIL $TMPLISTFIL
2700
2701 ls $srcdir/man/*.[[18]] > $MANLISTFIL
2702
2703 # Then, remove all those pages from the list which are specific to parts
2704 # (table handlers, features, ...) which are not configured in this run.
2705 AC_MSG_CHECKING("for man pages to remove")
2706 MAN_DROP="dropping"
2707 if test X"$have_ndbcluster" != Xyes
2708 then
2709 MAN_DROP="$MAN_DROP ndbcluster"
2710 grep -v '/ndb' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
2711 fi
2712 if test X"$with_embedded_server" != Xyes
2713 then
2714 MAN_DROP="$MAN_DROP embedded"
2715 grep -v 'embedded' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
2716 fi
2717 if test X"$have_innodb" != Xyes
2718 then
2719 MAN_DROP="$MAN_DROP innodb"
2720 grep -v 'inno' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
2721 fi
2722 AC_MSG_RESULT([$MAN_DROP])
2723
2724 # Finally, split the man pages into sections 1 and 8.
2725 # Get rid of line breaks.
2726 man1_files=`sed -n -e '/\.1$/s/^.*man\///p' <$MANLISTFIL`
2727 man8_files=`sed -n -e '/\.8$/s/^.*man\///p' <$MANLISTFIL`
2728
2729 man_dirs="man"
2730 man1_files=`echo $man1_files`
2731 man8_files=`echo $man8_files`
2732 rm -f $MANLISTFIL $TMPLISTFIL
2733 else
2734 man_dirs=""
2735 man1_files=""
2736 man8_files=""
2737 fi
2738 AC_SUBST(man_dirs)
2739 AC_SUBST(man1_files)
2740 AC_SUBST(man8_files)
2741
2742 # If we have threads generate some library functions and test programs
2743 sql_server_dirs=
2744 server_scripts=
2745 thread_dirs=
2746
2747 dnl This probably should be cleaned up more - for now the threaded
2748 dnl client is just using plain-old libs.
2749 sql_client_dirs="strings regex mysys libmysql client"
2750 linked_client_targets="linked_libmysql_sources"
2751
2752 if test "$THREAD_SAFE_CLIENT" != "no"
2753 then
2754 sql_client_dirs="libmysql_r $sql_client_dirs"
2755 linked_client_targets="$linked_client_targets linked_libmysql_r_sources"
2756 AC_CONFIG_FILES(libmysql_r/Makefile)
2757 AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe])
2758 fi
2759
2760 CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
2761
2762 AC_SUBST(CLIENT_LIBS)
2763 AC_SUBST(NON_THREADED_LIBS)
2764 AC_SUBST(STATIC_NSS_FLAGS)
2765 AC_SUBST(sql_client_dirs)
2766 AC_SUBST(linked_client_targets)
2767
2768 # If configuring for NetWare, set up to link sources from and build the netware directory
2769 netware_dir=
2770 linked_netware_sources=
2771 if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
2772 netware_dir="netware"
2773 linked_netware_sources="linked_netware_sources"
2774 fi
2775 AC_SUBST(netware_dir)
2776 AC_SUBST(linked_netware_sources)
2777 AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
2778
2779 # Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
2780 export CC CXX CFLAGS CXXFLAGS LD LDFLAGS AR
2781 ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'"
2782
2783 if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
2784 then
2785 AC_DEFINE([THREAD], [1],
2786 [Define if you want to have threaded code. This may be undef on client code])
2787 # Avoid _PROGRAMS names
2788 THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o"
2789 AC_SUBST(THREAD_LOBJECTS)
2790 server_scripts="mysqld_safe mysql_install_db"
2791 sql_server_dirs="strings mysys dbug extra regex"
2792
2793
2794 #
2795 # Configuration for optional table handlers
2796 #
2797
2798 if test X"$have_berkeley_db" != Xno; then
2799 if test X"$have_berkeley_db" != Xyes; then
2800 # we must build berkeley db from source
2801 sql_server_dirs="$sql_server_dirs $have_berkeley_db"
2802 AC_CONFIG_FILES(bdb/Makefile)
2803
2804 echo "CONFIGURING FOR BERKELEY DB"
2805 bdb_conf_flags="--disable-shared --build=$build_alias"
2806 if test $with_debug = "yes"
2807 then
2808 bdb_conf_flags="$bdb_conf_flags --enable-debug --enable-diagnostic"
2809 fi
2810 # NOTICE: if you're compiling BDB, it needs to be a SUBDIR
2811 # of $srcdir (i.e., you can 'cd $srcdir/$bdb'). It won't
2812 # work otherwise.
2813 if test -d "$bdb"; then :
2814 else
2815 # This should only happen when doing a VPATH build
2816 echo "NOTICE: I have to make the BDB directory: `pwd`:$bdb"
2817 mkdir "$bdb" || exit 1
2818 fi
2819 if test -d "$bdb"/build_unix; then :
2820 else
2821 # This should only happen when doing a VPATH build
2822 echo "NOTICE: I have to make the build_unix directory: `pwd`:$bdb/build_unix"
2823 mkdir "$bdb/build_unix" || exit 1
2824 fi
2825 rel_srcdir=
2826 case "$srcdir" in
2827 /* ) rel_srcdir="$srcdir" ;;
2828 * ) rel_srcdir="../../$srcdir" ;;
2829 esac
2830 (cd $bdb/build_unix && \
2831 sh $rel_srcdir/$bdb/dist/configure $bdb_conf_flags) || \
2832 AC_MSG_ERROR([could not configure Berkeley DB])
2833
2834 dnl echo "bdb = '$bdb'; inc = '$bdb_includes', lib = '$bdb_libs'"
2835 echo "END OF BERKELEY DB CONFIGURATION"
2836 fi
2837
2838 AC_DEFINE([HAVE_BERKELEY_DB], [1], [Have berkeley db installed])
2839 else
2840 if test -d bdb; then :
2841 else
2842 mkdir bdb && mkdir bdb/build_unix
2843 fi
2844
2845 if test -r bdb/build_unix/db.h; then :
2846 else
2847 cat <<EOF > bdb/build_unix/db.h
2848
2849 This file is a placeholder to fool make. The way that automake
2850 and GNU make work together causes some files to depend on this
2851 header, even if we're not building with Berkeley DB.
2852
2853 Obviously, if this file *is* used, it'll break and hopefully we can find
2854 out why this file was generated by ${top_srcdir}/configure instead of
2855 the real db.h.
2856
2857 If you run into some problems because of this file, please use mysql_bug
2858 to generate a bug report, and give the exact output of make and any
2859 details you can think of. Send the message to bugs@lists.mysql.com.
2860
2861 Thank you!
2862
2863 EOF
2864 fi
2865 fi
2866
2867 if test X"$have_innodb" = Xyes
2868 then
2869 innodb_conf_flags=""
2870 sql_server_dirs="$sql_server_dirs innobase"
2871 AC_CONFIG_SUBDIRS(innobase)
2872 fi
2873
2874 case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc-$have_ndbcluster in
2875 *solaris*-i?86-no-yes)
2876 # ndb fail for whatever strange reason to link Sun Forte/x86
2877 # unless using incremental linker
2878 CXXFLAGS="$CXXFLAGS -xildon"
2879 ;;
2880 *) ;;
2881 esac
2882
2883 if test X"$have_ndbcluster" = Xyes
2884 then
2885 if test X"$mysql_cv_compress" != Xyes
2886 then
2887 echo
2888 echo "MySQL Cluster table handler ndbcluster requires compress/uncompress."
2889 echo "Commonly available in libzlib.a. Please install and rerun configure."
2890 echo
2891 exit 1
2892 fi
2893 sql_server_dirs="$sql_server_dirs ndb"
2894 fi
2895 #
2896 # END of configuration for optional table handlers
2897 #
2898 sql_server_dirs="$sql_server_dirs myisam myisammrg heap vio sql"
2899 fi
2900
2901 # IMPORTANT - do not modify LIBS past this line - this hack is the only way
2902 # I know to add the static NSS magic if we have static NSS libraries with
2903 # glibc - Sasha
2904
2905 LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
2906 LIBS="$LIBS $STATIC_NSS_FLAGS"
2907
2908 AC_SUBST(sql_server_dirs)
2909 AC_SUBST(thread_dirs)
2910 AC_SUBST(server_scripts)
2911
2912 # Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
2913 # Start with the (longer) server list, add each client item not yet present.
2914 sql_union_dirs=" $sql_server_dirs "
2915 for DIR in $sql_client_dirs
2916 do
2917 if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
2918 then
2919 : # already present, skip
2920 else
2921 sql_union_dirs="$sql_union_dirs $DIR "
2922 fi
2923 done
2924 AC_SUBST(sql_union_dirs)
2925
2926 # Some usefull subst
2927 AC_SUBST(CC)
2928 AC_SUBST(GXX)
2929
2930 # Set configuration options for make_binary_distribution
2931 case $SYSTEM_TYPE in
2932 *netware*)
2933 MAKE_BINARY_DISTRIBUTION_OPTIONS=--no-strip
2934 ;;
2935 *)
2936 MAKE_BINARY_DISTRIBUTION_OPTIONS=
2937 ;;
2938 esac
2939
2940
2941 if test X"$have_ndbcluster" = Xyes
2942 then
2943 MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster"
2944
2945 CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)"
2946 if test "$have_ndb_debug" = "default"
2947 then
2948 have_ndb_debug=$with_debug
2949 fi
2950
2951 if test "$have_ndb_debug" = "yes"
2952 then
2953 # Medium debug.
2954 NDB_DEFS="-DNDB_DEBUG -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
2955 elif test "$have_ndb_debug" = "full"
2956 then
2957 NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
2958 else
2959 # no extra ndb debug but still do asserts if debug version
2960 if test "$with_debug" = "yes" -o "$with_debug" = "full"
2961 then
2962 NDB_DEFS=""
2963 else
2964 NDB_DEFS="-DNDEBUG"
2965 fi
2966 fi
2967
2968 AC_SUBST([NDB_DEFS])
2969 AC_SUBST([ndb_cxxflags_fix])
2970
2971
2972 if test X"$ndb_port" = Xdefault
2973 then
2974 ndb_port="1186"
2975 fi
2976 AC_SUBST([ndb_port])
2977
2978 ndb_transporter_opt_objs=""
2979 if test "$ac_cv_func_shmget" = "yes" &&
2980 test "$ac_cv_func_shmat" = "yes" &&
2981 test "$ac_cv_func_shmdt" = "yes" &&
2982 test "$ac_cv_func_shmctl" = "yes" &&
2983 test "$ac_cv_func_sigaction" = "yes" &&
2984 test "$ac_cv_func_sigemptyset" = "yes" &&
2985 test "$ac_cv_func_sigaddset" = "yes" &&
2986 test "$ac_cv_func_pthread_sigmask" = "yes"
2987 then
2988 AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
2989 [Including Ndb Cluster DB shared memory transporter])
2990 AC_MSG_RESULT([Including ndb shared memory transporter])
2991 ndb_transporter_opt_objs="$ndb_transporter_opt_objs SHM_Transporter.lo SHM_Transporter.unix.lo"
2992 else
2993 AC_MSG_RESULT([Not including ndb shared memory transporter])
2994 fi
2995
2996 if test X"$have_ndb_sci" = Xyes
2997 then
2998 ndb_transporter_opt_objs="$ndb_transporter_opt_objs SCI_Transporter.lo"
2999 fi
3000 AC_SUBST([ndb_transporter_opt_objs])
3001
3002 ndb_opt_subdirs=
3003 ndb_bin_am_ldflags="-static"
3004 if test X"$have_ndb_test" = Xyes
3005 then
3006 ndb_opt_subdirs="test"
3007 ndb_bin_am_ldflags=""
3008 fi
3009 if test X"$have_ndb_docs" = Xyes
3010 then
3011 ndb_opt_subdirs="$ndb_opt_subdirs docs"
3012 ndb_bin_am_ldflags=""
3013 fi
3014 # building dynamic breaks on AIX. (If you want to try it and get unresolved
3015 # __vec__delete2 and some such, try linking against libhC.)
3016 case "$host_os" in
3017 aix3.* | aix4.0.* | aix4.1.*) ;;
3018 *) ndb_bin_am_ldflags="-static";;
3019 esac
3020 AC_SUBST([ndb_bin_am_ldflags])
3021 AC_SUBST([ndb_opt_subdirs])
3022
3023 NDB_SIZEOF_CHARP="$ac_cv_sizeof_charp"
3024 NDB_SIZEOF_CHAR="$ac_cv_sizeof_char"
3025 NDB_SIZEOF_SHORT="$ac_cv_sizeof_short"
3026 NDB_SIZEOF_INT="$ac_cv_sizeof_int"
3027 NDB_SIZEOF_LONG="$ac_cv_sizeof_long"
3028 NDB_SIZEOF_LONG_LONG="$ac_cv_sizeof_long_long"
3029 AC_SUBST([NDB_SIZEOF_CHARP])
3030 AC_SUBST([NDB_SIZEOF_CHAR])
3031 AC_SUBST([NDB_SIZEOF_SHORT])
3032 AC_SUBST([NDB_SIZEOF_INT])
3033 AC_SUBST([NDB_SIZEOF_LONG])
3034 AC_SUBST([NDB_SIZEOF_LONG_LONG])
3035
3036 AC_CONFIG_FILES(ndb/Makefile ndb/include/Makefile dnl
3037 ndb/src/Makefile ndb/src/common/Makefile dnl
3038 ndb/docs/Makefile dnl
3039 ndb/tools/Makefile dnl
3040 ndb/src/common/debugger/Makefile dnl
3041 ndb/src/common/debugger/signaldata/Makefile dnl
3042 ndb/src/common/portlib/Makefile dnl
3043 ndb/src/common/util/Makefile dnl
3044 ndb/src/common/logger/Makefile dnl
3045 ndb/src/common/transporter/Makefile dnl
3046 ndb/src/common/mgmcommon/Makefile dnl
3047 ndb/src/kernel/Makefile dnl
3048 ndb/src/kernel/error/Makefile dnl
3049 ndb/src/kernel/blocks/Makefile dnl
3050 ndb/src/kernel/blocks/cmvmi/Makefile dnl
3051 ndb/src/kernel/blocks/dbacc/Makefile dnl
3052 ndb/src/kernel/blocks/dbdict/Makefile dnl
3053 ndb/src/kernel/blocks/dbdih/Makefile dnl
3054 ndb/src/kernel/blocks/dblqh/Makefile dnl
3055 ndb/src/kernel/blocks/dbtc/Makefile dnl
3056 ndb/src/kernel/blocks/dbtup/Makefile dnl
3057 ndb/src/kernel/blocks/ndbfs/Makefile dnl
3058 ndb/src/kernel/blocks/ndbcntr/Makefile dnl
3059 ndb/src/kernel/blocks/qmgr/Makefile dnl
3060 ndb/src/kernel/blocks/trix/Makefile dnl
3061 ndb/src/kernel/blocks/backup/Makefile dnl
3062 ndb/src/kernel/blocks/dbutil/Makefile dnl
3063 ndb/src/kernel/blocks/suma/Makefile dnl
3064 ndb/src/kernel/blocks/dbtux/Makefile dnl
3065 ndb/src/kernel/vm/Makefile dnl
3066 ndb/src/mgmapi/Makefile dnl
3067 ndb/src/ndbapi/Makefile dnl
3068 ndb/src/mgmsrv/Makefile dnl
3069 ndb/src/mgmclient/Makefile dnl
3070 ndb/src/cw/Makefile dnl
3071 ndb/src/cw/cpcd/Makefile dnl
3072 ndb/test/Makefile dnl
3073 ndb/test/src/Makefile dnl
3074 ndb/test/ndbapi/Makefile dnl
3075 ndb/test/ndbapi/bank/Makefile dnl
3076 ndb/test/tools/Makefile dnl
3077 ndb/test/run-test/Makefile mysql-test/ndb/Makefile dnl
3078 ndb/include/ndb_version.h ndb/include/ndb_global.h dnl
3079 ndb/include/ndb_types.h dnl
3080 )
3081 fi
3082
3083 AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
3084
3085 # Output results
3086 AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
3087 strings/Makefile regex/Makefile heap/Makefile dnl
3088 myisam/Makefile myisammrg/Makefile dnl
3089 os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
3090 man/Makefile BUILD/Makefile vio/Makefile dnl
3091 libmysql/Makefile client/Makefile dnl
3092 pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
3093 sql-common/Makefile SSL/Makefile dnl
3094 dbug/Makefile scripts/Makefile dnl
3095 include/Makefile sql-bench/Makefile dnl
3096 server-tools/Makefile server-tools/instance-manager/Makefile dnl
3097 tests/Makefile Docs/Makefile support-files/Makefile dnl
3098 support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
3099 mysql-test/Makefile dnl
3100 netware/Makefile dnl
3101 include/mysql_version.h dnl
3102 cmd-line-utils/Makefile dnl
3103 cmd-line-utils/libedit/Makefile dnl
3104 win/Makefile dnl
3105 zlib/Makefile dnl
3106 debian/Makefile debian/defs.mk debian/control dnl
3107 cmd-line-utils/readline/Makefile)
3108 AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
3109 AC_OUTPUT
3110
3111 echo
3112 echo "MySQL has a Web site at http://www.mysql.com/ which carries details on the"
3113 echo "latest release, upcoming features, and other information to make your"
3114 echo "work or play with MySQL more productive. There you can also find"
3115 echo "information about mailing lists for MySQL discussion."
3116 echo
3117 echo "Remember to check the platform specific part of the reference manual for"
3118 echo "hints about installing MySQL on your platform. Also have a look at the"
3119 echo "files in the Docs directory."
3120 echo
3121 # The following text is checked in ./Do-compile to verify that configure
3122 # ended sucessfully - don't remove it.
3123 echo "Thank you for choosing MySQL!"
3124 echo

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26