# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([ElectronicStructurePACKage], 1.1, heber@ins.uni-bonn.de, ESPACK) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_SRCDIR([src/pcp.c]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE(dist-bzip2) AC_CANONICAL_HOST # Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PATH_PROG([PERL],[perl]) AC_PATH_PROG([TAR],[tar]) AM_MISSING_PROG([DOXYGEN], [doxygen]) dnl Check for MPI-Routines AC_ARG_ENABLE([mpi], AS_HELP_STRING([--enable-mpi],[build MPI parallel version (default is yes if MPI code can be compiled)]), [enable_mpi=$enableval], [enable_mpi=maybe]) disabled_msg="MPI version disabled." if test x"$enable_mpi" = xyes -o x"$enable_mpi" = xmaybe then AC_MSG_NOTICE([checking for MPI features]) ACX_MPI([enable_mpi=yes CC=mpicc CXX=mpicxx], [err_msg="cannot find out how to compile MPI code." if test x"$enable_mpi" = xyes then AC_MSG_ERROR([$err_msg]) else AC_MSG_WARN([$err_msg $disabled_msg]) enable_mpi=no fi]) else AC_MSG_NOTICE([$disabled_msg]) fi #AC_ARG_VAR([MPILIBS],[necessary libraries to link MPI C code]) AM_CONDITIONAL([MPIVER], [test x"$enable_mpi" = xyes]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SIGNAL AC_C_CONST AC_C_INLINE AC_C_VOLATILE AC_C_RESTRICT # Checks for library functions. # use when adapted: AC_CHECK_FUNCS([floor ftruncate memmove memset mkdir modf pow realpath sqrt strchr strdup strerror strrchr strstr strtol statfs],[],[AC_MSG_WARN([Some functions not found. Compile may fail. Alternate methods may need to be implemented.])]) AC_FUNC_MALLOC AC_FUNC_REALLOC AC_TYPE_SIGNAL # Checks for fftw libraries and find out version. AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found])) AC_CHECK_FUNCS([alarm atexit floor pow sqrt strchr uname strstr strrchr]) FFTW=notfound RFFTW=notfound AC_ARG_ENABLE([fftw], AS_HELP_STRING([--enable-fftw],[build FFTW-2 version (default is yes if fftw2 code can be compiled)]), [enable_fftw=$enableval], [enable_fftw=maybe]) AC_ARG_ENABLE([dfftw], AS_HELP_STRING([--enable-dfftw],[build double fftw2 version (default is fftw2)]), [enable_dfftw=$enableval], [enable_dfftw=maybe]) AC_ARG_ENABLE([fftw3], AS_HELP_STRING([--enable-fftw3],[build FFTW-3 version (default is fftw2)]), [enable_fftw3=$enableval], [enable_fftw3=maybe]) # debugging info AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information (default is no)]), [enable_debug=$enableval], [enable_debug=maybe]) if test x"$enable_debug" = xyes; then AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"]) AC_SUBST(HAVE_DEBUG) fi # add replacement/saturation hydrogen or not AC_ARG_ENABLE([hydrogen],AS_HELP_STRING([--enable-hydrogen],[Adding saturation hydrogen (default is yes)]), [enable_hydrogen=$enableval], [enable_hydrogen=yes]) if test x"$enable_hydrogen" = xyes; then AC_DEFINE(ADDHYDROGEN,1, ["Adding saturation hydrogen"]) AC_SUBST(ADDHYDROGEN) fi # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([sys/time.h unistd.h float.h stddef.h]) AC_HEADER_STDBOOL # check for fftw headers and subsequently for libs # if FFTW=.. set on success condition, -l... is not appended # .._HEADER doesn't show up in configh.h, .._HEADERS does! FFTW=notfound if test x"$FFTW" = xnotfound -o x"$enable_fftw" = xyes; then FFTW=FFTW AC_CHECK_HEADERS(fftw.h, [AC_CHECK_LIB(fftw, fftw_create_plan, , [FFTW=notfound], -lfftw)], [FFTW=notfound] ) AC_CHECK_HEADERS(rfftw.h, [AC_CHECK_LIB(rfftw, rfftw_create_plan, , [FFTW=notfound],-lrfftw)], [FFTW=notfound] ) fi if test x"$FFTW" = xnotfound -o x"$enable_dfftw" = xyes; then FFTW=DFFTW AC_CHECK_HEADERS(dfftw.h, [AC_CHECK_LIB(dfftw, fftw_create_plan, , [FFTW=notfound],-ldfftw)], [FFTW=notfound] ) AC_CHECK_HEADERS(drfftw.h, [AC_CHECK_LIB(drfftw, rfftw_create_plan, , [FFTW=notfound],-ldrfftw)], [FFTW=notfound] ) fi if test x"$FFTW" = xnotfound -o x"$enable_fftw3" = xyes; then FFTW=FFTW3 AC_CHECK_HEADERS(fftw3.h, [AC_CHECK_LIB(fftw3, fftw_create_plan, , [FFTW=notfound],-lfftw3)], [FFTW=notfound] ) fi # warn if not found if test x"$FFTW" = xnotfound; then AC_MSG_WARN(["Missing lib(d)fftw(3) and/or lib(d)rfftw(3).\nIf exist but not in LD_.._PATH, use export LDFLAGS=-L.."]) AC_MSG_WARN(["Or missing header (d)fftw(3).h and/or (d)rfftw.h\nIf exist but not in PATH, use export CFLAGS=-I.."]) fi # check for GNU Scientific Library #AC_CHECK_LIB(m,main) AC_CHECK_LIB(gslcblas,main) AC_CHECK_LIB(gsl,main) dnl Check for "extern inline", using a modified version dnl of the test for AC_C_INLINE from acspecific.mt dnl AC_CACHE_CHECK([for extern inline], ac_cv_c_extern_inline, [ac_cv_c_extern_inline=no AC_TRY_COMPILE([extern $ac_cv_c_inline double foo(double x); extern $ac_cv_c_inline double foo(double x) { return x+1.0; }; double foo (double x) { return x + 1.0; };], [ foo(1.0) ], [ac_cv_c_extern_inline="yes"]) ]) if test "$ac_cv_c_inline" != no ; then AC_DEFINE(HAVE_INLINE,1, ["May use inline routines"]) AC_SUBST(HAVE_INLINE) fi AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile]) AC_OUTPUT