dnl Version info dnl dnl CW_INTERFACE_VERSION : Current interface version, increment whenever the interface is changed. dnl CW_INTERFACE_VERSION_REVISION : Revision, increment every public release; or set to 0 when the interface is changed. dnl CW_INTERFACE_AGE : Increment if interfaces have been added; or set to 0 when interfaces have been removed. define(CW_INTERFACE_VERSION, 11) define(CW_INTERFACE_VERSION_REVISION, 1) define(CW_INTERFACE_AGE, 11) define(CW_VERSION_MAJOR, 0) dnl CW_INTERFACE_VERSION - CW_INTERFACE_AGE define(CW_VERSION_MINOR, CW_INTERFACE_AGE) define(CW_VERSION_REVISION, CW_INTERFACE_VERSION_REVISION) dnl Automake package name and version AC_INIT([libecc], CW_VERSION_MAJOR.CW_VERSION_MINOR.CW_VERSION_REVISION, [carlo@alinoe.com]) dnl Put resulting configuration defines in this header file. AC_CONFIG_HEADERS([config.h]) dnl General intialization of `autoconf' variables. dnl Ensure that the directory specified with --srcdir was correct dnl by demanding that it contains `LICENSE'. AC_CONFIG_SRCDIR([LICENSE]) dnl Because we use cwautomacros. CW_AUTOMACROS dnl Automake options. AM_INIT_AUTOMAKE dnl Include maintainer mode targets. AM_MAINTAINER_MODE dnl Demand at least version 2.13 of autoconf. AC_PREREQ(2.13) dnl Libtool version info VERSIONINFO="CW_INTERFACE_VERSION:CW_INTERFACE_VERSION_REVISION:CW_INTERFACE_AGE" AC_SUBST(VERSIONINFO) dnl Cause aclocal to be invoked correctly. dnl ACLOCAL="${SHELL} \${top_srcdir}/missing --run aclocal -I aclocal" dnl AC_SUBST(ACLOCAL) dnl Check for compiler and preprocessor. AC_PROG_CC AC_PROG_CXX AC_PROG_CXXCPP dnl Add --enable-debug (DEBUG, DOXYGEN_DEBUG), --enable-libcwd (CWDEBUG, DOXYGEN_CWDEBUG), dnl --enable-optimise and --enable-profile options. dnl Update USE_LIBCWD, CWD_FLAGS, CWD_LIBS, CXXFLAGS and LDFLAGS accordingly. CW_OPG_FLAGS dnl We use doxygen for documentation. CW_DOXYGEN dnl Manual configuration options of libecc. AC_ARG_ENABLE(libecc, [ Options of package libecc:]) libecc_config_debug_output=yes AC_ARG_ENABLE(debug-output, AC_HELP_STRING([--disable-debug-output], [disable debug output of --enable-debug.]), libecc_config_debug_output=$enableval) libecc_config_mmx=yes AC_ARG_ENABLE(mmx, AC_HELP_STRING([--disable-mmx], [disable the use of MMX assembly instructions even when available (needed when using valgrind).]), libecc_config_mmx=$enableval) libecc_config_nasm=yes AC_ARG_ENABLE(nasm, AC_HELP_STRING([--disable-nasm], [disable the use of assembly instructions.]), libecc_config_nasm=$enableval) dnl Clear the cache values of all remaining tests if important dnl environment variables have been changed since last run. CW_CLEAN_CACHE dnl Figure out linker characteristics CW_RPATH_OPTION dnl Checks for other programs. AC_PROG_INSTALL AC_PROG_MAKE_SET AC_CHECK_PROG(NASM, nasm, [./nasmfe]) if test -n "$ac_cv_prog_NASM"; then CCAS="$ac_cv_prog_NASM" CCASFLAGS="-f elf $CW_DEBUG_FLAGS" AC_DEFINE([HAVE_NASM], [], [Define to 1 if you have the nasm assembler.]) elif test x"$libecc_config_nasm" != xno; then AC_MSG_WARN([ * Cannot find assembler program nasm. This means you will not be using * the fast assembly routines! Please install nasm or explicitely specify * --disable-nasm to get rid of this warning.]) fi AM_PROG_AS AC_PATH_PROGS(NASMSH, [bash sh]) dnl Specify assembly sources. AM_CONDITIONAL(NASM, test -n "$ac_cv_prog_NASM") dnl This block cannot be replaced by a macro because the DISABLE_* and the dnl AC_PROG_LIBTOOL macro need to be in configure.ac itself for some reason. dnl Generate libtool (also checks shared/static prerequisites). if expr "$host" : ".*openbsd.*" >/dev/null; then dnl openBSD has a buggy ld, no way that a shared library will work. AC_DISABLE_SHARED else dnl Disable building static libraries by default AC_DISABLE_STATIC fi test -n "$enable_shared" || enable_shared=yes test -n "$enable_static" || enable_static=yes dnl Note: due to a bug in libtool (up till at least 1.4.2), the language must be C at this point! AC_PROG_LIBTOOL dnl Configuration needed by the testsuite, extract this from the generated 'libtool' enable_shared=`./libtool --config | grep '^build_libtool_libs=' | sed -e 's/build_libtool_libs=//'` enable_static=`./libtool --config | grep '^build_old_libs=' | sed -e 's/build_old_libs=//'` if test $enable_shared = yes; then if expr "$host" : ".*openbsd.*" >/dev/null; then AC_MSG_ERROR([ The dynamic linker (ld) on openBSD is too buggy for C++ shared libraries. Static libraries are supported however, please configure using --enable-static --disable-shared, which is the default for openBSD. ]) fi fi dnl libtool has a bug that it adds an -rpath for the $libdir, we don't want dnl that because the only programs we have are test executables that are dnl never installed anyway! There is no option to turn this off other than dnl by directly messing with the just generated libtool. The trick used here dnl is to add $libdir (or what it will become later) to `sys_lib_dlsearch_path_spec`, dnl causing libtool to think that a hard coded path is not needed. sys_lib_dlsearch_path_spec=`./libtool --config | grep '^sys_lib_dlsearch_path_spec=' | sed -e 's/sys_lib_dlsearch_path_spec="\(.*\)"$/\1/'` tmp=$libdir test "x$tmp" = 'x${exec_prefix}/lib' && tmp=$exec_prefix/lib test "x$tmp" = 'xNONE/lib' && tmp=$prefix/lib test "x$tmp" = 'xNONE/lib' && tmp=$ac_default_prefix/lib dq='"' sq="'" se='|' eval sed -e ${sq}s${se}^sys_lib_dlsearch_path_spec=.*${se}sys_lib_dlsearch_path_spec=${dq}$sys_lib_dlsearch_path_spec $tmp${dq}${se}${sq} libtool > libtool.tmp && mv libtool.tmp libtool dnl"<-quote needed for syntax highlighting vim. dnl Used in sys.h to force recompilation CW_PROG_CXX_FINGER_PRINTS dnl Configuration defines of libecc/config.h AC_SUBST(CW_CONFIG_DEBUG) CW_CONFIG_DEBUG=0 AC_SUBST(CW_CONFIG_DEBUGOUTPUT) CW_CONFIG_DEBUGOUTPUT=0 CW_CONFIG_USEMMX=0 AC_SUBST(CW_CONFIG_USEMMX) CW_CONFIG_USETABLE=0 AC_SUBST(CW_CONFIG_USETABLE) dnl Configuration needed by the testsuite AC_SUBST(enable_shared) AC_SUBST(enable_static) dnl Set language requirements for the tests below. AC_LANG_CPLUSPLUS AC_REQUIRE_CPP dnl Configuration defines if test "$cw_config_debug" = yes; then CW_CONFIG_DEBUG=1 fi if test "$libecc_config_debug_output" = yes; then CW_CONFIG_DEBUGOUTPUT=1 fi AM_CONDITIONAL(ENABLETHREADING, test x$libecc_config_threading = xyes) AM_CONDITIONAL(ENABLENONTHREADING, test x$libecc_config_nonthreading = xyes) dnl Check for library functions. AC_CHECK_LIB(gmpxx, main, [LIBS="-lgmpxx $LIBS"]) if test "$ac_cv_lib_gmpxx_main" != "yes"; then AC_MSG_ERROR([ * Cannot find -lgmpxx (see config.log for more info), did you configure gmp with --enable-cxx? * You need gmp version 4.1 or higher (rpm: gmp-4.1 and gmp-devel-4.1), see http://swox.com/gmp/.]) fi dnl Checks for header files. AC_CHECK_HEADERS(_G_config.h) AC_CHECK_HEADERS(gmpxx.h) if test "$ac_cv_header_gmpxx_h" != "yes"; then AC_MSG_ERROR([ * Cannot find gmpxx.h (see config.log for more info). * You need gmp version 4.1 or higher (rpm: gmp-devel-4.1), see http://swox.com/gmp/.]) fi dnl Check for global variable. dnl Check for typedefs. dnl Check for structures. dnl Check for compiler/system characteristics. CW_BUG_G_CONFIG_H AC_C_BIGENDIAN if test -n "$ac_cv_prog_NASM"; then AC_CACHE_CHECK([if the cpu supports MMX], cw_cv_usemmx, [nasm $CCASFLAGS ${srcdir}/mmx_check.s -o mmx_check.o >/dev/null; $CC mmx_check.o -o mmx_check if test -e ./mmx_check && ./mmx_check; then cw_cv_usemmx=yes; else cw_cv_usemmx=no; fi; rm -f mmx_check.o mmx_check >/dev/null]) if test "$cw_cv_usemmx" = "yes" -a "$libecc_config_mmx" = "yes"; then CW_CONFIG_USEMMX=1 fi fi AC_CHECK_SIZEOF(long) CW_CONFIG_BITS=$ac_cv_sizeof_long AC_SUBST(CW_CONFIG_BITS) dnl Check for system services. dnl Set up build directory test -d include || mkdir include dnl Generate include/libecc/config.h and include/sys.h, preserving timestamp when they are not changed. AC_CONFIG_FILES(include/libecc/timestamp-config.h:include/libecc/config.h.in, [ cd include/libecc if cmp -s config.h timestamp-config.h 2> /dev/null; then echo "config.status: config.h is unchanged" else echo "config.status: creating config.h" cp timestamp-config.h config.h fi touch timestamp-config.h cd ../.. ]) AC_CONFIG_FILES(include/timestamp-sys.h:include/sys.h.in, [ cd include if cmp -s sys.h timestamp-sys.h 2> /dev/null; then echo "config.status: sys.h is unchanged" else echo "config.status: creating sys.h" cp timestamp-sys.h sys.h fi touch timestamp-sys.h cd .. ]) AC_CONFIG_COMMANDS([chmodnasmfe], [chmod +x ./nasmfe]) dnl Output the other configuration files. AC_CONFIG_FILES( [libecc.spec] [Makefile] [maintMakefile] [nasmfe] [include/Makefile] [include/libecc/Makefile] [testsuite/bitset/Makefile] [testsuite/rng/Makefile] [testsuite/sha1/Makefile] [testsuite/polynomial/Makefile] [testsuite/fieldmath/Makefile] [testsuite/point/Makefile] [doc/doxygen.config] [doc/Makefile] [doc/html.header] [doc/html.footer] [doc/styles/Makefile] ) AC_OUTPUT