############################################################################# # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT([I3D library],[1.0],address@hidden) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(src/config.h) AC_CONFIG_SRCDIR([src/image3d.h]) AC_PROG_MAKE_SET ############################################################################# # check parameters # check if user wants to use KAI compiler AC_ARG_ENABLE([kai-compiler], [AC_HELP_STRING([--enable-kai-compiler], [use KAI C++ compiler [default=no]])], [case "${enableval}" in yes) kai_compiler=true;; no) kai_compiler=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-kai-compiler);; esac],[kai_compiler=false]) # check if user wats to use True C++ compiler AC_ARG_ENABLE([Tru64-compiler], [AC_HELP_STRING([--enable-Tru64-compiler], [use Tru64 C++ compiler [default=no]])], [case "${enableval}" in yes) Tru64_compiler=true;; no) Tru64_compiler=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-Tru64-compiler);; esac],[Tru64_compiler=false]) # check if user wats to build debug version AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug], [compile the library with debug info [default=yes]])], [case "${enableval}" in yes) debug=true;; no) dabug=false;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug);; esac],[debug=true]) # check if user wats to use Electric Fence library AC_ARG_ENABLE([efence], [AC_HELP_STRING([--enable-efence], [use Electric Fence library [default=no]])], [case "${enableval}" in yes) MYLIBS = "-lefence $MYLIBS";; no) ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-efence);; esac]) ############################################################################# # set the compiler if test "x$kai_compiler" = "xtrue"; then AC_PROG_CXX([KCC]) if test "x$CXX" != "xKCC"; then AC_MSG_ERROR("KAI C++ compiler is not present.") fi CC="$CXX --c" else if test "x$Tru64_compiler" = "xtrue"; then AC_PROG_CXX([cxx]) if test "x$CXX" != "xcxx"; then AC_MSG_ERROR("Tru64 C++ compiler is not present.") fi AC_PROG_CC([cc]) if test "x$CC" != "xcc"; then AC_MSG_ERROR("Tru64 C compiler is not present.") fi else AC_PROG_CXX AC_PROG_CC fi fi ############################################################################# # Checks for other programs. AC_PROG_CC_C_O AC_PROG_F77 AC_PROG_INSTALL AC_PROG_MAKE_SET AC_DISABLE_STATIC AC_ENABLE_SHARED AC_PROG_LIBTOOL AC_LANG(C++) #AC_ARG_WITH([lapack], # [AC_HELP_STRING([--with-lapack=PATH],[choose the LAPACK header files # ])], # [CPPFLAGS="-I$withval $CPPFLAGS"], # [AC_MSG_ERROR([Please, choose the LAPACK header files directory by using --with-lapack=PATH])]) ############################################################################# # Checks for header files. CXXFLAGS="-I$includedir $CXXFLAGS" AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([float.h limits.h stddef.h stdlib.h string.h unistd.h]) AC_CHECK_HEADERS([jpeglib.h tiff.h f2c.h g2c.h]) AC_CHECK_HEADER([dgemm.h],,AC_MSG_ERROR([[Choose PATH to the LAPACK header files using the argument --includedir=PATH, see for more information.]])) ############################################################################# # Checks for libraries. AC_CHECK_LIB(m,abs,MYLIB="-lm $MYLIB",,) AC_CHECK_LIB(tiff,TIFFOpen,MYLIBS="-ltiff $MYLIBS",,) AC_CHECK_LIB(jpeg,jpeg_read_header,MYLIBS="-ljpeg $MYLIBS",,) AC_CHECK_LIB(g2c,f_exit,MYLIBS="-lg2c $MYLIBS", [AC_CHECK_LIB(f2c,f_exit,MYLIBS="-lf2c $MYLIBS")]) AC_LANG_PUSH(Fortran 77) #AC_CHECK_LIB(lapack,dgesv,MYLIBS="-llapack $MYLIBS") #AC_CHECK_LIB(blas,dgemm,MYLIBS="-lblas $MYLIBS") AC_SEARCH_LIBS(dgemm, [blas lapack], MYLIBS="-lblas -llapack $MYLIBS", AC_CHECK_LIB(cxml, dgemm, MYLIB="-cxml $MYLIBS", AC_MSG_ERROR(Lapack library is missing))) AC_LANG_POP(Fortran 77) ############################################################################# # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_CHECK_TYPES([ptrdiff_t]) ############################################################################# # Checks for library functions. AC_FUNC_CLOSEDIR_VOID AC_FUNC_MALLOC AC_FUNC_SETVBUF_REVERSED AC_CHECK_FUNCS([floor getcwd memset regcomp rint sqrt strchr strerror]) ############################################################################# # set the different debug options for each particular compiler if test "x$kai_compiler" = "xtrue"; then CXXFLAGS="$CXXFLAGS --one_instantiation_per_object --restrict --thread_safe" if test "x$debug" = "xtrue"; then CXXFLAGS="$CXXFLAGS +K0" else CXXFLAGS="$CXXFLAGS +K3" fi elif test "x$Tru64_compiler" = "xtrue"; then CPPFLAGS="$CPPFLAGS __USE_STD_IOSTREAM" AC_CHECK_LIB(cxxstd,fopen, [LDFLAGS="$LDFLAGS -pthread -hidden -cxxstd -non_hidden"], [AC_MSG_ERROR(Library libcxxstd.a is missing)]) if test "x$debug" = "xfalse"; then CXXFLAGS="$CXXFLAGS +O2" fi else if test "x$debug" = "xtrue"; then CXXFLAGS="$CXXFLAGS -O0" else CXXFLAGS="$CXXFLAGS -O2" fi fi ############################################################################# # independent of all the compilers if test "x$debug" = "xtrue"; then CXXFLAGS="$CXXFLAGS -g" AC_DEFINE([DEBUG],[1],[debug info]) # export it to the "config.h" file else LDFLAGS="$LDFLAGS -s" fi ############################################################################# LIB_VERSION="1:0:0" ############################################################################# AC_SUBST(LIB_VERSION) AC_SUBST(MYLIBS) ############################################################################# # Output AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile]) AC_OUTPUT #############################################################################