release 0.2.14
[gnupg.git] / configure.in
1 dnl
2 dnl Configure template for GNUPG
3 dnl
4 dnl (Process this file with autoconf to produce a configure script.)
5
6 AC_INIT(g10/g10.c)
7 AC_CONFIG_AUX_DIR(scripts)
8 AM_CONFIG_HEADER(config.h)
9
10
11 if test "x$exec_prefix" = xNONE ; then
12     if test "x$prefix" = xNONE ; then
13         g10_prefix="$ac_default_prefix"
14     else
15         g10_prefix="$prefix"
16     fi
17 else
18     g10_prefix="$exec_prefix"
19 fi
20
21
22 VERSION=`cat $srcdir/VERSION`
23 PACKAGE=gnupg
24 ALL_LINGUAS="de it"
25 AC_SUBST(VERSION)
26 AC_SUBST(PACKAGE)
27 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
28 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
29
30 AC_MSG_CHECKING([whether memory debugging is requested])
31 AC_ARG_ENABLE(m-debug,
32 [  --enable-m-debug       enable debugging of memory allocation],
33 use_m_debug=$enableval, use_m_debug=no)
34 AC_MSG_RESULT($use_m_debug)
35 if test "$use_m_debug" = yes; then
36     AC_DEFINE(M_DEBUG)
37     use_m_guard=yes
38 else
39     AC_MSG_CHECKING([whether memory guard is requested])
40     AC_ARG_ENABLE(m-guard,
41     [  --disable-m-guard       disable memory guard facility],
42     use_m_guard=$enableval, use_m_guard=yes)
43     AC_MSG_RESULT($use_m_guard)
44 fi
45 if test "$use_m_guard" = yes ; then
46     AC_DEFINE(M_GUARD)
47     CFLAGS="-g -Wall"
48 else
49     CFLAGS="-O2 -Wall"
50 fi
51
52
53 AC_MSG_CHECKING([whether included zlib is requested])
54 AC_ARG_WITH(included-zlib,
55     [  --with-included-zlib    use the zlib code included here],
56 [g10_force_zlib=yes], [g10_force_zlib=no] )
57 AC_MSG_RESULT($g10_force_zlib)
58
59
60 AC_CANONICAL_SYSTEM
61 WK_CHECK_CACHE
62
63 dnl Checks for programs.
64
65 AC_PROG_MAKE_SET
66 AC_ARG_PROGRAM
67
68 missing_dir=`cd $ac_aux_dir && pwd`
69 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
70 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
71 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
72 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
73 dnl AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
74 AC_ISC_POSIX
75
76 case "${target}" in
77     i386--mingw32)
78         # special stuff for Windoze NT
79         cross_compiling=yes
80         CC="i386--mingw32-gcc"
81         CPP="i386--mingw32-gcc -E"
82         RANLIB="i386--mingw32-ranlib"
83         ac_cv_have_dev_random=no
84         PRINTABLE_OS_NAME="MingW32"
85         ;;
86     *)
87 AC_PROG_RANLIB
88 AC_PROG_INSTALL
89 AC_PROG_CC
90 AC_PROG_CPP
91         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
92        ;;
93 esac
94 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
95
96 dnl Checks for libraries.
97
98 dnl Checks for header files.
99 AC_HEADER_STDC
100 AC_CHECK_HEADERS(unistd.h)
101
102
103
104 dnl Checks for typedefs, structures, and compiler characteristics.
105 AC_C_CONST
106 AC_C_INLINE
107 AC_TYPE_SIZE_T
108 AC_TYPE_SIGNAL
109 AC_DECL_SYS_SIGLIST
110
111 WK_CHECK_ENDIAN
112
113
114 WK_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
115 WK_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
116 WK_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
117 WK_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
118 WK_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
119
120 AC_CHECK_SIZEOF(unsigned short, 2)
121 AC_CHECK_SIZEOF(unsigned int, 4)
122 AC_CHECK_SIZEOF(unsigned long, 4)
123
124 if test "$ac_cv_sizeof_unsigned_short" = "0" \
125    || test "$ac_cv_sizeof_unsigned_int" = "0" \
126    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
127     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
128 fi
129
130
131
132 dnl Checks for library functions.
133 AC_FUNC_VPRINTF
134 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mlock mmap)
135 AC_CHECK_FUNCS(gettimeofday getrusage)
136
137
138
139
140 dnl check wether we have a random device
141 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
142 [if test -c /dev/random && test -c /dev/urandom ; then
143   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
144 if test "$ac_cv_have_dev_random" = yes; then
145     AC_DEFINE(HAVE_DEV_RANDOM)
146 fi
147
148
149 dnl setup assembler stuff
150 AC_MSG_CHECKING(for mpi assembler functions)
151 if test -f $srcdir/mpi/config.links ; then
152     . $srcdir/mpi/config.links
153     WK_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
154     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
155     ac_cv_mpi_config_done="yes"
156     AC_MSG_RESULT(done)
157 else
158     AC_MSG_RESULT(failed)
159     AC_MSG_ERROR([mpi/config.links missing!])
160 fi
161 MPI_EXTRA_ASM_OBJS=""
162 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
163 WK_MSG_PRINT([mpi extra asm functions:])
164 for i in $ac_cv_mpi_extra_asm_modules; do
165     WK_MSG_PRINT([$i])
166     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
167 done
168 AC_MSG_RESULT()
169 fi
170 AC_SUBST(MPI_EXTRA_ASM_OBJS)
171
172 dnl Do we have zlib? Must do it here because Solaris failed
173 dnl when compiling a conftest (due to the "-lz" from LIBS).
174 if test "$g10_force_zlib" = "yes"; then
175     ZLIBS="../zlib/libzlib.a"
176     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
177     WK_LINK_FILES(zlib/zlib.h, zlib.h )
178     WK_LINK_FILES(zlib/zconf.h, zconf.h )
179 else
180 AC_CHECK_HEADERS(zlib.h)
181 if test "$ac_cv_header_zlib_h" = yes ; then
182     LIBS="$LIBS -lz"
183     ZLIBS=
184     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
185 else
186     ZLIBS="../zlib/libzlib.a"
187     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
188     WK_LINK_FILES(zlib/zlib.h, zlib.h )
189     WK_LINK_FILES(zlib/zconf.h, zconf.h )
190 fi
191 fi
192 AC_SUBST(ZLIBS)
193
194
195 dnl checking whether we have other cipher source files
196 CIPHER_EXTRA_OBJS=""
197 CIPHER_EXTRA_DIST=""
198 AC_CACHE_CHECK(for extra cipher modules, ac_cv_have_rsa_cipher,
199 [if test -f $srcdir/cipher/rsa.c && test -f $srcdir/cipher/rsa.h; then
200   ac_cv_have_rsa_cipher=yes; else ac_cv_have_rsa_cipher=no; fi])
201 if test $ac_cv_have_rsa_cipher = yes; then
202     AC_DEFINE(HAVE_RSA_CIPHER)
203     CIPHER_EXTRA_OBJS="rsa.o"
204     CIPHER_EXTRA_DIST="rsa.c rsa.h"
205 fi
206 AC_SUBST(CIPHER_EXTRA_OBJS)
207 AC_SUBST(CIPHER_EXTRA_DIST)
208
209 AM_GNU_GETTEXT
210 G10_LOCALEDIR="$g10_prefix/$DATADIRNAME/locale"
211 AC_SUBST(G10_LOCALEDIR)
212 AC_DEFINE_UNQUOTED(G10_LOCALEDIR, "$G10_LOCALEDIR")
213 WK_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl )
214
215 WK_DO_LINK_FILES
216
217 AC_OUTPUT([
218 Makefile
219 intl/Makefile
220 po/Makefile.in
221 util/Makefile
222 mpi/Makefile
223 cipher/Makefile
224 g10/Makefile
225 doc/Makefile
226 tools/Makefile
227 zlib/Makefile
228 checks/Makefile
229 ],[echo timestamp >stamp-h; sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
230