OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / squid / acinclude.m4
1 dnl AC_CHECK_SIZEOF_SYSTYPE is as the standard AC_CHECK_SIZEOF macro
2 dnl but also capable of checking the size of system defined types, not
3 dnl only compiler defined types.
4 dnl
5 dnl AC_CHECK_SYSTYPE is the same thing but replacing AC_CHECK_TYPE
6 dnl However AC_CHECK_TYPE is not by far as limited as AC_CHECK_SIZEOF
7 dnl (it at least makes use of <sys/types.h>, <stddef.h> and <stdlib.h>)
8
9 dnl AC_CHECK_SIZEOF_SYSTYPE(TYPE [, CROSS-SIZE])
10 AC_DEFUN(AC_CHECK_SIZEOF_SYSTYPE,
11 [changequote(<<, >>)dnl
12 dnl The name to #define.
13 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
14 dnl The cache variable name.
15 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
16 changequote([, ])dnl
17 AC_MSG_CHECKING(size of $1)
18 AC_CACHE_VAL(AC_CV_NAME,
19 [AC_TRY_RUN([
20 #include <stdio.h>
21 #if STDC_HEADERS
22 #include <stdlib.h>
23 #include <stddef.h>
24 #endif
25 #if HAVE_INTTYPES_H
26 #include <inttypes.h>
27 #endif
28 #if HAVE_SYS_TYPES_H
29 #include <sys/types.h>
30 #endif
31 #if HAVE_SYS_BITYPES_H
32 #include <sys/bitypes.h>
33 #endif
34 int main()
35 {
36   FILE *f=fopen("conftestval", "w");
37   if (!f) return(1);
38   fprintf(f, "%d\n", sizeof($1));
39   return(0);
40 }
41 ], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
42 AC_MSG_RESULT($AC_CV_NAME)
43 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
44 undefine([AC_TYPE_NAME])dnl
45 undefine([AC_CV_NAME])dnl
46 ])
47
48 dnl AC_CHECK_SYSTYPE(TYPE, DEFAULT)
49 AC_DEFUN(AC_CHECK_SYSTYPE,
50 [AC_REQUIRE([AC_HEADER_STDC])dnl
51 AC_MSG_CHECKING(for $1)
52 AC_CACHE_VAL(ac_cv_type_$1,
53 [AC_EGREP_CPP(dnl
54 changequote(<<,>>)dnl
55 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
56 changequote([,]), [
57 /* What a mess.. many systems have added the (now standard) bit types
58  * in their own ways, so we need to scan a wide variety of headers to
59  * find them..
60  */
61 #include <sys/types.h>
62 #if STDC_HEADERS
63 #include <stdlib.h>
64 #include <stddef.h>
65 #endif
66 #if HAVE_INTTYPES_H
67 #include <inttypes.h>
68 #endif
69 #if HAVE_SYS_TYPES_H
70 #include <sys/types.h>
71 #endif
72 #if HAVE_SYS_BITYPES_H
73 #include <sys/bitypes.h>
74 #endif
75 ], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
76 AC_MSG_RESULT($ac_cv_type_$1)
77 if test $ac_cv_type_$1 = no; then
78   AC_DEFINE($1, $2)
79 fi
80 ])
81