1dnl Check for FLINT 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 8/6/12 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_FLINT ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 34dnl 35dnl Test for FLINT and define FLINT_CFLAGS and FLINT_LIBS 36 37AC_DEFUN([LB_CHECK_FLINT], 38[ 39 40AC_ARG_WITH(flint, 41[AC_HELP_STRING([--with-flint=<path>|yes], [Use FLINT library. This library is (not yet) mandatory for 42 LinBox compilation. If argument is yes or <empty> or <bad> 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 49AS_IF([test "$withval" = yes ], 50 [ FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}" ], 51 [ test "$withval" != no ], 52 [ FLINT_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}" ], 53 [ FLINT_HOME_PATH="${DEFAULT_CHECKING_PATH}"]) 54 55dnl min_flint_version=ifelse([$1], ,1.0.3,$1) 56 57 58dnl Check for existence 59BACKUP_CXXFLAGS=${CXXFLAGS} 60BACKUP_LIBS=${LIBS} 61 62AC_MSG_CHECKING(for FLINT) 63 64for FLINT_HOME in ${FLINT_HOME_PATH} 65 do 66 AS_IF([test -r "$FLINT_HOME/include/flint/flint.h"],[ 67 68 AS_IF([ test "x$FLINT_HOME" != "x/usr" -a "x$FLINT_HOME" != "x/usr/local"],[ 69 FLINT_CFLAGS="-I${FLINT_HOME}/include" 70 FLINT_LIBS="-L${FLINT_HOME}/lib -lflint"], [ 71 FLINT_CFLAGS= 72 FLINT_LIBS="-lflint" ]) 73 74 CXXFLAGS="${BACKUP_CXXFLAGS} ${FFLAS_FFPACK_CFLAGS} ${MPFR_CFLAGS} ${FLINT_CFLAGS}" 75 LIBS="${BACKUP_LIBS} ${FFLAS_FFPACK_LIBS} ${MPFR_LIBS} ${FLINT_LIBS}" 76 77 AC_TRY_LINK( 78 [ //extern "C" { 79 #define __GMP_BITS_PER_MP_LIMB GMP_LIMB_BITS 80 #include <flint/flint.h> 81 #include <flint/fmpz_mat.h> 82 //} 83 ], 84 [fmpz_mat_t a;], 85 [ 86 AC_TRY_RUN( 87 [ 88 #include "flint/flint.h" 89 int main () { 90 if ( (__FLINT_VERSION < 2) || ( (__FLINT_VERSION ==2) && (__FLINT_VERSION_MINOR < 4) ) ) 91 return 1 ; 92 else 93 return 0; 94 } 95 ],[ 96 flint_found="yes" 97 break 98 ],[ 99 flint_problem="$problem $FLINT_HOME" 100 unset FLINT_CFLAGS 101 unset FLINT_LIBS 102 ],[ 103 flint_found="yes" 104 flint_cross="yes" 105 break 106 ]) 107 ], 108 [ 109 flint_found="no" 110 flint_checked="$checked $FLINT_HOME" 111 unset FLINT_CFLAGS 112 unset FLINT_LIBS 113 ]) 114 dnl AC_MSG_RESULT(found in $flint_checked ? $flint_found) 115 ],[ 116 flint_found="no" 117 dnl AC_MSG_RESULT(not found at all $FLINT_HOME : $flint_found) 118 ]) 119done 120 121AS_IF([test "x$flint_found" = "xyes"],[ 122 AC_SUBST(FLINT_CFLAGS) 123 AC_SUBST(FLINT_LIBS) 124 AC_DEFINE(HAVE_FLINT,1,[Define if FLINT is installed]) 125 HAVE_FLINT=yes 126 AS_IF([test "x$flint_cross" != "xyes"], 127 [AC_MSG_RESULT(found)], 128 [AC_MSG_RESULT(unknown) 129 echo "WARNING: You appear to be cross compiling, so there is no way to determine" 130 echo "whether your FLINT version is new enough. I am assuming it is." 131 ]) 132 ifelse([$2], , :, [$2])], 133 [ test -n "$flint_problem" ], 134 [ AC_MSG_RESULT(problem) 135 echo "Sorry, your FLINT version is too old. Disabling." 136 ifelse([$3], , :, [$3]) ], 137 [ test "x$flint_found" = "xno" ], 138 [ AC_MSG_RESULT(>=2.4 not found ) 139 ifelse([$3], , :, [$3])]) 140 141AM_CONDITIONAL(LINBOX_HAVE_FLINT, test "x$HAVE_FLINT" = "xyes") 142 143CXXFLAGS=${BACKUP_CXXFLAGS} 144LIBS=${BACKUP_LIBS} 145#unset LD_LIBRARY_PATH 146 147]) 148