Skip to content
Snippets Groups Projects
Select Git revision
  • 3e744c3c60efebec03c2857b192b44f3072cef55
  • master default protected
  • releases
  • releases/3.0.3
4 results

configure.ac

Blame
  • configure.ac 6.95 KiB
    # Process this file with autoconf to produce a configure script.
    
    AC_PREREQ(2.52)
    AC_INIT([alberta], [1.2-pre6], [claus@mathematik.uni-freiburg.de])
    
    AC_CONFIG_SRCDIR([ALBERTA/src/Common/alberta.h])
    AM_MAINTAINER_MODE
    AC_CANONICAL_BUILD
    AC_CANONICAL_HOST
    
    AC_CONFIG_FILES([Makefile ALBERTA_UTIL/Makefile
    		 gnu-compat/Makefile
    		 GRAPE/Makefile GRAPE/mesh/Makefile
                     GRAPE/mesh/2d/Makefile
                     GRAPE/mesh/3d/Makefile
                     GRAPE/mesh/Common/Makefile
    		 SOLVER/Makefile SOLVER/src/Makefile
    		 PLOT_ANSI/Makefile PLOT_ANSI/src/Makefile
    		 DEMO/src/Makefile
    		 DEMO/src/1d/Makefile DEMO/src/2d/Makefile DEMO/src/3d/Makefile
    		 ALBERTA/Makefile ALBERTA/src/Makefile
    		 ALBERTA/src/Common/Makefile ALBERTA/src/Common/Makefile.alberta])
    
    dnl
    dnl all CONFIG_FILES for the ALBERTA libraries are added through the
    dnl ALBERT_DIMENSION_ENABLE/DISABLE() macros
    dnl
    
    AM_INIT_AUTOMAKE([1.7])
    AM_CONFIG_HEADER([config.h])
    
    # change the installation directory. This could surely be done more elegantly...
    dnl
    dnl cH: hey, boys and girls, why do we do that?
    dnl
    AC_PREFIX_DEFAULT([`pwd`])
    
    # Checks for programs.
    AC_PROG_INSTALL
    AC_PROG_LN_S
    AC_CHECK_PROGS([GZIP_PROGRAM],[gzip])
    AC_CHECK_PROGS([TAR_PROGRAM],[gtar tar])
    
    # Compiler characteristics
    dnl
    dnl ****************************************************************************
    dnl
    dnl First, we zap CFLAGS, FFLAGS and CXXFLAGS (unless explicitly set
    dnl by the user). We then choose -O3 for gcc and -O for all other
    dnl compilers, and no optimization for the debugging library.
    dnl
    dnl NOTE: we use 7 spaces to distinguish a user-override of "" from
    dnl our internal hack. Personally, I'd prefer to leave the fiddling
    dnl with the CFLAGS to the user. Mmmh.
    dnl
    test -z "$CFLAGS" && CFLAGS="       "
    test -z "$FFLAGS" && FFLAGS="       "
    dnl test -z "$CXXFLAGS" && CXXFLAGS="       "
    dnl
    dnl ****************************************************************************
    dnl
    dnl now check for compilers
    dnl
    AC_PROG_CC
    AC_C_INLINE
    AC_PROG_F77
    dnl
    dnl Mmmh. Quite elaborated nowadays. This is not used, but left in to
    dnl demonstrate what could (and should) be done some day.
    dnl
    AC_F77_WRAPPERS
    AC_F77_MAIN
    AC_F77_LIBRARY_LDFLAGS
    dnl
    dnl ****************************************************************************
    dnl
    dnl quick and very dirty hack for icc
    dnl
    if test `basename $CC` = icc; then
    	GCC=yes
    fi
    dnl
    dnl work around a bug in libtool which pulls in the C++ compiler which
    dnl we do not want at the moment. Remove the next two lines when this
    dnl changes!
    dnl
    AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG],[:])
    AC_DEFUN([AC_LIBTOOL_CXX],[:])
    dnl *********************** end CXX hack ***************************************
    AC_PROG_LIBTOOL
    if test `basename $CC` = icc; then
    	GCC=no
    fi
    dnl
    dnl ****************************************************************************
    dnl
    dnl set default debugging flags, but allow for user-override
    dnl
    if test -z "${ALBERTA_DEBUG_CFLAGS}"; then
    	if test "$GCC" = yes; then
    		ALBERTA_DEBUG_CFLAGS="-O0 -ggdb -fno-inline -fno-builtin"
    	else
    		ALBERTA_DEBUG_CFLAGS="-g"
    	fi
    fi
    AC_ARG_VAR([ALBERTA_DEBUG_CFLAGS],[Compiler-flags used to create the debug-enabled libraries])
    dnl
    dnl ****************************************************************************
    dnl
    dnl set default optimizing flags, but allow for user-override
    dnl
    if test -z "${ALBERTA_OPTIMISE_CFLAGS}"; then
    	if test "$GCC" = yes; then
    		ALBERTA_OPTIMISE_CFLAGS="-O3"
    	else
    		ALBERTA_OPTIMISE_CFLAGS="-O"
    	fi
    fi
    AC_ARG_VAR([ALBERTA_OPTIMISE_CFLAGS],[Compiler-flags used to create the optimised libraries])
    if test "${FFLAGS}" = "       "; then
    	if test "$GCC" = yes; then
    		FFLAGS="-O3"
    	else
    		FFLAGS="-O"
    	fi
    fi
    dnl if test "${CXXFLAGS}" = "       "; then
    dnl 	if test "$GCC" = yes; then
    dnl 		CXXFLAGS="-O3"
    dnl 	else
    dnl 		CXXFLAGS="-O"
    dnl 	fi
    dnl fi
    dnl
    dnl ****************************************************************************
    dnl
    
    # Checks for libraries.
    
    # Replace `main' with a function in -lm:
    AC_CHECK_LIB([m],[main],,
                 [AC_MSG_ERROR([no math library, exiting...!])] )
    
    AC_CHECK_FUNCS([alarm pow sqrt strdup strchr strstr],,
    	       [AC_MSG_ERROR([Sorry, these are needed..])])
    
    AC_FUNC_MALLOC
    AC_FUNC_VPRINTF
    
    AC_CHECK_FUNCS([unsetenv])
    AC_CHECK_FUNCS([getopt_long],[],
    	[AC_LIBOBJ([getopt])
    	AC_LIBOBJ([getopt1])
    	GNUCOMPAT_INCLUDE_PATH='$(top_srcdir)/gnu-compat/'])
    AC_SUBST([GNUCOMPAT_INCLUDE_PATH])
    
    # Checks for header files.
    AC_HEADER_STDC
    AC_CHECK_HEADERS([malloc.h unistd.h X11/Xlib.h X11/Xutil.h],,
    		 [AC_MSG_ERROR([Exiting...])])
    AC_CHECK_HEADERS([rpc/xdr.h],,[AC_MSG_ERROR([Exiting...])])
    
    # Checks for typedefs, structures, and compiler characteristics.
    AC_C_CONST
    AC_TYPE_SIZE_T
    AC_TYPE_SIGNAL
    
    
    # ******************************************************************************
    # These are our own tests
    # ******************************************************************************
    	
    case "$host_vendor" in
      *sun*)  AC_MSG_RESULT([Building fo a SUN system, affects xdr-routines...])
              AC_CHECK_LIB(nsl, main)
    	;;
    esac
    
    #
    # PLOT_ANSI stuff
    #
    ALBERTA_PLOT_ANSI_STUFF
    
    dnl
    dnl check for BLAS library. The BLAS may come under different names. We default
    dnl to -lblas, but other possibilities are sunperf, atlas, cxml (Alpha AXP)
    dnl etc etc etc etc etc etc etc etc etc etc ...........................
    dnl
    dnl Let the user decide what it wants (handled by ALBERTA_CHECK_PACKAGE()
    dnl
    ALBERTA_CHECK_PACKAGE(blas, blas, , ${FLIBS},,,,required)
    MANGLE_F77_FUNCTIONS(dnrm2, dset, daxpy, dexpy, dmxpy, dcopy, ddot, dscal, dswap, dxpay)
    
    dnl
    dnl check for X11
    dnl
    AC_PATH_X
    AC_PATH_XTRA
    X_ALL_LIBS="${X_PRE_LIBS} ${X_LIBS} -lX11 ${X_EXTRA_LIBS}"
    AC_SUBST(X_ALL_LIBS)
    
    dnl
    dnl check for OpenGL
    dnl
    ALBERTA_CHECK_PACKAGE(opengl, GL, ,${X_ALL_LIBS}, GL/gl.h,,,required)
    
    dnl
    dnl check for optional pacakge gltools
    dnl
    ALBERTA_CHECK_PACKAGE(gltools, gltools, , ${X_ALL_LIBS}, glmesh.h,,,optional)
    
    dnl
    dnl GRAPE interface stuff
    dnl
    ALBERTA_GRAPE_STUFF
    
    #
    # EL_INDEX
    #
    SIMPLE_ENABLE_FLAG([el-index], [additionally build ALBERTA libraries using EL_INDEX=1.], 0)
    #
    # NEIGH_IN_EL, probably buggy
    #
    dnl SIMPLE_ENABLE_FLAG([neigh-in-el],
    dnl [additionally build ALBERTA libraries using NEIGH_IN_EL=1.
    dnl NOTA BENE: using NEIGH_IN_EL=1 is probably buggy.], 0)
    #
    # Debugging
    #
    SIMPLE_ENABLE_FLAG([debug], [disable building of ALBERTA libraries with debugging information.], 1)
    
    # building of parametric versions is disabled by default, but can be
    # enabled using --enable-DIMDIMOFWORLD-dimension switches (the macros
    # below do _not_ enable the builds, but simply implement
    # AC_ARG_ENABLE() stuff
    #
    # BIG FAT NOTE: the DIMENSION_EN/DISABLE macro MUST COME LAST, right
    # before the AC_OUTPUT
    #
    ALBERTA_DIMENSION_DISABLE(1)
    ALBERTA_DIMENSION_DISABLE(2)
    ALBERTA_DIMENSION_DISABLE(3)
    ALBERTA_DIMENSION_ENABLE(1,2)
    ALBERTA_DIMENSION_ENABLE(1,3)
    ALBERTA_DIMENSION_ENABLE(2,3)
    
    AC_CONFIG_COMMANDS_POST([
    if ! test "$srcdir" = \. ; then
    	AC_MSG_CHECKING([Copying $srcdir/DEMO to current directory])
    	( cd $srcdir && tar cf - DEMO ) | tar xf -
    	AC_MSG_RESULT([done])	
    fi])
    
    #
    # flush everything to disk
    #
    AC_OUTPUT