You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

812 lines
22 KiB

Porting of "buffered read" patch to 5.0 and post-review fixes. The patch implements the idea suggested by Olaf van der Spek in thread "Client: many small reads?" (internals@lists.mysql.com). Now small reads performed by the client library are buffered. The buffering gives up to 2 times speedup when retrieving one-column tables. BUILD/SETUP.sh: Remove --with-vio option which no longer exist. BUILD/compile-pentium64-valgrind-max: Remove --with-vio option which no longer exist. config/ac-macros/misc.m4: Removed --with-vio configure switch: we always use VIO. The switch, in fact, only saved us one pointer dereferencing per call in case we had only one transport type in VIO enabled. config/ac-macros/openssl.m4: Removed HAVE_VIO. include/config-win.h: Removed HAVE_VIO (not needed anymore) Added HAVE_VIO_READ_BUFF (define buffered client reads for Windows clients). include/violite.h: Removed HAVE_VIO, as currently VIO is always in use. Added declaration for vio_read_buff and related members in struct VIO. sql-common/client.c: Use flags to set up vio read buffering in mysql_real_connect. sql/mysqld.cc: Use flags to disable vio read buffering when creating a server connection. vio/vio.c: Optionally set up vio read buffer when creating a new VIO structure. vio/viosocket.c: Implementation of client-side buffered reads in VIO: the idea is to buffer small reads in a client buffer to save amount of syscalls per retrieved result set. The implementation relies on the fact that read/recv will return as soon as there is some data in the kernel buffer, no matter how big the given user's buffer is. To be able to disable it in case recv/read don't have such semantics, the new calls are guarded with #define HAVE_VIO_READ_BUFF. Currently buffered reading is switched on only for BSD sockets and named pipes, both on Windows and UNIXes.
21 years ago
Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Added and used a configure.in macro. Replaced fixed limits by the configurable limit. Limited MyISAM indexes to its hard limit. Fixed a bug in opt_range.cc for many indexes with InnoDB. Tested for 2, 63, 64, 65, 127, 128, 129, 255, 256, and 257 indexes. Testing this part of the bugfix requires rebuilding of the server with different options. This cannot be done with our test suite. Therefore I added the necessary test files to the bug report. If you repeat the tests, please note that the ps_* tests fail for everything but 64 indexes. This is because of differences in the meta data, namely field lengths for index names etc. config/ac-macros/misc.m4: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Added a macro for the new build option. configure.in: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Added a call for the new macro. include/myisam.h: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Limit the number of keys for MyISAM to its hard limit. sql/mysql_priv.h: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Stick with the optimized Bitmap<64> if indexes are limited to 64 or lower. Otherwise use a bigger bitmap. It must be defined as a multiple of 8. sql/opt_range.cc: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Initialize an object element to avoid a crash when using InnoDB with many indexes. sql/unireg.h: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Replace the fixed limit by the configurable limit. tests/mysql_client_test.c: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Replace the fixed limit by the configurable limit.
20 years ago
WL#2286 - Compile MySQL w/YASSL support Fix GCC 4.0 link failure. Better CXX_VERSION guessing. config/ac-macros/misc.m4: Better CXX_VERSION guessing. configure.in: CXX_VERSION guessing moved to misc.m4. HAVE_EXPLICIT_TEMPLATE_INSTANTIATION moved to config.h. Use compiler AR with MIPSpro and Forte instead of instantiating templates explicitly. extra/yassl/src/crypto_wrapper.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/src/template_instnt.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/src/yassl_int.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/include/runtime.hpp: Fix GCC 4.0 link failure. Instruct compiler to always emit __cxa_pure_virtual even if it seems to be never used. extra/yassl/taocrypt/include/types.hpp: Include config.h. extra/yassl/taocrypt/src/algebra.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/taocrypt/src/dh.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/src/dsa.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/src/integer.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/taocrypt/src/rsa.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/src/template_instnt.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/field.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/item.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/item_buff.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/mysqld.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/opt_range.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/set_var.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/slave.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_acl.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_class.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_insert.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_map.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_select.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_show.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/table.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION.
21 years ago
  1. # Local macros for automake & autoconf
  2. # A local version of AC_CHECK_SIZEOF that includes sys/types.h
  3. dnl MYSQL_CHECK_SIZEOF(TYPE [, CROSS-SIZE])
  4. AC_DEFUN([MYSQL_CHECK_SIZEOF],
  5. [changequote(<<, >>)dnl
  6. dnl The name to #define.
  7. define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
  8. dnl The cache variable name.
  9. define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
  10. changequote([, ])dnl
  11. AC_MSG_CHECKING(size of $1)
  12. AC_CACHE_VAL(AC_CV_NAME,
  13. [AC_TRY_RUN([#include <stdio.h>
  14. #include <sys/types.h>
  15. #if STDC_HEADERS
  16. #include <stdlib.h>
  17. #include <stddef.h>
  18. #endif
  19. main()
  20. {
  21. FILE *f=fopen("conftestval", "w");
  22. if (!f) exit(1);
  23. fprintf(f, "%d\n", sizeof($1));
  24. exit(0);
  25. }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
  26. AC_MSG_RESULT($AC_CV_NAME)
  27. AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [ ])
  28. undefine([AC_TYPE_NAME])dnl
  29. undefine([AC_CV_NAME])dnl
  30. ])
  31. #---START: Used in for client configure
  32. AC_DEFUN([MYSQL_TYPE_ACCEPT],
  33. [ac_save_CXXFLAGS="$CXXFLAGS"
  34. AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
  35. AC_LANG_PUSH(C++)
  36. if test "$ac_cv_prog_gxx" = "yes"
  37. then
  38. # Add -Werror, remove -fbranch-probabilities (Bug #268)
  39. CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
  40. fi
  41. mysql_cv_btype_last_arg_accept=none
  42. [AC_TRY_COMPILE([#if defined(inline)
  43. #undef inline
  44. #endif
  45. #include <stdlib.h>
  46. #include <sys/types.h>
  47. #include <sys/socket.h>
  48. ],
  49. [int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0); return (a != 0);],
  50. mysql_cv_btype_last_arg_accept=socklen_t)]
  51. if test "$mysql_cv_btype_last_arg_accept" = "none"; then
  52. [AC_TRY_COMPILE([#if defined(inline)
  53. #undef inline
  54. #endif
  55. #include <stdlib.h>
  56. #include <sys/types.h>
  57. #include <sys/socket.h>
  58. ],
  59. [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0); return (a != 0);],
  60. mysql_cv_btype_last_arg_accept=size_t)]
  61. fi
  62. if test "$mysql_cv_btype_last_arg_accept" = "none"; then
  63. mysql_cv_btype_last_arg_accept=int
  64. fi)
  65. AC_LANG_POP(C++)
  66. AC_DEFINE_UNQUOTED([SOCKET_SIZE_TYPE], [$mysql_cv_btype_last_arg_accept],
  67. [The base type of the last arg to accept])
  68. CXXFLAGS="$ac_save_CXXFLAGS"
  69. ])
  70. #---END:
  71. dnl Find type of qsort
  72. AC_DEFUN([MYSQL_TYPE_QSORT],
  73. [AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort,
  74. [AC_TRY_COMPILE([#include <stdlib.h>
  75. #ifdef __cplusplus
  76. extern "C"
  77. #endif
  78. void qsort(void *base, size_t nel, size_t width,
  79. int (*compar) (const void *, const void *));
  80. ],
  81. [int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
  82. AC_DEFINE_UNQUOTED([RETQSORTTYPE], [$mysql_cv_type_qsort],
  83. [The return type of qsort (int or void).])
  84. if test "$mysql_cv_type_qsort" = "void"
  85. then
  86. AC_DEFINE_UNQUOTED([QSORT_TYPE_IS_VOID], [1], [qsort returns void])
  87. fi
  88. ])
  89. #---START: Figure out whether to use 'struct rlimit' or 'struct rlimit64'
  90. AC_DEFUN([MYSQL_TYPE_STRUCT_RLIMIT],
  91. [ac_save_CXXFLAGS="$CXXFLAGS"
  92. AC_CACHE_CHECK([struct type to use with setrlimit], mysql_cv_btype_struct_rlimit,
  93. AC_LANG_PUSH(C++)
  94. if test "$ac_cv_prog_gxx" = "yes"
  95. then
  96. # Add -Werror, remove -fbranch-probabilities (Bug #268)
  97. CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
  98. fi
  99. mysql_cv_btype_struct_rlimit=none
  100. [AC_TRY_COMPILE([#if defined(inline)
  101. #undef inline
  102. #endif
  103. #include <stdlib.h>
  104. #include <sys/resource.h>
  105. ],
  106. [struct rlimit64 rl; setrlimit(RLIMIT_CORE, &rl);],
  107. mysql_cv_btype_struct_rlimit="struct rlimit64")]
  108. if test "$mysql_cv_btype_struct_rlimit" = "none"; then
  109. mysql_cv_btype_struct_rlimit="struct rlimit"
  110. fi)
  111. AC_LANG_POP(C++)
  112. AC_DEFINE_UNQUOTED([STRUCT_RLIMIT], [$mysql_cv_btype_struct_rlimit],
  113. [The struct rlimit type to use with setrlimit])
  114. CXXFLAGS="$ac_save_CXXFLAGS"
  115. ])
  116. #---END:
  117. AC_DEFUN([MYSQL_TIMESPEC_TS],
  118. [AC_CACHE_CHECK([if struct timespec has a ts_sec member], mysql_cv_timespec_ts,
  119. [AC_TRY_COMPILE([#include <pthread.h>
  120. #ifdef __cplusplus
  121. extern "C"
  122. #endif
  123. ],
  124. [struct timespec abstime;
  125. abstime.ts_sec = time(NULL)+1;
  126. abstime.ts_nsec = 0;
  127. ], mysql_cv_timespec_ts=yes, mysql_cv_timespec_ts=no)])
  128. if test "$mysql_cv_timespec_ts" = "yes"
  129. then
  130. AC_DEFINE([HAVE_TIMESPEC_TS_SEC], [1],
  131. [Timespec has a ts_sec instead of tv_sev])
  132. fi
  133. ])
  134. AC_DEFUN([MYSQL_TZNAME],
  135. [AC_CACHE_CHECK([if we have tzname variable], mysql_cv_tzname,
  136. [AC_TRY_COMPILE([#include <time.h>
  137. #ifdef __cplusplus
  138. extern "C"
  139. #endif
  140. ],
  141. [ tzset();
  142. return tzname[0] != 0;
  143. ], mysql_cv_tzname=yes, mysql_cv_tzname=no)])
  144. if test "$mysql_cv_tzname" = "yes"
  145. then
  146. AC_DEFINE([HAVE_TZNAME], [1], [Have the tzname variable])
  147. fi
  148. ])
  149. #---START: Used in for client configure
  150. AC_DEFUN([MYSQL_CHECK_ULONG],
  151. [AC_MSG_CHECKING(for type ulong)
  152. AC_CACHE_VAL(ac_cv_ulong,
  153. [AC_TRY_RUN([#include <stdio.h>
  154. #include <sys/types.h>
  155. main()
  156. {
  157. ulong foo;
  158. foo++;
  159. exit(0);
  160. }], ac_cv_ulong=yes, ac_cv_ulong=no, ac_cv_ulong=no)])
  161. AC_MSG_RESULT($ac_cv_ulong)
  162. if test "$ac_cv_ulong" = "yes"
  163. then
  164. AC_DEFINE([HAVE_ULONG], [1], [system headers define ulong])
  165. fi
  166. ])
  167. AC_DEFUN([MYSQL_CHECK_UCHAR],
  168. [AC_MSG_CHECKING(for type uchar)
  169. AC_CACHE_VAL(ac_cv_uchar,
  170. [AC_TRY_RUN([#include <stdio.h>
  171. #include <sys/types.h>
  172. main()
  173. {
  174. uchar foo;
  175. foo++;
  176. exit(0);
  177. }], ac_cv_uchar=yes, ac_cv_uchar=no, ac_cv_uchar=no)])
  178. AC_MSG_RESULT($ac_cv_uchar)
  179. if test "$ac_cv_uchar" = "yes"
  180. then
  181. AC_DEFINE([HAVE_UCHAR], [1], [system headers define uchar])
  182. fi
  183. ])
  184. AC_DEFUN([MYSQL_CHECK_UINT],
  185. [AC_MSG_CHECKING(for type uint)
  186. AC_CACHE_VAL(ac_cv_uint,
  187. [AC_TRY_RUN([#include <stdio.h>
  188. #include <sys/types.h>
  189. main()
  190. {
  191. uint foo;
  192. foo++;
  193. exit(0);
  194. }], ac_cv_uint=yes, ac_cv_uint=no, ac_cv_uint=no)])
  195. AC_MSG_RESULT($ac_cv_uint)
  196. if test "$ac_cv_uint" = "yes"
  197. then
  198. AC_DEFINE([HAVE_UINT], [1], [system headers define uint])
  199. fi
  200. ])
  201. AC_DEFUN([MYSQL_CHECK_IN_ADDR_T],
  202. [AC_MSG_CHECKING(for type in_addr_t)
  203. AC_CACHE_VAL(ac_cv_in_addr_t,
  204. [AC_TRY_RUN([#include <stdio.h>
  205. #include <sys/types.h>
  206. #include <sys/socket.h>
  207. #include <netinet/in.h>
  208. #include <arpa/inet.h>
  209. int main(int argc, char **argv)
  210. {
  211. in_addr_t foo;
  212. exit(0);
  213. }], ac_cv_in_addr_t=yes, ac_cv_in_addr_t=no, ac_cv_in_addr_t=no)])
  214. AC_MSG_RESULT($ac_cv_in_addr_t)
  215. if test "$ac_cv_in_addr_t" = "yes"
  216. then
  217. AC_DEFINE([HAVE_IN_ADDR_T], [1], [system headers define in_addr_t])
  218. fi
  219. ])
  220. AC_DEFUN([MYSQL_PTHREAD_YIELD],
  221. [AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
  222. [AC_TRY_LINK([#define _GNU_SOURCE
  223. #include <pthread.h>
  224. #ifdef __cplusplus
  225. extern "C"
  226. #endif
  227. ],
  228. [
  229. pthread_yield();
  230. ], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
  231. if test "$ac_cv_pthread_yield_zero_arg" = "yes"
  232. then
  233. AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
  234. [pthread_yield that doesn't take any arguments])
  235. fi
  236. ]
  237. [AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
  238. [AC_TRY_LINK([#define _GNU_SOURCE
  239. #include <pthread.h>
  240. #ifdef __cplusplus
  241. extern "C"
  242. #endif
  243. ],
  244. [
  245. pthread_yield(0);
  246. ], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
  247. if test "$ac_cv_pthread_yield_one_arg" = "yes"
  248. then
  249. AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
  250. [pthread_yield function with one argument])
  251. fi
  252. ]
  253. )
  254. #---END:
  255. AC_DEFUN([MYSQL_CHECK_FP_EXCEPT],
  256. [AC_MSG_CHECKING(for type fp_except)
  257. AC_CACHE_VAL(ac_cv_fp_except,
  258. [AC_TRY_RUN([#include <stdio.h>
  259. #include <sys/types.h>
  260. #include <ieeefp.h>
  261. main()
  262. {
  263. fp_except foo;
  264. foo++;
  265. exit(0);
  266. }], ac_cv_fp_except=yes, ac_cv_fp_except=no, ac_cv_fp_except=no)])
  267. AC_MSG_RESULT($ac_cv_fp_except)
  268. if test "$ac_cv_fp_except" = "yes"
  269. then
  270. AC_DEFINE([HAVE_FP_EXCEPT], [1], [fp_except from ieeefp.h])
  271. fi
  272. ])
  273. # From fileutils-3.14/aclocal.m4
  274. # @defmac AC_PROG_CC_STDC
  275. # @maindex PROG_CC_STDC
  276. # @ovindex CC
  277. # If the C compiler in not in ANSI C mode by default, try to add an option
  278. # to output variable @code{CC} to make it so. This macro tries various
  279. # options that select ANSI C on some system or another. It considers the
  280. # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
  281. # handles function prototypes correctly.
  282. #
  283. # Patched by monty to only check if __STDC__ is defined. With the original
  284. # check it's impossible to get things to work with the Sunpro compiler from
  285. # Workshop 4.2
  286. #
  287. # If you use this macro, you should check after calling it whether the C
  288. # compiler has been set to accept ANSI C; if not, the shell variable
  289. # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
  290. # code in ANSI C, you can make an un-ANSIfied copy of it by using the
  291. # program @code{ansi2knr}, which comes with Ghostscript.
  292. # @end defmac
  293. AC_DEFUN([AM_PROG_CC_STDC],
  294. [AC_REQUIRE([AC_PROG_CC])
  295. AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  296. AC_CACHE_VAL(am_cv_prog_cc_stdc,
  297. [am_cv_prog_cc_stdc=no
  298. ac_save_CC="$CC"
  299. # Don't try gcc -ansi; that turns off useful extensions and
  300. # breaks some systems' header files.
  301. # AIX -qlanglvl=ansi
  302. # Ultrix and OSF/1 -std1
  303. # HP-UX -Aa -D_HPUX_SOURCE
  304. # SVR4 -Xc -D__EXTENSIONS__
  305. # removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it.
  306. for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
  307. do
  308. CC="$ac_save_CC $ac_arg"
  309. AC_TRY_COMPILE(
  310. [#if !defined(__STDC__)
  311. choke me
  312. #endif
  313. /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
  314. #ifdef _SEQUENT_
  315. # include <sys/types.h>
  316. # include <sys/stat.h>
  317. #endif
  318. ], [
  319. int test (int i, double x);
  320. struct s1 {int (*f) (int a);};
  321. struct s2 {int (*f) (double a);};],
  322. [am_cv_prog_cc_stdc="$ac_arg"; break])
  323. done
  324. CC="$ac_save_CC"
  325. ])
  326. AC_MSG_RESULT($am_cv_prog_cc_stdc)
  327. case "x$am_cv_prog_cc_stdc" in
  328. x|xno) ;;
  329. *) CC="$CC $am_cv_prog_cc_stdc" ;;
  330. esac
  331. ])
  332. # Orginal from bash-2.0 aclocal.m4, Changed to use termcap last by monty.
  333. AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
  334. [
  335. AC_CACHE_VAL(mysql_cv_termcap_lib,
  336. [AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
  337. [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
  338. [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
  339. [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
  340. mysql_cv_termcap_lib=NOT_FOUND)])])])])
  341. AC_MSG_CHECKING(for termcap functions library)
  342. if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
  343. AC_MSG_ERROR([No curses/termcap library found])
  344. elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
  345. TERMCAP_LIB=-ltermcap
  346. elif test "$mysql_cv_termcap_lib" = "libncurses"; then
  347. TERMCAP_LIB=-lncurses
  348. elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
  349. TERMCAP_LIB=-ltinfo
  350. else
  351. TERMCAP_LIB=-lcurses
  352. fi
  353. AC_MSG_RESULT($TERMCAP_LIB)
  354. ])
  355. dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
  356. AC_DEFUN([MYSQL_SIGNAL_CHECK],
  357. [AC_REQUIRE([AC_TYPE_SIGNAL])
  358. AC_MSG_CHECKING(for type of signal functions)
  359. AC_CACHE_VAL(mysql_cv_signal_vintage,
  360. [
  361. AC_TRY_LINK([#include <signal.h>],[
  362. sigset_t ss;
  363. struct sigaction sa;
  364. sigemptyset(&ss); sigsuspend(&ss);
  365. sigaction(SIGINT, &sa, (struct sigaction *) 0);
  366. sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
  367. ], mysql_cv_signal_vintage=posix,
  368. [
  369. AC_TRY_LINK([#include <signal.h>], [
  370. int mask = sigmask(SIGINT);
  371. sigsetmask(mask); sigblock(mask); sigpause(mask);
  372. ], mysql_cv_signal_vintage=4.2bsd,
  373. [
  374. AC_TRY_LINK([
  375. #include <signal.h>
  376. RETSIGTYPE foo() { }], [
  377. int mask = sigmask(SIGINT);
  378. sigset(SIGINT, foo); sigrelse(SIGINT);
  379. sighold(SIGINT); sigpause(SIGINT);
  380. ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7
  381. )]
  382. )]
  383. )
  384. ])
  385. AC_MSG_RESULT($mysql_cv_signal_vintage)
  386. if test "$mysql_cv_signal_vintage" = posix; then
  387. AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
  388. [Signal handling is POSIX (sigset/sighold, etc)])
  389. elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
  390. AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
  391. elif test "$mysql_cv_signal_vintage" = svr3; then
  392. AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
  393. fi
  394. ])
  395. AC_DEFUN([MYSQL_CHECK_GETPW_FUNCS],
  396. [AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
  397. AC_CACHE_VAL(mysql_cv_can_redecl_getpw,
  398. [AC_TRY_COMPILE([#include <sys/types.h>
  399. #include <pwd.h>
  400. extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
  401. mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
  402. AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
  403. if test "$mysql_cv_can_redecl_getpw" = "no"; then
  404. AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
  405. fi
  406. ])
  407. AC_DEFUN([MYSQL_HAVE_TIOCGWINSZ],
  408. [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
  409. AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
  410. [AC_TRY_COMPILE([#include <sys/types.h>
  411. #include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
  412. mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
  413. AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
  414. if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then
  415. AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
  416. [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
  417. fi
  418. ])
  419. AC_DEFUN([MYSQL_HAVE_FIONREAD],
  420. [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
  421. AC_CACHE_VAL(mysql_cv_fionread_in_ioctl,
  422. [AC_TRY_COMPILE([#include <sys/types.h>
  423. #include <sys/ioctl.h>], [int x = FIONREAD;],
  424. mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)])
  425. AC_MSG_RESULT($mysql_cv_fionread_in_ioctl)
  426. if test "$mysql_cv_fionread_in_ioctl" = "yes"; then
  427. AC_DEFINE([FIONREAD_IN_SYS_IOCTL], [1], [Do we have FIONREAD])
  428. fi
  429. ])
  430. AC_DEFUN([MYSQL_HAVE_TIOCSTAT],
  431. [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
  432. AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
  433. [AC_TRY_COMPILE([#include <sys/types.h>
  434. #include <sys/ioctl.h>], [int x = TIOCSTAT;],
  435. mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
  436. AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
  437. if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then
  438. AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
  439. [declaration of TIOCSTAT in sys/ioctl.h])
  440. fi
  441. ])
  442. AC_DEFUN([MYSQL_STRUCT_DIRENT_D_INO],
  443. [AC_REQUIRE([AC_HEADER_DIRENT])
  444. AC_MSG_CHECKING(if struct dirent has a d_ino member)
  445. AC_CACHE_VAL(mysql_cv_dirent_has_dino,
  446. [AC_TRY_COMPILE([
  447. #include <stdio.h>
  448. #include <sys/types.h>
  449. #ifdef HAVE_UNISTD_H
  450. # include <unistd.h>
  451. #endif /* HAVE_UNISTD_H */
  452. #if defined(HAVE_DIRENT_H)
  453. # include <dirent.h>
  454. #else
  455. # define dirent direct
  456. # ifdef HAVE_SYS_NDIR_H
  457. # include <sys/ndir.h>
  458. # endif /* SYSNDIR */
  459. # ifdef HAVE_SYS_DIR_H
  460. # include <sys/dir.h>
  461. # endif /* SYSDIR */
  462. # ifdef HAVE_NDIR_H
  463. # include <ndir.h>
  464. # endif
  465. #endif /* HAVE_DIRENT_H */
  466. ],[
  467. struct dirent d; int z; z = d.d_ino;
  468. ], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)])
  469. AC_MSG_RESULT($mysql_cv_dirent_has_dino)
  470. if test "$mysql_cv_dirent_has_dino" = "yes"; then
  471. AC_DEFINE(STRUCT_DIRENT_HAS_D_INO, [1],
  472. [d_ino member present in struct dirent])
  473. fi
  474. ])
  475. AC_DEFUN([MYSQL_STRUCT_DIRENT_D_NAMLEN],
  476. [AC_REQUIRE([AC_HEADER_DIRENT])
  477. AC_MSG_CHECKING(if struct dirent has a d_namlen member)
  478. AC_CACHE_VAL(mysql_cv_dirent_has_dnamlen,
  479. [AC_TRY_COMPILE([
  480. #include <stdio.h>
  481. #include <sys/types.h>
  482. #ifdef HAVE_UNISTD_H
  483. # include <unistd.h>
  484. #endif /* HAVE_UNISTD_H */
  485. #if defined(HAVE_DIRENT_H)
  486. # include <dirent.h>
  487. #else
  488. # define dirent direct
  489. # ifdef HAVE_SYS_NDIR_H
  490. # include <sys/ndir.h>
  491. # endif /* SYSNDIR */
  492. # ifdef HAVE_SYS_DIR_H
  493. # include <sys/dir.h>
  494. # endif /* SYSDIR */
  495. # ifdef HAVE_NDIR_H
  496. # include <ndir.h>
  497. # endif
  498. #endif /* HAVE_DIRENT_H */
  499. ],[
  500. struct dirent d; int z; z = (int)d.d_namlen;
  501. ], mysql_cv_dirent_has_dnamlen=yes, mysql_cv_dirent_has_dnamlen=no)])
  502. AC_MSG_RESULT($mysql_cv_dirent_has_dnamlen)
  503. if test "$mysql_cv_dirent_has_dnamlen" = "yes"; then
  504. AC_DEFINE(STRUCT_DIRENT_HAS_D_NAMLEN, [1],
  505. [d_namlen member present in struct dirent])
  506. fi
  507. ])
  508. AC_DEFUN([MYSQL_TYPE_SIGHANDLER],
  509. [AC_MSG_CHECKING([whether signal handlers are of type void])
  510. AC_CACHE_VAL(mysql_cv_void_sighandler,
  511. [AC_TRY_COMPILE([#include <sys/types.h>
  512. #include <signal.h>
  513. #ifdef signal
  514. #undef signal
  515. #endif
  516. #ifdef __cplusplus
  517. extern "C"
  518. #endif
  519. void (*signal ()) ();],
  520. [int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl
  521. AC_MSG_RESULT($mysql_cv_void_sighandler)
  522. if test "$mysql_cv_void_sighandler" = "yes"; then
  523. AC_DEFINE(VOID_SIGHANDLER, [1], [sighandler type is void (*signal ()) ();])
  524. fi
  525. ])
  526. AC_DEFUN([MYSQL_CXX_BOOL],
  527. [
  528. AC_REQUIRE([AC_PROG_CXX])
  529. AC_MSG_CHECKING(if ${CXX} supports bool types)
  530. AC_CACHE_VAL(mysql_cv_have_bool,
  531. [
  532. AC_LANG_SAVE
  533. AC_LANG_CPLUSPLUS
  534. AC_TRY_COMPILE(,[bool b = true;],
  535. mysql_cv_have_bool=yes,
  536. mysql_cv_have_bool=no)
  537. AC_LANG_RESTORE
  538. ])
  539. AC_MSG_RESULT($mysql_cv_have_bool)
  540. if test "$mysql_cv_have_bool" = yes; then
  541. AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
  542. fi
  543. ])dnl
  544. AC_DEFUN([MYSQL_STACK_DIRECTION],
  545. [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
  546. [AC_TRY_RUN([#include <stdlib.h>
  547. int find_stack_direction ()
  548. {
  549. static char *addr = 0;
  550. auto char dummy;
  551. if (addr == 0)
  552. {
  553. addr = &dummy;
  554. return find_stack_direction ();
  555. }
  556. else
  557. return (&dummy > addr) ? 1 : -1;
  558. }
  559. int main ()
  560. {
  561. exit (find_stack_direction() < 0);
  562. }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
  563. ac_cv_c_stack_direction=0)])
  564. AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
  565. ])dnl
  566. AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT],
  567. [
  568. AC_MSG_CHECKING(if conversion of longlong to float works)
  569. AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
  570. [AC_TRY_RUN([#include <stdio.h>
  571. typedef long long longlong;
  572. main()
  573. {
  574. longlong ll=1;
  575. float f;
  576. FILE *file=fopen("conftestval", "w");
  577. f = (float) ll;
  578. fprintf(file,"%g\n",f);
  579. fclose(file);
  580. exit (0);
  581. }], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl
  582. if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
  583. then
  584. ac_cv_conv_longlong_to_float=yes
  585. else
  586. ac_cv_conv_longlong_to_float=no
  587. fi
  588. AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
  589. ])
  590. AC_DEFUN([MYSQL_CHECK_VIO], [
  591. dnl
  592. dnl we always use vio: no need for special defines
  593. dnl
  594. AC_DEFINE([HAVE_VIO_READ_BUFF], [1],
  595. [Define to enable buffered read. This works only if syscalls
  596. read/recv return as soon as there is some data in the kernel
  597. buffer, no matter how big the given buffer is.])
  598. ])
  599. # Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
  600. # include #stdlib.h as default as this breaks things on Solaris
  601. # (Conflicts with pthreads and big file handling)
  602. m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
  603. [for ac_declaration in \
  604. ''\
  605. 'extern "C" void std::exit (int) throw (); using std::exit;' \
  606. 'extern "C" void std::exit (int); using std::exit;' \
  607. 'extern "C" void exit (int) throw ();' \
  608. 'extern "C" void exit (int);' \
  609. 'void exit (int);' \
  610. '#include <stdlib.h>'
  611. do
  612. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
  613. @%:@include <stdlib.h>],
  614. [exit (42);])],
  615. [],
  616. [continue])
  617. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration],
  618. [exit (42);])],
  619. [break])
  620. done
  621. rm -f conftest*
  622. if test -n "$ac_declaration"; then
  623. echo '#ifdef __cplusplus' >>confdefs.h
  624. echo $ac_declaration >>confdefs.h
  625. echo '#endif' >>confdefs.h
  626. fi
  627. ])# _AC_PROG_CXX_EXIT_DECLARATION
  628. dnl ---------------------------------------------------------------------------
  629. dnl ---------------------------------------------------------------------------
  630. dnl Macro: MYSQL_CHECK_BIG_TABLES
  631. dnl Sets BIG_TABLES if --with-big-tables is used
  632. dnl ---------------------------------------------------------------------------
  633. AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [
  634. AC_ARG_WITH([big-tables],
  635. [
  636. --with-big-tables Support tables with more than 4 G rows even on 32 bit platforms],
  637. [bigtables="$withval"],
  638. [bigtables=no])
  639. AC_MSG_CHECKING([for big tables support])
  640. case "$bigtables" in
  641. yes )
  642. AC_DEFINE([BIG_TABLES], [1], [Support big tables])
  643. AC_MSG_RESULT([yes])
  644. ;;
  645. * )
  646. AC_MSG_RESULT([no])
  647. ;;
  648. esac
  649. ])
  650. dnl ---------------------------------------------------------------------------
  651. dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
  652. dnl ---------------------------------------------------------------------------
  653. dnl ---------------------------------------------------------------------------
  654. dnl Macro: MYSQL_CHECK_MAX_INDEXES
  655. dnl Sets MAX_INDEXES
  656. dnl ---------------------------------------------------------------------------
  657. AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [
  658. AC_ARG_WITH([max-indexes],
  659. [
  660. --with-max-indexes=\# Sets the maximum number of indexes per table, default 64],
  661. [max_indexes="$withval"],
  662. [max_indexes=64])
  663. AC_MSG_CHECKING([max indexes per table])
  664. AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
  665. [Maximum number of indexes per table])
  666. AC_MSG_RESULT([$max_indexes])
  667. ])
  668. dnl ---------------------------------------------------------------------------
  669. dnl END OF MYSQL_CHECK_MAX_INDEXES SECTION
  670. dnl ---------------------------------------------------------------------------
  671. dnl MYSQL_NEEDS_MYSYS_NEW
  672. AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
  673. [AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new,
  674. [
  675. AC_LANG_PUSH(C++)
  676. AC_TRY_LINK([], [
  677. class A { public: int b; }; A *a=new A; a->b=10; delete a;
  678. ], mysql_use_mysys_new=no, mysql_use_mysys_new=yes)
  679. AC_LANG_POP(C++)
  680. ])
  681. if test "$mysql_use_mysys_new" = "yes"
  682. then
  683. AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
  684. fi
  685. ])
  686. AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [
  687. case $SYSTEM_TYPE in
  688. *netware*)
  689. CXX_VERSION=`$CXX -version | grep -i version`
  690. ;;
  691. *)
  692. CXX_VERSION=`$CXX --version | sed 1q`
  693. if test $? -ne "0" -o -z "$CXX_VERSION"
  694. then
  695. CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI
  696. fi
  697. if test $? -ne "0" -o -z "$CXX_VERSION"
  698. then
  699. CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha
  700. fi
  701. if test $? -ne "0" -o -z "$CXX_VERSION"
  702. then
  703. CXX_VERSION=""
  704. fi
  705. esac
  706. if test "$CXX_VERSION"
  707. then
  708. AC_MSG_CHECKING("C++ compiler version");
  709. AC_MSG_RESULT("$CXX $CXX_VERSION")
  710. fi
  711. AC_SUBST(CXX_VERSION)
  712. ])
  713. AC_DEFUN([MYSQL_PROG_AR], [
  714. case $CXX_VERSION in
  715. MIPSpro*)
  716. AR=$CXX
  717. ARFLAGS="-ar -o"
  718. ;;
  719. *Forte*)
  720. AR=$CXX
  721. ARFLAGS="-xar -o"
  722. ;;
  723. *)
  724. AC_CHECK_PROG([AR], [ar], [ar])
  725. if test -z "$AR" || test "$AR" = "false"
  726. then
  727. AC_MSG_ERROR([You need ar to build the library])
  728. fi
  729. if test -z "$ARFLAGS"
  730. then
  731. ARFLAGS="cru"
  732. fi
  733. esac
  734. AC_SUBST(AR)
  735. AC_SUBST(ARFLAGS)
  736. ])
  737. dnl
  738. dnl Macro to check time_t range: according to C standard
  739. dnl array index must be greater than 0 => if time_t is signed,
  740. dnl the code in the macros below won't compile.
  741. dnl
  742. AC_DEFUN([MYSQL_CHECK_TIME_T],[
  743. AC_MSG_CHECKING(if time_t is unsigned)
  744. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  745. [[
  746. #include <time.h>
  747. ]],
  748. [[
  749. int array[(((time_t)-1) > 0) ? 1 : -1];
  750. ]] )
  751. ], [
  752. AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
  753. AC_MSG_RESULT(yes)
  754. ],
  755. [AC_MSG_RESULT(no)]
  756. )
  757. ])