1dnl Process this file with autoconf to produce a configure script. 2AC_INIT 3 4crlibm_version=`cat $srcdir/VERSION` 5dnl For Automake 6AM_INIT_AUTOMAKE(crlibm, $crlibm_version) 7 8AC_CONFIG_HEADERS([crlibm_config.h]) 9 10 11AC_SUBST(VERSION) 12 13ISODATE=`date +%Y-%m-%d` 14AC_SUBST(ISODATE) 15 16dnl Check for system information 17AC_CANONICAL_HOST 18case $host_os in 19hpux*) 20 AC_DEFINE_UNQUOTED(CRLIBM_TYPEOS_HPUX,1,[OS type]);; 21*cygwin* | *mingw* | *uwin* | *djgpp | *emx*) 22 AC_DEFINE_UNQUOTED(CRLIBM_TYPEOS_CYGWIN,1,[OS type]);; 23freebsd*|netbsd*|darwin*) 24 AC_DEFINE_UNQUOTED(CRLIBM_TYPEOS_BSD,1,[OS type]);; 25esac; 26 27 28case $host_cpu in 29alpha) 30 AC_DEFINE_UNQUOTED(CRLIBM_TYPECPU_ALPHA,1,[Processor type]) ;; 31sparc) 32 AC_DEFINE_UNQUOTED(CRLIBM_TYPECPU_SPARC,1,[Processor type]) ;; 33powerpc*) 34 AC_DEFINE_UNQUOTED(CRLIBM_TYPECPU_POWERPC,1,[Processor type]);; 35i*86|k6|k7|pentium*|athlon*) 36 AC_DEFINE_UNQUOTED(CRLIBM_TYPECPU_X86,1,[Processor type]) 37 has_ia32_de=true;; 38x86_64|amd64) 39 AC_DEFINE_UNQUOTED(CRLIBM_TYPECPU_AMD64,1,[Processor type]) 40 has_ia32_de=true;; 41ia64) 42 AC_DEFINE_UNQUOTED(CRLIBM_TYPECPU_ITANIUM,1,[Processor type]) 43 has_ia64_de=true;; 44esac; 45 46 47AC_CONFIG_SRCDIR([crlibm.h]) 48AC_PROG_MAKE_SET 49 50dnl Check for compiler 51 52AC_PROG_CC(gcc icc cc) 53 54# Try to set compiler flags to get floating point arithmetics 55# to work. This is an old heritage and should become useless within 30 years 56# 57if test "${GCC}" != "yes" ; then 58 case "${build}" in 59 *-*-hpux* ) 60 AM_CFLAGS="${AM_CFLAGS} -Wp,-H30000" 61 ;; 62 *-dec-osf* ) 63 AM_CFLAGS="${AM_CFLAGS} -ieee" 64 ;; 65 *-apple-darwin* ) 66 AM_CFLAGS="${AM_CFLAGS} -fno-common" 67 ;; 68 *-sgi-irix* ) 69 ;; 70 esac 71else 72 case "${CC}" in 73 *icc* ) 74 # -Wall causes relocation errors with icc. 75 AM_CFLAGS="${AM_CFLAGS} -wd269" 76 ;; 77 * ) 78 case "${build}" in 79 *-dec-osf* ) 80 AM_CFLAGS="${AM_CFLAGS} -mieee -Wall" 81 ;; 82 *alpha*-*-linux* ) 83 AM_CFLAGS="${AM_CFLAGS} -mieee -Wall" 84 ;; 85 *alpha*-*-freebsd* ) 86 AM_CFLAGS="${AM_CFLAGS} -mieee -Wall" 87 ;; 88 *-apple-darwin* ) 89 AM_CFLAGS="${AM_CFLAGS} -fno-common -Wall" 90 ;; 91 * ) 92 AM_CFLAGS="${AM_CFLAGS} -Wall" 93 ;; 94 esac 95 ;; 96 esac 97fi 98 99 100 101 102 103 104dnl send this information to automake to set up compilation flags 105dnl (add your compiler here) 106AM_CONDITIONAL(COMPILER_ICC, test x$CC = xicc) 107 108dnl Checks for programs. 109AC_PROG_INSTALL 110AC_PROG_RANLIB 111AC_PROG_LN_S 112 113dnl Checks for standard C stuff. 114AC_HEADER_STDC 115AC_C_CONST 116AC_C_INLINE 117 118 119AC_CHECK_FUNCS([sqrt]) 120AC_CHECK_HEADERS([fenv.h]) 121AC_CHECK_HEADERS([float.h]) 122AC_CHECK_HEADER(fpu_control.h, has_fpu_control=yes, has_fpu_control=no) 123 124dnl Send this information to automake 125AM_CONDITIONAL(HAS_FPU_CONTROL, test x$has_fpu_control = xyes) 126 127if test x$has_fpu_control = xyes ; then 128AC_DEFINE_UNQUOTED(CRLIBM_HAS_FPU_CONTROL,1,[architecture- and system-specific FPU control header file]) 129fi 130 131dnl adds -lm 132AC_CHECK_LIB([m], [log]) 133 134dnl Other checks 135AC_C_BIGENDIAN(,,) 136dnl defines WORDS_BIGENDIAN, or not 137 138AC_C_LONG_DOUBLE 139dnl defines HAVE_LONG_DOUBLE, or not 140 141 142AC_CHECK_SIZEOF(int) 143dnl defines SIZEOF_INT to be the size in bytes of int 144 145 146 147 148 149dnl All the rest is related to MPFR and to Ziv's lib, useful for testing. 150 151dnl Sometimes the following function is provided by aclocal, sometimes not. 152dnl Copying it here is probably a bad way of managing this problem 153AC_DEFUN([AC_ADD_PATH_LIBS], 154[ 155if ` test "$1" ` 156then 157 AC_MSG_CHECKING($2 library) 158 if test -r "$1/lib$2.a" -o -r "$1/lib$2.so" 159 then 160 LDFLAGS="$LDFLAGS -L$1" 161 LIBS ="$LIBS -l$2" 162 else 163 AC_MSG_ERROR($2 not found) 164 fi 165 AC_MSG_RESULT(yes) 166else 167 AC_CHECK_LIB($2, main, , AC_MSG_ERROR($2 not found)) 168fi 169] 170) 171 172 173 174 175 176dnl Command-line arguments to ./configure: 177 178 179dnl switch for SSE2 180AC_ARG_ENABLE(sse2, 181 [ --enable-sse2 forces the use of sse2 arith [[default=no]]], 182 [case $enableval in 183 yes) 184 AC_DEFINE_UNQUOTED(HAS_SSE2,1,[Use the sse2 operators ]);; 185 no) ;; 186 *) AC_MSG_ERROR([bad value $enableval for --enable-sse2, need yes or no]) ;; 187 esac], 188 [enable_sse2=no]) 189dnl Send this information to automake 190AM_CONDITIONAL(USE_SSE2, test x$enable_sse2 = xyes ) 191 192 193 194 195dnl switch for compiling the interval functions 196AC_ARG_ENABLE(interval-functions, 197 [ --enable-interval-functions enables filib-compatible interval functions (DOES NOT WORK YET) [[default=no]]], 198 [case $enableval in 199 yes) 200 AC_DEFINE_UNQUOTED(BUILD_INTERVAL_FUNCTIONS,1,[Compile the filib-compatible interval functions]);; 201 no) ;; 202 *) AC_MSG_ERROR([bad value $enableval for --enable-interval-functions, need yes or no]) ;; 203 esac], 204 [enable_interval_functions=no]) 205dnl Send this information to automake 206AM_CONDITIONAL(USE_INTERVAL_FUNCTIONS, test x$enable_interval_functions = xyes ) 207 208 209 210dnl A switch to disable use of double-extended optimised version 211AC_ARG_ENABLE(double-extended, 212 [ --enable-double-extended enable double-extended optimised versions of functions if hardware supports it [[default=yes]]], 213 [case $enableval in 214 yes|no) ;; 215 *) AC_MSG_ERROR([bad value $enableval for --enable-double-extended, need yes or no]) ;; 216 esac], 217 [enable_double_extended=yes]) 218 219dnl following line needs a little bit more work on log-de.c and double-extended.h 220dnl AM_CONDITIONAL(USE_HARDWARE_DE, test x$has_ia32_de = xtrue -a x$enable_double_extended = xyes -a x$has_fpu_control=xyes -o x$has_ia64_de = xtrue -a x$CC = xicc -a x$enable_double_extended = xyes ) 221 222AM_CONDITIONAL(USE_HARDWARE_DE, test x$has_ia32_de = xtrue -a x$has_fpu_control = xyes -a x$enable_double_extended = xyes -a x$enable_interval_functions = xno ) 223dnl Note that at the moment, enabling intervals disables double-extended 224 225 226 227 228 229 230 231 232dnl If at some point we wish to include SPARC optimization back, 233dnl the default should take the value 10 and 25 in this case 234dnl for around 200 bits of precision 235 236AC_ARG_ENABLE(nbdigits, 237 [ --enable-nbdigits=N set the number of digits in the SCS structure to N [[default=8]] ], 238 [case $enableval in 239 *[[0-9]]) AC_DEFINE_UNQUOTED(SCS_NB_WORDS, $enableval, [Number of digits in the SCS structure]);; 240 *) AC_MSG_ERROR([bad value $enableval for --enable-nbdigits, number expected]) ;; 241 esac], 242 [AC_DEFINE_UNQUOTED(SCS_NB_WORDS, 8, [Number of digits in the SCS structure])] 243) 244 245AC_ARG_ENABLE(digitsize, 246 [ --enable-digitsize=N set the size of a digit to N bits [[default=30]] ], 247 [case $enableval in 248 *[[0-9]]) AC_DEFINE_UNQUOTED(SCS_NB_BITS, $enableval, [Size of an SCS digit]);; 249 *) AC_MSG_ERROR([bad value $enableval for --enable-digitsize, number expected]) ;; 250 esac], 251 [AC_DEFINE_UNQUOTED(SCS_NB_BITS, 30, [Size of an SCS digit])] 252) 253 254 255dnl ... for MPFR 256AC_ARG_ENABLE(mpfr, 257 [ --enable-mpfr enable MPFR function [[default=no]]], 258 [case $enableval in 259 yes|no) ;; 260 *) AC_MSG_ERROR([bad value $enableval for --enable-mpfr, need yes or no]) ;; 261 esac], 262 [enable_mpfr=no]) 263 264 265dnl ... for GMP 266AC_ARG_ENABLE(gmp, 267 [ --enable-gmp enable GMP function [[default=no]]], 268 [case $enableval in 269 yes|no) ;; 270 *) AC_MSG_ERROR([bad value $enableval for --enable-gmp, need yes or no]) ;; 271 esac], 272 [enable_gmp=no]) 273 274 275dnl ... for IBM Accurate Portable Library 276AC_ARG_ENABLE(ultim, 277 [ --enable-ultim enable comparison with libultim, IBM's Accurate Portable Math Library [[default=no]]], 278 [case $enableval in 279 yes|no) ;; 280 *) AC_MSG_ERROR([bad value $enableval for --enable-ultim, need yes or no]) ;; 281 esac], 282 [enable_ultim=no]) 283 284 285dnl ... for Sun's libmcr 286AC_ARG_ENABLE(mcr, 287 [ --enable-mcr enable comparison with Sun's LIBMCR [[default=no]]], 288 [case $enableval in 289 yes|no) ;; 290 *) AC_MSG_ERROR([bad value $enableval for --enable-mcr, need yes or no]) ;; 291 esac], 292 [enable_mcr=no]) 293 294 295dnl Now consider the result of the previous to set directories: 296 297 298dnl ... for GMP 299if test "$enable_gmp" = "yes" -o "$enable_mpfr" = "yes"; then 300 301AC_ARG_WITH(gmp_include, [ --with-gmp-include=DIR GMP include directory ], 302 with_gmp_include=$withval) 303AC_ARG_WITH(gmp_lib, [ --with-gmp-lib=DIR GMP lib directory ], 304 with_gmp_lib=$withval) 305AC_ARG_WITH(gmp, [ --with-gmp=DIR GMP directory ], 306 with_gmp_include=$withval/include with_gmp_lib=$withval/lib) 307 308if test -d "$with_gmp_include"; then 309 CPPFLAGS="$CPPFLAGS -I$with_gmp_include" 310else 311 with_gmp_include= 312fi 313AC_ADD_PATH_LIBS($with_gmp_lib, gmp) 314 315dnl If gmp.h is found, #defines HAVE_GMP_H 316AC_CHECK_HEADERS([gmp.h]) 317 318dnl If libgmp is found, adds -lgmp to LIBS 319dnl correct in theory: AC_CHECK_LIB([gmp], [__gmp_fprintf]) 320AC_CHECK_LIB([gmp], [main]) 321 322dnl end of test for gmp 323fi 324 325 326 327dnl and for MPFR 328 329if test "$enable_mpfr" = "yes"; then 330AC_ARG_WITH(mpfr_include, [ --with-mpfr-include=DIR MPFR include directory ], 331with_mpfr_include=$withval) 332AC_ARG_WITH(mpfr_lib, [ --with-mpfr-lib=DIR MPFR lib directory ], 333with_mpfr_lib=$withval) 334AC_ARG_WITH(mpfr, [ --with-mpfr=DIR MPFR directory ], 335with_mpfr_include=$withval/include with_mpfr_lib=$withval/lib) 336 337if test -d "$with_mpfr_include"; then 338 CPPFLAGS="$CPPFLAGS -I$with_mpfr_include" 339else 340 with_mpfr_include= 341fi 342AC_ADD_PATH_LIBS($with_mpfr_lib, mpfr) 343 344 345dnl If mpfr.h is found, #defines HAVE_MPFR_H 346dnl this line should be 347dnl AC_CHECK_HEADERS([mpfr.h], [], [], [#if HAVE_GMP_H #include<gmp.h> #endif]) 348dnl but it doesn't work properly so we assume that gmp is installed on the system 349dnl is mpfr is !!! 350AC_CHECK_HEADERS([mpfr.h], [], [], [#include<gmp.h>]) 351 352dnl If MPFR is found, adds -lmpfr to LIBS 353dnl correct in theory: AC_CHECK_LIB([mpfr], [mpfr_init2]) 354AC_CHECK_LIB([mpfr], [main]) 355 356dnl end of test for mpfr 357fi 358 359 360 361dnl ... for IBM 362if test "$enable_ultim" = "yes"; then 363 364AC_ARG_WITH(ultim_include, [ --with-ultim-include=DIR ULTIM include directory ], 365 with_ultim_include=$withval) 366AC_ARG_WITH(ultim_lib, [ --with-ultim-lib=DIR ULTIM lib directory ], 367 with_ultim_lib=$withval) 368AC_ARG_WITH(ultim, [ --with-ultim=DIR ULTIM directory ], 369 with_ultim_include=$withval/include with_ultim_lib=$withval/lib) 370 371if test -d "$with_ultim_include"; then 372 CPPFLAGS="$CPPFLAGS -I$with_ultim_include" 373else 374 with_ultim_include= 375fi 376AC_ADD_PATH_LIBS($with_ultim_lib, ultim) 377 378AC_CHECK_HEADERS([MathLib.h]) 379 380AC_CHECK_LIB([ultim], [main]) 381 382dnl end of test for IBM libultim 383fi 384 385 386 387dnl ... for SUN 388if test "$enable_mcr" = "yes"; then 389 390AC_ARG_WITH(mcr_include, [ --with-mcr-include=DIR LIBMCR include directory ], 391 with_mcr_include=$withval) 392AC_ARG_WITH(mcr_lib, [ --with-mcr-lib=DIR LIBMCR lib directory ], 393 with_mcr_lib=$withval) 394AC_ARG_WITH(mcr, [ --with-mcr=DIR LIBMCR directory ], 395 with_mcr_include=$withval/include with_mcr_lib=$withval/lib) 396 397if test -d "$with_mcr_include"; then 398 CPPFLAGS="$CPPFLAGS -I$with_mcr_include" 399else 400 with_mcr_include= 401fi 402AC_ADD_PATH_LIBS($with_mcr_lib, mcr) 403 404AC_CHECK_HEADERS([libmcr.h]) 405 406AC_CHECK_LIB([mcr], [main]) 407 408dnl end of test for IBM libultim 409fi 410 411 412#AC_CONFIG_SUBDIRS([scs_lib]) 413 414 415 416AC_CONFIG_FILES([Makefile tests/Makefile scs_lib/Makefile]) 417AC_OUTPUT 418 419 420