Epxerimenta support for GDBM keyings.
[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 dnl Must reset CDPATH so that bash's cd does not print to stdout
7 CDPATH=
8
9 AC_INIT(g10/g10.c)
10 AC_CONFIG_AUX_DIR(scripts)
11 AM_CONFIG_HEADER(config.h)
12
13
14 VERSION=`cat $srcdir/VERSION`
15 PACKAGE=gnupg
16 ALL_LINGUAS="en de it fr"
17 AC_SUBST(VERSION)
18 AC_SUBST(PACKAGE)
19 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
20 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
21
22 AC_ARG_ENABLE(dev-random,
23 [  --disable-dev-random    disable the use of dev random],
24     try_dev_random=$enableval, try_dev_random=yes)
25
26 AC_ARG_ENABLE(dynload,
27 [  --disable-dynload       disable dynamic loading],
28     try_dynload=$enableval, try_dynload=yes)
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 dnl Checks for programs.
60
61 AC_CANONICAL_SYSTEM
62 AC_ARG_PROGRAM
63 AC_PROG_MAKE_SET
64 AM_SANITY_CHECK
65 missing_dir=`cd $ac_aux_dir && pwd`
66 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
67 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
68 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
69 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
70 dnl AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
71 AC_PROG_CC
72 AC_PROG_CPP
73 AC_ISC_POSIX
74 AC_PROG_RANLIB
75 AC_PROG_INSTALL
76 AM_CYGWIN32
77
78
79
80 case "${target}" in
81     i386--mingw32)
82         # special stuff for Windoze NT
83         cross_compiling=yes
84         CC="i386--mingw32-gcc"
85         CPP="i386--mingw32-gcc -E"
86         RANLIB="i386--mingw32-ranlib"
87         ac_cv_have_dev_random=no
88         AC_DEFINE(USE_RAND_W32)
89         ;;
90     *-*-hpux*)
91         if test -z "$GCC" ; then
92             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
93         fi
94         AC_DEFINE(USE_RAND_UNIX)
95         ;;
96     *)
97         AC_DEFINE(USE_RAND_UNIX)
98        ;;
99 esac
100
101 case "${target}" in
102     i386--mingw32)
103         PRINTABLE_OS_NAME="MingW32"
104         ;;
105     *-linux*)
106         PRINTABLE_OS_NAME="GNU/Linux"
107         ;;
108     *)
109         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
110         ;;
111 esac
112 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
113
114 dnl  Fixme: Are these the best flags for OpenBSD????
115 case "${target}" in
116     *-openbsd*)
117         NAME_OF_DEV_RANDOM="/dev/srandom"
118         NAME_OF_DEV_URANDOM="/dev/urandom"
119         DYNLINK_MOD_CFLAGS="-shared -rdynamic -fpic -Wl,-Bshareable -Wl,-x"
120         ;;
121     *)
122         NAME_OF_DEV_RANDOM="/dev/random"
123         NAME_OF_DEV_URANDOM="/dev/urandom"
124         DYNLINK_MOD_CFLAGS="-shared  -fPIC -lc"
125         ;;
126 esac
127 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM")
128 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM")
129
130
131 dnl Checks for libraries.
132
133 AM_GNU_GETTEXT
134
135 AC_CHECK_LIB(gdbm,gdbm_firstkey)
136
137 if test "$try_dynload" = yes ; then
138 AC_CHECK_LIB(dl,dlopen)
139 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
140   AC_DEFINE(USE_DYNAMIC_LINKING)
141   AC_DEFINE(HAVE_DL_DLOPEN)
142   DYNLINK_LDFLAGS=-rdynamic
143   use_gnupg_extensions=yes
144 else
145 AC_CHECK_LIB(dld,dld_link)
146 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
147   AC_DEFINE(USE_DYNAMIC_LINKING)
148   AC_DEFINE(HAVE_DLD_DLD_LINK)
149   DYNLINK_LDFLAGS=-rdynamic
150   use_gnupg_extensions=yes
151 fi
152 fi
153 else
154   AC_MSG_CHECKING(for dynamic loading)
155   DYNLINK_LDFLAGS=
156   DYNLINK_MOD_CFLAGS=
157   use_gnupg_extensions=no
158   AC_MSG_RESULT(has been disabled)
159 fi
160
161 AM_CONDITIONAL(ENABLE_GNUPG_EXTENSIONS, test "$use_gnupg_extensions" = yes )
162 AC_SUBST(DYNLINK_LDFLAGS)
163 AC_SUBST(DYNLINK_MOD_CFLAGS)
164
165
166 dnl Checks for header files.
167 AC_HEADER_STDC
168 AC_CHECK_HEADERS(unistd.h)
169
170
171 dnl Checks for typedefs, structures, and compiler characteristics.
172 AC_C_CONST
173 AC_C_INLINE
174 AC_TYPE_SIZE_T
175 AC_TYPE_SIGNAL
176 AC_DECL_SYS_SIGLIST
177
178 WK_CHECK_ENDIAN
179
180
181 WK_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
182 WK_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
183 WK_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
184 WK_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
185 WK_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
186
187 AC_CHECK_SIZEOF(unsigned short, 2)
188 AC_CHECK_SIZEOF(unsigned int, 4)
189 AC_CHECK_SIZEOF(unsigned long, 4)
190
191 if test "$ac_cv_sizeof_unsigned_short" = "0" \
192    || test "$ac_cv_sizeof_unsigned_int" = "0" \
193    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
194     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
195 fi
196
197
198
199 dnl Checks for library functions.
200 AC_FUNC_VPRINTF
201 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mmap)
202 AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit)
203 AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime)
204
205 WK_CHECK_MLOCK
206
207 WK_CHECK_IPC
208 if test "$ac_cv_header_sys_shm_h" = "yes"; then
209   AC_DEFINE(USE_SHM_COPROCESSING)
210 fi
211
212 dnl check whether we have a random device
213 if test "$try_dev_random" = yes ; then
214 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
215 [if test -c "$NAME_OF_DEV_RANDOM" && test -c "$NAME_OF_DEV_URANDOM" ; then
216   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
217 if test "$ac_cv_have_dev_random" = yes; then
218     AC_DEFINE(HAVE_DEV_RANDOM)
219 fi
220 else
221     AC_MSG_CHECKING(for random device)
222     ac_cv_have_dev_random=no
223     AC_MSG_RESULT(has been disabled)
224 fi
225
226
227 dnl setup assembler stuff
228 AC_MSG_CHECKING(for mpi assembler functions)
229 if test -f $srcdir/mpi/config.links ; then
230     . $srcdir/mpi/config.links
231     WK_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
232     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
233     ac_cv_mpi_config_done="yes"
234     AC_MSG_RESULT(done)
235 else
236     AC_MSG_RESULT(failed)
237     AC_MSG_ERROR([mpi/config.links missing!])
238 fi
239 MPI_EXTRA_ASM_OBJS=""
240 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
241 WK_MSG_PRINT([mpi extra asm functions:])
242 for i in $ac_cv_mpi_extra_asm_modules; do
243     WK_MSG_PRINT([$i])
244     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
245 done
246 AC_MSG_RESULT()
247 fi
248 AC_SUBST(MPI_EXTRA_ASM_OBJS)
249
250 dnl Do we have zlib? Must do it here because Solaris failed
251 dnl when compiling a conftest (due to the "-lz" from LIBS).
252 if test "$g10_force_zlib" = "yes"; then
253     ZLIBS="../zlib/libzlib.a"
254     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
255     WK_LINK_FILES(zlib/zlib.h, zlib.h )
256     WK_LINK_FILES(zlib/zconf.h, zconf.h )
257 else
258 AC_CHECK_HEADERS(zlib.h)
259 if test "$ac_cv_header_zlib_h" = yes ; then
260     LIBS="$LIBS -lz"
261     ZLIBS=
262     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
263 else
264     ZLIBS="../zlib/libzlib.a"
265     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
266     WK_LINK_FILES(zlib/zlib.h, zlib.h )
267     WK_LINK_FILES(zlib/zconf.h, zconf.h )
268 fi
269 fi
270 AC_SUBST(ZLIBS)
271
272 WK_DO_LINK_FILES
273
274
275 AC_OUTPUT([
276 Makefile
277 intl/Makefile
278 po/Makefile.in
279 util/Makefile
280 mpi/Makefile
281 cipher/Makefile
282 g10/Makefile
283 doc/Makefile
284 tools/Makefile
285 zlib/Makefile
286 checks/Makefile
287 ])
288