3
dnl AIDE_CHECK_TYPEDEF(TYPE, HAVE_NAME)
4
dnl Check whether a typedef exists and create a #define $2 if it exists
6
AC_DEFUN(AIDE_CHECK_TYPEDEF,
7
[ AC_MSG_CHECKING(for $1 typedef)
8
AC_CACHE_VAL(aide_cv_typedef_$1,
9
[AC_TRY_COMPILE([#include <stdlib.h>
10
#include <sys/types.h>], [
13
], aide_cv_typedef_$1=yes, aide_cv_typedef_$1=no )])
14
AC_MSG_RESULT($aide_cv_typedef_$1)
15
if test "$aide_cv_typedef_$1" = yes; then
21
dnl define either LITTLE_ENDIAN_HOST or BIG_ENDIAN_HOST
23
define(AIDE_CHECK_ENDIAN,
24
[ if test "$cross_compiling" = yes; then
25
AC_MSG_WARN(cross compiling; assuming little endianess)
27
AC_MSG_CHECKING(endianess)
28
AC_CACHE_VAL(aide_cv_c_endian,
29
[ aide_cv_c_endian=unknown
30
# See if sys/param.h defines the BYTE_ORDER macro.
31
AC_TRY_COMPILE([#include <sys/types.h>
32
#include <sys/param.h>], [
33
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
35
#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
36
AC_TRY_COMPILE([#include <sys/types.h>
37
#include <sys/param.h>], [
38
#if BYTE_ORDER != BIG_ENDIAN
40
#endif], aide_cv_c_endian=big, aide_cv_c_endian=little)])
41
if test "$aide_cv_c_endian" = unknown; then
43
/* Are we little or big endian? From Harbison&Steele. */
47
char c[sizeof (long)];
50
exit (u.c[sizeof (long) - 1] == 1);
52
aide_cv_c_endian=little,
54
aide_cv_c_endian=little
58
AC_MSG_RESULT([$aide_cv_c_endian])
59
if test "$aide_cv_c_endian" = little; then
60
AC_DEFINE(LITTLE_ENDIAN_HOST)
62
AC_DEFINE(BIG_ENDIAN_HOST)
66
dnl AIDE_LINK_FILES( SRC, DEST )
67
dnl same as AC_LINK_FILES, but collect the files to link in
68
dnl some special variables and do the link
69
dnl when AIDE_DO_LINK_FILES is called
70
dnl This is a workaround for AC_LINK_FILES, because it does not work
71
dnl correct when using a caching scheme
73
define(AIDE_LINK_FILES,
74
[ if test "x$wk_link_files_src" = "x"; then
75
wk_link_files_src="$1"
76
wk_link_files_dst="$2"
78
wk_link_files_src="$wk_link_files_src $1"
79
wk_link_files_dst="$wk_link_files_dst $2"
83
define(AIDE_DO_LINK_FILES,
84
[ AC_LINK_FILES( $wk_link_files_src, $wk_link_files_dst )
87
dnl AIDE_MSG_PRINT(STRING)
90
define(AIDE_MSG_PRINT,
91
[ echo $ac_n "$1"" $ac_c" 1>&AC_FD_MSG