1dnl Check for NTL 2dnl Bradford Hovinen, 2001-06-13 3dnl Modified by Pascal Giorgi, 2003-12-03 4dnl Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12 5dnl Stolen from Chris Lahey 99-2-5 6dnl stolen from Manish Singh again 7dnl stolen back from Frank Belew 8dnl stolen from Manish Singh 9dnl Shamelessly stolen from Owen Taylor 10dnl Copyright (c) the LinBox group 11dnl This file is part of LinBox 12 13 dnl ========LICENCE======== 14 dnl This file is part of the library LinBox. 15 dnl 16 dnl LinBox is free software: you can redistribute it and/or modify 17 dnl it under the terms of the GNU Lesser General Public 18 dnl License as published by the Free Software Foundation; either 19 dnl version 2.1 of the License, or (at your option) any later version. 20 dnl 21 dnl This library is distributed in the hope that it will be useful, 22 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 23 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 dnl Lesser General Public License for more details. 25 dnl 26 dnl You should have received a copy of the GNU Lesser General Public 27 dnl License along with this library; if not, write to the Free Software 28 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 29 dnl ========LICENCE======== 30 dnl 31 32 33dnl LB_CHECK_NTL ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 34dnl 35dnl Test for Victor Shoup's NTL (Number Theory Library) and define 36dnl NTL_CFLAGS and NTL_LIBS 37 38AC_DEFUN([LB_CHECK_NTL], 39[ 40 41AC_ARG_WITH(ntl, 42[AC_HELP_STRING([--with-ntl=<path>|yes|no], [Use NTL library. If argument is no, you do not have 43 the library installed on your machine (set as 44 default). If argument is yes or <empty> that means 45 the library is reachable with the standard search 46 path (/usr or /usr/local). Otherwise you give the 47 <path> to the directory which contain the library. 48 ])], 49 [if test "$withval" = yes ; then 50 NTL_HOME_PATH="${DEFAULT_CHECKING_PATH}" 51 elif test "$withval" != no ; then 52 NTL_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}" 53 fi], 54 [NTL_HOME_PATH=${DEFAULT_CHECKING_PATH}]) 55 56min_ntl_version=ifelse([$1], ,5.0,$1) 57 58 59dnl Check for existence 60BACKUP_CXXFLAGS=${CXXFLAGS} 61BACKUP_LIBS=${LIBS} 62 63if test -n "$NTL_HOME_PATH"; then 64AC_MSG_CHECKING(for NTL >= $min_ntl_version) 65fi 66 67for NTL_HOME in ${NTL_HOME_PATH} 68 do 69if test -r "$NTL_HOME/include/NTL/ZZ.h"; then 70 71 if test "x$NTL_HOME" != "x/usr" -a "x$NTL_HOME" != "x/usr/local"; then 72 NTL_CFLAGS="-I${NTL_HOME}/include" 73 NTL_LIBS="-L${NTL_HOME}/lib -lntl" 74 else 75 NTL_CFLAGS= 76 NTL_LIBS="-lntl" 77 fi 78 CXXFLAGS="${BACKUP_CXXFLAGS} ${NTL_CFLAGS} ${FFLAS_FFPACK_CFLAGS}" 79 LIBS="${BACKUP_LIBS} ${NTL_LIBS} ${FFLAS_FFPACK_LIBS}" 80 81 AC_TRY_LINK( 82 [#include <NTL/ZZ.h>], 83 [NTL::ZZ a;], 84 [ 85 AC_TRY_RUN( 86 [#include <NTL/version.h> 87 int main () { if (NTL_MAJOR_VERSION < 5) return -1; else return 0; } 88 ],[ 89 ntl_found="yes" 90 break 91 ],[ 92 ntl_problem="$problem $NTL_HOME" 93 unset NTL_CFLAGS 94 unset NTL_LIBS 95 ],[ 96 ntl_found="yes" 97 ntl_cross="yes" 98 break 99 ]) 100 ], 101 [ 102 ntl_found="no" 103 ntl_checked="$checked $NTL_HOME" 104 unset NTL_CFLAGS 105 unset NTL_LIBS 106 ]) 107else 108 ntl_found="no" 109fi 110done 111 112if test "x$ntl_found" = "xyes" ; then 113 AC_SUBST(NTL_CFLAGS) 114 AC_SUBST(NTL_LIBS) 115 AC_DEFINE(HAVE_NTL,1,[Define if NTL is installed]) 116 HAVE_NTL=yes 117 if test "x$ntl_cross" != "xyes"; then 118 AC_MSG_RESULT(found) 119 else 120 AC_MSG_RESULT(unknown) 121 echo "WARNING: You appear to be cross compiling, so there is no way to determine" 122 echo "whether your NTL version is new enough. I am assuming it is." 123 fi 124 ifelse([$2], , :, [$2]) 125elif test -n "$ntl_problem"; then 126 AC_MSG_RESULT(problem) 127 echo "Sorry, your NTL version is too old. Disabling." 128 ifelse([$3], , :, [$3]) 129elif test "x$ntl_found" = "xno"; then 130 AC_MSG_RESULT(not found) 131 if test "x$NTL_HOME" != "x/usr" -a "x$NTL_HOME" != "x/usr/local" ; then 132 AC_MSG_WARN(NTL >= $min_ntl_version was not found. LinBox also requires the NTL namespace to be enabled. Please make sure NTL is compiled correctly.) 133 fi 134 ifelse([$3], , :, [$3]) 135fi 136 137 138 139AM_CONDITIONAL(LINBOX_HAVE_NTL, test "x$HAVE_NTL" = "xyes") 140 141CXXFLAGS=${BACKUP_CXXFLAGS} 142LIBS=${BACKUP_LIBS} 143#unset LD_LIBRARY_PATH 144 145]) 146 147