-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
160 lines (136 loc) · 4.49 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
#
# configure.in
#
# The Initial Developer of the Original Code is International
# Business Machines Corporation. Portions created by IBM
# Corporation are Copyright (C) 2005, 2006 International Business
# Machines Corporation. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the Common Public License as published by
# IBM Corporation; either version 1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Common Public License for more details.
#
# You should have received a copy of the Common Public License
# along with this program; if not, a copy can be viewed at
# http://www.opensource.org/licenses/cpl1.0.php.
#
AC_INIT(tpm-tools, 1.3.9, trousers-tech@lists.sf.net)
AC_PREREQ(2.12)dnl
AC_CONFIG_SRCDIR(Makefile.am)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign 1.6])
DEBUG=""
AC_MSG_CHECKING([for debug-enabled build])
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [create a debug build that outputs debug messages]),
[if test "$enableval" = "yes"; then
DEBUG="yes"
AC_MSG_RESULT([yes])
else
DEBUG="no"
AC_MSG_RESULT([no])
fi],
[DEBUG="no"
AC_MSG_RESULT([no])])
# If the user has not set CFLAGS, do something appropriate
test_CFLAGS=${CFLAGS+set}
if test "$test_CFLAGS" != set; then
if test "$DEBUG" == "yes"; then
CFLAGS="-O0 -g -DDEBUG"
else
CFLAGS="-g -O2"
fi
elif test "$DEBUG" == "yes"; then
CFLAGS="$CFLAGS -O0 -g -DDEBUG"
fi
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_CHECK_PROGS(COPY, cp)
AC_CHECK_PROGS(ECHO, echo)
AC_CHECK_PROGS(MKDIR, mkdir)
AC_CHECK_PROGS(RM, rm)
AM_GNU_GETTEXT_VERSION([0.15])
AM_GNU_GETTEXT([external])
# Arch specific stuff
case $target in
*ppc64* | *powerpc64* | *x86_64* | *s390x*)
CFLAGS="$CFLAGS -m64"
;;
*)
;;
esac
# Non-standard OpenSSL location
AC_MSG_CHECKING([Non-standard OpenSSL location])
AC_ARG_WITH(openssl,
AC_HELP_STRING([--with-openssl=PATH], [Location of openssl libs/includes]),
[OPENSSL_INCLUDE_DIR="$withval/include"
OPENSSL_LIB_DIR="$withval/lib"
if test ! -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"
AC_SUBST([OPENSSL_LIB_DIR])
fi],
[AC_MSG_RESULT([no])
AC_SUBST([OPENSSL_LIB_DIR], []) ] )
AC_CHECK_LIB(tspi, Tspi_Context_Create, [TSS_LIB="1"], [AC_MSG_ERROR([tss lib not found: libtspi.so])])
AC_CHECK_LIB(tspi, Tspi_TPM_SetOperatorAuth, [TSS_12="1"], [TSS_12="0"])
if test "$TSS_12" = "1"; then
AM_CONDITIONAL(TSS_LIB_IS_12, true)
AC_MSG_NOTICE([Configuring tpm-tools for TSS 1.2])
else
AM_CONDITIONAL(TSS_LIB_IS_12, false)
AC_MSG_NOTICE([Configuring tpm-tools for TSS 1.1])
fi
AC_CHECK_HEADER(trousers/tss.h, [TSS_INC="1"], [AC_MSG_ERROR([tss header not found: trousers/tss.h])])
AC_CHECK_LIB(crypto, PEM_read_X509, [OPENSSL_LIB="1"], [AC_MSG_ERROR([openssl lib not found: libcrypto.so])])
AC_CHECK_HEADER(openssl/evp.h, [OPENSSL_INC="1"], [AC_MSG_ERROR([openssl header not found: openssl/evp.h])])
OPENCRYPTOKI="0"
AC_ARG_ENABLE(pkcs11_support,
AC_HELP_STRING([--disable-pkcs11-support], [don't build data_mgmt commands [[default=no]]]),
[disable_pkcs11_support="yes"
AC_MSG_RESULT([*** Not building data_mgmt at user request ***])],)
if test "x$disable_pkcs11_support" != "xyes"; then
AC_CHECK_HEADER(opencryptoki/pkcs11.h, [OPENCRYPTOKI_INC="1"], [OPENCRYPTOKI_INC="0"])
if test "$OPENCRYPTOKI_INC" = "1"; then
OPENCRYPTOKI="1"
fi
fi
AM_CONDITIONAL([P11_SUPPORT], [test "$OPENCRYPTOKI" = "1"])
AC_HEADER_STDC
AC_C_CONST
AC_C_INLINE
AC_SYS_LONG_FILE_NAMES
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_TYPE_UID_T
CFLAGS="$CFLAGS -Wall -Wreturn-type -Wsign-compare"
AC_CONFIG_FILES(Makefile \
po/Makefile.in \
m4/Makefile \
include/Makefile \
lib/Makefile \
src/Makefile \
src/tpm_mgmt/Makefile \
src/cmds/Makefile \
src/data_mgmt/Makefile \
dist/tpm-tools.spec \
man/Makefile \
man/man1/Makefile \
man/man3/Makefile \
man/man8/Makefile)
AC_OUTPUT
echo "CFLAGS=$CFLAGS"
echo "LDFLAGS=$LDFLAGS"