diff --git a/configure.ac b/configure.ac index dbaa0389509f84849d1bda2d83162def205bdfd1..085d8b3510bbc9c9cb867ee14146862ddf860c68 100644 --- a/configure.ac +++ b/configure.ac @@ -33,18 +33,47 @@ AC_CONFIG_FILES([Makefile ALBERTA_UTIL/Makefile AM_INIT_AUTOMAKE([1.6]) 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 + +# 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=" " +test -z "$CXXFLAGS" && CXXFLAGS=" " +dnl +dnl **************************************************************************** +dnl +dnl now check for compilers +dnl AC_PROG_CC AC_PROG_F77 dnl -dnl Mmmh. Quite elaborated nowadays +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 @@ -55,15 +84,48 @@ AC_PROG_LIBTOOL if test `basename $CC` = icc; then GCC=no fi -# change the installation directory. This could surely be done more elegantly... -AC_PREFIX_DEFAULT([`pwd`]) - -if test "$GCC" = yes; then - ALBERTA_DEBUG_CFLAGS="-ggdb -fno-inline -fno-builtin" -else - ALBERTA_DEBUG_CFLAGS="-g" +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="-ggdb -fno-inline -fno-builtin" + else + ALBERTA_DEBUG_CFLAGS="-g" + fi fi AC_SUBST(ALBERTA_DEBUG_CFLAGS) +dnl +dnl **************************************************************************** +dnl +dnl set default optimizing flags, but allow for user-override +dnl +if test "${CFLAGS}" = " "; then + if test "$GCC" = yes; then + CFLAGS="-O3" + else + CFLAGS="-O" + fi +fi +if test "${FFLAGS}" = " "; then + if test "$GCC" = yes; then + FFLAGS="-O3" + else + FFLAGS="-O" + fi +fi +if test "${CXXFLAGS}" = " "; then + if test "$GCC" = yes; then + CXXFLAGS="-O3" + else + CXXFLAGS="-O" + fi +fi +dnl +dnl **************************************************************************** +dnl # Checks for libraries. @@ -129,21 +191,9 @@ dnl check for BLAS library. The BLAS may come under different names. We default dnl to -lblas, but other possibilities are sunperf, atlas, cpml (Alpha AXP) dnl etc etc etc etc etc etc etc etc etc etc ........................... dnl -dnl Let the user decide what it wants. +dnl Let the user decide what it wants (handled by ALBERTA_CHECK_PACKAGE() dnl -AC_ARG_WITH(BLASname, -AC_HELP_STRING([--with-BLASname=NAME], [use NAME as the name of the BLAS library (without leading "lib" prefix and trailing suffix). Default: "blas"]), -[case "$withval" in - yes) AC_MSG_ERROR("option \"--with-BLASname\" requires an argument") - ;; - no) AC_MSG_ERROR("option \"--with-BLASname\" requires an argument") - ;; - *) LIBBLAS=$withval - ;; -esac], -LIBBLAS=blas) -AC_SUBST(LIBBLAS) -ALBERTA_CHECK_PACKAGE(blas, $LIBBLAS, , ${FLIBS},,,,required) +ALBERTA_CHECK_PACKAGE(blas, blas, , ${FLIBS},,,,required) dnl dnl check for X11 @@ -154,53 +204,9 @@ X_ALL_LIBS="${X_PRE_LIBS} ${X_LIBS} -lX11 ${X_EXTRA_LIBS}" AC_SUBST(X_ALL_LIBS) dnl -dnl check for OpenGL (maybe Mesa) -dnl -AC_ARG_WITH(GLname, -AC_HELP_STRING([--with-GLname=NAME], [use NAME as the name of the OpenGL (tm) library (without leading "lib" prefix and trailing suffix). Default: "GL"]), -[case "$withval" in - yes) AC_MSG_ERROR("option \"--with-GLname\" requires an argument") - ;; - no) AC_MSG_ERROR("option \"--with-GLname\" requires an argument") - ;; - *) LIBGL=$withval - ;; -esac], -LIBGL=GL) -AC_SUBST(LIBGL) -ALBERTA_CHECK_PACKAGE(opengl, $LIBGL, ,${X_ALL_LIBS}, GL/gl.h,,,required) - -dnl case "$build_os" in -dnl *linux*) AC_MSG_RESULT([Building on Linux system...]) -dnl AC_CHECK_LIB(g2c, main) -dnl AC_CHECK_LIB(blas, main,, -dnl [AC_MSG_WARN([Problems with libblas, also tried lg2c...]) -dnl make_own_blas_lib=libblas.la], -dnl [-lg2c]) -dnl AC_CHECK_LIB(X11, main,, -dnl [AC_MSG_ERROR([Exiting...])], -dnl [${X_LIBS}]) -dnl AC_CHECK_LIB(Xext, main,, -dnl [AC_MSG_ERROR([Exiting...])], -dnl [${X_LIBS}]) -dnl AC_CHECK_LIB(GL, main,, -dnl [AC_CHECK_LIB(MesaGL,main)], -dnl [${X_LIBS}]) -dnl ;; -dnl *) -dnl AC_CHECK_LIB(blas, main,, -dnl [AC_MSG_WARN([Problems with libblas, creating our own...]) -dnl make_own_blas_lib=libblas.la]) -dnl AC_CHECK_LIB(X11, main,, -dnl [AC_MSG_ERROR(Exiting...)], -dnl [${X_LIBS}]) -dnl AC_CHECK_LIB(Xext, main,, -dnl [AC_MSG_ERROR(Exiting...)], -dnl [${X_LIBS}]) -dnl AC_CHECK_LIB(gl, main) -dnl AC_CHECK_LIB(GL, main) -dnl ;; -dnl esac +dnl check for OpenGL +dnl +ALBERTA_CHECK_PACKAGE(opengl, GL, ,${X_ALL_LIBS}, GL/gl.h,,,required) dnl dnl check for optional pacakge gltools @@ -210,12 +216,12 @@ ALBERTA_CHECK_PACKAGE(gltools, gltools, , ${X_ALL_LIBS}, glmesh.h,,,optional) dnl dnl some defines to enable building of alberta_movi dnl -ALBERTA_CHECK_PACKAGE(grape, gr, , -l${LIBGL} ${X_ALL_LIBS}, grape.h,,, optional) +ALBERTA_CHECK_PACKAGE(grape, gr, , ${OPENGL_LIB} ${X_ALL_LIBS}, grape.h,,, optional) AM_CONDITIONAL(GRAPE, test -n "${GRAPE_LIB}") ALBERTA_LIB_PATH=$prefix/lib ALBERTA_INCLUDE_PATH='$(top_srcdir)/ALBERTA/src/Common/ -I$(top_srcdir)/ALBERTA_UTIL' -ALBERTA_LIBS_22='$(top_builddir)/ALBERTA/src/ALBERTA22_0/libALBERTA22_0.la $(top_builddir)/SOLVER/src/libcsolver.la $(top_builddir)/ALBERTA_UTIL/libalberta_util.la $(top_builddir)/PLOT_ANSI/src/libPLOTansi.la' -ALBERTA_LIBS_33='$(top_builddir)/ALBERTA/src/ALBERTA33_0/libALBERTA33_0.la $(top_builddir)/SOLVER/src/libcsolver.la $(top_builddir)/ALBERTA_UTIL/libalberta_util.la' +ALBERTA_LIBS_22='$(top_builddir)/ALBERTA/src/ALBERTA22_0/libALBERTA22_0.la $(top_builddir)/SOLVER/src/libcsolver.la $(top_builddir)/ALBERTA_UTIL/libalberta_util.la $(top_builddir)/PLOT_ANSI/src/libPLOTansi.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB)' +ALBERTA_LIBS_33='$(top_builddir)/ALBERTA/src/ALBERTA33_0/libALBERTA33_0.la $(top_builddir)/SOLVER/src/libcsolver.la $(top_builddir)/ALBERTA_UTIL/libalberta_util.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB)' ALBERTA_DEBUG= AC_SUBST(ALBERTA_DEBUG) AC_SUBST(ALBERTA_LIB_PATH) diff --git a/m4/check-package.m4 b/m4/check-package.m4 index 6e9be5f373f25ca376e8492f57b0ea721639cf28..b6243250a9c16b8db19966173ef27d2d5692711f 100644 --- a/m4/check-package.m4 +++ b/m4/check-package.m4 @@ -116,7 +116,7 @@ dnl need to use m4_if, the $i arguments are not shell variables dnl m4_if($8, optional,[ALBERTA_CHECK_PKG_OPT([$1])]) dnl -dnl bail out if package disabled completely +dnl bail out if package is completely disabled dnl if test "${UPNAME[_DISABLE]}" = yes; then : @@ -128,6 +128,20 @@ else DEFAULT_LIBDIR=$3 fi dnl +dnl Optionally use an alternate name (e.g. MesaGL instead of GL etc.) +dnl +AC_ARG_WITH($1-name, +AC_HELP_STRING([--with-$1-name=NAME], [use NAME as the name of the $1 library (without leading "lib" prefix and trailing suffix). Default: "$2"]), +[case "$withval" in + yes) AC_MSG_ERROR("option \"--with-$1-name\" requires an argument") + ;; + no) AC_MSG_ERROR("option \"--with-$1-name\" requires an argument") + ;; + *) UPNAME[_NAME]=$withval + ;; +esac], +UPNAME[_NAME]=$2) +dnl dnl headers and libraries below the same directory :( dnl m4_if($5,[],[],[ALBERTA_CHECK_PKG_DIR_OPT([$1])]) @@ -162,7 +176,7 @@ dnl dnl now check if the library and header files exist dnl if test "$8" = "optional" ; then - AC_CHECK_LIB($2, main, + AC_CHECK_LIB(${UPNAME[_NAME]}, main, [UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l$2" UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l$2 $4"], [UPNAME[_LIB]="" @@ -172,7 +186,7 @@ if test "$8" = "optional" ; then UPNAME[_INCLUDE_PATH]=""], -L${UPNAME[_LIB_PATH]} $4) else - AC_CHECK_LIB($2, main, + AC_CHECK_LIB(${UPNAME[_NAME]}, main, [UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l$2" UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l$2 $4"], [AC_MSG_ERROR([Library "lib$2" was not found])], @@ -222,4 +236,5 @@ AC_SUBST(UPNAME[_LIB_PATH]) AC_SUBST(UPNAME[_INCLUDE]) AC_SUBST(UPNAME[_LIB]) AC_SUBST(UPNAME[_ALL_LIB]) +AC_SUBST(UPNAME[_NAME]) ])