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