See ChangeLog: Thu Jan 7 18:00:58 CET 1999 Werner Koch
[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 AC_REVISION($Revision$)dnl
6
7 dnl Must reset CDPATH so that bash's cd does not print to stdout
8 CDPATH=
9
10 AC_INIT(g10/g10.c)
11 AC_CONFIG_AUX_DIR(scripts)
12 AM_CONFIG_HEADER(config.h)
13
14
15 VERSION=`cat $srcdir/VERSION`
16 PACKAGE=gnupg
17 ALL_LINGUAS="de es_ES fr it pl pt_BR ru"
18 AC_SUBST(VERSION)
19 AC_SUBST(PACKAGE)
20 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
21 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
22
23 AC_MSG_CHECKING([whether use of /dev/random is requested])
24 AC_ARG_ENABLE(dev-random,
25 [  --disable-dev-random    disable the use of dev random],
26     try_dev_random=$enableval, try_dev_random=yes)
27 AC_MSG_RESULT($try_dev_random)
28
29 AC_MSG_CHECKING([whether use of extensions is requested])
30 AC_ARG_ENABLE(dynload,
31 [  --disable-dynload       disable use of extensions],
32     try_dynload=$enableval, try_dynload=yes)
33 AC_MSG_RESULT($try_dynload)
34
35 AC_MSG_CHECKING([whether assembler modules are requested])
36 AC_ARG_ENABLE(asm,
37 [  --disable-asm           do not use assembler modules],
38      try_asm_modules=$enableval, try_asm_modules=yes)
39 AC_MSG_RESULT($try_asm_modules)
40
41 AC_MSG_CHECKING([whether memory debugging is requested])
42 AC_ARG_ENABLE(m-debug,
43 [  --enable-m-debug        enable debugging of memory allocation],
44 use_m_debug=$enableval, use_m_debug=no)
45 AC_MSG_RESULT($use_m_debug)
46 if test "$use_m_debug" = yes; then
47     AC_DEFINE(M_DEBUG)
48     use_m_guard=yes
49 else
50     AC_MSG_CHECKING([whether memory guard is requested])
51     AC_ARG_ENABLE(m-guard,
52     [  --disable-m-guard       disable memory guard facility],
53     use_m_guard=$enableval, use_m_guard=yes)
54     AC_MSG_RESULT($use_m_guard)
55 fi
56 if test "$use_m_guard" = yes ; then
57     AC_DEFINE(M_GUARD)
58     CFLAGS="$CFLAGS -g"
59 else
60     CFLAGS="$CFLAGS -O2"
61 fi
62
63 if test "$GCC" = yes; then
64     CFLAGS="$CFLAGS -Wall"
65 fi
66
67
68 AC_MSG_CHECKING([whether included zlib is requested])
69 AC_ARG_WITH(included-zlib,
70     [  --with-included-zlib    use the zlib code included here],
71 [g10_force_zlib=yes], [g10_force_zlib=no] )
72 AC_MSG_RESULT($g10_force_zlib)
73
74 dnl Checks for programs.
75
76 AC_CANONICAL_SYSTEM
77 AC_ARG_PROGRAM
78 AC_PROG_MAKE_SET
79 AM_SANITY_CHECK
80 missing_dir=`cd $ac_aux_dir && pwd`
81 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
82 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
83 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
84 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
85 dnl AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
86 AC_PROG_CC
87 AC_PROG_CPP
88 AC_ISC_POSIX
89 AC_PROG_RANLIB
90 AC_PROG_INSTALL
91 AM_CYGWIN32
92
93
94 case "${target}" in
95     i386--mingw32)
96         # special stuff for Windoze NT
97         cross_compiling=yes
98         CC="i386--mingw32-gcc"
99         CPP="i386--mingw32-gcc -E"
100         RANLIB="i386--mingw32-ranlib"
101         ac_cv_have_dev_random=no
102         AC_DEFINE(USE_RNDW32)
103         ;;
104     *-*-hpux*)
105         if test -z "$GCC" ; then
106             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
107         fi
108         ;;
109     m68k-atari-mint)
110         ;;
111     *)
112        ;;
113 esac
114
115
116 GNUPG_CHECK_PIC
117 GNUPG_CHECK_RDYNAMIC
118 if test "$NO_PIC" = yes; then
119     try_dynload=no
120 fi
121
122
123 case "${target}" in
124     i386--mingw32)
125         PRINTABLE_OS_NAME="MingW32"
126         ;;
127     *-linux*)
128         PRINTABLE_OS_NAME="GNU/Linux"
129         ;;
130     *)
131         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
132         ;;
133 esac
134 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
135
136 dnl  Fixme: Are these the best flags for OpenBSD????
137 case "${target}" in
138     *-openbsd*)
139         NAME_OF_DEV_RANDOM="/dev/srandom"
140         NAME_OF_DEV_URANDOM="/dev/urandom"
141         DYNLINK_MOD_CFLAGS="-shared -rdynamic -fpic -Wl,-Bshareable -Wl,-x"
142         ;;
143     *)
144         NAME_OF_DEV_RANDOM="/dev/random"
145         NAME_OF_DEV_URANDOM="/dev/urandom"
146         DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC -lc"
147         ;;
148 esac
149 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM")
150 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM")
151
152
153 dnl Checks for libraries.
154
155 AM_GNU_GETTEXT
156
157 AC_CHECK_LIB(gdbm,gdbm_firstkey)
158
159
160 if test "$try_dynload" = yes ; then
161   AC_CHECK_LIB(dl,dlopen)
162   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
163     AC_DEFINE(USE_DYNAMIC_LINKING)
164     AC_DEFINE(HAVE_DL_DLOPEN)
165     DYNLINK_LDFLAGS="$CFLAGS_RDYNAMIC"
166     use_gnupg_extensions=yes
167   else
168     AC_CHECK_LIB(c,dlopen)
169     if test "$ac_cv_lib_c_dlopen" = "yes"; then
170       AC_DEFINE(USE_DYNAMIC_LINKING)
171       AC_DEFINE(HAVE_DL_DLOPEN)
172       DYNLINK_LDFLAGS="$CFLAGS_RDYNAMIC"
173       dnl fixme: this is probably false but it should
174       dnl work for freebsd
175       AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
176       use_gnupg_extensions=yes
177     else
178       AC_CHECK_LIB(dld,dld_link)
179       if test "$ac_cv_lib_dld_dld_link" = "yes"; then
180         AC_DEFINE(USE_DYNAMIC_LINKING)
181         AC_DEFINE(HAVE_DLD_DLD_LINK)
182         DYNLINK_LDFLAGS="$CFLAGS_RDYNAMIC"
183         use_gnupg_extensions=yes
184       fi
185     fi
186   fi
187 else
188   AC_MSG_CHECKING(for dynamic loading)
189   DYNLINK_LDFLAGS=
190   DYNLINK_MOD_CFLAGS=
191   use_gnupg_extensions=no
192   AC_MSG_RESULT(has been disabled)
193 fi
194
195 AM_CONDITIONAL(ENABLE_GNUPG_EXTENSIONS, test "$use_gnupg_extensions" = yes )
196 AC_SUBST(DYNLINK_LDFLAGS)
197 AC_SUBST(DYNLINK_MOD_CFLAGS)
198
199
200 dnl Checks for header files.
201 AC_HEADER_STDC
202 AC_CHECK_HEADERS(unistd.h)
203
204
205 dnl Checks for typedefs, structures, and compiler characteristics.
206 AC_C_CONST
207 AC_C_INLINE
208 AC_TYPE_SIZE_T
209 AC_TYPE_SIGNAL
210 AC_DECL_SYS_SIGLIST
211
212 GNUPG_CHECK_ENDIAN
213
214
215 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
216 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
217 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
218 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
219 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
220
221 AC_CHECK_SIZEOF(unsigned short, 2)
222 AC_CHECK_SIZEOF(unsigned int, 4)
223 AC_CHECK_SIZEOF(unsigned long, 4)
224
225 if test "$ac_cv_sizeof_unsigned_short" = "0" \
226    || test "$ac_cv_sizeof_unsigned_int" = "0" \
227    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
228     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
229 fi
230
231
232
233 dnl Checks for library functions.
234 AC_FUNC_VPRINTF
235 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mmap)
236 AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit)
237 AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime)
238
239 GNUPG_CHECK_MLOCK
240
241 GNUPG_CHECK_IPC
242 if test "$ac_cv_header_sys_shm_h" = "yes"; then
243   AC_DEFINE(USE_SHM_COPROCESSING)
244 fi
245
246 dnl check whether we have a random device
247 if test "$try_dev_random" = yes ; then
248 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
249 [if test -c "$NAME_OF_DEV_RANDOM" && test -c "$NAME_OF_DEV_URANDOM" ; then
250   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
251 if test "$ac_cv_have_dev_random" = yes; then
252     AC_DEFINE(HAVE_DEV_RANDOM)
253     AC_DEFINE(USE_RNDLINUX)
254 fi
255 else
256     AC_MSG_CHECKING(for random device)
257     ac_cv_have_dev_random=no
258     AC_MSG_RESULT(has been disabled)
259 fi
260
261
262 dnl setup assembler stuff
263 AC_MSG_CHECKING(for mpi assembler functions)
264 if test -f $srcdir/mpi/config.links ; then
265     . $srcdir/mpi/config.links
266     GNUPG_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
267     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
268     ac_cv_mpi_sflags="$mpi_sflags"
269     ac_cv_mpi_config_done="yes"
270     AC_MSG_RESULT(done)
271 else
272     AC_MSG_RESULT(failed)
273     AC_MSG_ERROR([mpi/config.links missing!])
274 fi
275 MPI_EXTRA_ASM_OBJS=""
276 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
277 GNUPG_MSG_PRINT([mpi extra asm functions:])
278 for i in $ac_cv_mpi_extra_asm_modules; do
279     GNUPG_MSG_PRINT([$i])
280     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
281 done
282 AC_MSG_RESULT()
283 fi
284 AC_SUBST(MPI_EXTRA_ASM_OBJS)
285 MPI_SFLAGS="$ac_cv_mpi_sflags"
286 AC_SUBST(MPI_SFLAGS)
287
288 dnl Do we have zlib? Must do it here because Solaris failed
289 dnl when compiling a conftest (due to the "-lz" from LIBS).
290 if test "$g10_force_zlib" = "yes"; then
291     ZLIBS="../zlib/libzlib.a"
292     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
293     GNUPG_LINK_FILES(zlib/zlib.h, zlib.h )
294     GNUPG_LINK_FILES(zlib/zconf.h, zconf.h )
295 else
296 AC_CHECK_HEADERS(zlib.h)
297 if test "$ac_cv_header_zlib_h" = yes ; then
298     LIBS="$LIBS -lz"
299     ZLIBS=
300     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
301 else
302     ZLIBS="../zlib/libzlib.a"
303     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
304     GNUPG_LINK_FILES(zlib/zlib.h, zlib.h )
305     GNUPG_LINK_FILES(zlib/zconf.h, zconf.h )
306 fi
307 fi
308 AC_SUBST(ZLIBS)
309
310 GNUPG_DO_LINK_FILES
311
312
313 AC_OUTPUT([
314 Makefile
315 intl/Makefile
316 po/Makefile.in
317 util/Makefile
318 mpi/Makefile
319 cipher/Makefile
320 g10/Makefile
321 doc/Makefile
322 tools/Makefile
323 zlib/Makefile
324 checks/Makefile
325 ])
326
327 dnl *-*wedit:notab*-*  Please keep this as the last line.