freebsd-dev/contrib/file/acinclude.m4
2000-11-05 08:33:55 +00:00

80 lines
2.2 KiB
Plaintext

dnl cloned from autoconf 2.13 acspecific.m4
AC_DEFUN(AC_C_LONG_LONG,
[AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
[if test "$GCC" = yes; then
ac_cv_c_long_long=yes
else
AC_TRY_RUN([int main() {
long long foo = 0;
exit(sizeof(long long) < sizeof(long)); }],
ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
fi])
if test $ac_cv_c_long_long = yes; then
AC_DEFINE(HAVE_LONG_LONG)
fi
])
dnl from autoconf 2.13 acgeneral.m4, with patch:
dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
dnl From: eggert@twinsun.com (Paul Eggert)
dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
dnl Newsgroups: gnu.utils.bug
dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
AC_DEFUN(AC_CHECK_TYPE2,
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
changequote([,]), [#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl
if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_DEFINE_UNQUOTED($1, $2)
fi
])
dnl from autoconf 2.13 acgeneral.m4, with additional third argument
dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(size of $1)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([$3
#include <stdio.h>
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof($1));
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
[AC_CHECK_SIZEOF_INCLUDES($1, $2,
[#include <sys/types.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
])
])