.links: Drop obsolete `lib-config.in' file.
[u/mdw/catacomb] / configure.in
index 4a6ba52..eecc3a8 100644 (file)
@@ -1,6 +1,6 @@
-dnl -*-fundamental-*-
+dnl -*-m4-*-
 dnl
-dnl $Id: configure.in,v 1.2 1999/10/23 12:56:25 mdw Exp $
+dnl $Id$
 dnl
 dnl Autoconfiguration for Catacomb
 dnl
@@ -15,42 +15,32 @@ dnl Catacomb is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU Library General Public License as
 dnl published by the Free Software Foundation; either version 2 of the
 dnl License, or (at your option) any later version.
-dnl 
+dnl
 dnl Catacomb is distributed in the hope that it will be useful,
 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 dnl GNU Library General Public License for more details.
-dnl 
+dnl
 dnl You should have received a copy of the GNU Library General Public
 dnl License along with Catacomb; if not, write to the Free
 dnl Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 dnl MA 02111-1307, USA.
 
-dnl ----- Revision history --------------------------------------------------
-dnl
-dnl $Log: configure.in,v $
-dnl Revision 1.2  1999/10/23 12:56:25  mdw
-dnl Version number change.
-dnl
-dnl Revision 1.2  1999/10/23 12:56:25  mdw
-dnl Version number change.
-dnl
-dnl Revision 1.1  1999/09/03 08:41:11  mdw
-dnl Initial import.
-dnl
-
 dnl --- Boring boilerplate ---
 
-AC_INIT(blkc.h)
-AM_INIT_AUTOMAKE(catacomb, 1.0.0pre2)
+mdw_AUTO_VERSION
+AC_INIT(catacomb, AUTO_VERSION, mdw@distorted.org.uk)
+AC_CONFIG_SRCDIR(blkc.h)
+AC_CONFIG_AUX_DIR(.)
 AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(foreign)
 
 dnl --- Make sure I can compile and build libraries ---
 
 AC_PROG_CC
-AC_CHECK_PROG(AR, ar, ar)
-AC_PROG_RANLIB
-mdw_MLIB
+AM_PROG_LIBTOOL
+AX_CFLAGS_WARN_ALL
+mdw_LIBTOOL_VERSION_INFO
 
 AC_PROG_YACC
 
@@ -61,38 +51,69 @@ AC_HEADER_STDC
 
 dnl --- Check for various important system types ---
 
-AC_TYPE_PID_T
-
-dnl --- Tedious check for ssize_t ---
-dnl
-dnl glibc-2 puts ssize_t in a strange place.
-
-AC_CACHE_CHECK(for ssize_t, cat_cv_type_ssize_t,
-[AC_EGREP_CPP(ssize_t,
-[#include <sys/types.h>
-#if HAVE_UNISTD_H
-#inlcude <unistd.h>
-#endif
-#if STDC_HEADERS
-#include <stddef.h>
-#include <stdlib.h>
-#endif],
-cat_cv_type_ssize_t=yes, cat_cv_type_ssize_t=no)])
-if test $cat_cv_type_ssize_t = no; then
-  AC_DEFINE(ssize_t, int)
-fi
+AC_CHECK_TYPE(pid_t, int)
+AC_CHECK_TYPE(size_t, unsigned)
 AC_TYPE_UID_T
 AC_CHECK_TYPE(time_t, long)
-mdw_TYPE_SSIZE_T
+AC_CHECK_TYPE(ssize_t, int)
 
-dnl --- Can I call `initgroups'? ---
-dnl
-dnl This is used in noise-gathering.
+dnl --- The maths library, for Maurer's test ---
+
+OLIBS=$LIBS
+AC_SEARCH_LIBS(log, m)
+AC_SEARCH_LIBS(sqrt, m)
+AC_SUBST([CATACOMB_LIBS], [$LIBS]) LIBS=$OLIBS
+
+dnl --- Functions used for noise-gathering ---
 
 AC_CHECK_FUNCS(setgroups)
-AC_OUTPUT(Makefile)
+
+AC_CACHE_CHECK([whether the freewheel noise generator will work],
+[catacomb_cv_freewheel],
+[AC_TRY_LINK([
+#include <setjmp.h>
+#include <sys/time.h>
+],
+[struct itimerval itv = { { 0, 0 }, { 0, 5000 } };
+jmp_buf j;
+setitimer(ITIMER_REAL, &itv, 0);
+sigsetjmp(j, 1);],
+[catacomb_cv_freewheel=yes],
+[catacomb_cv_freewheel=no])])
+if test "$catacomb_cv_freewheel" = "yes"; then
+  AC_DEFINE([USE_FREEWHEEL], [1],
+           [Define if you want to use the freewheel noise generator.])
+fi
+
+dnl --- Support for the passphrase pixie ---
+
+OLIBS=$LIBS
+AC_SEARCH_LIBS(socket, socket)
+AC_SUBST([PIXIE_LIBS], [$LIBS]) LIBS=$OLIBS
+AC_CHECK_FUNCS(mlock)
+
+dnl --- Debugging things ---
+
+AC_ARG_ENABLE([mpw],
+             [AS_HELP_STRING([--enable-mpw],
+                             [force small-width mp digits])],
+             [case "$enableval" in
+                y*|t*|short)
+                  AC_DEFINE([FORCE_MPW_SHORT], [1],
+                            [Define to force small-width mp digits.])
+                  ;;
+                cussid)
+                  AC_DEFINE([FORCE_MPW_CUSSID], [1],
+                            [Define to force strange-width mp digits.])
+                  ;;
+              esac])
+
 dnl --- Done ---
 
-AC_OUTPUT(Makefile catacomb-config)
+PKG_CHECK_MODULES(mLib, mLib >= 2.0.4)
+CFLAGS="$CFLAGS $mLib_CFLAGS"
+LIBS="$LIBS $mLib_LIBS"
+AC_OUTPUT(Makefile tests/Makefile catacomb.pc qcc,
+  chmod 755 qcc)
 
 dnl ----- That's all, folks -------------------------------------------------