Newer
Older
Kurt A. O'Hearn
committed
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([Purdue Molecular Dynamics Suite], [1.0], [ohearnku@msu.edu hma@msu.edu])
Kurt A. O'Hearn
committed
AM_INIT_AUTOMAKE([1.15 -Wall -Werror])
Kurt A. O'Hearn
committed
LT_PREREQ([2.2])
LT_INIT([dlopen])
AC_CONFIG_MACRO_DIR([m4])
Kurt A. O'Hearn
committed
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY],[1])])
Kurt A. O'Hearn
committed
AC_ARG_ENABLE([serial],
[AS_HELP_STRING([--enable-serial],
[enable serial support @<:@default: no@:>@])],
Kurt A. O'Hearn
committed
[package_serial_enabled=${enableval}], [package_serial_enabled=no])
Kurt A. O'Hearn
committed
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--enable-openmp],
[enable OpenMP support @<:@default: yes@:>@])],
Kurt A. O'Hearn
committed
[package_openmp_enabled=${enableval}], [package_openmp_enabled=yes])
Kurt A. O'Hearn
committed
AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--enable-mpi],
[enable MPI support @<:@default: no@:>@])],
Kurt A. O'Hearn
committed
[package_mpi_enabled=${enableval}], [package_mpi_enabled=no])
AC_ARG_ENABLE([gpu],
[AS_HELP_STRING([--enable-gpu],
[enable CUDA (single GPU) support @<:@default: no@:>@])],
[package_gpu_enabled=${enableval}], [package_gpu_enabled=no])
AC_ARG_ENABLE([mpi-not-gpu],
[AS_HELP_STRING([--enable-mpi-not-gpu],
[enable MPI but not CUDA support @<:@default: no@:>@])],
[package_mpi_not_gpu_enabled=${enableval}], [package_mpi_not_gpu_enabled=no])
AC_ARG_ENABLE([mpi-gpu],
[AS_HELP_STRING([--enable-mpi-gpu],
Kurt A. O'Hearn
committed
[enable MPI+CUDA (multi GPU) support @<:@default: no@:>@])],
[package_mpi_gpu_enabled=${enableval}], [package_mpi_gpu_enabled=no])
Kurt A. O'Hearn
committed
Kurt A. O'Hearn
committed
if test "x${package_serial_enabled}" = "xyes" || test "x${package_openmp_enabled}" = "xyes"; then
AC_CONFIG_SUBDIRS([sPuReMD])
if test "x${package_serial_enabled}" = "xyes" || test "x${package_openmp_enabled}" != "xyes"; then
export BUILD_OPENMP="no"
else
export BUILD_OPENMP="yes"
fi
fi
AM_CONDITIONAL([BUILD_S_OMP], [test "x${package_serial_enabled}" = "xyes" || test "x${package_openmp_enabled}" = "xyes"])
Kurt A. O'Hearn
committed
if test "x${package_mpi_enabled}" = "xyes"; then
AC_CONFIG_SUBDIRS([PuReMD])
fi
AM_CONDITIONAL([BUILD_MPI], [test "x${package_mpi_enabled}" = "xyes"])
if test "x${package_gpu_enabled}" = "xyes"; then
Kurt A. O'Hearn
committed
AC_CONFIG_SUBDIRS([PuReMD-GPU])
fi
AM_CONDITIONAL([BUILD_GPU], [test "x${package_gpu_enabled}" = "xyes"])
if test "x${package_mpi_not_gpu_enabled}" = "xyes" || test "x${package_mpi_gpu_enabled}" = "xyes"; then
Kurt A. O'Hearn
committed
AC_CONFIG_SUBDIRS([PG-PuReMD])
if test "x${package_mpi_not_gpu_enabled}" = "xyes" || test "x${package_mpi_gpu_enabled}" != "xyes"; then
export BUILD_MPI_NOT_GPU="yes"
else
export BUILD_MPI_NOT_GPU="no"
fi
Kurt A. O'Hearn
committed
fi
AM_CONDITIONAL([BUILD_MPI_GPU], [test "x${package_mpi_not_gpu_enabled}" = "xyes" || test "x${package_mpi_gpu_enabled}" = "xyes"])
Kurt A. O'Hearn
committed
# Provides debug compilation mode.
AC_ARG_ENABLE([debug],
Kurt A. O'Hearn
committed
[AS_HELP_STRING([--enable-debug],
[enable debug support @<:@default: no@:>@])],
[DEBUG=${enableval}], [DEBUG=no]
)
if test "x$DEBUG" = "xyes"
Kurt A. O'Hearn
committed
#TODO: fix exporting to subdirs
# See: http://stackoverflow.com/questions/34124337/changing-flags-in-configure-ac-vs-caching-with-subprojects
Kurt A. O'Hearn
committed
export BUILD_DEBUG="true"
fi
# gprof flags.
AC_ARG_ENABLE([gprof],
Kurt A. O'Hearn
committed
[AS_HELP_STRING([--enable-gprof],
[enable support for profiling with gprof @<:@default: no@:>@])],
Kurt A. O'Hearn
committed
gprof_enabled="yes"
gprof_compiler="gnu compiler"
gprof_flags="-pg"
;;
intel)
Kurt A. O'Hearn
committed
gprof_enabled="yes"
gprof_compiler="intel compiler"
gprof_flags="-p"
;;
no)
Kurt A. O'Hearn
committed
gprof_enabled="no"
gprof_compiler="none"
gprof_flags=""
;;
*)
AC_MSG_ERROR([bad value ${enableval} for --enable-gprof (only yes, gnu or intel are possible)]) ;;
esac],
Kurt A. O'Hearn
committed
[gprof_enabled="no"
gprof_compiler="none"
gprof_flags=""
]
)
Kurt A. O'Hearn
committed
if test "x$gprof_enabled" = "xyes"
Kurt A. O'Hearn
committed
#TODO: fix exporting to subdirs
CPPFLAGS="${CPPFLAGS} ${gprof_flags}"
LDFLAGS="${LDFLAGS} ${gprof_flags}"
Kurt A. O'Hearn
committed
export BUILD_PROF="yes"
fi
# Timing measurements.
AC_ARG_ENABLE([timing],
Kurt A. O'Hearn
committed
[AS_HELP_STRING([--enable-timing],
[enable timing measurements and reporting @<:@default: no@:>@])],
[timing_enabled=${enableval}], [timing_enabled=no]
Kurt A. O'Hearn
committed
if test "x$timing_enabled" = "xyes"
Kurt A. O'Hearn
committed
export BUILD_TIMING="yes"
Kurt A. O'Hearn
committed
AC_CONFIG_FILES([Makefile])
AC_OUTPUT