-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure.ac
87 lines (74 loc) · 2.19 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
#
# configure.in for the OpenSSL TPM engine project
#
AC_INIT(openssl-tpm-engine, 0.5.0, [email protected])
AM_INIT_AUTOMAKE(1.6.3)
# Debugging support
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [turn on all debugging flags [default is off]]),
[enable_debug="yes"
AC_MSG_RESULT([*** Enabling debugging at user request ***])],)
# If the user has not set CFLAGS, do something appropriate
test_CFLAGS=${CFLAGS+set}
if test "$test_CFLAGS" != set; then
if test "x$enable_debug" == "xyes"; then
CFLAGS="-O0 -g -DDEBUG"
else
CFLAGS="-O2"
fi
fi
#if test "${OPENSSL_LIB_DIR+set}" != set; then
# OPENSSL_LIB_DIR="/usr/local/ssl/lib"
#fi
#if test "${OPENSSL_INCLUDE_DIR+set}" != set; then
# OPENSSL_INCLUDE_DIR="/usr/local/ssl/include"
#fi
# Non-standard OpenSSL
AC_MSG_CHECKING([Non-standard OpenSSL])
AC_ARG_WITH(openssl,
[AS_HELP_STRING([--with-openssl=PATH], [Location of openssl libs/includes])],
[OPENSSL_INCLUDE_DIR="$withval/include"
OPENSSL_LIB_DIR="$withval/lib"
if [[ ! -d $OPENSSL_INCLUDE_DIR -o ! -d $OPENSSL_LIB_DIR ]]; then
AC_MSG_ERROR([$OPENSSL_INCLUDE_DIR or $OPENSSL_LIB_DIR doen't exist!])
else
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS -L$OPENSSL_LIB_DIR -I$OPENSSL_INCLUDE_DIR"
fi],
[AC_MSG_RESULT([no])
AC_SUBST(OPENSSL_LIB_DIR)
AC_SUBST(OPENSSL_INCLUDE_DIR)])
AC_DISABLE_STATIC
AC_PROG_CC
AC_PROG_LIBTOOL
AC_MSG_CHECKING([for OpenSSL 1.1])
AC_TRY_COMPILE(
[#include <openssl/opensslv.h>],
[
#if OPENSSL_VERSION_NUMBER < 0x1010000fL
# error "old ssl"
#else
# warning "new openssl"
#endif
],
[AC_MSG_RESULT(yes)
openssl_11=true
],
[AC_MSG_RESULT(no)
openssl_11=false
]
)
AM_CONDITIONAL([OPENSSL_11], [test x$openssl_11 = xtrue])
PKG_CHECK_MODULES([libcrypto], [libcrypto],
[libcrypto_enginesdir=`$PKG_CONFIG --variable=enginesdir libcrypto`],
[libcrypto_enginesdir="\${libdir}/openssl/engines"]
)
AC_ARG_WITH([enginedir],
[AS_HELP_STRING([--with-enginedir=DIR], [engine directory])],
[enginedir=$withval],
[enginedir="$libcrypto_enginesdir"])
AC_SUBST([enginedir], [$enginedir])
CFLAGS="$CFLAGS -Wall"
AC_SUBST(CFLAGS)
AC_OUTPUT(Makefile src/Makefile test/Makefile)
echo "CFLAGS=$CFLAGS"