See ChangeLog: Sun Dec 13 14:10:56 CET 1998 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 it fr ru es_ES pt_BR"
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     *)
110        ;;
111 esac
112
113
114 GNUPG_CHECK_PIC
115 if test "$NO_PIC" = yes; then
116     try_dynload=no
117 fi
118
119
120 case "${target}" in
121     i386--mingw32)
122         PRINTABLE_OS_NAME="MingW32"
123         ;;
124     *-linux*)
125         PRINTABLE_OS_NAME="GNU/Linux"
126         ;;
127     *)
128         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
129         ;;
130 esac
131 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
132
133 dnl  Fixme: Are these the best flags for OpenBSD????
134 case "${target}" in
135     *-openbsd*)
136         NAME_OF_DEV_RANDOM="/dev/srandom"
137         NAME_OF_DEV_URANDOM="/dev/urandom"
138         DYNLINK_MOD_CFLAGS="-shared -rdynamic -fpic -Wl,-Bshareable -Wl,-x"
139         ;;
140     *)
141         NAME_OF_DEV_RANDOM="/dev/random"
142         NAME_OF_DEV_URANDOM="/dev/urandom"
143         DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC -lc"
144         ;;
145 esac
146 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM")
147 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM")
148
149
150 dnl Checks for libraries.
151
152 AM_GNU_GETTEXT
153
154 AC_CHECK_LIB(gdbm,gdbm_firstkey)
155
156
157 if test "$try_dynload" = yes ; then
158   AC_CHECK_LIB(dl,dlopen)
159   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
160     AC_DEFINE(USE_DYNAMIC_LINKING)
161     AC_DEFINE(HAVE_DL_DLOPEN)
162     DYNLINK_LDFLAGS="-Wl,-export-dynamic"
163     use_gnupg_extensions=yes
164   else
165     AC_CHECK_LIB(c,dlopen)
166     if test "$ac_cv_lib_c_dlopen" = "yes"; then
167       AC_DEFINE(USE_DYNAMIC_LINKING)
168       AC_DEFINE(HAVE_DL_DLOPEN)
169       DYNLINK_LDFLAGS="-Wl,-export-dynamic"
170       dnl fixme: this is probably false but it should
171       dnl work for freebsd
172       AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
173       use_gnupg_extensions=yes
174     else
175       AC_CHECK_LIB(dld,dld_link)
176       if test "$ac_cv_lib_dld_dld_link" = "yes"; then
177         AC_DEFINE(USE_DYNAMIC_LINKING)
178         AC_DEFINE(HAVE_DLD_DLD_LINK)
179         DYNLINK_LDFLAGS="-Wl,-export-dynamic"
180         use_gnupg_extensions=yes
181       fi
182     fi
183   fi
184 else
185   AC_MSG_CHECKING(for dynamic loading)
186   DYNLINK_LDFLAGS=
187   DYNLINK_MOD_CFLAGS=
188   use_gnupg_extensions=no
189   AC_MSG_RESULT(has been disabled)
190 fi
191
192 AM_CONDITIONAL(ENABLE_GNUPG_EXTENSIONS, test "$use_gnupg_extensions" = yes )
193 AC_SUBST(DYNLINK_LDFLAGS)
194 AC_SUBST(DYNLINK_MOD_CFLAGS)
195
196
197 dnl Checks for header files.
198 AC_HEADER_STDC
199 AC_CHECK_HEADERS(unistd.h)
200
201
202 dnl Checks for typedefs, structures, and compiler characteristics.
203 AC_C_CONST
204 AC_C_INLINE
205 AC_TYPE_SIZE_T
206 AC_TYPE_SIGNAL
207 AC_DECL_SYS_SIGLIST
208
209 GNUPG_CHECK_ENDIAN
210
211
212 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
213 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
214 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
215 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
216 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
217
218 AC_CHECK_SIZEOF(unsigned short, 2)
219 AC_CHECK_SIZEOF(unsigned int, 4)
220 AC_CHECK_SIZEOF(unsigned long, 4)
221
222 if test "$ac_cv_sizeof_unsigned_short" = "0" \
223    || test "$ac_cv_sizeof_unsigned_int" = "0" \
224    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
225     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
226 fi
227
228
229
230 dnl Checks for library functions.
231 AC_FUNC_VPRINTF
232 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mmap)
233 AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit)
234 AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime)
235
236 GNUPG_CHECK_MLOCK
237
238 GNUPG_CHECK_IPC
239 if test "$ac_cv_header_sys_shm_h" = "yes"; then
240   AC_DEFINE(USE_SHM_COPROCESSING)
241 fi
242
243 dnl check whether we have a random device
244 if test "$try_dev_random" = yes ; then
245 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
246 [if test -c "$NAME_OF_DEV_RANDOM" && test -c "$NAME_OF_DEV_URANDOM" ; then
247   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
248 if test "$ac_cv_have_dev_random" = yes; then
249     AC_DEFINE(HAVE_DEV_RANDOM)
250     AC_DEFINE(USE_RNDLINUX)
251 fi
252 else
253     AC_MSG_CHECKING(for random device)
254     ac_cv_have_dev_random=no
255     AC_MSG_RESULT(has been disabled)
256 fi
257
258
259 dnl setup assembler stuff
260 AC_MSG_CHECKING(for mpi assembler functions)
261 if test -f $srcdir/mpi/config.links ; then
262     . $srcdir/mpi/config.links
263     GNUPG_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
264     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
265     ac_cv_mpi_sflags="$mpi_sflags"
266     ac_cv_mpi_config_done="yes"
267     AC_MSG_RESULT(done)
268 else
269     AC_MSG_RESULT(failed)
270     AC_MSG_ERROR([mpi/config.links missing!])
271 fi
272 MPI_EXTRA_ASM_OBJS=""
273 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
274 GNUPG_MSG_PRINT([mpi extra asm functions:])
275 for i in $ac_cv_mpi_extra_asm_modules; do
276     GNUPG_MSG_PRINT([$i])
277     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
278 done
279 AC_MSG_RESULT()
280 fi
281 AC_SUBST(MPI_EXTRA_ASM_OBJS)
282 MPI_SFLAGS="$ac_cv_mpi_sflags"
283 AC_SUBST(MPI_SFLAGS)
284
285 dnl Do we have zlib? Must do it here because Solaris failed
286 dnl when compiling a conftest (due to the "-lz" from LIBS).
287 if test "$g10_force_zlib" = "yes"; then
288     ZLIBS="../zlib/libzlib.a"
289     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
290     GNUPG_LINK_FILES(zlib/zlib.h, zlib.h )
291     GNUPG_LINK_FILES(zlib/zconf.h, zconf.h )
292 else
293 AC_CHECK_HEADERS(zlib.h)
294 if test "$ac_cv_header_zlib_h" = yes ; then
295     LIBS="$LIBS -lz"
296     ZLIBS=
297     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
298 else
299     ZLIBS="../zlib/libzlib.a"
300     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
301     GNUPG_LINK_FILES(zlib/zlib.h, zlib.h )
302     GNUPG_LINK_FILES(zlib/zconf.h, zconf.h )
303 fi
304 fi
305 AC_SUBST(ZLIBS)
306
307 GNUPG_DO_LINK_FILES
308
309
310 AC_OUTPUT([
311 Makefile
312 intl/Makefile
313 po/Makefile.in
314 util/Makefile
315 mpi/Makefile
316 cipher/Makefile
317 g10/Makefile
318 doc/Makefile
319 tools/Makefile
320 zlib/Makefile
321 checks/Makefile
322 ])
323
324 dnl *-*wedit:notab*-*  Please keep this as the last line.