/* configure.ac Copyright (C) 2009, 2010, 2011, 2012, 2013, 2017, 2018, 2020 Andreas Enge This file is part of the MPFRCX Library. The MPFRCX Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The MPFRCX Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the MPC Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ AC_PREREQ(2.61) AC_INIT(mpfrcx, 0.6, andreas.enge@inria.fr) AC_CONFIG_SRCDIR([src/mpfrcx-impl.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([1.9 -Wall -Werror]) AM_MAINTAINER_MODE AM_PROG_AR AC_CANONICAL_HOST AC_CONFIG_MACRO_DIR([m4]) # Extra arguments to configure AC_ARG_WITH([gmp], [AC_HELP_STRING([--with-gmp=DIR], [GMP install directory])], [ CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib" ]) AC_ARG_WITH([mpfr], [AC_HELP_STRING([--with-mpfr=DIR], [MPFR install directory])], [ CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib" ]) AC_ARG_WITH([mpc], [AC_HELP_STRING([--with-mpc=DIR], [MPC install directory])], [ CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib" ]) AC_ARG_ENABLE([valgrind-tests], [AC_HELP_STRING([--enable-valgrind-tests], [run checks through valgrind (default = no)])], [case $enableval in yes) gl_VALGRIND_TESTS ;; no) ;; *) AC_MSG_ERROR([Bad value for --enable-valgrind-tests: Use yes or no]) ;; esac ] ) # Checks for programs. AC_PROG_CC AC_LANG(C) # Set up LibTool AC_PROG_LIBTOOL # Check GMP Header AC_MSG_CHECKING(for gmp.h) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include "gmp.h" ]])],[AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no) AC_MSG_ERROR([gmp.h can't be found, or is unusable.]) ]) # Checks if compiler accepts warning flags. MPC_C_CHECK_WARNINGCFLAGS # Checks for libraries. AC_CHECK_LIB([gmp], [__gmpz_init], [LIBS="-lgmp $LIBS"], [AC_MSG_ERROR([libgmp not found or uses a different ABI.])]) AC_MSG_CHECKING(for MPFR) LIBS="-lmpfr $LIBS" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include "mpfr.h"]], [[mpfr_t x; mpfr_init(x) ; mpfr_clear(x);]] )], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_MSG_ERROR([libmpfr not found or uses a different ABI.]) ]) AC_MSG_CHECKING(for MPC) LIBS="-lmpc $LIBS" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include "mpc.h"]], [[mpc_t x; mpc_init2(x, 2) ; mpc_clear(x);]] )], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_MSG_ERROR([libmpc not found or uses a different ABI.]) ]) # Check for a recent MPC: we require at least 1.0 for mpc_mul_2ui AC_MSG_CHECKING(for recent MPC) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[ #include "mpc.h" #if (MPC_VERSION < MPC_VERSION_NUM (1,0,0)) # error "Minimal MPC version is 1.0" error #endif ]])], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_MSG_ERROR([MPC version >= 1.0 required]) ]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC # Checks for gcc version, result in variables MPFRCX_GCC etc. inside config.h AX_GCC_VERSION AC_DEFINE_UNQUOTED([MPFRCX_GCC], ["$GCC"], [Gcc yes or no]) AC_DEFINE_UNQUOTED([MPFRCX_CC], ["$CC"], [C compiler]) AC_DEFINE_UNQUOTED([MPFRCX_GCC_VERSION], ["$GCC_VERSION"], [Version of gcc]) AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile]) AC_OUTPUT