configure.ac: Replace with a new version.
[u/mdw/catacomb] / configure.ac
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..9aff84a
--- /dev/null
@@ -0,0 +1,125 @@
+dnl -*-autoconf-*-
+dnl
+dnl Configuration script for Catacomb
+dnl
+dnl (c) 2013 Straylight/Edgeware
+dnl
+
+dnl----- Licensing notice ---------------------------------------------------
+dnl
+dnl This file is part of Catacomb.
+dnl
+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 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 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--------------------------------------------------------------------------
+dnl Initialization.
+
+mdw_AUTO_VERSION
+AC_INIT([catacomb], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([catacomb.pc.in])
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([foreign parallel-tests])
+mdw_SILENT_RULES
+
+AC_PROG_CC
+AX_CFLAGS_WARN_ALL
+AM_PROG_LIBTOOL
+mdw_LIBTOOL_VERSION_INFO
+
+AC_PROG_YACC
+
+AC_SUBST(AM_CFLAGS)
+
+dnl--------------------------------------------------------------------------
+dnl C programming environment.
+
+dnl Various standard types.
+AC_CHECK_TYPE([pid_t], [int])
+AC_TYPE_UID_T
+AC_CHECK_TYPE([ssize_t], [int])
+
+dnl The maths library.
+mdw_ORIG_LIBS=$LIBS
+AC_SEARCH_LIBS([log], [m])
+AC_SEARCH_LIBS([sqrt], [m])
+AC_SUBST([CATACOMB_LIBS], [$LIBS])
+LIBS=$mdw_ORIG_LIBS
+
+dnl Functions used for noise-gathering.
+AC_CHECK_FUNCS([setgroups])
+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);
+sigsetjump(j, 1);],
+[catacomb_cv_freewheel=yes],
+[catacomb_cv_freewheel=no])])
+case $catacomb_cv_freewheel in
+  yes)
+    AC_DEFINE([USE_FREEWHEEL], [1],
+             [Define if you want to use the freewheel noise generator.])
+    ;;
+esac
+
+dnl Support for the passphrase pixie.
+mdw_ORIG_LIBS=$LIBS
+AC_SEARCH_LIBS([socket], [socket])
+AC_SUBST([PIXIE_LIBS], [$LIBS])
+LIBS=$mdw_ORIG_LIBS
+
+dnl Memory locking support.
+AC_CHECK_FUNCS([mlock])
+
+dnl Necessary support libraries.
+PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4])
+AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS"
+
+dnl--------------------------------------------------------------------------
+dnl Python.
+
+dnl Make sure we have a suitable version.
+AM_PATH_PYTHON([2.5])
+
+dnl--------------------------------------------------------------------------
+dnl Special debugging options.
+
+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--------------------------------------------------------------------------
+dnl Produce output.
+
+AC_CONFIG_HEADER([config/config.h])
+
+AC_CONFIG_FILES(
+  [Makefile])
+AC_OUTPUT
+
+dnl----- That's all, folks --------------------------------------------------