summaryrefslogtreecommitdiffstats
path: root/sha1/configure.ac
blob: 39d9165d98372f99f454e5afd7e81010410edd4b (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright 2001-2004 Double Precision, Inc.
dnl See COPYING for distribution information.

AC_PREREQ([2.71])
AC_INIT([libsha1],[1.21],[courier-users@lists.sourceforge.net])

>confdefs.h  # Kill PACKAGE_ macros

AC_CONFIG_SRCDIR([hmac.c])
AC_CONFIG_AUX_DIR(../..)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign no-define])

AM_CONDITIONAL(HMACC, test -d ${srcdir}/../libhmac)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
LT_INIT

if test "$GCC" = yes
then
	CFLAGS="-Wall $CFLAGS"
fi
CFLAGS="$CFLAGS -I$srcdir/.. -I.."

dnl Checks for libraries.

dnl Checks for header files.

AC_CHECK_HEADERS(sys/types.h stdint.h)

AC_ARG_WITH(int32,
[  --with-int32='type'     use 'type' for an unsigned 32 bit integer type
                          ( default is 'unsigned')],
	int32="$withval", [

		AC_MSG_CHECKING(for uint32_t)

		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_SYS_TYPES_H
#include	<sys/types.h>
#endif
#if HAVE_STDINT_H
#include	<stdint.h>
#endif
uint32_t i;
		]], [[
		]])],[ AC_MSG_RESULT(yes) ; int32="uint32_t"],[

		AC_MSG_RESULT(no)
		AC_MSG_CHECKING(for u_int_32_t)

		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_SYS_TYPES_H
#include	<sys/types.h>
#endif
#if HAVE_STDINT_H
#include	<stdint.h>
#endif
u_int32_t i;
			]], [[
			]])],[AC_MSG_RESULT(yes); int32="u_int32_t"],[

			AC_MSG_RESULT(no)

			AC_CHECK_SIZEOF(unsigned, 0)
			if test "$ac_cv_sizeof_unsigned" != 4
			then
				AC_CHECK_SIZEOF(unsigned long, 0)
				if test "$ac_cv_sizeof_unsigned_long" != 4
				then
					AC_CHECK_SIZEOF(unsigned short, 0)
					if test "$ac_cv_sizeof_unsigned_short" != 4
					then
						AC_MSG_ERROR(--with-int32 option is required)
					fi
					int32="unsigned short"
				else
					int32="unsigned long"
				fi
			else
				int32="unsigned"
			fi
			])
		])
	]
)
UINT32="$int32"

AC_DEFINE_UNQUOTED(SHA1_WORD, $UINT32, [ 32 bit data type ])

AC_ARG_WITH(int64,
[  --with-int64='type'     use 'type' for an unsigned 64 bit integer type
                          ( default is 'unsigned')],
	int64="$withval", [

		AC_MSG_CHECKING(for uint64_t)

		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_SYS_TYPES_H
#include	<sys/types.h>
#endif
#if HAVE_STDINT_H
#include	<stdint.h>
#endif
uint64_t	i;
		]], [[
		]])],[ AC_MSG_RESULT(yes) ; int64="uint64_t"],[

		AC_MSG_RESULT(no)
		AC_MSG_CHECKING(for u_int_64_t)

		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_SYS_TYPES_H
#include	<sys/types.h>
#endif
#if HAVE_STDINT_H
#include	<stdint.h>
#endif
u_int64_t	i;
			]], [[
			]])],[AC_MSG_RESULT(yes); int64="u_int64_t"],[

			AC_MSG_RESULT(no)

			AC_CHECK_SIZEOF(unsigned, 0)
			if test "$ac_cv_sizeof_unsigned" != 8
			then
				AC_CHECK_SIZEOF(unsigned long, 0)
				if test "$ac_cv_sizeof_unsigned_long" != 8
				then
					AC_CHECK_SIZEOF(unsigned long long, 0)
					if test "$ac_cv_sizeof_unsigned_long_long" != 8
					then
						AC_CHECK_SIZEOF(unsigned short, 0)
						if test "$ac_cv_sizeof_unsigned_short" != 8
						then
							AC_MSG_ERROR(--with-int64 option is required)
						fi
						int64="unsigned short"
					else
						int64="unsigned long long"
					fi
				else
					int64="unsigned long"
				fi
			else
				int64="unsigned"
			fi
			])
		])
	]
)
UINT64="$int64"

AC_DEFINE_UNQUOTED(SHA512_WORD, $UINT64, [ 64 bit data type ])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_SYS_LARGEFILE

AC_CONFIG_FILES([Makefile])
AC_OUTPUT