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.

694 lines
20 KiB

  1. # Local macros for automake & autoconf
  2. #---START: Used in for client configure
  3. AC_DEFUN([MYSQL_TYPE_ACCEPT],
  4. [ac_save_CXXFLAGS="$CXXFLAGS"
  5. AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
  6. AC_LANG_PUSH(C++)
  7. if test "$ac_cv_prog_gxx" = "yes"
  8. then
  9. # Add -Werror, remove -fbranch-probabilities (Bug #268)
  10. CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
  11. fi
  12. mysql_cv_btype_last_arg_accept=none
  13. [AC_TRY_COMPILE([#if defined(inline)
  14. #undef inline
  15. #endif
  16. #include <stdlib.h>
  17. #include <sys/types.h>
  18. #include <sys/socket.h>
  19. ],
  20. [int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0); return (a != 0);],
  21. mysql_cv_btype_last_arg_accept=socklen_t)]
  22. if test "$mysql_cv_btype_last_arg_accept" = "none"; then
  23. [AC_TRY_COMPILE([#if defined(inline)
  24. #undef inline
  25. #endif
  26. #include <stdlib.h>
  27. #include <sys/types.h>
  28. #include <sys/socket.h>
  29. ],
  30. [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0); return (a != 0);],
  31. mysql_cv_btype_last_arg_accept=size_t)]
  32. fi
  33. if test "$mysql_cv_btype_last_arg_accept" = "none"; then
  34. mysql_cv_btype_last_arg_accept=int
  35. fi)
  36. AC_LANG_POP(C++)
  37. AC_DEFINE_UNQUOTED([SOCKET_SIZE_TYPE], [$mysql_cv_btype_last_arg_accept],
  38. [The base type of the last arg to accept])
  39. CXXFLAGS="$ac_save_CXXFLAGS"
  40. ])
  41. #---END:
  42. dnl Find type of qsort
  43. AC_DEFUN([MYSQL_TYPE_QSORT],
  44. [AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort,
  45. [AC_TRY_COMPILE([#include <stdlib.h>
  46. #ifdef __cplusplus
  47. extern "C"
  48. #endif
  49. void qsort(void *base, size_t nel, size_t width,
  50. int (*compar) (const void *, const void *));
  51. ],
  52. [int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
  53. AC_DEFINE_UNQUOTED([RETQSORTTYPE], [$mysql_cv_type_qsort],
  54. [The return type of qsort (int or void).])
  55. if test "$mysql_cv_type_qsort" = "void"
  56. then
  57. AC_DEFINE_UNQUOTED([QSORT_TYPE_IS_VOID], [1], [qsort returns void])
  58. fi
  59. ])
  60. #---START: Figure out whether to use 'struct rlimit' or 'struct rlimit64'
  61. AC_DEFUN([MYSQL_TYPE_STRUCT_RLIMIT],
  62. [ac_save_CXXFLAGS="$CXXFLAGS"
  63. AC_CACHE_CHECK([struct type to use with setrlimit], mysql_cv_btype_struct_rlimit,
  64. AC_LANG_PUSH(C++)
  65. if test "$ac_cv_prog_gxx" = "yes"
  66. then
  67. # Add -Werror, remove -fbranch-probabilities (Bug #268)
  68. CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
  69. fi
  70. mysql_cv_btype_struct_rlimit=none
  71. [AC_TRY_COMPILE([#if defined(inline)
  72. #undef inline
  73. #endif
  74. #include <stdlib.h>
  75. #include <sys/resource.h>
  76. ],
  77. [struct rlimit64 rl; setrlimit(RLIMIT_CORE, &rl);],
  78. mysql_cv_btype_struct_rlimit="struct rlimit64")]
  79. if test "$mysql_cv_btype_struct_rlimit" = "none"; then
  80. mysql_cv_btype_struct_rlimit="struct rlimit"
  81. fi)
  82. AC_LANG_POP(C++)
  83. AC_DEFINE_UNQUOTED([STRUCT_RLIMIT], [$mysql_cv_btype_struct_rlimit],
  84. [The struct rlimit type to use with setrlimit])
  85. CXXFLAGS="$ac_save_CXXFLAGS"
  86. ])
  87. #---END:
  88. AC_DEFUN([MYSQL_TIMESPEC_TS],
  89. [AC_CACHE_CHECK([if struct timespec has a ts_sec member], mysql_cv_timespec_ts,
  90. [AC_TRY_COMPILE([#include <pthread.h>
  91. #ifdef __cplusplus
  92. extern "C"
  93. #endif
  94. ],
  95. [struct timespec abstime;
  96. abstime.ts_sec = time(NULL)+1;
  97. abstime.ts_nsec = 0;
  98. ], mysql_cv_timespec_ts=yes, mysql_cv_timespec_ts=no)])
  99. if test "$mysql_cv_timespec_ts" = "yes"
  100. then
  101. AC_DEFINE([HAVE_TIMESPEC_TS_SEC], [1],
  102. [Timespec has a ts_sec instead of tv_sev])
  103. fi
  104. ])
  105. AC_DEFUN([MYSQL_TZNAME],
  106. [AC_CACHE_CHECK([if we have tzname variable], mysql_cv_tzname,
  107. [AC_TRY_COMPILE([#include <time.h>
  108. #ifdef __cplusplus
  109. extern "C"
  110. #endif
  111. ],
  112. [ tzset();
  113. return tzname[0] != 0;
  114. ], mysql_cv_tzname=yes, mysql_cv_tzname=no)])
  115. if test "$mysql_cv_tzname" = "yes"
  116. then
  117. AC_DEFINE([HAVE_TZNAME], [1], [Have the tzname variable])
  118. fi
  119. ])
  120. AC_DEFUN([MYSQL_PTHREAD_YIELD],
  121. [AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
  122. [AC_TRY_LINK([#define _GNU_SOURCE
  123. #include <pthread.h>
  124. #ifdef __cplusplus
  125. extern "C"
  126. #endif
  127. ],
  128. [
  129. pthread_yield();
  130. ], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
  131. if test "$ac_cv_pthread_yield_zero_arg" = "yes"
  132. then
  133. AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
  134. [pthread_yield that doesn't take any arguments])
  135. fi
  136. ]
  137. [AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
  138. [AC_TRY_LINK([#define _GNU_SOURCE
  139. #include <pthread.h>
  140. #ifdef __cplusplus
  141. extern "C"
  142. #endif
  143. ],
  144. [
  145. pthread_yield(0);
  146. ], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
  147. if test "$ac_cv_pthread_yield_one_arg" = "yes"
  148. then
  149. AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
  150. [pthread_yield function with one argument])
  151. fi
  152. ]
  153. )
  154. #---END:
  155. # From fileutils-3.14/aclocal.m4
  156. # @defmac AC_PROG_CC_STDC
  157. # @maindex PROG_CC_STDC
  158. # @ovindex CC
  159. # If the C compiler in not in ANSI C mode by default, try to add an option
  160. # to output variable @code{CC} to make it so. This macro tries various
  161. # options that select ANSI C on some system or another. It considers the
  162. # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
  163. # handles function prototypes correctly.
  164. #
  165. # Patched by monty to only check if __STDC__ is defined. With the original
  166. # check it's impossible to get things to work with the Sunpro compiler from
  167. # Workshop 4.2
  168. #
  169. # If you use this macro, you should check after calling it whether the C
  170. # compiler has been set to accept ANSI C; if not, the shell variable
  171. # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
  172. # code in ANSI C, you can make an un-ANSIfied copy of it by using the
  173. # program @code{ansi2knr}, which comes with Ghostscript.
  174. # @end defmac
  175. AC_DEFUN([AM_PROG_CC_STDC],
  176. [AC_REQUIRE([AC_PROG_CC])
  177. AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  178. AC_CACHE_VAL(am_cv_prog_cc_stdc,
  179. [am_cv_prog_cc_stdc=no
  180. ac_save_CC="$CC"
  181. # Don't try gcc -ansi; that turns off useful extensions and
  182. # breaks some systems' header files.
  183. # AIX -qlanglvl=ansi
  184. # Ultrix and OSF/1 -std1
  185. # HP-UX -Aa -D_HPUX_SOURCE
  186. # SVR4 -Xc -D__EXTENSIONS__
  187. # removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it.
  188. for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
  189. do
  190. CC="$ac_save_CC $ac_arg"
  191. AC_TRY_COMPILE(
  192. [#if !defined(__STDC__)
  193. choke me
  194. #endif
  195. /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
  196. #ifdef _SEQUENT_
  197. # include <sys/types.h>
  198. # include <sys/stat.h>
  199. #endif
  200. ], [
  201. int test (int i, double x);
  202. struct s1 {int (*f) (int a);};
  203. struct s2 {int (*f) (double a);};],
  204. [am_cv_prog_cc_stdc="$ac_arg"; break])
  205. done
  206. CC="$ac_save_CC"
  207. ])
  208. AC_MSG_RESULT($am_cv_prog_cc_stdc)
  209. case "x$am_cv_prog_cc_stdc" in
  210. x|xno) ;;
  211. *) CC="$CC $am_cv_prog_cc_stdc" ;;
  212. esac
  213. ])
  214. # Orginal from bash-2.0 aclocal.m4, Changed to use termcap last by monty.
  215. AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
  216. [
  217. AC_CACHE_VAL(mysql_cv_termcap_lib,
  218. [AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw,
  219. [AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
  220. [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
  221. [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
  222. [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
  223. mysql_cv_termcap_lib=NOT_FOUND)])])])])])
  224. AC_MSG_CHECKING(for termcap functions library)
  225. if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
  226. AC_MSG_ERROR([No curses/termcap library found])
  227. elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
  228. TERMCAP_LIB=-ltermcap
  229. elif test "$mysql_cv_termcap_lib" = "libncursesw"; then
  230. TERMCAP_LIB=-lncursesw
  231. elif test "$mysql_cv_termcap_lib" = "libncurses"; then
  232. TERMCAP_LIB=-lncurses
  233. elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
  234. TERMCAP_LIB=-ltinfo
  235. else
  236. TERMCAP_LIB=-lcurses
  237. fi
  238. AC_MSG_RESULT($TERMCAP_LIB)
  239. ])
  240. dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
  241. AC_DEFUN([MYSQL_SIGNAL_CHECK],
  242. [AC_REQUIRE([AC_TYPE_SIGNAL])
  243. AC_MSG_CHECKING(for type of signal functions)
  244. AC_CACHE_VAL(mysql_cv_signal_vintage,
  245. [
  246. AC_TRY_LINK([#include <signal.h>],[
  247. sigset_t ss;
  248. struct sigaction sa;
  249. sigemptyset(&ss); sigsuspend(&ss);
  250. sigaction(SIGINT, &sa, (struct sigaction *) 0);
  251. sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
  252. ], mysql_cv_signal_vintage=posix,
  253. [
  254. AC_TRY_LINK([#include <signal.h>], [
  255. int mask = sigmask(SIGINT);
  256. sigsetmask(mask); sigblock(mask); sigpause(mask);
  257. ], mysql_cv_signal_vintage=4.2bsd,
  258. [
  259. AC_TRY_LINK([
  260. #include <signal.h>
  261. RETSIGTYPE foo() { }], [
  262. int mask = sigmask(SIGINT);
  263. sigset(SIGINT, foo); sigrelse(SIGINT);
  264. sighold(SIGINT); sigpause(SIGINT);
  265. ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7
  266. )]
  267. )]
  268. )
  269. ])
  270. AC_MSG_RESULT($mysql_cv_signal_vintage)
  271. if test "$mysql_cv_signal_vintage" = posix; then
  272. AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
  273. [Signal handling is POSIX (sigset/sighold, etc)])
  274. elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
  275. AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
  276. elif test "$mysql_cv_signal_vintage" = svr3; then
  277. AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
  278. fi
  279. ])
  280. AC_DEFUN([MYSQL_CHECK_GETPW_FUNCS],
  281. [AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
  282. AC_CACHE_VAL(mysql_cv_can_redecl_getpw,
  283. [AC_TRY_COMPILE([#include <sys/types.h>
  284. #include <pwd.h>
  285. extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
  286. mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
  287. AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
  288. if test "$mysql_cv_can_redecl_getpw" = "no"; then
  289. AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
  290. fi
  291. ])
  292. AC_DEFUN([MYSQL_HAVE_TIOCGWINSZ],
  293. [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
  294. AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
  295. [AC_TRY_COMPILE([#include <sys/types.h>
  296. #include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
  297. mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
  298. AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
  299. if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then
  300. AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
  301. [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
  302. fi
  303. ])
  304. AC_DEFUN([MYSQL_HAVE_FIONREAD],
  305. [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
  306. AC_CACHE_VAL(mysql_cv_fionread_in_ioctl,
  307. [AC_TRY_COMPILE([#include <sys/types.h>
  308. #include <sys/ioctl.h>], [int x = FIONREAD;],
  309. mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)])
  310. AC_MSG_RESULT($mysql_cv_fionread_in_ioctl)
  311. if test "$mysql_cv_fionread_in_ioctl" = "yes"; then
  312. AC_DEFINE([FIONREAD_IN_SYS_IOCTL], [1], [Do we have FIONREAD])
  313. fi
  314. ])
  315. AC_DEFUN([MYSQL_HAVE_TIOCSTAT],
  316. [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
  317. AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
  318. [AC_TRY_COMPILE([#include <sys/types.h>
  319. #include <sys/ioctl.h>], [int x = TIOCSTAT;],
  320. mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
  321. AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
  322. if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then
  323. AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
  324. [declaration of TIOCSTAT in sys/ioctl.h])
  325. fi
  326. ])
  327. AC_DEFUN([MYSQL_STRUCT_DIRENT_D_INO],
  328. [AC_REQUIRE([AC_HEADER_DIRENT])
  329. AC_MSG_CHECKING(if struct dirent has a d_ino member)
  330. AC_CACHE_VAL(mysql_cv_dirent_has_dino,
  331. [AC_TRY_COMPILE([
  332. #include <stdio.h>
  333. #include <sys/types.h>
  334. #ifdef HAVE_UNISTD_H
  335. # include <unistd.h>
  336. #endif /* HAVE_UNISTD_H */
  337. #if defined(HAVE_DIRENT_H)
  338. # include <dirent.h>
  339. #else
  340. # define dirent direct
  341. # ifdef HAVE_SYS_NDIR_H
  342. # include <sys/ndir.h>
  343. # endif /* SYSNDIR */
  344. # ifdef HAVE_SYS_DIR_H
  345. # include <sys/dir.h>
  346. # endif /* SYSDIR */
  347. # ifdef HAVE_NDIR_H
  348. # include <ndir.h>
  349. # endif
  350. #endif /* HAVE_DIRENT_H */
  351. ],[
  352. struct dirent d; int z; z = d.d_ino;
  353. ], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)])
  354. AC_MSG_RESULT($mysql_cv_dirent_has_dino)
  355. if test "$mysql_cv_dirent_has_dino" = "yes"; then
  356. AC_DEFINE(STRUCT_DIRENT_HAS_D_INO, [1],
  357. [d_ino member present in struct dirent])
  358. fi
  359. ])
  360. AC_DEFUN([MYSQL_STRUCT_DIRENT_D_NAMLEN],
  361. [AC_REQUIRE([AC_HEADER_DIRENT])
  362. AC_MSG_CHECKING(if struct dirent has a d_namlen member)
  363. AC_CACHE_VAL(mysql_cv_dirent_has_dnamlen,
  364. [AC_TRY_COMPILE([
  365. #include <stdio.h>
  366. #include <sys/types.h>
  367. #ifdef HAVE_UNISTD_H
  368. # include <unistd.h>
  369. #endif /* HAVE_UNISTD_H */
  370. #if defined(HAVE_DIRENT_H)
  371. # include <dirent.h>
  372. #else
  373. # define dirent direct
  374. # ifdef HAVE_SYS_NDIR_H
  375. # include <sys/ndir.h>
  376. # endif /* SYSNDIR */
  377. # ifdef HAVE_SYS_DIR_H
  378. # include <sys/dir.h>
  379. # endif /* SYSDIR */
  380. # ifdef HAVE_NDIR_H
  381. # include <ndir.h>
  382. # endif
  383. #endif /* HAVE_DIRENT_H */
  384. ],[
  385. struct dirent d; int z; z = (int)d.d_namlen;
  386. ], mysql_cv_dirent_has_dnamlen=yes, mysql_cv_dirent_has_dnamlen=no)])
  387. AC_MSG_RESULT($mysql_cv_dirent_has_dnamlen)
  388. if test "$mysql_cv_dirent_has_dnamlen" = "yes"; then
  389. AC_DEFINE(STRUCT_DIRENT_HAS_D_NAMLEN, [1],
  390. [d_namlen member present in struct dirent])
  391. fi
  392. ])
  393. AC_DEFUN([MYSQL_TYPE_SIGHANDLER],
  394. [AC_MSG_CHECKING([whether signal handlers are of type void])
  395. AC_CACHE_VAL(mysql_cv_void_sighandler,
  396. [AC_TRY_COMPILE([#include <sys/types.h>
  397. #include <signal.h>
  398. #ifdef signal
  399. #undef signal
  400. #endif
  401. #ifdef __cplusplus
  402. extern "C"
  403. #endif
  404. void (*signal ()) ();],
  405. [int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl
  406. AC_MSG_RESULT($mysql_cv_void_sighandler)
  407. if test "$mysql_cv_void_sighandler" = "yes"; then
  408. AC_DEFINE(VOID_SIGHANDLER, [1], [sighandler type is void (*signal ()) ();])
  409. fi
  410. ])
  411. AC_DEFUN([MYSQL_CXX_BOOL],
  412. [
  413. AC_REQUIRE([AC_PROG_CXX])
  414. AC_MSG_CHECKING(if ${CXX} supports bool types)
  415. AC_CACHE_VAL(mysql_cv_have_bool,
  416. [
  417. AC_LANG_SAVE
  418. AC_LANG_CPLUSPLUS
  419. AC_TRY_COMPILE(,[bool b = true;],
  420. mysql_cv_have_bool=yes,
  421. mysql_cv_have_bool=no)
  422. AC_LANG_RESTORE
  423. ])
  424. AC_MSG_RESULT($mysql_cv_have_bool)
  425. if test "$mysql_cv_have_bool" = yes; then
  426. AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
  427. fi
  428. ])dnl
  429. AC_DEFUN([MYSQL_STACK_DIRECTION],
  430. [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
  431. [AC_TRY_RUN([#include <stdlib.h>
  432. /* Prevent compiler optimization by HP's compiler, see bug#42213 */
  433. #if defined(__HP_cc) || defined (__HP_aCC) || defined (__hpux)
  434. #pragma noinline
  435. #endif
  436. int find_stack_direction ()
  437. {
  438. static char *addr = 0;
  439. auto char dummy;
  440. if (addr == 0)
  441. {
  442. addr = &dummy;
  443. return find_stack_direction ();
  444. }
  445. else
  446. return (&dummy > addr) ? 1 : -1;
  447. }
  448. int main ()
  449. {
  450. exit (find_stack_direction() < 0);
  451. }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
  452. ac_cv_c_stack_direction=)])
  453. AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
  454. ])dnl
  455. AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT],
  456. [
  457. AC_MSG_CHECKING(if conversion of longlong to float works)
  458. AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
  459. [AC_TRY_RUN([#include <stdio.h>
  460. typedef long long longlong;
  461. int main()
  462. {
  463. longlong ll=1;
  464. float f;
  465. FILE *file=fopen("conftestval", "w");
  466. f = (float) ll;
  467. fprintf(file,"%g\n",f);
  468. fclose(file);
  469. return (0);
  470. }], ac_cv_conv_longlong_to_float=`cat conftestval`,
  471. ac_cv_conv_longlong_to_float=0,
  472. ac_cv_conv_longlong_to_float="yes")])dnl # Cross compiling, assume can convert
  473. if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
  474. then
  475. ac_cv_conv_longlong_to_float=yes
  476. else
  477. ac_cv_conv_longlong_to_float=no
  478. fi
  479. AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
  480. ])
  481. AC_DEFUN([MYSQL_CHECK_VIO], [
  482. dnl
  483. dnl we always use vio: no need for special defines
  484. dnl
  485. AC_DEFINE([HAVE_VIO_READ_BUFF], [1],
  486. [Define to enable buffered read. This works only if syscalls
  487. read/recv return as soon as there is some data in the kernel
  488. buffer, no matter how big the given buffer is.])
  489. ])
  490. # Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
  491. # include #stdlib.h as default as this breaks things on Solaris
  492. # (Conflicts with pthreads and big file handling)
  493. m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
  494. [for ac_declaration in \
  495. ''\
  496. 'extern "C" void std::exit (int) throw (); using std::exit;' \
  497. 'extern "C" void std::exit (int); using std::exit;' \
  498. 'extern "C" void exit (int) throw ();' \
  499. 'extern "C" void exit (int);' \
  500. 'void exit (int);' \
  501. '#include <stdlib.h>'
  502. do
  503. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
  504. @%:@include <stdlib.h>],
  505. [exit (42);])],
  506. [],
  507. [continue])
  508. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration],
  509. [exit (42);])],
  510. [break])
  511. done
  512. rm -f conftest*
  513. if test -n "$ac_declaration"; then
  514. echo '#ifdef __cplusplus' >>confdefs.h
  515. echo $ac_declaration >>confdefs.h
  516. echo '#endif' >>confdefs.h
  517. fi
  518. ])# _AC_PROG_CXX_EXIT_DECLARATION
  519. dnl ---------------------------------------------------------------------------
  520. dnl ---------------------------------------------------------------------------
  521. dnl Macro: MYSQL_CHECK_BIG_TABLES
  522. dnl Sets BIG_TABLES if --with-big-tables is used
  523. dnl ---------------------------------------------------------------------------
  524. AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [
  525. AC_ARG_WITH([big-tables],
  526. AS_HELP_STRING([--with-big-tables],
  527. [Support tables with more than 4 G rows even on 32 bit platforms]),
  528. [bigtables="$withval"],
  529. [bigtables=no])
  530. AC_MSG_CHECKING([for big tables support])
  531. case "$bigtables" in
  532. yes )
  533. AC_DEFINE([BIG_TABLES], [1], [Support big tables])
  534. AC_MSG_RESULT([yes])
  535. ;;
  536. * )
  537. AC_MSG_RESULT([no])
  538. ;;
  539. esac
  540. ])
  541. dnl ---------------------------------------------------------------------------
  542. dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
  543. dnl ---------------------------------------------------------------------------
  544. dnl ---------------------------------------------------------------------------
  545. dnl Macro: MYSQL_CHECK_MAX_INDEXES
  546. dnl Sets MAX_INDEXES
  547. dnl ---------------------------------------------------------------------------
  548. AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [
  549. AC_ARG_WITH([max-indexes],
  550. AS_HELP_STRING([--with-max-indexes=N],
  551. [Sets the maximum number of indexes per table, default 64]),
  552. [max_indexes="$withval"],
  553. [max_indexes=64])
  554. AC_MSG_CHECKING([max indexes per table])
  555. AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
  556. [Maximum number of indexes per table])
  557. AC_MSG_RESULT([$max_indexes])
  558. ])
  559. dnl ---------------------------------------------------------------------------
  560. dnl END OF MYSQL_CHECK_MAX_INDEXES SECTION
  561. dnl ---------------------------------------------------------------------------
  562. dnl MYSQL_NEEDS_MYSYS_NEW
  563. AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
  564. [AC_CACHE_CHECK([needs mysys_new helpers], mysql_cv_use_mysys_new,
  565. [
  566. AC_LANG_PUSH(C++)
  567. AC_TRY_LINK([], [
  568. class A { public: int b; }; A *a=new A; a->b=10; delete a;
  569. ], mysql_cv_use_mysys_new=no, mysql_cv_use_mysys_new=yes)
  570. AC_LANG_POP(C++)
  571. ])
  572. if test "$mysql_cv_use_mysys_new" = "yes"
  573. then
  574. AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
  575. fi
  576. ])
  577. AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [
  578. case $SYSTEM_TYPE in
  579. *netware*)
  580. CXX_VERSION=`$CXX -version | grep -i version`
  581. ;;
  582. *)
  583. CXX_VERSION=`$CXX --version | sed 1q`
  584. if test $? -ne "0" -o -z "$CXX_VERSION"
  585. then
  586. CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI
  587. fi
  588. if test $? -ne "0" -o -z "$CXX_VERSION"
  589. then
  590. CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha
  591. fi
  592. if test $? -ne "0" -o -z "$CXX_VERSION"
  593. then
  594. CXX_VERSION=""
  595. fi
  596. esac
  597. if test "$CXX_VERSION"
  598. then
  599. AC_MSG_CHECKING("C++ compiler version")
  600. AC_MSG_RESULT("$CXX $CXX_VERSION")
  601. fi
  602. AC_SUBST(CXX_VERSION)
  603. ])
  604. AC_DEFUN([MYSQL_PROG_AR], [
  605. case $CXX_VERSION in
  606. MIPSpro*)
  607. AR=$CXX
  608. ARFLAGS="-ar -o"
  609. ;;
  610. *Forte*)
  611. AR=$CXX
  612. ARFLAGS="-xar -o"
  613. ;;
  614. *)
  615. AC_CHECK_PROG([AR], [ar], [ar])
  616. if test -z "$AR" || test "$AR" = "false"
  617. then
  618. AC_MSG_ERROR([You need ar to build the library])
  619. fi
  620. if test -z "$ARFLAGS"
  621. then
  622. ARFLAGS="cru"
  623. fi
  624. esac
  625. AC_SUBST(AR)
  626. AC_SUBST(ARFLAGS)
  627. ])
  628. dnl
  629. dnl Macro to check time_t range: according to C standard
  630. dnl array index must be greater than 0 => if time_t is signed,
  631. dnl the code in the macros below won't compile.
  632. dnl
  633. AC_DEFUN([MYSQL_CHECK_TIME_T],[
  634. AC_MSG_CHECKING(if time_t is unsigned)
  635. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  636. [[
  637. #include <time.h>
  638. ]],
  639. [[
  640. int array[(((time_t)-1) > 0) ? 1 : -1];
  641. ]] )
  642. ], [
  643. AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
  644. AC_MSG_RESULT(yes)
  645. ],
  646. [AC_MSG_RESULT(no)]
  647. )
  648. ])