configure.in 12.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
dnl Run autoreconf -iv to produce the configure script and associated files.

dnl Giac version number
m4_define([giac_major_version], [1])
m4_define([giac_minor_version], [4])
m4_define([giac_micro_version], [9])
m4_define([giac_version], [giac_major_version.giac_minor_version.giac_micro_version])

dnl Attempt to change archive name made by make dist 
dnl REVNUM=`date +%Y%m%d`
dnl AC_SUBST(REVNUM)


dnl Giac library ABI versioning information 
dnl (NOT to be confused with version number) 
m4_define([giac_lt_current], [0])
m4_define([giac_lt_age], [0])
m4_define([giac_lt_revision], [0])

AC_INIT([giac], giac_version)
AC_PREREQ(2.59)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_SRCDIR([src/index.h])
dnl XXX: gettext hard-codes location of config.h. f@#$!
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([gnu 1.8 dist-bzip2])

dnl AM_MAINTAINER_MODE

dnl AC_GNU_SOURCE
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG([C++])
AC_PROG_LIBTOOL
AC_PROG_YACC
AM_PROG_LEX

dnl Check for standard C+headers
GINAC_STD_CXX_HEADERS

dnl Check for GMP
CONFIG_TOMMATH="no"
AC_ARG_ENABLE([tommath],
	[AS_HELP_STRING([--enable-tommath], [Use libtommath instead of GMP [[default=no]]])],
	[ if test "x$enableval" = "xyes"; then CONFIG_TOMMATH="yes"; fi ], [])

if test "$CONFIG_TOMMATH" = "yes" ; then 
	AC_DEFINE([USE_GMP_REPLACEMENTS], [], [Replace GMP by tommath])
	AC_CHECK_HEADERS(tommath.h,AC_CHECK_LIB(tommath,mp_init))
else
  AC_CHECK_HEADERS(gmp.h,AC_CHECK_LIB(gmp,main))
  dnl Check for MPFR
  AC_CHECK_HEADERS(mpfr.h,AC_CHECK_LIB(mpfr,main))
  AC_CHECK_FUNCS(mpfr_set_str_raw)
  dnl Check for MPFI
  AC_CHECK_HEADERS(mpfi.h,AC_CHECK_LIB(mpfi,main))
fi
  
  
dnl Optimization or debug
CONFIG_DEBUG_P="yes"
AC_ARG_ENABLE([debug],
	[AS_HELP_STRING([--enable-debug], [enables debug support [[default=no]] ])],
	[ if test "x$enableval" = "xno"; then CONFIG_DEBUG_P="no"; fi ], [])

if test "$CONFIG_DEBUG_P" = "yes"; then
	AC_DEFINE(DEBUG_SUPPORT, ,[Set if debugging is enabled])
  fi
  
  dnl Garbage collector
CONFIG_GC="no"
AC_ARG_ENABLE([gc],
	[AS_HELP_STRING([--enable-gc], [Use Boehm garbage collector [[default=no]]])],
	[ if test "$enableval" = "yes"; then CONFIG_GC="yes"; fi ], [])

if test "$CONFIG_GC" = "xyes" ; then 
	AC_CHECK_LIB(gc,GC_malloc_atomic)
  fi
  
CONFIG_SSCL="no"
  dnl Include semi-classical
AC_ARG_ENABLE([sscl], [
	AS_HELP_STRING([--enable-sscl],
		[enable semi-classical algorithms (not working yet) [[default=no]]])],
	[ if "x$enableval" = "xyes"; then CONFIG_SSCL="yes"; fi ], [])
  
if test "x$CONFIG_SSCL" = "xyes"; then 
	AC_DEFINE(HAVE_SSCL, ,[Set to enable semi-classical routines])
fi
  
AC_CHECK_LIB(m, main)

CONFIG_PNG="yes"
AC_ARG_ENABLE(png,
	[AS_HELP_STRING([--enable-png], [Enable PNG library])],
	[ if test "x$enableval" = "xno"; then CONFIG_PNG="no"; fi], [])
  
if test "x$CONFIG_PNG" = "xyes"; then 
   AC_CHECK_HEADERS(png.h, AC_CHECK_LIB(png,main)) dnl AC_CHECK_LIBS(main,[png16,png14,png12,png]))
fi

  
dnl Checking for dl
  
CONFIG_DL="yes"
AC_ARG_ENABLE(dl,
	[AS_HELP_STRING([--enable-dl], [Enable dynamically loaded modules])],
	[ if test "x$enableval" = "xno"; then CONFIG_DL="no"; fi], [])
  
if test "x$CONFIG_DL" = "xyes"; then 
	AC_CHECK_LIB(dl, dlopen)
  fi
  
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
  
dnl Checking for Gnu Sci Lib
CONFIG_GSL="yes"
AC_ARG_ENABLE([gsl],[
	AS_HELP_STRING([--enable-gsl], [Use GNU scientific library [[default=yes]]])],
	[ if test "x$enableval" = "xno"; then CONFIG_GSL="no"; fi], [])

if test "$CONFIG_GSL" = "yes"; then
	AC_CHECK_HEADERS(gsl/gsl_blas.h)
	AC_CHECK_HEADERS(gsl/gsl_eigen.h)
	if test "$ac_cv_header_gsl_gsl_blas_h" != "yes" -o "$ac_cv_header_gsl_gsl_eigen_h" != "yes"; then
		CONFIG_GSL="no"
	fi
fi
if test "$CONFIG_GSL" = "yes"; then
	save_LIBS="$LIBS"
	AC_CHECK_LIB(gslcblas, main, [], [CONFIG_GSL="no"])
	AC_CHECK_LIB(gsl, gsl_sf_gamma, [], [CONFIG_GSL="no"])
	LIBS="$save_LIBS"
  fi
GSL_LIBS=""
if test "$CONFIG_GSL" = "yes"; then
	GSL_LIBS="-lgsl -lgslcblas"
  fi
AC_SUBST(CONFIG_GSL)
AC_SUBST(GSL_LIBS)
AM_CONDITIONAL(CONFIG_GSL, [test "$CONFIG_GSL" = "yes"])
  
CONFIG_LAPACK="yes"
AC_ARG_ENABLE([lapack],
	[AS_HELP_STRING([--enable-lapack], [Use LAPACK [[default=yes]]])],
	[ if test "$enableval" = "no"; then CONFIG_LAPACK="no"; fi], [])
  
if test "$CONFIG_LAPACK" = "yes"; then
#	AC_CHECK_LIB(f2c, main, [], [CONFIG_LAPACK="no"])
#	AC_CHECK_LIB(blas, main, [], [CONFIG_LAPACK="no"])
#	AC_CHECK_LIB(tmglib, main, [], [CONFIG_LAPACK="no"])
	AC_CHECK_LIB(gfortran, main)
	AC_CHECK_LIB(blas, main)
	AC_CHECK_LIB(lapack, main, [], [CONFIG_LAPACK="no"])
#        AX_BLAS([have_blas=yes],[have_blas=no])
#        AX_LAPACK([have_lapack=yes],[have_lapack=no])
fi
  
CONFIG_PARI="yes"
AC_ARG_ENABLE([pari],
	[AS_HELP_STRING([--enable-pari], [Use PARI [[default=yes]]])],
	[ if test "$enableval" = "no"; then CONFIG_PARI="no"; fi], [])
  
if test "$CONFIG_PARI" = "yes"; then
	AC_CHECK_HEADERS(pari/pari.h, [], [CONFIG_PARI="no"])
fi
if test "$CONFIG_PARI" = "yes"; then
	save_LIBS="$LIBS"
	AC_CHECK_LIB(pari, main, [], [CONFIG_PARI="no"])
	LIBS="$save_LIBS"
  fi
PARI_LIBS=""
if test "$CONFIG_PARI" = "yes"; then
	PARI_LIBS="-lpari"
fi
AC_SUBST(PARI_LIBS)
AC_SUBST(CONFIG_PARI)
AM_CONDITIONAL(CONFIG_PARI, [test "$CONFIG_PARI" = "yes"])
  
dnl Checking for NTL
CONFIG_NTL="yes"
AC_ARG_ENABLE([ntl],
	[AS_HELP_STRING([--enable-ntl], [Use NTL [[default=yes]]])],
	[if test "$enableval" = "no"; then CONFIG_NTL="no"; fi], [])

if test "$CONFIG_NTL" = "yes"; then
	AC_CHECK_HEADER(NTL/ZZ.h, [], [CONFIG_NTL="no"])
  fi
if test "$CONFIG_NTL" = "yes"; then
	save_LIBS="$LIBS"
	AC_CHECK_LIB(ntl, main, [], [CONFIG_NTL="no"])
	LIBS="$save_LIBS"
  fi
NTL_LIBS=""
if test "$CONFIG_NTL" = "yes"; then
	NTL_LIBS="-lntl"
  fi
AC_SUBST(CONFIG_NTL)
AC_SUBST(NTL_LIBS)
AM_CONDITIONAL(CONFIG_NTL, [test "$CONFIG_NTL" = "yes"])

CONFIG_GMPXX="yes"
AC_ARG_ENABLE([gmpxx],
	[AS_HELP_STRING([--enable-gmpxx], [Use GMP C+wrappers [[default=yes]]])],
	[if test "$enableval" = "no"; then CONFIG_GMPXX="no"; fi], [])
if test "$CONFIG_GMPXX" = "yes"; then 
	AC_CHECK_HEADERS(gmpxx.h, [], [CONFIG_GMPXX="no"])
  fi
if test "$CONFIG_GMPXX" = "yes"; then 
	save_LIBS="$LIBS"
	AC_CHECK_LIB(gmpxx, main, [], [CONFIG_GMPXX="no"])
	LIBS="$save_LIBS"
  fi
GMPXX_LIBS=""
if test "$CONFIG_GMPXX" = "yes"; then
	GMPXX_LIBS="-lgmpxx"
  fi
AC_SUBST(CONFIG_GMPXX)
AC_SUBST(GMPXX_LIBS)
AM_CONDITIONAL(CONFIG_GMPXX, [test "$CONFIG_GMPXX" = "yes"])

CONFIG_COCOA="yes"
AC_ARG_ENABLE([cocoa],
	[AS_HELP_STRING([--enable-cocoa], [Use CoCoA library [[default=autodetect]]])],
	[if test "$enableval" = "no"; then CONFIG_COCOA="no"; fi], [])

if test "$CONFIG_COCOA" = "yes"; then
	AC_CHECK_HEADER(CoCoA/io.H, [], [CONFIG_COCOA="no"])
  fi
if test "$CONFIG_COCOA" = "yes"; then
	save_LIBS="$LIBS"
	AC_CHECK_LIB(cocoa, main, [], [CONFIG_COCOA="no"])
	LIBS="$save_LIBS"
fi
COCOA_LIBS=""
if test "$CONFIG_COCOA" = "yes"; then
	COCOA_LIBS="-lcocoa"
fi
AC_SUBST(CONFIG_COCOA)
AC_SUBST(COCOA_LIBS)
AM_CONDITIONAL(CONFIG_COCOA, [test "$CONFIG_COCOA" = "yes"])

dnl AC_CHECK_LIB(ao, main)
CONFIG_AO="yes"
AC_ARG_ENABLE([ao],
	[AS_HELP_STRING([--enable-ao], [Use AO [[default=yes]]])],
	[if test "$enableval" = "no"; then CONFIG_AO="no"; fi], [])

if test "$CONFIG_AO" = "yes"; then
	AC_CHECK_HEADER(ao/ao.h, [], [CONFIG_AO="no"])
  fi
if test "$CONFIG_AO" = "yes"; then
	AC_CHECK_LIB(ao, main, [], [CONFIG_AO="no"])
  fi
AC_SUBST(CONFIG_AO)
AC_SUBST(AO_LIBS)
AM_CONDITIONAL(CONFIG_AO, [test "$CONFIG_AO" = "yes"])

  
AC_CANONICAL_HOST
dnl Check for stuff needed for building the Giac interactive shell (cas).
GINAC_READLINE

dnl Ugh...
CONFIG_GUI="yes"
AC_ARG_ENABLE([gui],
	[AS_HELP_STRING([--enable-gui], [enable GUI [[default=yes]]])],
	[ if test "x$enableval" = "xno"; then CONFIG_GUI="no"; fi], [])
	
save_LIBS="$LIBS"
if test "$CONFIG_GUI" = "yes"; then 
dnl Check for X11 anf fltk or cygwin and fltk...
	case $host_os in
		*cygwin*)
		AC_CHECK_LIB(GL, main)
dnl		AC_CHECK_LIB(GLU, main)
		AC_CHECK_LIB(fltk_gl, main)
		AC_CHECK_LIB(fltk, main)
		AC_CHECK_LIB(z, main)
		AC_CHECK_LIB(jpeg, main)
		AC_CHECK_LIB(fltk_images, main)
		if test "$HAVE_LIBFLTK" = "1" ; then
			AC_DEFINE([HAVE_LIBFLVW],1,[Now defined if fltk is available])
		fi
		LIBS="$LIBS -mwindows -lole32 -luuid -lcomctl32 -lwsock32"
		if test "$HAVE_LIBFLTK_GL" = "1" ; then
		    AC_DEFINE([USE_OPENGL32],1,[Defined if fltk has OpenGL enabled])
		    LIBS="$LIBS -lglu32 -lopengl32 -lfltk_png"
		fi

		CXXFLAGS="$CXXFLAGS -DWIN32"
		AC_CHECK_LIB(intl.dll, main)
		AC_CHECK_LIB(intl, main)
		;;

		*darwin*)
		dnl FLTK does not need X libraries on this platform
		;;
		*)
		AC_PATH_XTRA
		AC_CHECK_LIB(GL, main)
dnl		AC_CHECK_LIB(GLU, main)
		;;
	esac
	dnl X11, check for opengl, fltk
	AC_CHECK_LIB(X11,main)
	AC_CHECK_LIB(Xinerama, main)
	AC_CHECK_LIB(fontconfig, main)
	AC_CHECK_LIB(Xft, main)
	AC_CHECK_LIB(Xext, main)
	AC_CHECK_LIB(fltk_gl, main)
	AC_CHECK_LIB(fltk, main)
	if test "$HAVE_LIBFLTK" = "1"; then
	   AC_DEFINE([HAVE_LIBFLVW],1, [Now defined if fltk is available])
	fi
	AC_CHECK_LIB(z,main)
	AC_CHECK_HEADERS(png.h, AC_CHECK_LIB(png,main))
	AC_CHECK_LIB(jpeg, main)
	AC_CHECK_LIB(fltk_images, main)
	GUI_LIBS="$LIBS $X_LIBS"
	AC_SUBST(GUI_LIBS)
  fi
LIBS="$save_LIBS"
  
AC_CHECK_LIB(pthread,main)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_LIB(rt,clock_gettime)
  
  dnl Checking for hash_map
AC_CHECK_HEADER(unordered_map, AC_DEFINE(C11_UNORDERED_MAP,1, [Define if <unordered_map> header is available]))
AC_CHECK_HEADER(ext/hash_map, AC_DEFINE(EXT_HASH_MAP,1, [Define if <ext/hash_map> header is aviailable]))
AC_CHECK_HEADER(tr1/unordered_map, AC_DEFINE(UNORDERED_MAP,1, [Define if <tr1/unordered_map> header is available]))
AC_CHECK_HEADER(hash_map,AC_DEFINE(HASH_MAP,1, [Define if <hash_map> header is aviailable]))
AC_CHECK_HEADERS(pwd.h, ,AC_DEFINE(HAVE_NO_PWD_H,1, [Set if pwd.h is NOT available]))
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/times.h, , AC_DEFINE(HAVE_NO_SYS_TIMES_H,1, [Set if <sys/times.h> is NOT available]))
AC_CHECK_HEADERS(sys/resource.h, , AC_DEFINE(HAVE_NO_SYS_RESOURCE_WAIT_H,1, [Set if <sys/resource.h> is NOT available]))
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_FUNCS(getpid, , AC_DEFINE(HAVE_NO_SIGNAL_H,1, [Set if getpid() function is NOT available]))
AC_CHECK_FUNCS(getcwd, , AC_DEFINE(HAVE_NO_CWD,1, [Set if getcwd() function is NOT available]))
AC_CHECK_FUNCS(getpwuid, , AC_DEFINE(HAVE_NO_HOME_DIRECTORY,1, [Set if getpwuid() function is NOT available]))
AC_CHECK_FUNCS(system, , AC_DEFINE(HAVE_NO_SYSTEM, 1, [Set if system() function is NOT available]))
  
ALL_LINGUAS="es fr el pt it en zh de"
AM_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION([0.14.5])
AC_CHECK_LIB(intl, main)

AC_PROG_EGREP
CONFIG_DOC_PROGS="yes"
AC_PATH_PROG(LATEX, latex, "")
if test -z "$LATEX"; then CONFIG_DOC_PROGS = "no"; fi

if test "$CONFIG_DOC_PROGS" = "yes"; then
	AC_PATH_PROG(MAKEINDEX, makeindex, "")
	if test -z "$MAKEINDEX"; then CONFIG_DOC_PROGS = "no"; fi
fi

if test "$CONFIG_DOC_PROGS" = "yes"; then
	AC_PATH_PROG(PDFLATEX, pdflatex, "")
	if test -z "$PDFLATEX"; then CONFIG_DOC_PROGS = "no"; fi
fi
if test "$CONFIG_DOC_PROGS" = "yes"; then
	AC_PATH_PROG(DVIPS, dvips, "")
	if test -z "$DVIPS"; then CONFIG_DOC_PROGS = "no"; fi
fi
dnl if test "$CONFIG_DOC_PROGS" = "yes"; then
dnl 	AC_PATH_PROG(LATEX2HTML, latex2html, "")
dnl	if test -z "$LATEX2HTML"; then CONFIG_DOC_PROGS = "no"; fi
dnl fi
AC_SUBST(CONFIG_DOC_PROGS)
AM_CONDITIONAL(DOC_PROGS, [test "$CONFIG_DOC_PROGS" = "yes"])

dnl Checking for sstream for mathml
AC_CHECK_HEADERS(sstream, AC_DEFINE(HAVE_SSTREAM,1), )

dnl CXXFLAGS="$CXXFLAGS -fno-strict-aliasing -DSMARTPTR64"
CXXFLAGS="$CXXFLAGS -fno-strict-aliasing -DGIAC_GENERIC_CONSTANTS"

dnl Output makefiles etc.
AC_OUTPUT([
Makefile
src/Makefile
check/Makefile
doc/Makefile
doc/en/Makefile
doc/es/Makefile
doc/fr/Makefile
doc/el/Makefile
doc/el/tutoriel/Makefile
doc/el/casinter/Makefile
doc/local/Makefile
doc/pt/Makefile
doc/zh/Makefile
doc/de/Makefile
intl/Makefile
po/Makefile.in
examples/Makefile
debianold/Makefile
debian/Makefile
])

echo "Adding link . to giac in src"
rm -f src/giac && ln -s . src/giac
rm -f src/config.h && cp config.h src
rm -f path.h
echo "#define giac_html_location \"$prefix/share/giac/doc/\"" >> path.h
echo "#define giac_aide_location \"$prefix/share/giac/aide_cas\"" >> path.h
echo "#ifdef __APPLE__" >> path.h
echo "#define giac_locale_location \"/Applications/usr/share/locale/\"" >> path.h
echo "#else" >> path.h
echo "#define giac_locale_location \"$prefix/share/locale/\"" >> path.h
echo "#endif" >> path.h
echo "#define giac_gnuplot_location \"$GNUPLOT\"" >> path.h
rm -f src/path.h && cp path.h src