assuan/
[gnupg.git] / configure.in
blob563e9a4f6abfcb3e74ea516d4e242d3a40c4f07a
1 dnl
2 dnl Configure template for GNUPG
3 dnl
4 dnl (Process this file with autoconf to produce a configure script.)
5 AC_REVISION($Revision$)dnl
7 dnl Must reset CDPATH so that bash's cd does not print to stdout
8 CDPATH=
10 AC_PREREQ(2.13)
11 AC_INIT(g10/gpg.c)
12 AC_CONFIG_AUX_DIR(scripts)
13 AM_CONFIG_HEADER(config.h)
14 AC_CANONICAL_SYSTEM
15 AM_INIT_AUTOMAKE(gnupg,1.1.2a)
17 ALL_LINGUAS="da de eo es_ES fr id it ja nl pl pt_BR pt_PT ru sv"
19 AC_PROG_AWK
21 dnl
22 dnl  Check other options
23 dnl
25 AC_MSG_CHECKING([whether memory debugging is requested])
26 AC_ARG_ENABLE(m-debug,
27 [  --enable-m-debug        enable debugging of memory allocation],
28 use_m_debug=$enableval, use_m_debug=no)
29 AC_MSG_RESULT($use_m_debug)
30 if test "$use_m_debug" = yes; then
31     AC_DEFINE(M_DEBUG)
32     use_m_guard=yes
33 else
34     AC_MSG_CHECKING([whether memory guard is requested])
35     AC_ARG_ENABLE(m-guard,
36     [  --enable-m-guard        enable memory guard facility],
37     use_m_guard=$enableval, use_m_guard=no)
38     AC_MSG_RESULT($use_m_guard)
40 if test "$use_m_guard" = yes ; then
41     AC_DEFINE(M_GUARD)
45 AC_MSG_CHECKING([whether included zlib is requested])
46 AC_ARG_WITH(included-zlib,
47     [  --with-included-zlib    use the zlib code included here],
48 [g10_force_zlib=yes], [g10_force_zlib=no] )
49 AC_MSG_RESULT($g10_force_zlib)
51 dnl
52 dnl Check whether we want to use Linux capabilities
53 dnl
54 AC_MSG_CHECKING([whether use of capabilities is requested])
55 AC_ARG_WITH(capabilities,
56     [  --with-capabilities     use linux capabilities [default=no]],
57 [use_capabilities="$withval"],[use_capabilities=no])
58 AC_MSG_RESULT($use_capabilities)
64 AM_MAINTAINER_MODE
66 dnl Checks for programs.
68 dnl
69 dnl Setup some stuff depending on host/target.
70 dnl
71 case "${target}" in
72     *-*-mingw32*)
73         # special stuff for Windoze NT
74         # Do we need to set cross_compiling here or is it sufficient
75         # to rely on AC_PROG_CC which is called later?
76         cross_compiling=yes
77         CC="${target}-gcc"
78         CPP="${target}-gcc -E"
79         RANLIB="${target}-ranlib"
80         disallowed_modules="rndunix rndlinux rndegd"
81         ;;
82     *)
83         disallowed_modules="rndw32"
84        ;;
85 esac
87 AC_ARG_PROGRAM
88 AC_PROG_MAKE_SET
89 AM_SANITY_CHECK
90 missing_dir=`cd $ac_aux_dir && pwd`
91 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
92 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
93 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
94 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
95 dnl AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
96 AC_PROG_CC
97 AC_PROG_CPP
98 AC_ISC_POSIX
99 AC_PROG_INSTALL
100 AC_PROG_AWK
101 GPH_PROG_DOCBOOK
102 GNUPG_CHECK_FAQPROG
105 try_gettext=yes
106 case "${target}" in
107     *-*-mingw32*)
108         # special stuff for Windoze NT
109         ac_cv_have_dev_random=no
110         AC_DEFINE(USE_ONLY_8DOT3)
111         AC_DEFINE(HAVE_DRIVE_LETTERS)
112         AC_DEFINE(HAVE_DOSISH_SYSTEM)
113         AC_DEFINE(USE_SIMPLE_GETTEXT)
114         try_gettext="no"
115         ;;
116     i?86-emx-os2 | i?86-*-os2*emx )
117         # OS/2 with the EMX environment
118         ac_cv_have_dev_random=no
119         AC_DEFINE(HAVE_DRIVE_LETTERS)
120         AC_DEFINE(HAVE_DOSISH_SYSTEM)
121         try_gettext="no"
122         ;;
124     i?86-*-msdosdjgpp*)
125         # DOS with the DJGPP environment
126         ac_cv_have_dev_random=no
127         AC_DEFINE(HAVE_DRIVE_LETTERS)
128         AC_DEFINE(HAVE_DOSISH_SYSTEM)
129         try_gettext="no"
130         ;;
132     *-*-freebsd*)
133        # FreeBSD
134        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
135        LDFLAGS="$LDFLAGS -L/usr/local/lib"
136        ;;
138     *-*-hpux*)
139         if test -z "$GCC" ; then
140             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
141         fi
142         ;;
143     *-dec-osf4*)
144         if test -z "$GCC" ; then
145             # Suppress all warnings
146             # to get rid of the unsigned/signed char mismatch warnings.
147             CFLAGS="$CFLAGS -w"
148         fi
149         ;;
150     m68k-atari-mint)
151         ;;
152     *)
153        ;;
154 esac
157 case "${target}" in
158     *-*-mingw32*)
159         PRINTABLE_OS_NAME="MingW32"
160         ;;
161     i?86-emx-os2 | i?86-*-os2*emx )
162         PRINTABLE_OS_NAME="OS/2"
163         ;;
164     i?86-*-msdosdjgpp*)
165         PRINTABLE_OS_NAME="MSDOS/DJGPP"
166         ;;
167     *-linux*)
168         PRINTABLE_OS_NAME="GNU/Linux"
169         ;;
170 dnl let that after linux to avoid gnu-linux problems
171     *-gnu*)
172         PRINTABLE_OS_NAME="GNU/Hurd"
173         ;;
174     *)
175         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
176         ;;
177 esac
178 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
180 dnl Checks for libraries.
182 if test "$try_gettext" = yes; then
183 AM_GNU_GETTEXT
184 else
185 USE_NLS=no
186 USE_INCLUDED_LIBINTL=no
187 AC_SUBST(USE_NLS)
188 AC_SUBST(USE_INCLUDED_LIBINTL)
191 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config)
192 if test -n "$LIBGCRYPT_CONFIG"; then
193         LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
194         LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
195 else
196     AC_MSG_ERROR([[
198 *** You need libgcrypt to build this program.
199 *** It should be available at the same place you go this
200 *** software.
201 ***]])
203 AC_SUBST(LIBGCRYPT_CFLAGS)
204 AC_SUBST(LIBGCRYPT_LIBS)
207 dnl Where is the GTK+ toolkit
208 if test "$cross_compiling" = yes ; then
209   CFLAGS="$CFLAGS -I/home/wk/work/gtk+w32/include/gtk+/gdk/win32 \
210  -I/home/wk/work/gtk+w32/include -I/home/wk/work/gtk+w32/include/gtk+"
211   LIBS="$LIBS     -L/home/wk/work/gtk+w32/lib -lgtk -lgdk -lglib"
212   compile_agent=no
213 else
214   AM_PATH_GTK(1.2.1, compile_agent=yes,compile_agent=no)
216 AM_CONDITIONAL(COMPILE_AGENT, test x$compile_agent = xyes)
219 dnl Solaris needs -lsocket and -lnsl. Unisys system includes
220 dnl gethostbyname in libsocket but needs libnsl for socket.
221 AC_CHECK_LIB(nsl, gethostbyname)
222 AC_CHECK_LIB(socket, socket, ac_need_libsocket=1, ac_try_nsl=1)
223 if test x$ac_need_libsocket = x1; then
224     LIBS="$LIBS -lsocket"
226 if test x$ac_try_nsl = x1; then
227     AC_CHECK_LIB(nsl, gethostbyname, ac_need_libnsl=1)
228     if test x$ac_need_libnsl = x1
229     then
230         LIBS="$LIBS -lnsl"
231     fi
235 dnl Checks for header files.
236 AC_HEADER_STDC
237 AC_CHECK_HEADERS(unistd.h langinfo.h termio.h)
240 dnl Checks for typedefs, structures, and compiler characteristics.
241 AC_C_CONST
242 AC_C_INLINE
243 AC_TYPE_SIZE_T
244 AC_TYPE_SIGNAL
245 AC_DECL_SYS_SIGLIST
247 GNUPG_CHECK_ENDIAN
250 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
251 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
252 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
253 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
254 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
256 AC_CHECK_SIZEOF(unsigned short, 2)
257 AC_CHECK_SIZEOF(unsigned int, 4)
258 AC_CHECK_SIZEOF(unsigned long, 4)
259 AC_CHECK_SIZEOF(unsigned long long, 0)
261 if test "$ac_cv_sizeof_unsigned_short" = "0" \
262    || test "$ac_cv_sizeof_unsigned_int" = "0" \
263    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
264     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
269 dnl Checks for library functions.
270 AC_FUNC_VPRINTF
271 AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap)
272 AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit clock_gettime)
273 AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)
274 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask fopen64 fstat64)
276 GNUPG_CHECK_MLOCK
277 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
280 dnl Check whether we can use Linux capabilities as requested
282 if test "$use_capabilities" = "yes" ; then
283 use_capabilities=no
284 AC_CHECK_HEADERS(sys/capability.h)
285 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
286   AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
287   if test "$ac_cv_lib_cap_cap_init" = "yes"; then
288      AC_DEFINE(USE_CAPABILITIES)
289      LIBS="$LIBS -lcap"
290      use_capabilities=yes
291   fi
293 if test "$use_capabilities" = "no" ; then
294     AC_MSG_WARN([[
296 *** The use of capabilities on this system is not possible.
297 *** You need a recent Linux kernel and some patches:
298 ***   fcaps-2.2.9-990610.patch      (kernel patch for 2.2.9)
299 ***   fcap-module-990613.tar.gz     (kernel module)
300 ***   libcap-1.92.tar.gz            (user mode library and utilities)
301 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
302 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
303 ***]])
308 GNUPG_CHECK_IPC
309 if test "$ac_cv_header_sys_shm_h" = "yes"; then
310   AC_DEFINE(USE_SHM_COPROCESSING)
315 dnl Do we have zlib? Must do it here because Solaris failed
316 dnl when compiling a conftest (due to the "-lz" from LIBS).
318 use_local_zlib=yes
319 if test "$g10_force_zlib" = "yes"; then
320   :
321 else
322   AC_CHECK_HEADERS(zlib.h)
323   if test "$ac_cv_header_zlib_h" = yes ; then
324       AC_CHECK_LIB(z,deflateInit2_,use_local_zlib=no,:)
325   fi
328 if test "$use_local_zlib" = yes ; then
329     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
330     GNUPG_LINK_FILES(zlib/zlib.h, zlib.h )
331     GNUPG_LINK_FILES(zlib/zconf.h, zconf.h )
332     ZLIBS="../zlib/libzlib.a"
333 else
334     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
335     ZLIBS=
336     LIBS="-lz $LIBS"
338 AC_SUBST(ZLIBS)
341 # Allow users to append something to the version string without
342 # flagging it as development version.  The user version part is
343 # considered everything after a dash.
344 changequote(,)dnl
345 tmp_pat='[a-zA-Z]'
346 changequote([,])dnl
347 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
348     AC_DEFINE(IS_DEVELOPMENT_VERSION)
351 dnl Temp workarounds 
352 GNUPG_LINK_FILES(include/types.h, types.h )
354 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
356 GNUPG_DO_LINK_FILES
358 GNUPG_CHECK_GNUMAKE
360 if test "$GCC" = yes; then
361     if test "$MAINTAINER_MODE" = "yes"; then
362         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
363     else
364         CFLAGS="$CFLAGS -Wall"
365     fi
369 AC_OUTPUT_COMMANDS([
370 chmod +x scripts/db2html
371 cat >gnupg-defs.tmp <<G10EOF
372 /* Generated automatically by configure */
373 #ifdef HAVE_DRIVE_LETTERS
374   #define GNUPG_LOCALEDIR "c:/lib/gnupg/locale"
375   #define GNUPG_LIBDIR  "c:/lib/gnupg"
376   #define GNUPG_DATADIR "c:/lib/gnupg"
377   #define GNUPG_HOMEDIR "c:/gnupg-test"
378 #else
379   #define GNUPG_LOCALEDIR "${prefix}/${DATADIRNAME}/locale"
380   #define GNUPG_LIBDIR  "${libdir}/gnupg"
381   #define GNUPG_DATADIR "${datadir}/gnupg"
382   #ifdef __VMS
383     #define GNUPG_HOMEDIR "/SYS\$LOGIN/gnupg" 
384   #else
385     #define GNUPG_HOMEDIR "~/.gnupg-test" 
386   #endif
387 #endif
388 G10EOF
389 if cmp -s gnupg-defs.h gnupg-defs.tmp 2>/dev/null; then
390     echo "gnupg-defs.h is unchanged"
391     rm -f gnupg-defs.tmp
392 else
393     rm -f gnupg-defs.h
394     mv gnupg-defs.tmp gnupg-defs.h
395     echo "gnupg-defs.h created"
398 prefix=$prefix
399 exec_prefix=$exec_prefix
400 libdir=$libdir
401 datadir=$datadir
402 DATADIRNAME=$DATADIRNAME
406 AC_OUTPUT([
407 Makefile
408 scripts/db2html
409 intl/Makefile
410 po/Makefile.in
411 jnlib/Makefile
412 util/Makefile
413 g10/Makefile
414 agent/Makefile
415 doc/Makefile
416 doc/version.sgml
417 tools/Makefile
418 zlib/Makefile
419 checks/Makefile