mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 12:23:56 +01:00
Added configure scripts
This commit is contained in:
parent
0dffa4ce4c
commit
2bb844dd59
16
Makefile.in
16
Makefile.in
@ -4,11 +4,11 @@
|
||||
# Clear suffix list
|
||||
.SUFFIXES:
|
||||
|
||||
package = qmckl
|
||||
version = 0.1-alpha
|
||||
package = @PACKAGE_TARNAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
tarname = $(package)
|
||||
distdir = $(tarname)-$(version)
|
||||
prefix = /usr/local
|
||||
prefix = @prefix@
|
||||
|
||||
QMCKL_ROOT=$(CURDIR)
|
||||
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
|
||||
@ -47,14 +47,19 @@ $(distdir): $(qmckl_h) $(qmckl_f) $(static_lib) $(shared_lib) src/Makefile.gener
|
||||
mkdir -p $(distdir)/man
|
||||
cp $(QMCKL_ROOT)/munit/munit.h munit/munit.c $(distdir)/munit/
|
||||
cp $(QMCKL_ROOT)/src/*.c src/*.h src/*.f90 $(distdir)/src/
|
||||
cp $(QMCKL_ROOT)/src/Makefile.generated $(distdir)/src/Makefile
|
||||
cp $(QMCKL_ROOT)/src/Makefile.generated.in $(distdir)/src/Makefile.in
|
||||
cp $(QMCKL_ROOT)/config.h.in $(distdir)/config.h.in
|
||||
cp $(qmckl_h) $(distdir)/include
|
||||
cp $(QMCKL_ROOT)/Makefile $(distdir)/
|
||||
cp $(QMCKL_ROOT)/Makefile.in $(distdir)/
|
||||
cp $(QMCKL_ROOT)/share/doc/qmckl/html/*.html $(distdir)/share/doc/qmckl/html/
|
||||
cp $(QMCKL_ROOT)/share/doc/qmckl/html/*.css $(distdir)/share/doc/qmckl/html/
|
||||
cp $(QMCKL_ROOT)/share/doc/qmckl/text/*.txt $(distdir)/share/doc/qmckl/text/
|
||||
cp $(qmckl_f) $(distdir)/share/qmckl/fortran/
|
||||
cp $(QMCKL_ROOT)/configure.ac.dist $(distdir)/configure.ac
|
||||
cp $(QMCKL_ROOT)/qmckl.pc.in $(distdir)/qmckl.pc.in
|
||||
cp -r $(QMCKL_ROOT)/m4 $(distdir)/m4
|
||||
mkdir -p $(distdir)/lib
|
||||
cd $(distdir) && ../autogen.sh
|
||||
|
||||
|
||||
FORCE:
|
||||
@ -64,6 +69,7 @@ FORCE:
|
||||
|
||||
distcheck: $(distdir).tar.gz
|
||||
gzip -cd $(distdir).tar.gz | tar xvf -
|
||||
cd $(distdir) && ./configure --enable-debug
|
||||
cd $(distdir) && $(MAKE) all
|
||||
cd $(distdir) && $(MAKE) check
|
||||
cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst install
|
||||
|
5
autogen.sh
Executable file
5
autogen.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
automake --add-missing --copy 2> /dev/null
|
||||
autoreconf -i
|
||||
|
240
config.h.in
Normal file
240
config.h.in
Normal file
@ -0,0 +1,240 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to turn on debugging checks */
|
||||
#undef DEBUG
|
||||
|
||||
/* Define to use debugging malloc/free */
|
||||
#undef DEBUG_MALLOC
|
||||
|
||||
/* Define when using the profiler tool */
|
||||
#undef ENABLE_PROF
|
||||
|
||||
/* Define to 1 if your Fortran compiler doesn't accept -c and -o together. */
|
||||
#undef FC_NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#undef HAVE_ASSERT_H
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR_R
|
||||
|
||||
/* Define to 1 if you have the `dup2' function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <langinfo.h> header file. */
|
||||
#undef HAVE_LANGINFO_H
|
||||
|
||||
/* Define to 1 if you have the `efence' library (-lefence). */
|
||||
#undef HAVE_LIBEFENCE
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the <mach/mach.h> header file. */
|
||||
#undef HAVE_MACH_MACH_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <math.h> header file. */
|
||||
#undef HAVE_MATH_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `nl_langinfo' function. */
|
||||
#undef HAVE_NL_LANGINFO
|
||||
|
||||
/* Define if OpenMP is enabled */
|
||||
#undef HAVE_OPENMP
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#undef HAVE_PTHREAD_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
|
||||
and to 0 otherwise. */
|
||||
#undef HAVE_REALLOC
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
#undef HAVE_STRERROR_R
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strtoul' function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#undef HAVE_WORKING_VFORK
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#undef HAVE__BOOL
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* major version */
|
||||
#undef QMCKL_VERSION_MAJOR
|
||||
|
||||
/* minor version */
|
||||
#undef QMCKL_VERSION_MINOR
|
||||
|
||||
/* patch version */
|
||||
#undef QMCKL_VERSION_PATCH
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if strerror_r returns char *. */
|
||||
#undef STRERROR_R_CHAR_P
|
||||
|
||||
/* Define to use OpenMP threading. */
|
||||
#undef USE_OPENMP
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
#undef _UINT32_T
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
#undef _UINT64_T
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to the type of a signed integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#undef int32_t
|
||||
|
||||
/* Define to the type of a signed integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#undef int64_t
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to rpl_realloc if the replacement function should be used. */
|
||||
#undef realloc
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#undef uint32_t
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#undef uint64_t
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
#undef vfork
|
195
configure.ac
195
configure.ac
@ -1,35 +1,200 @@
|
||||
VERSION=[1.0]
|
||||
AC_SUBST([VERSION])
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# configure script for maintainers.
|
||||
|
||||
AC_REVISION([c2d02f7 Added DESTDIR in Makefile])
|
||||
AC_INIT([QMCkl],[1.0],
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
AC_INIT([QMCkl],[0.1.1],
|
||||
[https://github.com/TREX-CoE/qmckl/issues], [],
|
||||
[https://trex-coe.github.io/qmckl/index.html])
|
||||
|
||||
AC_CONFIG_SRCDIR([src/README.org])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
#AM_MAINTAINER_MODE
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
AC_PROG_CC([gcc icc clang nvcc xlc])
|
||||
VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
|
||||
VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
|
||||
VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1`
|
||||
AC_DEFINE_UNQUOTED(QMCKL_VERSION_MAJOR, [$VERSION_MAJOR], [major version])
|
||||
AC_DEFINE_UNQUOTED(QMCKL_VERSION_MINOR, [$VERSION_MINOR], [minor version])
|
||||
AC_DEFINE_UNQUOTED(QMCKL_VERSION_PATCH, [$VERSION_PATCH], [patch version])
|
||||
|
||||
AC_CHECK_HEADERS([assert.h errno.h malloc.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h])
|
||||
#AM_INIT_AUTOMAKE([foreign color-tests parallel-tests silent-rules 1.11])
|
||||
#AM_SILENT_RULES(yes)
|
||||
#AC_SUBST(SHARED_VERSION_INFO)
|
||||
#AM_ENABLE_SHARED(no) dnl shared libs cause too many headaches to be default
|
||||
#AC_PROG_LIBTOOL
|
||||
|
||||
AC_PROG_FC([ifort gfortran flang nvfortran xlf90],[Fortran])
|
||||
AC_LANG(C)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_FC
|
||||
AC_PROG_FC_C_O
|
||||
AC_FC_SRCEXT([f90])
|
||||
AC_FC_FREEFORM
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_CC_C99
|
||||
AC_CHECK_PROGS([EMACS],[emacs26 emacs],[no])
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
PKG_LIBS=""
|
||||
PKG_CFLAGS=""
|
||||
|
||||
AC_CHECK_HEADER([munit/munit.h], [echo found], [echo not found] )
|
||||
if test x${EMACS} == xno ; then
|
||||
AC_MSG_ERROR([
|
||||
--------------------------------------
|
||||
Error: Emacs is required for org-mode.
|
||||
--------------------------------------
|
||||
])
|
||||
fi
|
||||
|
||||
# fPIC option
|
||||
AC_MSG_CHECKING(whether fPIC compiler option is accepted in C)
|
||||
SAVED_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -fPIC -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
CFLAGS="${SAVED_CFLAGS} -fPIC"],
|
||||
[AC_MSG_RESULT(no)
|
||||
CFLAGS="${SAVED_CFLAGS}"])
|
||||
|
||||
AC_MSG_CHECKING(whether fPIC compiler option is accepted in Fortran)
|
||||
FCFLAGS="${FCFLAGS} -fPIC -Werror"
|
||||
SAVED_FCFLAGS="${FCFLAGS}"
|
||||
AC_LANG_PUSH(Fortran)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
FCFLAGS="${SAVED_FCFLAGS} -fPIC"],
|
||||
[AC_MSG_RESULT(no)
|
||||
FCFLAGS="${SAVED_FCFLAGS}"])
|
||||
AC_LANG_POP()
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
AC_FC_LIBRARY_LDFLAGS
|
||||
|
||||
AC_CHECK_LIB([m], [sqrt])
|
||||
AC_CHECK_HEADERS([assert.h errno.h malloc.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h])
|
||||
|
||||
## pthread
|
||||
AC_CHECK_LIB([pthread], [pthread_create])
|
||||
|
||||
AC_SEARCH_LIBS([dgemm], [blas mkl],
|
||||
[],
|
||||
AC_MSG_ERROR([Unable to find a BLAS library]) )
|
||||
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
# OpenMP
|
||||
AC_ARG_WITH(openmp, [AC_HELP_STRING([--with-openmp],[enable OpenMP])], with_omp=$withval, with_omp=no)
|
||||
if test "x$with_omp" = xyes; then
|
||||
AC_DEFINE([USE_OPENMP], [1], [Define to use OpenMP threading.])
|
||||
AX_OPENMP([],
|
||||
[AC_MSG_ERROR([Could not find OpenMP flags; configure with --without-openmp])])
|
||||
CFLAGS="${CFLAGS} ${OPENMP_CFLAGS}"
|
||||
fi
|
||||
|
||||
|
||||
## BLAS
|
||||
#AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])])
|
||||
|
||||
## LAPACK
|
||||
#AX_LAPACK([], [AC_MSG_ERROR([LAPACK was not found.])])
|
||||
|
||||
# Checks for header files.
|
||||
|
||||
## qmckl
|
||||
AC_CHECK_HEADERS([inttypes.h malloc.h stdint.h stdlib.h string.h strings.h unistd.h])
|
||||
|
||||
## munit
|
||||
AC_CHECK_FILE([munit/munit.h], [],
|
||||
AC_MSG_ERROR([
|
||||
-------------------------------------------------
|
||||
Error: Git submodule for munit is not downloaded.
|
||||
$ git submodule update --init
|
||||
-------------------------------------------------
|
||||
]) )
|
||||
|
||||
AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h mach/mach.h sys/time.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
## qmckl
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_TYPE_INT32_T
|
||||
AC_TYPE_INT64_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT64_T
|
||||
|
||||
## munit
|
||||
AC_TYPE_PID_T
|
||||
AC_C_INLINE
|
||||
AC_TYPE_SSIZE_T
|
||||
|
||||
# Checks for library functions.
|
||||
|
||||
## qmckl
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset strerror])
|
||||
|
||||
## munit
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_STRERROR_R
|
||||
AC_FUNC_FORK
|
||||
AC_CHECK_FUNCS([clock_gettime dup2 gettimeofday nl_langinfo setlocale strcasecmp strtoul])
|
||||
|
||||
# Options.
|
||||
|
||||
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile for debugging])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
if test "$GCC" = "yes"; then
|
||||
CFLAGS="$CFLAGS \
|
||||
-Wall -W -Wbad-function-cast -Wcast-qual \
|
||||
-Wpointer-arith -Wcast-align -Wpedantic -Wextra -fmax-errors=3"
|
||||
fi
|
||||
if test "$GFC" = "yes"; then
|
||||
FCFLAGS="$FCFLAGS \
|
||||
-fcheck=all -Waliasing -Wampersand -Wconversion \
|
||||
-Wsurprising -ffpe-trap=zero,overflow,underflow \
|
||||
-Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \
|
||||
-Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan"
|
||||
fi
|
||||
if test "$FC" = "ifort"; then
|
||||
FCFLAGS="$FCFLAGS \
|
||||
-traceback -check all -debug all -fpe-all=0 -implicitnone"
|
||||
fi
|
||||
AC_DEFINE(DEBUG,1,[Define to turn on debugging checks])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(debug-malloc, [AC_HELP_STRING([--enable-debug-malloc],[use debug malloc/free])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
AC_DEFINE(DEBUG_MALLOC,1,[Define to use debugging malloc/free])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(prof, [AC_HELP_STRING([--enable-prof],[compile for profiling])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -pg"
|
||||
AC_DEFINE(ENABLE_PROF,1,[Define when using the profiler tool])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(efence, [AC_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
AC_CHECK_LIB(efence, malloc)
|
||||
fi
|
||||
|
||||
|
||||
#PKG-CONFIG
|
||||
#mkl-dynamic-lp64-seq
|
||||
|
||||
LIBS="${LAPACK_LIBS} ${BLAS_LIBS} ${LIBS}"
|
||||
PKG_LIBS="${PKG_LIBS} ${LIBS}"
|
||||
AC_SUBST([PKG_LIBS])
|
||||
AC_SUBST([PKG_CFLAGS])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
qmckl.pc
|
||||
configure.ac.dist
|
||||
src/Makefile.generated
|
||||
src/Makefile])
|
||||
|
||||
AC_CHECK_PROGS([HAS_EMACS],[emacs],[])
|
||||
|
||||
AC_OUTPUT
|
||||
|
168
configure.ac.dist.in
Normal file
168
configure.ac.dist.in
Normal file
@ -0,0 +1,168 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# configure script for maintainers.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
AC_INIT([@PACKAGE_NAME@],[@PACKAGE_VERSION@],
|
||||
[@PACKAGE_BUGREPORT@], [],
|
||||
[@PACKAGE_URL@])
|
||||
|
||||
AC_CONFIG_SRCDIR([src/qmckl_ao.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
#AM_MAINTAINER_MODE
|
||||
|
||||
VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
|
||||
VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
|
||||
VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1`
|
||||
AC_DEFINE_UNQUOTED(QMCKL_VERSION_MAJOR, [$VERSION_MAJOR], [major version])
|
||||
AC_DEFINE_UNQUOTED(QMCKL_VERSION_MINOR, [$VERSION_MINOR], [minor version])
|
||||
AC_DEFINE_UNQUOTED(QMCKL_VERSION_PATCH, [$VERSION_PATCH], [patch version])
|
||||
|
||||
#AM_INIT_AUTOMAKE([foreign color-tests parallel-tests silent-rules 1.11])
|
||||
#AM_SILENT_RULES(yes)
|
||||
#AC_SUBST(SHARED_VERSION_INFO)
|
||||
#AM_ENABLE_SHARED(no) dnl shared libs cause too many headaches to be default
|
||||
#AC_PROG_LIBTOOL
|
||||
|
||||
AC_LANG(C)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C_O
|
||||
AC_PROG_FC
|
||||
AC_PROG_FC_C_O
|
||||
AC_FC_SRCEXT([f90])
|
||||
AC_FC_FREEFORM
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_CC_C99
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
PKG_LIBS=""
|
||||
PKG_CFLAGS=""
|
||||
|
||||
# fPIC option
|
||||
AC_MSG_CHECKING(whether fPIC compiler option is accepted in C)
|
||||
SAVED_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -fPIC -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
CFLAGS="${SAVED_CFLAGS} -fPIC"],
|
||||
[AC_MSG_RESULT(no)
|
||||
CFLAGS="${SAVED_CFLAGS}"])
|
||||
|
||||
AC_MSG_CHECKING(whether fPIC compiler option is accepted in Fortran)
|
||||
FCFLAGS="${FCFLAGS} -fPIC -Werror"
|
||||
SAVED_FCFLAGS="${FCFLAGS}"
|
||||
AC_LANG_PUSH(Fortran)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
FCFLAGS="${SAVED_FCFLAGS} -fPIC"],
|
||||
[AC_MSG_RESULT(no)
|
||||
FCFLAGS="${SAVED_FCFLAGS}"])
|
||||
AC_LANG_POP()
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
AC_FC_LIBRARY_LDFLAGS
|
||||
|
||||
AC_CHECK_LIB([m], [sqrt])
|
||||
AC_CHECK_HEADERS([assert.h errno.h malloc.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h])
|
||||
|
||||
## pthread
|
||||
AC_CHECK_LIB([pthread], [pthread_create])
|
||||
|
||||
# OpenMP
|
||||
AC_ARG_WITH(openmp, [AC_HELP_STRING([--with-openmp],[enable OpenMP])], with_omp=$withval, with_omp=no)
|
||||
if test "x$with_omp" = xyes; then
|
||||
AC_DEFINE([USE_OPENMP], [1], [Define to use OpenMP threading.])
|
||||
AX_OPENMP([],
|
||||
[AC_MSG_ERROR([Could not find OpenMP flags; configure with --without-openmp])])
|
||||
CFLAGS="${CFLAGS} ${OPENMP_CFLAGS}"
|
||||
fi
|
||||
|
||||
|
||||
## BLAS
|
||||
AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])])
|
||||
|
||||
## LAPACK
|
||||
AX_LAPACK([], [AC_MSG_ERROR([LAPACK was not found.])])
|
||||
|
||||
# Checks for header files.
|
||||
|
||||
## qmckl
|
||||
AC_CHECK_HEADERS([inttypes.h malloc.h stdint.h stdlib.h string.h strings.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
## qmckl
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_TYPE_INT32_T
|
||||
AC_TYPE_INT64_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT64_T
|
||||
|
||||
# Checks for library functions.
|
||||
|
||||
## qmckl
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset strerror])
|
||||
|
||||
# Options.
|
||||
|
||||
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile for debugging])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
if test "$GCC" = "yes"; then
|
||||
CFLAGS="$CFLAGS \
|
||||
-Wall -W -Wbad-function-cast -Wcast-qual \
|
||||
-Wpointer-arith -Wcast-align -Wpedantic -Wextra -fmax-errors=3"
|
||||
fi
|
||||
if test "$GFC" = "yes"; then
|
||||
FCFLAGS="$FCFLAGS \
|
||||
-fcheck=all -Waliasing -Wampersand -Wconversion \
|
||||
-Wsurprising -ffpe-trap=zero,overflow,underflow \
|
||||
-Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \
|
||||
-Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan"
|
||||
fi
|
||||
if test "$FC" = "ifort"; then
|
||||
FCFLAGS="$FCFLAGS \
|
||||
-traceback -check all -debug all -fpe-all=0 -implicitnone"
|
||||
fi
|
||||
AC_DEFINE(DEBUG,1,[Define to turn on debugging checks])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(debug-malloc, [AC_HELP_STRING([--enable-debug-malloc],[use debug malloc/free])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
AC_DEFINE(DEBUG_MALLOC,1,[Define to use debugging malloc/free])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(prof, [AC_HELP_STRING([--enable-prof],[compile for profiling])], ok=$enableval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -pg"
|
||||
AC_DEFINE(ENABLE_PROF,1,[Define when using the profiler tool])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(efence, [AC_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no)
|
||||
if test "$ok" = "yes"; then
|
||||
AC_CHECK_LIB(efence, malloc)
|
||||
fi
|
||||
|
||||
|
||||
#PKG-CONFIG
|
||||
#mkl-dynamic-lp64-seq
|
||||
|
||||
LIBS="${LAPACK_LIBS} ${BLAS_LIBS} ${LIBS}"
|
||||
PKG_LIBS="${PKG_LIBS} ${LIBS}"
|
||||
AC_SUBST([PKG_LIBS])
|
||||
AC_SUBST([PKG_CFLAGS])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
qmckl.pc
|
||||
src/Makefile
|
||||
])
|
||||
|
||||
|
||||
AC_OUTPUT
|
207
m4/ax_blas.m4
Normal file
207
m4/ax_blas.m4
Normal file
@ -0,0 +1,207 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_blas.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro looks for a library that implements the BLAS linear-algebra
|
||||
# interface (see http://www.netlib.org/blas/). On success, it sets the
|
||||
# BLAS_LIBS output variable to hold the requisite library linkages.
|
||||
#
|
||||
# To link with BLAS, you should link with:
|
||||
#
|
||||
# $BLAS_LIBS $LIBS $FLIBS
|
||||
#
|
||||
# in that order. FLIBS is the output variable of the
|
||||
# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
|
||||
# sometimes necessary in order to link with F77 libraries. Users will also
|
||||
# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
|
||||
# reason.
|
||||
#
|
||||
# Many libraries are searched for, from ATLAS to CXML to ESSL. The user
|
||||
# may also use --with-blas=<lib> in order to use some specific BLAS
|
||||
# library <lib>. In order to link successfully, however, be aware that you
|
||||
# will probably need to use the same Fortran compiler (which can be set
|
||||
# via the F77 env. var.) as was used to compile the BLAS library.
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is
|
||||
# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
|
||||
# not found. If ACTION-IF-FOUND is not specified, the default action will
|
||||
# define HAVE_BLAS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 12
|
||||
|
||||
AU_ALIAS([ACX_BLAS], [AX_BLAS])
|
||||
AC_DEFUN([AX_BLAS], [
|
||||
AC_PREREQ(2.50)
|
||||
AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
|
||||
ax_blas_ok=no
|
||||
|
||||
AC_ARG_WITH(blas,
|
||||
[AS_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
|
||||
case $with_blas in
|
||||
yes | "") ;;
|
||||
no) ax_blas_ok=disable ;;
|
||||
-* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
|
||||
*) BLAS_LIBS="-l$with_blas" ;;
|
||||
esac
|
||||
|
||||
# Get fortran linker names of BLAS functions to check for.
|
||||
AC_F77_FUNC(sgemm)
|
||||
AC_F77_FUNC(dgemm)
|
||||
|
||||
ax_blas_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $FLIBS"
|
||||
|
||||
# First, check BLAS_LIBS environment variable
|
||||
if test $ax_blas_ok = no; then
|
||||
if test "x$BLAS_LIBS" != x; then
|
||||
save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
|
||||
AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes], [BLAS_LIBS=""])
|
||||
AC_MSG_RESULT($ax_blas_ok)
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
fi
|
||||
|
||||
# BLAS linked to by default? (happens on some supercomputers)
|
||||
if test $ax_blas_ok = no; then
|
||||
save_LIBS="$LIBS"; LIBS="$LIBS"
|
||||
AC_MSG_CHECKING([if $sgemm is being linked in already])
|
||||
AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes])
|
||||
AC_MSG_RESULT($ax_blas_ok)
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/)
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes
|
||||
BLAS_LIBS="-lopenblas"])
|
||||
fi
|
||||
|
||||
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(atlas, ATL_xerbla,
|
||||
[AC_CHECK_LIB(f77blas, $sgemm,
|
||||
[AC_CHECK_LIB(cblas, cblas_dgemm,
|
||||
[ax_blas_ok=yes
|
||||
BLAS_LIBS="-lcblas -lf77blas -latlas"],
|
||||
[], [-lf77blas -latlas])],
|
||||
[], [-latlas])])
|
||||
fi
|
||||
|
||||
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(blas, $sgemm,
|
||||
[AC_CHECK_LIB(dgemm, $dgemm,
|
||||
[AC_CHECK_LIB(sgemm, $sgemm,
|
||||
[ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
|
||||
[], [-lblas])],
|
||||
[], [-lblas])])
|
||||
fi
|
||||
|
||||
# BLAS in Intel MKL library?
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread])
|
||||
fi
|
||||
|
||||
# BLAS in Apple vecLib library?
|
||||
if test $ax_blas_ok = no; then
|
||||
save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
|
||||
AC_MSG_CHECKING([for $sgemm in -framework vecLib])
|
||||
AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"])
|
||||
AC_MSG_RESULT($ax_blas_ok)
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
# BLAS in Alpha CXML library?
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"])
|
||||
fi
|
||||
|
||||
# BLAS in Alpha DXML library? (now called CXML, see above)
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"])
|
||||
fi
|
||||
|
||||
# BLAS in Sun Performance library?
|
||||
if test $ax_blas_ok = no; then
|
||||
if test "x$GCC" != xyes; then # only works with Sun CC
|
||||
AC_CHECK_LIB(sunmath, acosp,
|
||||
[AC_CHECK_LIB(sunperf, $sgemm,
|
||||
[BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
|
||||
ax_blas_ok=yes],[],[-lsunmath])])
|
||||
fi
|
||||
fi
|
||||
|
||||
# BLAS in SCSL library? (SGI/Cray Scientific Library)
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"])
|
||||
fi
|
||||
|
||||
# BLAS in SGIMATH library?
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(complib.sgimath, $sgemm,
|
||||
[ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
|
||||
fi
|
||||
|
||||
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(blas, $sgemm,
|
||||
[AC_CHECK_LIB(essl, $sgemm,
|
||||
[ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
|
||||
[], [-lblas $FLIBS])])
|
||||
fi
|
||||
|
||||
# Generic BLAS library?
|
||||
if test $ax_blas_ok = no; then
|
||||
AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"])
|
||||
fi
|
||||
|
||||
AC_SUBST(BLAS_LIBS)
|
||||
|
||||
LIBS="$ax_blas_save_LIBS"
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_blas_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
|
||||
:
|
||||
else
|
||||
ax_blas_ok=no
|
||||
$2
|
||||
fi
|
||||
])dnl AX_BLAS
|
131
m4/ax_lapack.m4
Normal file
131
m4/ax_lapack.m4
Normal file
@ -0,0 +1,131 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_lapack.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro looks for a library that implements the LAPACK linear-algebra
|
||||
# interface (see http://www.netlib.org/lapack/). On success, it sets the
|
||||
# LAPACK_LIBS output variable to hold the requisite library linkages.
|
||||
#
|
||||
# To link with LAPACK, you should link with:
|
||||
#
|
||||
# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
|
||||
#
|
||||
# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro,
|
||||
# called automatically. FLIBS is the output variable of the
|
||||
# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
|
||||
# sometimes necessary in order to link with F77 libraries. Users will also
|
||||
# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
|
||||
# reason.
|
||||
#
|
||||
# The user may also use --with-lapack=<lib> in order to use some specific
|
||||
# LAPACK library <lib>. In order to link successfully, however, be aware
|
||||
# that you will probably need to use the same Fortran compiler (which can
|
||||
# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS
|
||||
# libraries.
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library
|
||||
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||
# will define HAVE_LAPACK.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 7
|
||||
|
||||
AU_ALIAS([ACX_LAPACK], [AX_LAPACK])
|
||||
AC_DEFUN([AX_LAPACK], [
|
||||
AC_REQUIRE([AX_BLAS])
|
||||
ax_lapack_ok=no
|
||||
|
||||
AC_ARG_WITH(lapack,
|
||||
[AS_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
|
||||
case $with_lapack in
|
||||
yes | "") ;;
|
||||
no) ax_lapack_ok=disable ;;
|
||||
-* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;;
|
||||
*) LAPACK_LIBS="-l$with_lapack" ;;
|
||||
esac
|
||||
|
||||
# Get fortran linker name of LAPACK function to check for.
|
||||
AC_F77_FUNC(cheev)
|
||||
|
||||
# We cannot use LAPACK if BLAS is not found
|
||||
if test "x$ax_blas_ok" != xyes; then
|
||||
ax_lapack_ok=noblas
|
||||
LAPACK_LIBS=""
|
||||
fi
|
||||
|
||||
# First, check LAPACK_LIBS environment variable
|
||||
if test "x$LAPACK_LIBS" != x; then
|
||||
save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
|
||||
AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
|
||||
AC_TRY_LINK_FUNC($cheev, [ax_lapack_ok=yes], [LAPACK_LIBS=""])
|
||||
AC_MSG_RESULT($ax_lapack_ok)
|
||||
LIBS="$save_LIBS"
|
||||
if test $ax_lapack_ok = no; then
|
||||
LAPACK_LIBS=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# LAPACK linked to by default? (is sometimes included in BLAS lib)
|
||||
if test $ax_lapack_ok = no; then
|
||||
save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
|
||||
AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes])
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
# Generic LAPACK library?
|
||||
for lapack in lapack lapack_rs6k; do
|
||||
if test $ax_lapack_ok = no; then
|
||||
save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
|
||||
AC_CHECK_LIB($lapack, $cheev,
|
||||
[ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
done
|
||||
|
||||
AC_SUBST(LAPACK_LIBS)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_lapack_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1])
|
||||
:
|
||||
else
|
||||
ax_lapack_ok=no
|
||||
$2
|
||||
fi
|
||||
])dnl AX_LAPACK
|
99
m4/ax_openmp.m4
Normal file
99
m4/ax_openmp.m4
Normal file
@ -0,0 +1,99 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_openmp.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro tries to find out how to compile programs that use OpenMP a
|
||||
# standard API and set of compiler directives for parallel programming
|
||||
# (see http://www-unix.mcs/)
|
||||
#
|
||||
# On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_F77FLAGS
|
||||
# output variable to the flag (e.g. -omp) used both to compile *and* link
|
||||
# OpenMP programs in the current language.
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also link it with them as well.
|
||||
#
|
||||
# If you want to compile everything with OpenMP, you should set:
|
||||
#
|
||||
# CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
||||
# #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
|
||||
# #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS"
|
||||
#
|
||||
# (depending on the selected language).
|
||||
#
|
||||
# The user can override the default choice by setting the corresponding
|
||||
# environment variable (e.g. OPENMP_CFLAGS).
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if an OpenMP flag is
|
||||
# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
|
||||
# not found. If ACTION-IF-FOUND is not specified, the default action will
|
||||
# define HAVE_OPENMP.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 8
|
||||
|
||||
AC_DEFUN([AX_OPENMP], [
|
||||
AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
|
||||
|
||||
AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
|
||||
# Flags to try: -fopenmp (gcc), -openmp (icc), -mp (SGI & PGI),
|
||||
# -xopenmp (Sun), -omp (Tru64), -qsmp=omp (AIX), none
|
||||
ax_openmp_flags="-fopenmp -openmp -mp -xopenmp -omp -qsmp=omp none"
|
||||
if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
|
||||
ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
|
||||
fi
|
||||
for ax_openmp_flag in $ax_openmp_flags; do
|
||||
case $ax_openmp_flag in
|
||||
none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
|
||||
*) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
|
||||
esac
|
||||
AC_TRY_LINK_FUNC(omp_set_num_threads,
|
||||
[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break])
|
||||
done
|
||||
[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
|
||||
])
|
||||
if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then
|
||||
m4_default([$2],:)
|
||||
else
|
||||
if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then
|
||||
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp
|
||||
fi
|
||||
m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
|
||||
fi
|
||||
])dnl AX_OPENMP
|
12
qmckl.pc
12
qmckl.pc
@ -1,12 +0,0 @@
|
||||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
includedir=${exec_prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: QMCkl
|
||||
Description: Quantum Monte Carlo kernel library
|
||||
URL: https://github.com/trex-coe/qmckl
|
||||
Version: 1.0.0
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lqmckl
|
||||
Requires.private: blas
|
13
qmckl.pc.in
Normal file
13
qmckl.pc.in
Normal file
@ -0,0 +1,13 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
includedir=@includedir@
|
||||
libdir=@libdir@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: Quantum Monte Carlo kernel library
|
||||
URL: https://github.com/trex-coe/qmckl
|
||||
Version: @PACKAGE_VERSION@
|
||||
Cflags: -I${includedir} @PKG_CFLAGS@
|
||||
Libs: -L${libdir} -lqmckl @PKG_LIBS@
|
||||
Requires: @PKG_BLAS@
|
||||
|
141
src/Makefile
141
src/Makefile
@ -1,141 +0,0 @@
|
||||
# Header :noexport:
|
||||
|
||||
|
||||
# This file was created by tools/Building.org
|
||||
|
||||
.POSIX:
|
||||
|
||||
# Dependencies
|
||||
|
||||
|
||||
LIBS=-lpthread
|
||||
|
||||
# Variables
|
||||
|
||||
|
||||
QMCKL_ROOT=$(shell dirname $(CURDIR))
|
||||
|
||||
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
|
||||
static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
|
||||
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
|
||||
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
|
||||
|
||||
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
|
||||
|
||||
ORG_SOURCE_FILES=$(wildcard *.org)
|
||||
C_SOURCE_FILES=$(patsubst %.org,%.c,$(ORG_SOURCE_FILES))
|
||||
INCLUDE=-I$(QMCKL_ROOT)/include/
|
||||
|
||||
# Compiler options
|
||||
|
||||
# GNU, Intel and LLVM compilers are supported. Choose here:
|
||||
|
||||
|
||||
COMPILER=GNU
|
||||
#COMPILER=INTEL
|
||||
#COMPILER=LLVM
|
||||
|
||||
# GNU
|
||||
|
||||
|
||||
ifeq ($(COMPILER),GNU)
|
||||
#----------------------------------------------------------
|
||||
CC=gcc -g
|
||||
CFLAGS=-fPIC $(INCLUDE) \
|
||||
-fexceptions -Wall -Werror -Wpedantic -Wextra -fmax-errors=3
|
||||
|
||||
FC=gfortran -g
|
||||
FFLAGS=-fPIC $(INCLUDE) \
|
||||
-fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising \
|
||||
-Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \
|
||||
-Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan \
|
||||
-ffpe-trap=zero,overflow,underflow
|
||||
|
||||
LIBS+=-lgfortran -lm
|
||||
#----------------------------------------------------------
|
||||
endif
|
||||
|
||||
# Intel
|
||||
|
||||
|
||||
ifeq ($(COMPILER),INTEL)
|
||||
#----------------------------------------------------------
|
||||
CC=icc -xHost
|
||||
CFLAGS=-fPIC -g -O2 $(INCLUDE)
|
||||
|
||||
FC=ifort -xHost
|
||||
FFLAGS=-fPIC -g -O2 $(INCLUDE)
|
||||
|
||||
LIBS+=-lm -lifcore -lirc
|
||||
#----------------------------------------------------------
|
||||
CC=icc -xHost
|
||||
endif
|
||||
|
||||
# LLVM
|
||||
|
||||
|
||||
ifeq ($(COMPILER),LLVM)
|
||||
#----------------------------------------------------------
|
||||
CC=clang
|
||||
CFLAGS=-fPIC -g -O2 $(INCLUDE)
|
||||
|
||||
FC=flang
|
||||
FFLAGS=fPIC -g -O2 $(INCLUDE)
|
||||
|
||||
LIBS+=-lm
|
||||
#----------------------------------------------------------
|
||||
endif
|
||||
|
||||
# Rules
|
||||
|
||||
# The source files are created during the generation of the file ~Makefile.generated~.
|
||||
# The Makefile.generated is the one that will be distributed with the library.
|
||||
|
||||
|
||||
.PHONY: clean shared static doc all check install uninstall
|
||||
.SECONDARY: # Needed to keep the produced C and Fortran files
|
||||
|
||||
$(shared_lib) $(static_lib): $(qmckl_h) $(qmckl_f) Makefile.generated
|
||||
$(MAKE) -f Makefile.generated $@
|
||||
|
||||
install uninstall: Makefile.generated
|
||||
$(MAKE) -f Makefile.generated $@
|
||||
|
||||
$(qmckl_f) $(qmckl_h): Makefile.generated
|
||||
$(QMCKL_ROOT)/tools/build_qmckl_h.sh
|
||||
|
||||
shared: $(shared_lib)
|
||||
static: $(static_lib)
|
||||
all: shared static doc check
|
||||
|
||||
check: $(static_lib)
|
||||
$(MAKE) -f Makefile.generated check
|
||||
|
||||
cppcheck:
|
||||
cppcheck \
|
||||
--addon=cert \
|
||||
--enable=warning,style,performance,portability,information \
|
||||
qmckl_*.c
|
||||
|
||||
doc: $(ORG_SOURCE_FILES)
|
||||
$(QMCKL_ROOT)/tools/build_doc.sh
|
||||
|
||||
clean:
|
||||
- $(MAKE) -f Makefile.generated clean
|
||||
- $(RM) test_qmckl_* test_qmckl.c \
|
||||
$(qmckl_h) $(qmckl_f) \
|
||||
qmckl_*.f90 qmckl_*.c qmckl_*.h \
|
||||
Makefile.generated *.html *.txt
|
||||
|
||||
veryclean: clean FORCE
|
||||
- $(RM) $(QMCKL_ROOT)/share/doc/qmckl/html/*.html \
|
||||
$(QMCKL_ROOT)/share/doc/qmckl/text/*.txt
|
||||
|
||||
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES) ../tools/Building.org
|
||||
$(QMCKL_ROOT)/tools/create_makefile.sh
|
||||
|
||||
|
||||
.SUFFIXES: .org .c
|
||||
|
||||
.org.c:
|
||||
$(QMCKL_ROOT)/tools/tangle.sh $<
|
104
src/Makefile.generated.in
Normal file
104
src/Makefile.generated.in
Normal file
@ -0,0 +1,104 @@
|
||||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
package = @PACKAGE_TARNAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
|
||||
prefix = @prefix@
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS= @CFLAGS@ -I../munit/ -I../include
|
||||
|
||||
FC = @FC@
|
||||
FCFLAGS= @FCFLAGS@
|
||||
|
||||
OBJECT_FILES=qmckl_f.o qmckl_ao.o qmckl_ao_f.o qmckl_context.o qmckl_distance_f.o qmckl_electron.o qmckl_electron_f.o qmckl_error.o qmckl_memory.o qmckl_numprec.o
|
||||
|
||||
TESTS = test_qmckl_ao.o test_qmckl_context.o test_qmckl_distance.o test_qmckl_electron.o test_qmckl_error.o test_qmckl_memory.o test_qmckl_numprec.o
|
||||
TESTS_F = test_qmckl_ao_f.o test_qmckl_distance_f.o
|
||||
|
||||
LIBS = @LIBS@
|
||||
FCLIBS = @FCLIBS@
|
||||
|
||||
QMCKL_ROOT=$(shell dirname $(CURDIR))
|
||||
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
|
||||
static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
|
||||
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
|
||||
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
|
||||
munit=$(QMCKL_ROOT)/munit/munit.c
|
||||
|
||||
datarootdir=$(prefix)/share
|
||||
datadir=$(datarootdir)
|
||||
docdir=$(datarootdir)/doc/$(package)
|
||||
htmldir=$(docdir)/html
|
||||
libdir=$(prefix)/lib
|
||||
includedir=$(prefix)/include
|
||||
fortrandir=$(datarootdir)/$(package)/fortran
|
||||
|
||||
|
||||
shared: $(shared_lib)
|
||||
static: $(static_lib)
|
||||
|
||||
|
||||
all: shared static
|
||||
|
||||
$(shared_lib): $(OBJECT_FILES)
|
||||
$(CC) -shared $(OBJECT_FILES) -o $(shared_lib)
|
||||
|
||||
$(static_lib): $(OBJECT_FILES)
|
||||
$(AR) rcs $(static_lib) $(OBJECT_FILES)
|
||||
|
||||
|
||||
# Test
|
||||
|
||||
qmckl_f.o: $(qmckl_f)
|
||||
$(FC) $(FCFLAGS) -c $(qmckl_f) -o $@
|
||||
|
||||
test_qmckl: test_qmckl.c $(qmckl_h) $(static_lib) $(TESTS) $(TESTS_F)
|
||||
$(CC) $(CFLAGS) $(munit) $(TESTS) $(TESTS_F) $(static_lib) $(LIBS) \
|
||||
$(FCLIBS) test_qmckl.c -o $@
|
||||
|
||||
test_qmckl_shared: test_qmckl.c $(qmckl_h) $(shared_lib) $(TESTS) $(TESTS_F)
|
||||
$(CC) $(CFLAGS) -Wl,-rpath,$(QMCKL_ROOT)/lib -L$(QMCKL_ROOT)/lib \
|
||||
$(munit) $(TESTS) $(TESTS_F) -lqmckl $(LIBS) $(FCLIBS) test_qmckl.c -o $@
|
||||
|
||||
check: test_qmckl test_qmckl_shared
|
||||
./test_qmckl
|
||||
|
||||
clean:
|
||||
$(RM) -- *.o *.mod $(shared_lib) $(static_lib) test_qmckl
|
||||
|
||||
|
||||
|
||||
|
||||
install:
|
||||
install -d $(DESTDIR)$(prefix)/lib
|
||||
install -d $(DESTDIR)$(prefix)/include
|
||||
install -d $(DESTDIR)$(prefix)/share/qmckl/fortran
|
||||
install -d $(DESTDIR)$(prefix)/share/doc/qmckl/html/
|
||||
install -d $(DESTDIR)$(prefix)/share/doc/qmckl/text/
|
||||
install $(shared_lib) $(DESTDIR)$(libdir)/
|
||||
install $(static_lib) $(DESTDIR)$(libdir)/
|
||||
install $(qmckl_h) $(DESTDIR)$(includedir)
|
||||
install $(qmckl_f) $(DESTDIR)$(fortrandir)
|
||||
install $(QMCKL_ROOT)/share/doc/qmckl/html/*.html $(DESTDIR)$(docdir)/html/
|
||||
install $(QMCKL_ROOT)/share/doc/qmckl/html/*.css $(DESTDIR)$(docdir)/html/
|
||||
install $(QMCKL_ROOT)/share/doc/qmckl/text/*.txt $(DESTDIR)$(docdir)/text/
|
||||
|
||||
uninstall:
|
||||
rm $(DESTDIR)$(libdir)/libqmckl.so
|
||||
rm $(DESTDIR)$(libdir)/libqmckl.a
|
||||
rm $(DESTDIR)$(includedir)/qmckl.h
|
||||
rm -rf $(DESTDIR)$(datarootdir)/$(package)
|
||||
rm -rf $(DESTDIR)$(docdir)
|
||||
|
||||
.SUFFIXES: .c .f90 .o
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $*.c -o $*.o
|
||||
|
||||
.f90.o: qmckl_f.o
|
||||
$(FC) $(FCFLAGS) -c $*.f90 -o $*.o
|
||||
|
||||
.PHONY: check cppcheck clean all
|
||||
|
96
src/Makefile.in
Normal file
96
src/Makefile.in
Normal file
@ -0,0 +1,96 @@
|
||||
# Header
|
||||
|
||||
# We want the Makefile to be POSIX-compliant, such that it works not
|
||||
# only with GNU Make.
|
||||
|
||||
|
||||
# This file was created by tools/Building.org
|
||||
|
||||
.POSIX:
|
||||
|
||||
# Compiler options
|
||||
|
||||
# Compiler variables are obtained from the configure script (see =configure.ac=)
|
||||
|
||||
|
||||
CC = @CC@
|
||||
FC = @FC@
|
||||
CFLAGS = @CFLAGS@
|
||||
FCFLAGS = @FCFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# Variables
|
||||
|
||||
|
||||
HAS_CPPCHECK = @HAS_CPPCHECK@
|
||||
|
||||
QMCKL_ROOT=$(shell dirname $(CURDIR))
|
||||
|
||||
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
|
||||
static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
|
||||
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
|
||||
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
|
||||
|
||||
export CC CFLAGS FC FCFLAGS LIBS QMCKL_ROOT
|
||||
|
||||
ORG_SOURCE_FILES=$(wildcard $(QMCKL_ROOT)/*.org)
|
||||
C_SOURCE_FILES=$(patsubst %.org,%.c,$(ORG_SOURCE_FILES))
|
||||
INCLUDE=-I$(QMCKL_ROOT)/include/
|
||||
|
||||
# Rules
|
||||
|
||||
# The source files are created during the generation of the file ~Makefile.generated~.
|
||||
# The Makefile.generated is the one that will be distributed with the library.
|
||||
|
||||
|
||||
.PHONY: clean shared static doc all check install uninstall
|
||||
.SECONDARY: # Needed to keep the produced C and Fortran files
|
||||
|
||||
$(shared_lib) $(static_lib): $(qmckl_h) $(qmckl_f) Makefile.generated
|
||||
$(MAKE) -f Makefile.generated $@
|
||||
|
||||
install uninstall: Makefile.generated
|
||||
$(MAKE) -f Makefile.generated $@
|
||||
|
||||
$(qmckl_f) $(qmckl_h): Makefile.generated
|
||||
$(QMCKL_ROOT)/tools/build_qmckl_h.sh
|
||||
|
||||
shared: $(shared_lib)
|
||||
static: $(static_lib)
|
||||
all: shared static doc check
|
||||
|
||||
check: $(static_lib)
|
||||
$(MAKE) -f Makefile.generated check
|
||||
|
||||
ifeq ($(HAS_CPPCHECK),1)
|
||||
cppcheck:
|
||||
cppcheck \
|
||||
--addon=cert \
|
||||
--enable=warning,style,performance,portability,information \
|
||||
qmckl_*.c
|
||||
endif
|
||||
|
||||
doc: $(ORG_SOURCE_FILES)
|
||||
$(QMCKL_ROOT)/tools/build_doc.sh
|
||||
|
||||
clean:
|
||||
- $(MAKE) -f Makefile.generated clean
|
||||
- $(RM) test_qmckl_* test_qmckl.c \
|
||||
$(qmckl_h) $(qmckl_f) \
|
||||
qmckl_*.f90 qmckl_*.c qmckl_*.h \
|
||||
Makefile.generated *.html *.txt
|
||||
|
||||
veryclean: clean FORCE
|
||||
- $(RM) $(QMCKL_ROOT)/share/doc/qmckl/html/*.html \
|
||||
$(QMCKL_ROOT)/share/doc/qmckl/text/*.txt
|
||||
|
||||
Makefile.generated.in: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES) ../tools/Building.org
|
||||
$(QMCKL_ROOT)/tools/create_makefile.sh
|
||||
|
||||
Makefile.generated: Makefile.generated.in
|
||||
cd .. ; ./config.status
|
||||
|
||||
.SUFFIXES: .org .c
|
||||
|
||||
.org.c:
|
||||
$(QMCKL_ROOT)/tools/tangle.sh $<
|
@ -197,7 +197,7 @@ const char* qmckl_string_of_error(const qmckl_exit_code error) {
|
||||
}
|
||||
|
||||
void qmckl_string_of_error_f(const qmckl_exit_code error, char result[<<MAX_STRING_LENGTH()>>]) {
|
||||
strncpy(result, qmckl_string_of_error(error), <<MAX_STRING_LENGTH()>>);
|
||||
strncpy(result, qmckl_string_of_error(error), <<MAX_STRING_LENGTH()>>-1);
|
||||
}
|
||||
#+end_src
|
||||
|
||||
@ -273,8 +273,8 @@ qmckl_set_error(qmckl_context context,
|
||||
assert (ctx != NULL); /* Impossible because the context is valid. */
|
||||
|
||||
ctx->error.exit_code = exit_code;
|
||||
strncpy(ctx->error.function, function_name, QMCKL_MAX_FUN_LEN);
|
||||
strncpy(ctx->error.message, message, QMCKL_MAX_MSG_LEN);
|
||||
strncpy(ctx->error.function, function_name, QMCKL_MAX_FUN_LEN-1);
|
||||
strncpy(ctx->error.message, message, QMCKL_MAX_MSG_LEN-1);
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
||||
|
@ -89,7 +89,7 @@ Compiler variables are obtained from the configure script (see =configure.ac=)
|
||||
CC = @CC@
|
||||
FC = @FC@
|
||||
CFLAGS = @CFLAGS@
|
||||
FFLAGS = @FFLAGS@
|
||||
FCFLAGS = @FCFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
#+end_src
|
||||
@ -106,7 +106,7 @@ static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
|
||||
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
|
||||
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
|
||||
|
||||
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
|
||||
export CC CFLAGS FC FCFLAGS LIBS QMCKL_ROOT
|
||||
|
||||
ORG_SOURCE_FILES=$(wildcard $(QMCKL_ROOT)/*.org)
|
||||
C_SOURCE_FILES=$(patsubst %.org,%.c,$(ORG_SOURCE_FILES))
|
||||
@ -160,9 +160,11 @@ veryclean: clean FORCE
|
||||
- $(RM) $(QMCKL_ROOT)/share/doc/qmckl/html/*.html \
|
||||
$(QMCKL_ROOT)/share/doc/qmckl/text/*.txt
|
||||
|
||||
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES) ../tools/Building.org
|
||||
Makefile.generated.in: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES) ../tools/Building.org
|
||||
$(QMCKL_ROOT)/tools/create_makefile.sh
|
||||
|
||||
Makefile.generated: Makefile.generated.in
|
||||
cd .. ; ./config.status
|
||||
|
||||
.SUFFIXES: .org .c
|
||||
|
||||
@ -185,7 +187,7 @@ Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURC
|
||||
|
||||
<<check_src>>
|
||||
|
||||
OUTPUT=Makefile.generated
|
||||
OUTPUT=Makefile.generated.in
|
||||
#+end_src
|
||||
|
||||
We start by tangling all the org-mode files.
|
||||
@ -233,24 +235,30 @@ cat << EOF > ${OUTPUT}
|
||||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
prefix=/usr/local
|
||||
package = @PACKAGE_TARNAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
|
||||
CC=$CC
|
||||
CFLAGS=$CFLAGS -I../munit/
|
||||
prefix = @prefix@
|
||||
|
||||
FC=$FC
|
||||
FFLAGS=$FFLAGS
|
||||
CC = @CC@
|
||||
CFLAGS= @CFLAGS@ -I../munit/ -I../include
|
||||
|
||||
FC = @FC@
|
||||
FCFLAGS= @FCFLAGS@
|
||||
|
||||
OBJECT_FILES=$OBJECTS
|
||||
|
||||
TESTS = $TESTS
|
||||
TESTS_F = $TESTS_F
|
||||
|
||||
LIBS=$LIBS
|
||||
LIBS = @LIBS@
|
||||
FCLIBS = @FCLIBS@
|
||||
EOF
|
||||
|
||||
echo '
|
||||
<<rules>>
|
||||
' >> ${OUTPUT}
|
||||
|
||||
#+end_src
|
||||
|
||||
and the rules:
|
||||
@ -264,7 +272,6 @@ qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
|
||||
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
|
||||
munit=$(QMCKL_ROOT)/munit/munit.c
|
||||
|
||||
package=qmckl
|
||||
datarootdir=$(prefix)/share
|
||||
datadir=$(datarootdir)
|
||||
docdir=$(datarootdir)/doc/$(package)
|
||||
@ -290,14 +297,15 @@ $(static_lib): $(OBJECT_FILES)
|
||||
# Test
|
||||
|
||||
qmckl_f.o: $(qmckl_f)
|
||||
$(FC) $(FFLAGS) -c $(qmckl_f) -o $@
|
||||
$(FC) $(FCFLAGS) -c $(qmckl_f) -o $@
|
||||
|
||||
test_qmckl: test_qmckl.c $(qmckl_h) $(static_lib) $(TESTS) $(TESTS_F)
|
||||
$(CC) $(CFLAGS) $(munit) $(TESTS) $(TESTS_F) $(static_lib) $(LIBS) test_qmckl.c -o $@
|
||||
$(CC) $(CFLAGS) $(munit) $(TESTS) $(TESTS_F) $(static_lib) $(LIBS) \
|
||||
$(FCLIBS) test_qmckl.c -o $@
|
||||
|
||||
test_qmckl_shared: test_qmckl.c $(qmckl_h) $(shared_lib) $(TESTS) $(TESTS_F)
|
||||
$(CC) $(CFLAGS) -Wl,-rpath,$(QMCKL_ROOT)/lib -L$(QMCKL_ROOT)/lib \
|
||||
$(munit) $(TESTS) $(TESTS_F) -lqmckl $(LIBS) test_qmckl.c -o $@
|
||||
$(munit) $(TESTS) $(TESTS_F) -lqmckl $(LIBS) $(FCLIBS) test_qmckl.c -o $@
|
||||
|
||||
check: test_qmckl test_qmckl_shared
|
||||
./test_qmckl
|
||||
@ -335,7 +343,7 @@ uninstall:
|
||||
$(CC) $(CFLAGS) -c $*.c -o $*.o
|
||||
|
||||
.f90.o: qmckl_f.o
|
||||
$(FC) $(FFLAGS) -c $*.f90 -o $*.o
|
||||
$(FC) $(FCFLAGS) -c $*.f90 -o $*.o
|
||||
|
||||
.PHONY: check cppcheck clean all
|
||||
#+end_src
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
OUTPUT=Makefile.generated
|
||||
OUTPUT=Makefile.generated.in
|
||||
|
||||
|
||||
|
||||
@ -66,19 +66,24 @@ cat << EOF > ${OUTPUT}
|
||||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
prefix=/usr/local
|
||||
package = @PACKAGE_TARNAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
|
||||
CC=$CC
|
||||
CFLAGS=$CFLAGS -I../munit/
|
||||
prefix = @prefix@
|
||||
|
||||
FC=$FC
|
||||
FFLAGS=$FFLAGS
|
||||
CC = @CC@
|
||||
CFLAGS= @CFLAGS@ -I../munit/ -I../include
|
||||
|
||||
FC = @FC@
|
||||
FCFLAGS= @FCFLAGS@
|
||||
|
||||
OBJECT_FILES=$OBJECTS
|
||||
|
||||
TESTS = $TESTS
|
||||
TESTS_F = $TESTS_F
|
||||
|
||||
LIBS=$LIBS
|
||||
LIBS = @LIBS@
|
||||
FCLIBS = @FCLIBS@
|
||||
EOF
|
||||
|
||||
echo '
|
||||
@ -89,7 +94,6 @@ qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
|
||||
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
|
||||
munit=$(QMCKL_ROOT)/munit/munit.c
|
||||
|
||||
package=qmckl
|
||||
datarootdir=$(prefix)/share
|
||||
datadir=$(datarootdir)
|
||||
docdir=$(datarootdir)/doc/$(package)
|
||||
@ -115,14 +119,15 @@ $(static_lib): $(OBJECT_FILES)
|
||||
# Test
|
||||
|
||||
qmckl_f.o: $(qmckl_f)
|
||||
$(FC) $(FFLAGS) -c $(qmckl_f) -o $@
|
||||
$(FC) $(FCFLAGS) -c $(qmckl_f) -o $@
|
||||
|
||||
test_qmckl: test_qmckl.c $(qmckl_h) $(static_lib) $(TESTS) $(TESTS_F)
|
||||
$(CC) $(CFLAGS) $(munit) $(TESTS) $(TESTS_F) $(static_lib) $(LIBS) test_qmckl.c -o $@
|
||||
$(CC) $(CFLAGS) $(munit) $(TESTS) $(TESTS_F) $(static_lib) $(LIBS) \
|
||||
$(FCLIBS) test_qmckl.c -o $@
|
||||
|
||||
test_qmckl_shared: test_qmckl.c $(qmckl_h) $(shared_lib) $(TESTS) $(TESTS_F)
|
||||
$(CC) $(CFLAGS) -Wl,-rpath,$(QMCKL_ROOT)/lib -L$(QMCKL_ROOT)/lib \
|
||||
$(munit) $(TESTS) $(TESTS_F) -lqmckl $(LIBS) test_qmckl.c -o $@
|
||||
$(munit) $(TESTS) $(TESTS_F) -lqmckl $(LIBS) $(FCLIBS) test_qmckl.c -o $@
|
||||
|
||||
check: test_qmckl test_qmckl_shared
|
||||
./test_qmckl
|
||||
@ -160,7 +165,7 @@ uninstall:
|
||||
$(CC) $(CFLAGS) -c $*.c -o $*.o
|
||||
|
||||
.f90.o: qmckl_f.o
|
||||
$(FC) $(FFLAGS) -c $*.f90 -o $*.o
|
||||
$(FC) $(FCFLAGS) -c $*.f90 -o $*.o
|
||||
|
||||
.PHONY: check cppcheck clean all
|
||||
' >> ${OUTPUT}
|
||||
|
Loading…
Reference in New Issue
Block a user