specific.m4 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. # This file is part of Autoconf. -*- Autoconf -*-
  2. # Macros that test for specific, unclassified, features.
  3. #
  4. # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
  5. # This file is part of Autoconf. This program is free
  6. # software; you can redistribute it and/or modify it under the
  7. # terms of the GNU General Public License as published by the
  8. # Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # Under Section 7 of GPL version 3, you are granted additional
  17. # permissions described in the Autoconf Configure Script Exception,
  18. # version 3.0, as published by the Free Software Foundation.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # and a copy of the Autoconf Configure Script Exception along with
  22. # this program; see the files COPYINGv3 and COPYING.EXCEPTION
  23. # respectively. If not, see <http://www.gnu.org/licenses/>.
  24. # Written by David MacKenzie, with help from
  25. # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  26. # Roland McGrath, Noah Friedman, david d zuhn, and many others.
  27. ## ------------------------- ##
  28. ## Checks for declarations. ##
  29. ## ------------------------- ##
  30. # AC_DECL_SYS_SIGLIST
  31. # -------------------
  32. AN_IDENTIFIER([sys_siglist], [AC_CHECK_DECLS([sys_siglist])])
  33. AU_DEFUN([AC_DECL_SYS_SIGLIST],
  34. [AC_CHECK_DECLS([sys_siglist],,,
  35. [#include <signal.h>
  36. /* NetBSD declares sys_siglist in unistd.h. */
  37. #ifdef HAVE_UNISTD_H
  38. # include <unistd.h>
  39. #endif
  40. ])
  41. ])# AC_DECL_SYS_SIGLIST
  42. ## -------------------------------------- ##
  43. ## Checks for operating system services. ##
  44. ## -------------------------------------- ##
  45. # AC_SYS_INTERPRETER
  46. # ------------------
  47. AC_DEFUN([AC_SYS_INTERPRETER],
  48. [AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter,
  49. [echo '#! /bin/cat
  50. exit 69
  51. ' >conftest
  52. chmod u+x conftest
  53. (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null 2>&1)
  54. if test $? -ne 69; then
  55. ac_cv_sys_interpreter=yes
  56. else
  57. ac_cv_sys_interpreter=no
  58. fi
  59. rm -f conftest])
  60. interpval=$ac_cv_sys_interpreter
  61. ])
  62. AU_DEFUN([AC_HAVE_POUNDBANG],
  63. [AC_SYS_INTERPRETER],
  64. [Remove this warning when you adjust your code to use
  65. `AC_SYS_INTERPRETER'.])
  66. AU_DEFUN([AC_ARG_ARRAY], [],
  67. [$0 is no longer implemented: don't do unportable things
  68. with arguments. Remove this warning when you adjust your code.])
  69. # _AC_SYS_LARGEFILE_TEST_INCLUDES
  70. # -------------------------------
  71. m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
  72. [@%:@include <sys/types.h>
  73. /* Check that off_t can represent 2**63 - 1 correctly.
  74. We can't simply define LARGE_OFF_T to be 9223372036854775807,
  75. since some C++ compilers masquerading as C compilers
  76. incorrectly reject 9223372036854775807. */
  77. @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  78. int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
  79. && LARGE_OFF_T % 2147483647 == 1)
  80. ? 1 : -1]];[]dnl
  81. ])
  82. # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
  83. # CACHE-VAR,
  84. # DESCRIPTION,
  85. # PROLOGUE, [FUNCTION-BODY])
  86. # --------------------------------------------------------
  87. m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
  88. [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
  89. [while :; do
  90. m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
  91. [AC_LANG_PROGRAM([$5], [$6])],
  92. [$3=no; break])
  93. m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
  94. [AC_LANG_PROGRAM([@%:@define $1 $2
  95. $5], [$6])],
  96. [$3=$2; break])
  97. $3=unknown
  98. break
  99. done])
  100. case $$3 in #(
  101. no | unknown) ;;
  102. *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
  103. esac
  104. rm -rf conftest*[]dnl
  105. ])# _AC_SYS_LARGEFILE_MACRO_VALUE
  106. # AC_SYS_LARGEFILE
  107. # ----------------
  108. # By default, many hosts won't let programs access large files;
  109. # one must use special compiler options to get large-file access to work.
  110. # For more details about this brain damage please see:
  111. # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
  112. AC_DEFUN([AC_SYS_LARGEFILE],
  113. [AC_ARG_ENABLE(largefile,
  114. [ --disable-largefile omit support for large files])
  115. if test "$enable_largefile" != no; then
  116. AC_CACHE_CHECK([for special C compiler options needed for large files],
  117. ac_cv_sys_largefile_CC,
  118. [ac_cv_sys_largefile_CC=no
  119. if test "$GCC" != yes; then
  120. ac_save_CC=$CC
  121. while :; do
  122. # IRIX 6.2 and later do not support large files by default,
  123. # so use the C compiler's -n32 option if that helps.
  124. AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
  125. AC_COMPILE_IFELSE([], [break])
  126. CC="$CC -n32"
  127. AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
  128. break
  129. done
  130. CC=$ac_save_CC
  131. rm -f conftest.$ac_ext
  132. fi])
  133. if test "$ac_cv_sys_largefile_CC" != no; then
  134. CC=$CC$ac_cv_sys_largefile_CC
  135. fi
  136. _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
  137. ac_cv_sys_file_offset_bits,
  138. [Number of bits in a file offset, on hosts where this is settable.],
  139. [_AC_SYS_LARGEFILE_TEST_INCLUDES])
  140. if test $ac_cv_sys_file_offset_bits = unknown; then
  141. _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
  142. ac_cv_sys_large_files,
  143. [Define for large files, on AIX-style hosts.],
  144. [_AC_SYS_LARGEFILE_TEST_INCLUDES])
  145. fi
  146. AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
  147. [/* Enable large inode numbers on Mac OS X 10.5. */
  148. #ifndef _DARWIN_USE_64_BIT_INODE
  149. # define _DARWIN_USE_64_BIT_INODE 1
  150. #endif])
  151. fi
  152. ])# AC_SYS_LARGEFILE
  153. # AC_SYS_LONG_FILE_NAMES
  154. # ----------------------
  155. # Security: use a temporary directory as the most portable way of
  156. # creating files in /tmp securely. Removing them leaves a race
  157. # condition, set -C is not portably guaranteed to use O_EXCL, so still
  158. # leaves a race, and not all systems have the `mktemp' utility. We
  159. # still test for existence first in case of broken systems where the
  160. # mkdir succeeds even when the directory exists. Broken systems may
  161. # retain a race, but they probably have other security problems
  162. # anyway; this should be secure on well-behaved systems. In any case,
  163. # use of `mktemp' is probably inappropriate here since it would fail in
  164. # attempting to create different file names differing after the 14th
  165. # character on file systems without long file names.
  166. AC_DEFUN([AC_SYS_LONG_FILE_NAMES],
  167. [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
  168. [ac_cv_sys_long_file_names=yes
  169. # Test for long file names in all the places we know might matter:
  170. # . the current directory, where building will happen
  171. # $prefix/lib where we will be installing things
  172. # $exec_prefix/lib likewise
  173. # $TMPDIR if set, where it might want to write temporary files
  174. # /tmp where it might want to write temporary files
  175. # /var/tmp likewise
  176. # /usr/tmp likewise
  177. for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do
  178. # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib
  179. # in the usual case where exec_prefix is '${prefix}'.
  180. case $ac_dir in #(
  181. . | /* | ?:[[\\/]]*) ;; #(
  182. *) continue;;
  183. esac
  184. test -w "$ac_dir/." || continue # It is less confusing to not echo anything here.
  185. ac_xdir=$ac_dir/cf$$
  186. (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue
  187. ac_tf1=$ac_xdir/conftest9012345
  188. ac_tf2=$ac_xdir/conftest9012346
  189. touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" ||
  190. ac_cv_sys_long_file_names=no
  191. rm -f -r "$ac_xdir" 2>/dev/null
  192. test $ac_cv_sys_long_file_names = no && break
  193. done])
  194. if test $ac_cv_sys_long_file_names = yes; then
  195. AC_DEFINE(HAVE_LONG_FILE_NAMES, 1,
  196. [Define to 1 if you support file names longer than 14 characters.])
  197. fi
  198. ])
  199. # AC_SYS_RESTARTABLE_SYSCALLS
  200. # ---------------------------
  201. # If the system automatically restarts a system call that is
  202. # interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'.
  203. AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS],
  204. [AC_DIAGNOSE([obsolete],
  205. [$0: AC_SYS_RESTARTABLE_SYSCALLS is useful only when supporting very
  206. old systems that lack `sigaction' and `SA_RESTART'. Don't bother with
  207. this macro unless you need to support very old systems like 4.2BSD and
  208. SVR3.])dnl
  209. AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl
  210. AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
  211. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  212. [/* Exit 0 (true) if wait returns something other than -1,
  213. i.e. the pid of the child, which means that wait was restarted
  214. after getting the signal. */
  215. AC_INCLUDES_DEFAULT
  216. #include <signal.h>
  217. #ifdef HAVE_SYS_WAIT_H
  218. # include <sys/wait.h>
  219. #endif
  220. /* Some platforms explicitly require an extern "C" signal handler
  221. when using C++. */
  222. #ifdef __cplusplus
  223. extern "C" void ucatch (int dummy) { }
  224. #else
  225. void ucatch (dummy) int dummy; { }
  226. #endif
  227. int
  228. main ()
  229. {
  230. int i = fork (), status;
  231. if (i == 0)
  232. {
  233. sleep (3);
  234. kill (getppid (), SIGINT);
  235. sleep (3);
  236. return 0;
  237. }
  238. signal (SIGINT, ucatch);
  239. status = wait (&i);
  240. if (status == -1)
  241. wait (&i);
  242. return status == -1;
  243. }])],
  244. [ac_cv_sys_restartable_syscalls=yes],
  245. [ac_cv_sys_restartable_syscalls=no])])
  246. if test $ac_cv_sys_restartable_syscalls = yes; then
  247. AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS, 1,
  248. [Define to 1 if system calls automatically restart after
  249. interruption by a signal.])
  250. fi
  251. ])# AC_SYS_RESTARTABLE_SYSCALLS
  252. # AC_SYS_POSIX_TERMIOS
  253. # --------------------
  254. AC_DEFUN([AC_SYS_POSIX_TERMIOS],
  255. [AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios,
  256. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  257. #include <unistd.h>
  258. #include <termios.h>
  259. ]],
  260. [/* SunOS 4.0.3 has termios.h but not the library calls. */
  261. tcgetattr(0, 0);])],
  262. ac_cv_sys_posix_termios=yes,
  263. ac_cv_sys_posix_termios=no)])
  264. ])# AC_SYS_POSIX_TERMIOS
  265. ## ------------------------------------ ##
  266. ## Checks for not-quite-Unix variants. ##
  267. ## ------------------------------------ ##
  268. # AC_GNU_SOURCE
  269. # -------------
  270. AU_DEFUN([AC_GNU_SOURCE], [AC_USE_SYSTEM_EXTENSIONS])
  271. # AC_CYGWIN
  272. # ---------
  273. # Check for Cygwin. This is a way to set the right value for
  274. # EXEEXT.
  275. AU_DEFUN([AC_CYGWIN],
  276. [AC_CANONICAL_HOST
  277. case $host_os in
  278. *cygwin* ) CYGWIN=yes;;
  279. * ) CYGWIN=no;;
  280. esac
  281. ], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
  282. matches *cygwin*])# AC_CYGWIN
  283. # AC_EMXOS2
  284. # ---------
  285. # Check for EMX on OS/2. This is another way to set the right value
  286. # for EXEEXT.
  287. AU_DEFUN([AC_EMXOS2],
  288. [AC_CANONICAL_HOST
  289. case $host_os in
  290. *emx* ) EMXOS2=yes;;
  291. * ) EMXOS2=no;;
  292. esac
  293. ], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
  294. matches *emx*])# AC_EMXOS2
  295. # AC_MINGW32
  296. # ----------
  297. # Check for mingw32. This is another way to set the right value for
  298. # EXEEXT.
  299. AU_DEFUN([AC_MINGW32],
  300. [AC_CANONICAL_HOST
  301. case $host_os in
  302. *mingw32* ) MINGW32=yes;;
  303. * ) MINGW32=no;;
  304. esac
  305. ], [$0 is obsolete: use AC_CANONICAL_HOST and check if $host_os
  306. matches *mingw32*])# AC_MINGW32
  307. # AC_USE_SYSTEM_EXTENSIONS
  308. # ------------------------
  309. # Enable extensions on systems that normally disable them,
  310. # typically due to standards-conformance issues.
  311. #
  312. # Remember that #undef in AH_VERBATIM gets replaced with #define by
  313. # AC_DEFINE. The goal here is to define all known feature-enabling
  314. # macros, then, if reports of conflicts are made, disable macros that
  315. # cause problems on some platforms (such as __EXTENSIONS__).
  316. AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
  317. [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
  318. AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
  319. AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
  320. if test "$MINIX" = yes; then
  321. AC_DEFINE([_POSIX_SOURCE], [1],
  322. [Define to 1 if you need to in order for `stat' and other
  323. things to work.])
  324. AC_DEFINE([_POSIX_1_SOURCE], [2],
  325. [Define to 2 if the system does not provide POSIX.1 features
  326. except with this defined.])
  327. AC_DEFINE([_MINIX], [1],
  328. [Define to 1 if on MINIX.])
  329. fi
  330. dnl Use a different key than __EXTENSIONS__, as that name broke existing
  331. dnl configure.ac when using autoheader 2.62.
  332. AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
  333. [/* Enable extensions on AIX 3, Interix. */
  334. #ifndef _ALL_SOURCE
  335. # undef _ALL_SOURCE
  336. #endif
  337. /* Enable GNU extensions on systems that have them. */
  338. #ifndef _GNU_SOURCE
  339. # undef _GNU_SOURCE
  340. #endif
  341. /* Enable threading extensions on Solaris. */
  342. #ifndef _POSIX_PTHREAD_SEMANTICS
  343. # undef _POSIX_PTHREAD_SEMANTICS
  344. #endif
  345. /* Enable extensions on HP NonStop. */
  346. #ifndef _TANDEM_SOURCE
  347. # undef _TANDEM_SOURCE
  348. #endif
  349. /* Enable general extensions on Solaris. */
  350. #ifndef __EXTENSIONS__
  351. # undef __EXTENSIONS__
  352. #endif
  353. ])
  354. AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
  355. [ac_cv_safe_to_define___extensions__],
  356. [AC_COMPILE_IFELSE(
  357. [AC_LANG_PROGRAM([[
  358. # define __EXTENSIONS__ 1
  359. ]AC_INCLUDES_DEFAULT])],
  360. [ac_cv_safe_to_define___extensions__=yes],
  361. [ac_cv_safe_to_define___extensions__=no])])
  362. test $ac_cv_safe_to_define___extensions__ = yes &&
  363. AC_DEFINE([__EXTENSIONS__])
  364. AC_DEFINE([_ALL_SOURCE])
  365. AC_DEFINE([_GNU_SOURCE])
  366. AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
  367. AC_DEFINE([_TANDEM_SOURCE])
  368. ])# AC_USE_SYSTEM_EXTENSIONS
  369. ## -------------------------- ##
  370. ## Checks for UNIX variants. ##
  371. ## -------------------------- ##
  372. # These are kludges which should be replaced by a single POSIX check.
  373. # They aren't cached, to discourage their use.
  374. # AC_AIX
  375. # ------
  376. AU_DEFUN([AC_AIX], [AC_USE_SYSTEM_EXTENSIONS])
  377. # AC_MINIX
  378. # --------
  379. AU_DEFUN([AC_MINIX], [AC_USE_SYSTEM_EXTENSIONS])
  380. # AC_ISC_POSIX
  381. # ------------
  382. AU_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS([strerror], [cposix])])
  383. # AC_XENIX_DIR
  384. # ------------
  385. AU_DEFUN([AC_XENIX_DIR],
  386. [AC_MSG_CHECKING([for Xenix])
  387. AC_EGREP_CPP([yes],
  388. [#if defined M_XENIX && ! defined M_UNIX
  389. yes
  390. @%:@endif],
  391. [AC_MSG_RESULT([yes]); XENIX=yes],
  392. [AC_MSG_RESULT([no]); XENIX=])
  393. AC_HEADER_DIRENT[]dnl
  394. ],
  395. [You shouldn't need to depend upon XENIX. Remove the
  396. `AC_MSG_CHECKING', `AC_EGREP_CPP', and this warning if this part
  397. of the test is useless.])
  398. # AC_DYNIX_SEQ
  399. # ------------
  400. AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT])
  401. # AC_IRIX_SUN
  402. # -----------
  403. AU_DEFUN([AC_IRIX_SUN],
  404. [AC_FUNC_GETMNTENT
  405. AC_CHECK_LIB([sun], [getpwnam])])
  406. # AC_SCO_INTL
  407. # -----------
  408. AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME])