forked from cisco/libacvp
-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.ac
234 lines (194 loc) · 7.14 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# When to bump versions.
# Major - Bumped if an API or ABI changes, Build changes etc.
# Minor - Bumped for every release of software
# Micro - Bumped for patch releases only
# age - Represents how many revisions back of the Major/Current this library
# supports. Each library client, Mgmt, common can be ABI compatible
# depending on the change in the library.
#
# Once a number gets incremented all numbers to the left get reset to zero.
# Shared objects are named library.so.Major.age.Minor by autotools
#
m4_define([libacvp_major_version], [1])
m4_define([libacvp_minor_version], [0])
m4_define([libacvp_micro_version], [1])
AC_INIT([libacvp], [libacvp_major_version.libacvp_minor_version.libacvp_micro_version], [https://github.com/cisco/libacvp/issues])
# Safety checks in case user overwritten --srcdir
SUBDIRS=src
AC_CONFIG_MACRO_DIR([m4])
m4_pattern_allow([^AM_])
m4_pattern_allow([^AC_])
# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess)
# in this dir (build-aux)
AC_CONFIG_AUX_DIR([config])
# Init automake, and specify this program use relaxed structures.
# i.e. this program doesn't follow the gnu coding standards, and doesn't have
# ChangeLog, COPYING, AUTHORS, INSTALL, README etc. files.
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
# Check for C compiler
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_AR
LT_INIT
# We can add more checks in this section
AC_CANONICAL_HOST
##
# Set the CFLAGS
##
CFLAGS="$CFLAGS -Wall -fstack-protector-all -D_FORTIFY_SOURCE=2"
##
# OSX doesn't need/support -z,noexecstack
# only add if running on linux
##
gcc_z_support=no
case "${host_os}" in
linux*)
gcc_z_support=yes
;;
esac
AS_IF(
[test "$gcc_z_support" = "yes"],
[[CFLAGS="$CFLAGS -Wl,-z,noexecstack"]])
##
# OpenSSL variables
##
AC_ARG_WITH([ssl-dir],
[AS_HELP_STRING([--with-ssl-dir],
[location of OpenSSL install folder, defaults to /usr/local/ssl])],
[ssldir="$withval"],
[ssldir="/usr/local/ssl"])
AC_SUBST([SSL_CFLAGS], "-I$ssldir/include")
AC_SUBST([SSL_LDFLAGS], "-L$ssldir/lib -lssl -lcrypto")
LDFLAGS="$LDFLAGS -L$ssldir/lib"
# Hold onto the LIBS variable before AC_SEARCH_LIBS modifies it
pre_libs="$LIBS"
AC_SEARCH_LIBS([EVP_EncryptInit], [crypto], [],
[AC_MSG_FAILURE([can't find openssl crypto lib])], [])
if test "$is_freebsd" = "1" ; then
AC_SEARCH_LIBS([EVP_EncryptInit], [crypto], [],
[AC_MSG_FAILURE([can't find openssl crypto lib])], [])
else
AC_SEARCH_LIBS([EVP_EncryptInit], [crypto], [],
[AC_MSG_FAILURE([can't find openssl crypto lib])], [-ldl])
fi
AC_SEARCH_LIBS([SSL_CTX_new], [ssl], [],
[AC_MSG_FAILURE([can't find openssl ssl lib])], [])
##
# Libcurl installation directory path
##
AC_ARG_WITH([libcurl-dir],
[AS_HELP_STRING([--with-libcurl-dir],
[enable support for client proxy using libcurl])],
[libcurldir="$withval"],
[with_libcurldir=no])
AS_IF([test "x$with_libcurldir" != xno],
[AC_SUBST([LIBCURL_CFLAGS], "-I$libcurldir/include")
AC_SUBST([LIBCURL_LDFLAGS], "-L$libcurldir/lib -lcurl")
LDFLAGS="$LDFLAGS -L$libcurldir/lib"
AC_SEARCH_LIBS([curl_easy_init], [curl], [],
[AC_MSG_FAILURE([--with-libcurl-dir was given, but test for libcurl failed])]
)
]
)
##
# Libmurl installation directory path
##
AC_ARG_WITH([libmurl-dir],
[AS_HELP_STRING([--with-libmurl-dir],
[enable support for client proxy using libmurl])],
[libmurldir="$withval"],
[with_libmurldir=no])
AS_IF(
[test "x$with_libmurldir" != xno],
[[CFLAGS="$CFLAGS -I$libmurldir -DUSE_MURL"]
[LDFLAGS="$LDFLAGS -L$libmurldir -lmurl"]]
)
##
# FOM installation directory path
##
AC_ARG_VAR(FOM_OBJ_DIR, "directory with fipscanister.o")
AC_ARG_WITH([fom-dir],
[AS_HELP_STRING([--with-fom-dir],
[Path to FOM install directory])],
[fomdir="$withval"],
[with_fomdir=no])
AS_IF([test "x$with_fomdir" != xno],
[AC_SUBST([FOM_CFLAGS], "-DACVP_NO_RUNTIME -DOPENSSL_FIPS -DOPENSSL_KDF_SUPPORT -I$fomdir/include")
AC_SUBST([FOM_LDFLAGS], "-L$fomdir/lib")
AC_SUBST([FOM_OBJ_DIR], "$fomdir/lib")
]
)
AM_CONDITIONAL([USE_FOM], [test "x$with_fomdir" != xno])
##
# Offline mode
##
AC_ARG_ENABLE([offline],
[AS_HELP_STRING([--enable-offline],
[Flag to indicate use of offline mode])],
[offline="$enableval"],
[enable_offline=false])
AC_SUBST([SSL_LDFLAGS], "-L$ssldir/lib -lcrypto")
AS_IF(
[test "x$enable_offline" != "xfalse"],
[[CFLAGS="$CFLAGS -DACVP_OFFLINE"]
[LDFLAGS="-static $LDFLAGS"]
[CC="$fomdir/bin/fipsld"]
]
)
AC_ARG_ENABLE([cflags],
[AS_HELP_STRING([--enable-cflags],
[Flag to indicate use of enhanced CFLAGS])],
[cflags="$enableval"],
[enable_cflags=false])
AS_IF(
[test "x$enable_cflags" != "xfalse"],
[[CFLAGS="$CFLAGS -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wformat -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnested-externs -Wnonnull -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wswitch-default -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wno-pointer-sign -Wcast-qual -Wfloat-equal -Wuninitialized -Wno-error=unreachable-code -Winline -Wno-error=cast-align -Wbad-function-cast -Wswitch-enum -Wsystem-headers -Wunused-but-set-variable -Wextra -Wno-error=unreachable-code"]
]
)
##
# Gcoverage
##
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[Flag to indicate use of gcov tool])],
[gcov="$enableval"],
[enable_gcov=false])
AS_IF(
[test "x$enable_gcov" != "xfalse"],
[[CFLAGS="$CFLAGS --coverage"]
[LDFLAGS="$LDFLAGS -lgcov"]
]
)
if test "x$enable_gcov" != "xfalse" ; then
CLEANFILES="app/*.gcda app/*.gcno src/*.gcda src/*.gcno test/*.gcda test/*.gcno safe_c_stub/src/*.gcno"
AC_SUBST(CLEANFILES)
fi
AC_ARG_WITH([criterion-dir],
[AS_HELP_STRING([--with-criterion-dir],
[location of Criterion install folder])],
[criteriondir="$withval"],
[with_criteriondir="no"])
AS_IF([test "x$with_criterion" != xno],
[AC_SUBST([CRITERION_CFLAGS], "-I$criteriondir/include")
AC_SUBST([CRITERION_LDFLAGS], "-L$criteriondir/lib -lcriterion")
]
)
AM_CONDITIONAL([UNIT_TEST_SUPPORTED], [test "x$with_criteriondir" != "xno"])
##
# SafeC Stub
##
SAFEC_STUB_DIR='$(abs_top_builddir)/safe_c_stub'
AC_SUBST(SAFEC_STUB_DIR)
safecdir="$SAFEC_STUB_DIR"
AC_SUBST([SAFEC_CFLAGS], "-I$safecdir/include")
AC_SUBST([SAFEC_LDFLAGS], "$safecdir/lib/libsafe_lib.la")
# Reset LIBS to original
LIBS="$pre_libs"
# Default installation directory
AC_PREFIX_DEFAULT([/usr/local/acvp])
cp confdefs.h acvp_config.h
AC_CONFIG_FILES([Makefile safe_c_stub/Makefile safe_c_stub/lib/Makefile src/Makefile app/Makefile test/Makefile])
AC_OUTPUT