NEw test keyrings
[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"
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 G10_LOCALEDIR="$g10_prefix/$DATADIRNAME/locale"
103 AC_SUBST(G10_LOCALEDIR)
104 AC_DEFINE_UNQUOTED(G10_LOCALEDIR, "$G10_LOCALEDIR")
105
106
107 dnl Checks for typedefs, structures, and compiler characteristics.
108 AC_C_CONST
109 AC_C_INLINE
110 AC_TYPE_SIZE_T
111
112 WK_CHECK_ENDIAN
113
114
115 WK_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
116 WK_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
117 WK_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
118 WK_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
119 WK_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
120
121 AC_CHECK_SIZEOF(unsigned short, 2)
122 AC_CHECK_SIZEOF(unsigned int, 4)
123 AC_CHECK_SIZEOF(unsigned long, 4)
124
125 if test "$ac_cv_sizeof_unsigned_short" = "0" \
126    || test "$ac_cv_sizeof_unsigned_int" = "0" \
127    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
128     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
129 fi
130
131
132
133 dnl Checks for library functions.
134 AC_FUNC_VPRINTF
135 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mlock mmap)
136 AC_CHECK_FUNCS(gettimeofday getrusage)
137
138
139
140
141 dnl check wether we have a random device
142 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
143 [if test -c /dev/random && test -c /dev/urandom ; then
144   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
145 if test "$ac_cv_have_dev_random" = yes; then
146     AC_DEFINE(HAVE_DEV_RANDOM)
147 fi
148
149
150 dnl setup assembler stuff
151 AC_MSG_CHECKING(for mpi assembler functions)
152 if test -f $srcdir/mpi/config.links ; then
153     . $srcdir/mpi/config.links
154     WK_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
155     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
156     ac_cv_mpi_config_done="yes"
157     AC_MSG_RESULT(done)
158 else
159     AC_MSG_RESULT(failed)
160     AC_MSG_ERROR([mpi/config.links missing!])
161 fi
162 MPI_EXTRA_ASM_OBJS=""
163 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
164 WK_MSG_PRINT([mpi extra asm functions:])
165 for i in $ac_cv_mpi_extra_asm_modules; do
166     WK_MSG_PRINT([$i])
167     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
168 done
169 AC_MSG_RESULT()
170 fi
171 AC_SUBST(MPI_EXTRA_ASM_OBJS)
172
173 dnl Do we have zlib? Must do it here because Solaris failed
174 dnl when compiling a conftest (due to the "-lz" from LIBS).
175 if test "$g10_force_zlib" = "yes"; then
176     ZLIBS="../zlib/libzlib.a"
177     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
178     WK_LINK_FILES(zlib/zlib.h, zlib.h )
179     WK_LINK_FILES(zlib/zconf.h, zconf.h )
180 else
181 AC_CHECK_HEADERS(zlib.h)
182 if test "$ac_cv_header_zlib_h" = yes ; then
183     LIBS="$LIBS -lz"
184     ZLIBS=
185     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
186 else
187     ZLIBS="../zlib/libzlib.a"
188     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
189     WK_LINK_FILES(zlib/zlib.h, zlib.h )
190     WK_LINK_FILES(zlib/zconf.h, zconf.h )
191 fi
192 fi
193 AC_SUBST(ZLIBS)
194
195
196 dnl checking whether we have other cipher source files
197 CIPHER_EXTRA_OBJS=""
198 CIPHER_EXTRA_DIST=""
199 AC_CACHE_CHECK(for extra cipher modules, ac_cv_have_rsa_cipher,
200 [if test -f $srcdir/cipher/rsa.c && test -f $srcdir/cipher/rsa.h; then
201   ac_cv_have_rsa_cipher=yes; else ac_cv_have_rsa_cipher=no; fi])
202 if test $ac_cv_have_rsa_cipher = yes; then
203     AC_DEFINE(HAVE_RSA_CIPHER)
204     CIPHER_EXTRA_OBJS="rsa.o"
205     CIPHER_EXTRA_DIST="rsa.c rsa.h"
206 fi
207 AC_SUBST(CIPHER_EXTRA_OBJS)
208 AC_SUBST(CIPHER_EXTRA_DIST)
209
210 AM_GNU_GETTEXT
211 WK_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl )
212
213 WK_DO_LINK_FILES
214
215 AC_OUTPUT([
216 Makefile
217 intl/Makefile
218 po/Makefile.in
219 util/Makefile
220 mpi/Makefile
221 cipher/Makefile
222 g10/Makefile
223 doc/Makefile
224 tools/Makefile
225 zlib/Makefile
226 checks/Makefile
227 ],[echo timestamp >stamp-h; sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
228