Reduce size by removing unnecessary dependencies
[platform/upstream/ecryptfs-utils.git] / configure.ac
1 # Copyright (C) 2006-2007 International Business Machines Corp.
2 #  
3 # This file is free software; as a special exception the author gives
4 # unlimited permission to copy and/or distribute it, with or without 
5 # modifications, as long as this notice is preserved.
6
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
11
12 AC_PREREQ(2.59)
13 AC_INIT([ecryptfs-utils],[104])
14 AC_CANONICAL_HOST
15 AC_CANONICAL_TARGET
16 AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
17 AC_CONFIG_SRCDIR([src/libecryptfs])
18 AC_CONFIG_HEADERS([config.h])
19 AC_SUBST(AM_CPPFLAGS, '-include $(top_builddir)/config.h')
20 AC_CONFIG_MACRO_DIR([m4])
21
22 AC_DISABLE_STATIC
23
24 # libecryptfs versioning instructions
25 #
26 # Update the version information only once per public release of
27 # ecryptfs-utils. More frequent updates are unnecessary, and only guarantee
28 # that the current interface number gets larger faster.
29 #
30 # 1. If the library source code has changed at all since the last update, then
31 #    increment LIBECRYPTFS_LT_REVISION.
32 # 2. If any interfaces have been added, removed, or changed since the last
33 #    update, increment LIBECRYPTFS_LT_CURRENT, and set LIBECRYPTFS_LT_REVISION to 0.
34 # 3. If any interfaces have been added since the last public release, then
35 #    increment LIBECRYPTFS_LT_AGE.
36 # 4. If any interfaces have been removed or changed since the last public
37 #    release, then set LIBECRYPTFS_LT_AGE to 0. 
38 #
39 # For more details:
40 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
41 LIBECRYPTFS_LT_CURRENT="1"
42 LIBECRYPTFS_LT_REVISION="0"
43 LIBECRYPTFS_LT_AGE="0"
44 AC_SUBST([LIBECRYPTFS_LT_CURRENT])
45 AC_SUBST([LIBECRYPTFS_LT_REVISION])
46 AC_SUBST([LIBECRYPTFS_LT_AGE])
47
48 AC_ARG_ENABLE(
49         [nss],
50         [AS_HELP_STRING([--disable-nss],[Build against gcrypt rather than NSS])],
51         ,
52         [enable_nss="detect"]
53 )
54
55 AC_ARG_ENABLE(
56         [pywrap],
57         [AS_HELP_STRING([--disable-pywrap],[Disable build of libecryptfs Python wrappers])],
58         ,
59         [enable_pywrap="detect"]
60 )
61
62 AC_ARG_ENABLE(
63         [openssl],
64         [AS_HELP_STRING([--disable-openssl],[Disable build of OpenSSL key module])],
65         ,
66         [enable_openssl="detect"]
67 )
68
69 AC_ARG_ENABLE(
70         [pkcs11-helper],
71         [AS_HELP_STRING([--enable-pkcs11-helper],[Build pkcs11-helper key module])],
72         ,
73         enable_pkcs11_helper="no"
74 )
75
76 AC_ARG_ENABLE(
77         [tspi],
78         [AS_HELP_STRING([--enable-tspi],[Build TrouSerS key module])],
79         ,
80         [enable_tspi="no"]
81 )
82
83 AC_ARG_ENABLE(
84         [gpg],
85         [AS_HELP_STRING([--enable-gpg],[Build GnuPG key module])],
86         ,
87         [enable_gpg="no"]
88 )
89
90 AC_ARG_ENABLE(
91         [pam],
92         [AS_HELP_STRING([--disable-pam],[Disable build of PAM module])],
93         ,
94         [enable_pam="yes"]
95 )
96
97 AC_ARG_ENABLE(
98         [gui],
99         [AS_HELP_STRING([--enable-gui],[Enable building of GUI components])],
100         ,
101         [enable_gui="no"]
102 )
103
104 AC_ARG_ENABLE(
105         [docs],
106         [AS_HELP_STRING([--enable-docs],[Enable installing document])],
107         ,
108         [enable_docs="no"]
109 )
110
111 AC_ARG_ENABLE(
112         [docs-gen],
113         [AS_HELP_STRING([--enable-docs-gen],[Enable generating documents])],
114         ,
115         [enable_docs_gen="no"]
116 )
117 test "${enable_docs_gen}" = "yes" && enable_docs="yes"
118
119 AC_ARG_ENABLE(
120         [tests],
121         [AS_HELP_STRING([--enable-tests],[Enable system specific tests])],
122         ,
123         [enable_tests="no"]
124 )
125
126 AC_ARG_ENABLE(
127         [mudflap],
128         [AS_HELP_STRING([--enable-mudflap],[Build with -fmudflap gcc option])],
129         [
130                 if "${enableval}" = "yes"; then
131                         CFLAGS="$CFLAGS -fmudflap"
132                         LDFLAGS="$LDFLAGS -lmudflap"
133                 fi
134         ]
135 )
136
137 AC_ARG_WITH(
138         [gpgme-prefix],
139         [AS_HELP_STRING([--with-gpgme-prefix=PATH],[Specify the directory where gpgme install, default /usr])],
140         ,
141         [with_gpgme_prefix="/usr"]
142 )
143
144 AC_ARG_WITH(
145         [pamdir],
146         [AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored])],
147         [pamdir="${withval}"],
148         [
149                 if test "${prefix}" = "/usr"; then
150                         pamdir="/lib${libdir##*/lib}/security"
151                 else
152                         pamdir="\$(libdir)/security"
153                 fi
154         ]
155 )
156
157 AC_ARG_WITH(
158         [ecryptfskeymoddir],
159         [AS_HELP_STRING([--with-ecryptfskeymoddir=PATH],[Specify the directory where key modules are stored])],
160         [
161                 ecryptfskeymoddir="${withval}"
162                 full_ecryptfskeymoddir="${ecryptfskeymoddir}"
163         ],
164         [
165                 full_ecryptfskeymoddir=`eval eval eval eval eval echo "${libdir}/ecryptfs" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
166                 ecryptfskeymoddir="\$(libdir)/ecryptfs"
167         ]
168 )
169 AC_DEFINE_UNQUOTED([ECRYPTFS_DEFAULT_KEY_MOD_DIR], ["$full_ecryptfskeymoddir"], "Location of key modules")
170
171 AC_GNU_SOURCE
172
173 AC_PROG_CC
174 AC_MINIX
175 AM_PROG_CC_C_O
176 AC_PROG_LN_S
177 PKG_PROG_PKG_CONFIG
178
179 ifdef(
180         [LT_INIT],
181         [LT_INIT],
182         [AC_PROG_LIBTOOL]
183 )
184
185 AC_SYS_LARGEFILE
186
187 AC_PATH_PROGS([POD2MAN], [pod2man])
188 test -z "${POD2MAN}" && AC_MSG_ERROR([I couldn't find pod2man; make sure it's installed and in your path])
189
190 AC_PATH_PROGS([TAR], [tar])
191 AC_PATH_PROGS([PS2PDF], [ps2pdf])
192 AC_PATH_PROGS([DVIPS], [dvips])
193 AC_PATH_PROGS([LATEX2HTML], [latex2html])
194 AC_PATH_PROGS([LATEX], [latex])
195 if test "${enable_docs_gen}" = "yes"; then
196         test -z "${TAR}" && AC_MSG_ERROR([Couldn't find tar])
197         test -z "${PS2PDF}" && AC_MSG_ERROR([Couldn't find ps2pdf])
198         test -z "${DVIPS}" && AC_MSG_ERROR([Couldn't find dvips])
199         test -z "${LATEX2HTML}" && AC_MSG_ERROR([Couldn't find latex2html])
200         test -z "${LATEX}" && AC_MSG_ERROR([Couldn't find latex])
201 fi
202
203 AC_ISC_POSIX
204 AC_HEADER_STDC
205 AC_CHECK_LIB([dl], [dlopen])
206
207 # Verify keyutils version 1.0 or higher
208 if test -z "${KEYUTILS_LIBS}"; then
209         AC_ARG_VAR([KEYUTILS_CFLAGS], [C compiler flags for keyutils])
210         AC_ARG_VAR([KEYUTILS_LIBS], [linker flags for keyutils])
211         AC_CHECK_LIB(
212                 [keyutils],
213                 [keyctl_search],
214                 [KEYUTILS_LIBS="-lkeyutils"],
215                 [AC_MSG_ERROR([eCryptfs userspace tools require Keyutils version 1.0 or higher.
216 You might find the package at:
217 http://people.redhat.com/~dhowells/keyutils/
218 ])
219                 ]
220         )
221 fi
222
223 if test -z "${OPENSSL_LIBS}"; then
224         PKG_CHECK_MODULES(
225                 [OPENSSL],
226                 [libcrypto >= 0.9.7],
227                 [have_openssl="yes"],
228                 [PKG_CHECK_MODULES(
229                         [OPENSSL],
230                         [openssl >= 0.9.7],
231                         [have_openssl="yes"],
232                         [AC_CHECK_LIB(
233                                 [crypto],
234                                 [RSA_version],
235                                 [
236                                         have_openssl="yes"
237                                         OPENSSL_LIBS="-lcrypto"
238                                 ],
239                                 [have_openssl="no"]
240                         )]
241                 )]
242         )
243 else
244         have_openssl="yes"
245 fi
246
247 #Verify nss
248 PKG_CHECK_MODULES(
249         [NSS],
250         [nss],
251         [have_nss="yes"
252          NSS_CFLAGS="${NSS_CFLAGS} -DENABLE_NSS"],
253         [have_nss="no"])
254
255 if test "${enable_nss}" = "detect" ; then
256         if test "$have_nss" == "yes" ; then
257                 enable_nss="yes"
258         else
259                 enable_nss="no"
260         fi
261 fi
262
263 OLD_CFLAGS="${CFLAGS}"
264 CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
265 AC_CHECK_HEADER([openssl/rsa.h],, [have_openssl="no"])
266 CFLAGS="${OLD_CFLAGS}"
267
268 if test "${enable_pywrap}" != "no" ; then
269         AM_PATH_PYTHON(2.5, [have_python="yes"], [have_python="no"])
270         AC_PROG_SWIG(1.3.31)
271         SWIG_PYTHON
272 fi
273
274 if test "x${SWIG}" != "x" ; then
275    have_swig="yes"
276 else
277    have_swig="no"
278 fi
279
280 if test "${enable_pywrap}" = "detect" ; then
281         if test "${have_python}" = "yes" ; then
282                 if test "${have_swig}" = "yes" ; then
283                         enable_pywrap="yes"
284                 fi
285         fi
286 fi
287
288 if test "${enable_pywrap}" = "yes" ; then
289         test "${have_python}" != "yes" && AC_MSG_ERROR([Python not found])
290         test "${have_swig}" != "yes" && AC_MSG_ERROR([SWIG not found])
291 fi
292
293 test "${enable_openssl}" = "detect" && enable_openssl="${have_openssl}"
294
295 if test "${enable_openssl}" = "yes" ; then
296         test "${have_openssl}" != "yes" && AC_MSG_ERROR([OpenSSL not found])
297 fi
298
299 if test "${enable_pkcs11_helper}" = "yes" ; then
300         test "${have_openssl}" != "yes" && AC_MSG_ERROR([OpenSSL not found])
301         PKG_CHECK_MODULES([PKCS11_HELPER], [libpkcs11-helper-1 >= 1.04],, [AC_MSG_ERROR([Cannot locate pkcs11-helper])])
302 fi
303
304 if test "${enable_tspi}" = "yes" ; then
305         if test -z "${TSPI_LIBS}"; then
306                 AC_ARG_VAR([TSPI_CFLAGS], [C compiler flags for tspi])
307                 AC_ARG_VAR([TSPI_LIBS], [linker flags for tspi])
308                 AC_CHECK_LIB(
309                         [tspi],
310                         [Tspi_Context_Create],
311                         [TSPI_LIBS="-ltspi"],
312                         [AC_MSG_ERROR([Cannot find tspi])]
313                 )
314         fi
315 fi
316
317 if test "${enable_gpg}" = "yes" ; then
318         AC_MSG_CHECKING([for gpgme])
319         if ! test -x "${with_gpgme_prefix}/bin/gpgme-config"; then
320                 AC_MSG_ERROR([Cannot locate gpgme])
321         else
322                 AC_MSG_RESULT([found])
323                 GPGME_CFLAGS="`\"${with_gpgme_prefix}/bin/gpgme-config\" --cflags`"
324                 GPGME_LIBS="`\"${with_gpgme_prefix}/bin/gpgme-config\" --libs`"
325         fi
326 fi
327
328 if test "${enable_pam}" = "yes" ; then
329         if test -z "${PAM_LIBS}"; then
330                 AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam])
331                 AC_ARG_VAR([PAM_LIBS], [linker flags for pam])
332                 AC_CHECK_LIB(
333                         [pam],
334                         [pam_authenticate],
335                         [PAM_LIBS="-lpam"],
336                         [AC_MSG_ERROR([Cannot find pam])]
337                 )
338                 AC_CHECK_LIB(
339                         [pam_misc],
340                         [pam_misc_setenv],
341                         [PAM_LIBS="${PAM_LIBS} ${TSPI_LIBS} -lpam_misc"],
342                         [AC_MSG_ERROR([Cannot find pam_misc])]
343                 )
344         fi
345 fi
346
347 if test "${enable_gui}" = "yes"; then
348         PKG_CHECK_MODULES(
349                 [GTK],
350                 [gtk+-2.0 >= 2.0],
351                 ,
352                 PKG_CHECK_MODULES(
353                         [GTK],
354                         [gtk+ >= 1.0],,
355                         AC_MSG_ERROR([Cannot locate gtk+])
356                 )
357         )
358 fi
359
360 pkgconfigdir="\$(libdir)/pkgconfig"
361 if test "${prefix}" = "/usr"; then
362         rootsbindir="/sbin"
363 else
364         rootsbindir="\$(sbindir)"
365 fi
366
367 GETTEXT_PACKAGE=ecryptfs-utils
368 AC_SUBST(GETTEXT_PACKAGE)
369 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
370                    [the gettext translation domain])
371
372 AM_GLIB_GNU_GETTEXT
373
374 IT_PROG_INTLTOOL([0.41.0])
375
376 LOCALEDIR='${prefix}/${datadir}/locale'
377 AC_SUBST(LOCALEDIR)
378
379
380 CRYPTO_CFLAGS=${NSS_CFLAGS}
381 CRYPTO_LIBS=${NSS_LIBS}
382
383 AC_SUBST([pamdir])
384 AC_SUBST([pamlibdir])
385 AC_SUBST([pkgconfigdir])
386 AC_SUBST([rootsbindir])
387 AC_SUBST([ecryptfskeymoddir])
388 AC_SUBST([GPGME_CFLAGS])
389 AC_SUBST([GPGME_LIBS])
390 AC_SUBST([CRYPTO_CFLAGS])
391 AC_SUBST([CRYPTO_LIBS])
392 AM_CONDITIONAL([BUILD_OPENSSL], [test "${enable_openssl}" = "yes"])
393 AM_CONDITIONAL([BUILD_PKCS11_HELPER], [test "${enable_pkcs11_helper}" = "yes"])
394 AM_CONDITIONAL([BUILD_TSPI], [test "${enable_tspi}" = "yes"])
395 AM_CONDITIONAL([BUILD_GPG], [test "${enable_gpg}" = "yes"])
396 AM_CONDITIONAL([BUILD_PAM], [test "${enable_pam}" = "yes"])
397 AM_CONDITIONAL([BUILD_PYWRAP], [test "${enable_pywrap}" = "yes"])
398 AM_CONDITIONAL([BUILD_NSS], [test "${enable_nss}" = "yes"])
399 AM_CONDITIONAL([BUILD_GUI], [test "${enable_gui}" = "yes"])
400 AM_CONDITIONAL([BUILD_DOCS], [test "${enable_docs}" = "yes"])
401 AM_CONDITIONAL([BUILD_DOCS_GEN], [test "${enable_docs_gen}" = "yes"])
402 AM_CONDITIONAL([ENABLE_TESTS], [test "${enable_tests}" = "yes"])
403
404 # workaround for <autoconf-2.60
405 if test -z "${docdir}"; then
406         docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)"
407         AC_SUBST([docdir])
408 fi
409 if test -z "${htmldir}"; then
410         htmldir="\$(docdir)"
411         AC_SUBST([htmldir])
412 fi
413 # end workaround
414 # workaround for <automake-1.10
415 if test -z "${MKDIR_P}"; then
416         MKDIR_P="\$(mkdir_p)"
417         AC_SUBST([MKDIR_P])
418 fi
419 # end workaround
420
421 AC_CONFIG_FILES([
422         Makefile
423         doc/Makefile
424         src/Makefile
425         src/libecryptfs/Makefile
426         src/utils/Makefile
427         src/key_mod/Makefile
428         src/daemon/Makefile
429         src/desktop/Makefile
430         src/desktop/ecryptfs-mount-private.desktop
431         src/desktop/ecryptfs-setup-private.desktop
432         src/include/Makefile
433         doc/manpage/Makefile
434         src/pam_ecryptfs/Makefile
435         src/libecryptfs/libecryptfs.pc
436         src/libecryptfs-swig/Makefile
437         tests/Makefile
438         tests/lib/Makefile
439         tests/kernel/Makefile
440         tests/userspace/Makefile
441         po/Makefile.in
442 ])
443 AC_OUTPUT
444
445 if test "${prefix}" != "/usr"; then
446         echo
447         echo "Warning: install prefix is $prefix"
448         echo
449         echo "Most mount applications expect the mount helper to install to"
450         echo "/sbin. You can install the mount helper to that location by "
451         echo "running the configure script again with --prefix=/usr:"
452         echo
453         echo "./configure --prefix=/usr"
454         echo
455 fi