-
Notifications
You must be signed in to change notification settings - Fork 22
/
configure.ac
152 lines (134 loc) · 3.04 KB
/
configure.ac
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
##
# Prologue
##
AC_INIT([scrub],
m4_esyscmd([git describe --tags --always | awk '/.*/ {sub(/^v/, ""); printf "%s",$1; exit}']))
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_SRCDIR([NEWS])
AC_CANONICAL_SYSTEM
AC_CONFIG_MACRO_DIR([config])
X_AC_EXPAND_INSTALL_DIRS
##
# Automake support
##
AM_INIT_AUTOMAKE([subdir-objects foreign])
AM_SILENT_RULES([yes])
AM_CONFIG_HEADER([config/config.h])
AM_MAINTAINER_MODE
##
# Conditionally build libscrub
##
AC_ARG_ENABLE(libscrub,
[ --enable-libscrub Build libscrub],
[case "${enableval}" in
yes) libscrub=true ;;
no) libscrub=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-libscrub) ;;
esac],[libscrub=false])
AM_CONDITIONAL(LIBSCRUB, test x$libscrub = xtrue)
##
# Checks for programs
##
AC_PROG_CC
AM_PROG_CC_C_O
##
# Checks for header files.
##
AC_USE_SYSTEM_EXTENSIONS
AC_HEADER_STDC
AC_CHECK_HEADERS( \
getopt.h \
stdbool.h \
stdint.h \
pthread.h \
linux/fs.h \
sys/devinfo.h \
sys/disk.h \
sys/dkio.h \
sys/ioctl.h \
sys/scsi.h \
sys/mman.h \
)
AC_PROG_LIBTOOL
AC_PKGCONFIG
##
# Checks for typedefs, structures, and compiler characteristics
##
AC_C_BIGENDIAN
AC_C_CONST
##
# Checks for libraries
##
AC_CHECK_LIB(prop, prop_dictionary_recv_ioctl, LIBPROP=-lprop)
AC_SUBST(LIBPROP)
##
# Checks for library functions
##
AC_CHECK_FUNCS( \
getopt_long \
posix_memalign \
memalign \
posix_fadvise \
rand_r \
random_r \
)
X_AC_CHECK_PTHREADS
# Sanity check; we cannot have both --with-libgcrypt AND --with-openssl
# together.
AS_IF([test "x$with_openssl" = "xyes"], [
AS_IF([test "x$with_libgcrypt" = "xyes"],
[AC_MSG_ERROR([You can use either --with-openssl or --with-libgcrypt, not both at once])]
)
])
##
# OpenSSL libcrypto library
##
have_openssl=no
AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl], [build with OpenSSL libcrypto]))
if test "x$with_openssl" = "xyes"; then
AC_SEARCH_LIBS([RAND_bytes], [crypto],
[AC_DEFINE([HAVE_OPENSSL], [1], [OpenSSL libcrypto available])
have_openssl=yes
], [AC_MSG_ERROR([OpenSSL libcrypto required])]
)
fi
##
# gcrypt library
##
have_libgcrypt=no
AC_ARG_WITH(libgcrypt, AS_HELP_STRING([--without-libgcrypt], [build without libgcrypt;
fallback to custom AES implementation]))
# Technically there is no need for testing this again, as we already
# error'ed out early if both options were enabled at once.
AS_IF([test "x$with_openssl" != "xyes"], [
AS_IF([test "x$with_libgcrypt" != "xno"], [
AM_PATH_LIBGCRYPT([1.5.0],
[AC_DEFINE([HAVE_LIBGCRYPT], [1], [libgcrypt API available])
gcrypt_CFLAGS="$LIBGCRYPT_CFLAGS"
gcrypt_LIBS="$LIBGCRYPT_LIBS"
have_libgcrypt=yes
]
)]
)]
)
AM_CONDITIONAL([LIBGCRYPT], [test "$have_libgcrypt" = "yes"])
AC_SUBST([gcrypt_CFLAGS])
AC_SUBST([gcrypt_LIBS])
##
# Arrange for large file support
##
AC_SYS_LARGEFILE
##
# Epilogue
##
AC_CONFIG_FILES( \
Makefile \
scrub.spec \
src/Makefile \
man/Makefile \
man/scrub.1 \
test/Makefile \
libscrub/Makefile \
libscrub/libscrub.pc \
)
AC_OUTPUT