summaryrefslogtreecommitdiff
path: root/source3/lib/replace/libreplace_cc.m4
blob: aa0465983afef05334e5fa96b6aee2ad67f07b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_START,
[
echo "LIBREPLACE_CC_CHECKS: START"
])

AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_END,
[
echo "LIBREPLACE_CC_CHECKS: END"
])

dnl
dnl
dnl AC_LIBREPLACE_CC_CHECKS
dnl
dnl Note: we need to use m4_define instead of AC_DEFUN because
dnl       of the ordering of tests
dnl       
dnl 
m4_define(AC_LIBREPLACE_CC_CHECKS,
[
AC__LIBREPLACE_ONLY_CC_CHECKS_START

dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable it
dnl which conflicts with C99 on HPUX
ac_cv_prog_cc_Ae=no

savedCFLAGS=$CFLAGS
AC_PROG_CC
CFLAGS=$savedCFLAGS
AC_PROG_CC_C99
if test x"$GCC" = x"yes" ; then
	AC_MSG_CHECKING([for version of gcc])
	GCC_VERSION=`$CC -dumpversion`
	AC_MSG_RESULT(${GCC_VERSION})
fi
AC_USE_SYSTEM_EXTENSIONS
AC_C_BIGENDIAN
AC_C_INLINE
LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not supported])])

AC_PROG_INSTALL

AC_ISC_POSIX
AC_EXTENSION_FLAG(_XOPEN_SOURCE_EXTENDED)
AC_EXTENSION_FLAG(_OSF_SOURCE)

AC_SYS_LARGEFILE

dnl Add #include for broken IRIX header files
case "$host_os" in
	*irix6*) AC_ADD_INCLUDE(<standards.h>)
		;;
	*hpux*)
		# mmap on HPUX is completely broken...
		AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
		;;
	*aix*)
		if test "${GCC}" != "yes"; then
			## for funky AIX compiler using strncpy()
			CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
		fi
		;;
	#
	# VOS may need to have POSIX support and System V compatibility enabled.
	#
	*vos*)
		case "$CFLAGS" in
			*-D_POSIX_C_SOURCE*);;
			*)
				CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
				AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
				;;
		esac
		case "$CFLAGS" in
			*-D_SYSV*|*-D_SVID_SOURCE*);;
			*)
				CFLAGS="$CFLAGS -D_SYSV"
				AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
				;;
		esac
		;;
esac



AC_CHECK_HEADERS([standards.h])

# Solaris needs HAVE_LONG_LONG defined
AC_CHECK_TYPES(long long)

AC_CHECK_TYPE(uint_t, unsigned int)
AC_CHECK_TYPE(int8_t, char)
AC_CHECK_TYPE(uint8_t, unsigned char)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(uint16_t, unsigned short)
AC_CHECK_TYPE(int32_t, long)
AC_CHECK_TYPE(uint32_t, unsigned long)
AC_CHECK_TYPE(int64_t, long long)
AC_CHECK_TYPE(uint64_t, unsigned long long)

AC_CHECK_TYPE(size_t, unsigned int)
AC_CHECK_TYPE(ssize_t, int)

AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)

AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(ssize_t)

AC_CHECK_TYPE(intptr_t, unsigned long long)
AC_CHECK_TYPE(ptrdiff_t, unsigned long long)

if test x"$ac_cv_type_long_long" != x"yes";then
	AC_MSG_ERROR([LIBREPLACE needs type 'long long'])
fi
if test $ac_cv_sizeof_long_long -lt 8;then
	AC_MSG_ERROR([LIBREPLACE needs sizeof(long long) >= 8])
fi

AC__LIBREPLACE_ONLY_CC_CHECKS_END
]) dnl end AC_LIBREPLACE_CC_CHECKS