1dnl Check for MPFR 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_MPFR ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 34dnl 35dnl Test for MPFR and define MPFR_CFLAGS and MPFR_LIBS 36 37AC_DEFUN([LB_CHECK_MPFR], 38[ 39 40AC_ARG_WITH(mpfr, 41[AC_HELP_STRING([--with-mpfr=<path>|yes], [Use MPFR 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 [if test "$withval" = yes ; then 49 MPFR_HOME_PATH="${DEFAULT_CHECKING_PATH}" 50 elif test "$withval" != no ; then 51 MPFR_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}" 52 fi], 53 [MPFR_HOME_PATH="${DEFAULT_CHECKING_PATH}"]) 54 55dnl min_mpfr_version=ifelse([$1], ,1.0.3,$1) 56 57 58dnl Check for existence 59BACKUP_CXXFLAGS=${CXXFLAGS} 60BACKUP_LIBS=${LIBS} 61 62AC_MSG_CHECKING(for MPFR) 63 64for MPFR_HOME in ${MPFR_HOME_PATH} 65 do 66 if test -r "$MPFR_HOME/include/mpfr.h"; then 67 68 AS_IF([ test "x$MPFR_HOME" != "x/usr" -a "x$MPFR_HOME" != "x/usr/local"], [ 69 MPFR_CFLAGS="-I${MPFR_HOME}/include" 70 MPFR_LIBS="-L${MPFR_HOME}/lib -lmpfr" 71 ],[ 72 MPFR_CFLAGS= 73 MPFR_LIBS="-lmpfr" 74 ]) 75 76 CXXFLAGS="${BACKUP_CXXFLAGS} ${MPFR_CFLAGS} ${FFLAS_FFPACK_CFLAGS}" 77 LIBS="${BACKUP_LIBS} ${FFLAS_FFPACK_LIBS} ${MPFR_LIBS} " 78 79 AC_TRY_LINK( 80 [ 81 #include <mpfr.h> 82 ], 83 [mpfr_t a ;], 84 [ 85 AC_TRY_RUN( 86 [ 87 int main () { return 0; /* not important to check for version */ } 88 ],[ 89 mpfr_found="yes" 90 break 91 ],[ 92 mpfr_problem="$problem $MPFR_HOME" 93 unset MPFR_CFLAGS 94 unset MPFR_LIBS 95 ],[ 96 mpfr_found="yes" 97 mpfr_cross="yes" 98 break 99 ]) 100 ], 101 [ 102 mpfr_found="no" 103 mpfr_checked="$checked $MPFR_HOME" 104 unset MPFR_CFLAGS 105 unset MPFR_LIBS 106 ]) 107 dnl AC_MSG_RESULT(found in $mpfr_checked ? $mpfr_found) 108 else 109 mpfr_found="no" 110 dnl AC_MSG_RESULT(not found at all $MPFR_HOME : $mpfr_found) 111 fi 112done 113 114if test "x$mpfr_found" = "xyes" ; then 115 AC_SUBST(MPFR_CFLAGS) 116 AC_SUBST(MPFR_LIBS) 117 AC_DEFINE(HAVE_MPFR,1,[Define if MPFR is installed]) 118 HAVE_MPFR=yes 119 AS_IF([ test "x$mpfr_cross" != "xyes" ],[ 120 AC_MSG_RESULT(found) 121 ],[ 122 AC_MSG_RESULT(unknown) 123 echo "WARNING: You appear to be cross compiling, so there is no way to determine" 124 echo "whether your MPFR version is new enough. I am assuming it is." 125 ]) 126 ifelse([$2], , :, [$2]) 127elif test -n "$mpfr_problem"; then 128 AC_MSG_RESULT(problem) 129 echo "Sorry, your MPFR version is too old. Disabling." 130 ifelse([$3], , :, [$3]) 131elif test "x$mpfr_found" = "xno" ; then 132 AC_MSG_RESULT(not found) 133 ifelse([$3], , :, [$3]) 134fi 135 136AM_CONDITIONAL(LINBOX_HAVE_MPFR, test "x$HAVE_MPFR" = "xyes") 137 138CXXFLAGS=${BACKUP_CXXFLAGS} 139LIBS=${BACKUP_LIBS} 140#unset LD_LIBRARY_PATH 141 142]) 143