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