]>
Commit | Line | Data |
---|---|---|
f163b202 SB |
1 | # |
2 | # configure.ac | |
3 | # | |
4 | # The Initial Developer of the Original Code is International | |
5 | # Business Machines Corporation. Portions created by IBM | |
6 | # Corporation are Copyright (C) 2014 International Business | |
7 | # Machines Corporation. All Rights Reserved. | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the Common Public License as published by | |
11 | # IBM Corporation; either version 1 of the License, or (at your option) | |
12 | # any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # Common Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the Common Public License | |
20 | # along with this program; if not, a copy can be viewed at | |
21 | # http://www.opensource.org/licenses/cpl1.0.php. | |
22 | # | |
23 | # This file is derived from tpm-tool's configure.in. | |
24 | # | |
25 | ||
26 | AC_INIT(swtpm, 0.1.0) | |
27 | AC_PREREQ(2.12) | |
28 | AC_CONFIG_SRCDIR(Makefile.am) | |
29 | AC_CONFIG_HEADER(config.h) | |
30 | ||
31 | SWTPM_VER_MAJOR=`echo $PACKAGE_VERSION | cut -d "." -f1` | |
32 | SWTPM_VER_MINOR=`echo $PACKAGE_VERSION | cut -d "." -f2` | |
33 | SWTPM_VER_MICRO=`echo $PACKAGE_VERSION | cut -d "." -f3` | |
34 | ||
35 | AC_SUBST([SWTPM_VER_MAJOR]) | |
36 | AC_SUBST([SWTPM_VER_MINOR]) | |
37 | AC_SUBST([SWTPM_VER_MICRO]) | |
38 | ||
39 | dnl Check for programs | |
40 | AC_PROG_CC | |
41 | AC_PROG_INSTALL | |
42 | AC_PROG_LN_S | |
43 | AC_PROG_LIBTOOL | |
44 | ||
f163b202 SB |
45 | AC_CONFIG_MACRO_DIR([m4]) |
46 | AC_CANONICAL_TARGET | |
47 | AM_INIT_AUTOMAKE([foreign 1.6]) | |
48 | ||
49 | DEBUG="" | |
50 | AC_MSG_CHECKING([for debug-enabled build]) | |
51 | AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [create a debug build]), | |
52 | [if test "$enableval" = "yes"; then | |
53 | DEBUG="yes" | |
54 | AC_MSG_RESULT([yes]) | |
55 | else | |
56 | DEBUG="no" | |
57 | AC_MSG_RESULT([no]) | |
58 | fi], | |
59 | [DEBUG="no", | |
60 | AC_MSG_RESULT([no])]) | |
61 | ||
62 | # If the user has not set CFLAGS, do something appropriate | |
63 | test_CFLAGS=${CFLAGS+set} | |
64 | if test "$test_CFLAGS" != set; then | |
65 | if test "$DEBUG" == "yes"; then | |
66 | CFLAGS="-O0 -g -DDEBUG" | |
67 | else | |
68 | CFLAGS="-g -O2" | |
69 | fi | |
70 | elif test "$DEBUG" == "yes"; then | |
71 | CFLAGS="$CFLAGS -O0 -g -DDEBUG" | |
72 | fi | |
73 | ||
e46a2b66 SB |
74 | AC_HEADER_STDC |
75 | AC_C_CONST | |
76 | AC_C_INLINE | |
77 | ||
78 | AC_TYPE_SIZE_T | |
79 | AC_TYPE_SIGNAL | |
80 | ||
81 | ||
f163b202 SB |
82 | GLIB_CFLAGS=$(pkg-config --cflags glib-2.0) |
83 | if test $? -ne 0; then | |
84 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get cflags") | |
85 | fi | |
86 | ||
87 | GLIB_LDFLAGS=$(pkg-config --libs glib-2.0) | |
88 | if test $? -ne 0; then | |
89 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs") | |
90 | fi | |
91 | ||
92 | GTHREAD_LDFLAGS=$(pkg-config --libs gthread-2.0) | |
93 | if test $? -ne 0; then | |
94 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs for gthread-2.0") | |
95 | fi | |
96 | ||
97 | NSS_CFLAGS=$(pkg-config --cflags nss) | |
98 | if test $? -ne 0; then | |
99 | AC_MSG_ERROR("Is nss-softokn-freebl-devel installed? -- could not get cflags for nss") | |
100 | fi | |
101 | ||
102 | NSS_LDFLAGS=$(pkg-config --libs nss) | |
103 | if test $? -ne 0; then | |
104 | AC_MSG_ERROR("Is nss-softokn-freebl-devel installed? -- could not get libs for nss") | |
105 | fi | |
106 | ||
107 | CFLAGS="$CFLAGS $GLIB_CFLAGS $NSS_CFLAGS" | |
108 | LDFLAGS="$LDFLAGS $GLIB_LDFLAGS $GTHREAD_LDFLAGS $NSS_LDFLAGS" | |
109 | ||
110 | CPPFLAGS=$GLIB_CFLAGS | |
111 | AC_CHECK_HEADERS([glib.h],[], | |
112 | AC_MSG_ERROR([You must install glib2-devel])) | |
113 | ||
114 | AC_PROG_CC | |
115 | AC_PROG_INSTALL | |
116 | ||
117 | #AM_GNU_GETTEXT_VERSION([0.15]) | |
118 | #AM_GNU_GETTEXT([external]) | |
119 | ||
e46a2b66 SB |
120 | AC_PATH_PROG([TPM_NVDEFINE], tpm_nvdefine) |
121 | if test "x$TPM_NVDEFINE" == "x"; then | |
122 | AC_MSG_ERROR([NVRAM area tools are need: tpm-tools package]) | |
123 | fi | |
124 | ||
f163b202 SB |
125 | AC_CHECK_LIB([tpms], [TPMLIB_MainInit], [], |
126 | [AC_MSG_ERROR([TPM library not found: libtpms.so])]) | |
127 | AC_CHECK_HEADER(libtpms/tpm_library.h, [], \ | |
128 | [AC_MSG_ERROR([TPM library header not found: libtpms/tpm_library.h])]) | |
129 | ||
130 | saved_CFLAGS="$CFLAGS" | |
131 | CFLAGS=`pkg-config fuse --cflags` | |
132 | CPPFLAGS=$CFLAGS | |
133 | AC_CHECK_LIB([fuse], [cuse_lowlevel_main], [], | |
134 | [AC_MSG_ERROR([FUSE library not found: libfuse.so])]) | |
135 | AC_CHECK_HEADER(cuse_lowlevel.h, [], \ | |
136 | [AC_MSG_ERROR([FUSE library header not found: fuse/cuse_lowlevel.h])]) | |
137 | CFLAGS="$saved_CFLAGS" | |
138 | ||
e46a2b66 SB |
139 | if test "x$with_gnutls" != "xno"; then |
140 | GNUTLS_LDFLAGS=$(pkg-config --libs gnutls) | |
141 | if test $? -ne 0; then | |
142 | if "x$with_gnutls" == "xyes"; then | |
143 | AC_MSG_ERROR("Is gnutls installed? -- could not get libs for gnutls") | |
144 | else | |
145 | with_gnutls=no | |
146 | fi | |
147 | fi | |
148 | fi | |
f163b202 | 149 | |
e46a2b66 SB |
150 | saved_CFLAGS="$CFLAGS" |
151 | if test "x$with_gnutls" != "xno"; then | |
152 | CFLAGS=`pkg-config gnutls --cflags` | |
153 | AC_CHECK_LIB([gnutls], [gnutls_x509_crt_set_key], [], | |
154 | [if test "x$with_gnutls" == "xyes"; then | |
155 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library not found: libgnutls.so]) | |
156 | else | |
157 | with_gnutls="no" | |
158 | fi]) | |
159 | fi | |
160 | ||
161 | if test "x$with_gnutls" != "xno"; then | |
162 | AC_CHECK_HEADER(gnutls/abstract.h, [], \ | |
163 | [if test "x$with_gnutls" == "xyes"; then | |
164 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library header not found: gnutls/abstract.h]) | |
165 | else | |
166 | with_gnutls="no" | |
167 | fi]) | |
168 | fi | |
169 | ||
170 | if test "x$with_gnutls" != "xno"; then | |
171 | with_gnutls="yes" | |
172 | fi | |
173 | AM_CONDITIONAL([WITH_GNUTLS], [test "x$with_gnutls" == "xyes"]) | |
174 | ||
175 | CFLAGS="$saved_CFLAGS" | |
f163b202 SB |
176 | |
177 | CFLAGS="$CFLAGS -Wreturn-type -Wsign-compare -Wswitch-enum" | |
178 | CFLAGS="$CFLAGS -Wmissing-prototypes -Wall -Werror" | |
179 | ||
180 | AC_CONFIG_FILES(Makefile \ | |
181 | dist/swtpm.spec \ | |
e46a2b66 SB |
182 | etc/Makefile \ |
183 | samples/Makefile \ | |
f163b202 SB |
184 | include/Makefile \ |
185 | include/swtpm/Makefile \ | |
186 | src/Makefile \ | |
187 | src/selinux/Makefile \ | |
188 | src/swtpm/Makefile \ | |
189 | src/swtpm/swtpm.h \ | |
e46a2b66 SB |
190 | src/swtpm_bios/Makefile \ |
191 | src/swtpm_cert/Makefile \ | |
192 | src/swtpm_ioctl/Makefile \ | |
193 | src/swtpm_setup/Makefile \ | |
f163b202 SB |
194 | man/Makefile \ |
195 | man/man8/Makefile \ | |
e46a2b66 | 196 | tests/Makefile \ |
f163b202 SB |
197 | ) |
198 | AC_OUTPUT | |
199 | ||
e46a2b66 SB |
200 | echo |
201 | echo "with_gnutls : $with_gnutls (no = swtpm_cert will NOT be built)" | |
202 | echo | |
f163b202 SB |
203 | echo "CFLAGS=$CFLAGS" |
204 | echo "LDFLAGS=$LDFLAGS" |