xref: /freebsd/contrib/file/acinclude.m4 (revision 77a0943ded95b9e6438f7db70c4a28e4d93946d4)
1dnl cloned from autoconf 2.13 acspecific.m4
2AC_DEFUN(AC_C_LONG_LONG,
3[AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
4[if test "$GCC" = yes; then
5  ac_cv_c_long_long=yes
6else
7AC_TRY_RUN([int main() {
8long long foo = 0;
9exit(sizeof(long long) < sizeof(long)); }],
10ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
11fi])
12if test $ac_cv_c_long_long = yes; then
13  AC_DEFINE(HAVE_LONG_LONG)
14fi
15])
16
17dnl from autoconf 2.13 acgeneral.m4, with patch:
18dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
19dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
20dnl From: eggert@twinsun.com (Paul Eggert)
21dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
22dnl Newsgroups: gnu.utils.bug
23
24dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
25AC_DEFUN(AC_CHECK_TYPE2,
26[AC_REQUIRE([AC_HEADER_STDC])dnl
27AC_MSG_CHECKING(for $1)
28AC_CACHE_VAL(ac_cv_type_$1,
29[AC_EGREP_CPP(dnl
30changequote(<<,>>)dnl
31<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
32changequote([,]), [#include <sys/types.h>
33#if STDC_HEADERS
34#include <stdlib.h>
35#include <stddef.h>
36#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl
37if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
38  AC_MSG_RESULT(yes)
39else
40  AC_MSG_RESULT(no)
41  AC_DEFINE_UNQUOTED($1, $2)
42fi
43])
44
45dnl from autoconf 2.13 acgeneral.m4, with additional third argument
46dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
47AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
48[changequote(<<, >>)dnl
49dnl The name to #define.
50define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
51dnl The cache variable name.
52define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
53changequote([, ])dnl
54AC_MSG_CHECKING(size of $1)
55AC_CACHE_VAL(AC_CV_NAME,
56[AC_TRY_RUN([$3
57#include <stdio.h>
58main()
59{
60  FILE *f=fopen("conftestval", "w");
61  if (!f) exit(1);
62  fprintf(f, "%d\n", sizeof($1));
63  exit(0);
64}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
65AC_MSG_RESULT($AC_CV_NAME)
66AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
67undefine([AC_TYPE_NAME])dnl
68undefine([AC_CV_NAME])dnl
69])
70
71dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
72AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
73[AC_CHECK_SIZEOF_INCLUDES($1, $2,
74[#include <sys/types.h>
75#ifdef STDC_HEADERS
76#include <stdlib.h>
77#endif
78])
79])
80