Dear amber developers:
I started a project to integrate autotool into amber install code.
Autotool is Gnu M4 based packages to produce shell scripts to
automatically configure software source code packages. In simplest case,
developer need to prepare configure.ac and various Makefile.am files for
autotool to generate final configure script and Makefiles. Since I only
wrote demo code to compile serial version of amber8 on freebsd5.4 and
win32+mingw with g95 compiler, the autoconf/automake configuration files
are quite simple and limited.
Follow the suggestions of Dr. David Case, I post here some code snippets
in my configure.ac and Makefile.am as a demostration to show the
capability of autotools.
#
# This is a part of configure.ac to detect supported OS type and installed
compiler
#
# checks for architecture and os type
#
AC_SYS_SUPPORTED_OS
#
# checks for programs
#
AC_PROG_RANLIB
AC_PROG_INSTALL
#
# check standard compiler features
#
AC_PROG_AMBER_C([icc ecc pgcc xlc cl cc gcc egcs])
AC_PROG_AMBER_CXX([icc ecc pgCC xlC aCC cl CC KCC cxx cc++ c++ g++ egcs
gcc])
AC_PROG_AMBER_FC([ifc ifort pgf90 efc f90 g95 mpif90 mpxlf90_r xlf90])
****************************************************************
#
# This is sample macro defs of OS detection
#
# AC_SYS_SUPPORTED_OS()
# -----------------------------------------------------------------
# detect the supported OSs, exit if unsupported.
AC_DEFUN([AC_SYS_SUPPORTED_OS],
[
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
# OS supported
# Linux, SGI-ALTIX, SGI-MIPS, Sparc, AIX, FreeBSD, Win32
# fixme: add SGI-ALTIX detection code to config.guess
AC_MSG_CHECKING([for supported operating system])
case $build in
*-*-aix*)
ac_sys_os_type="aix";;
sparc-sun-*)
ac_sys_os_type="sparc";;
mips-sgi-*)
ac_sys_os_type="sgi-mips";;
*-*-freebsd*)
ac_sys_os_type="freebsd";;
*-*-mingw32* | *-*-windows*)
ac_sys_os_type="win32";;
*-*-cygwin*)
ac_sys_os_type="win32";;
*-*-linux)
ac_sys_os_type="linux";;
*-*-linux-gnu)
ac_sys_os_type="linux-gnu"
*)
ac_sys_os_type="unknown";;
esac
AS_IF([ test "x$ac_sys_os_type" != "xunknown" ],
[ AC_MSG_RESULT([$ac_sys_os_type ok!]) ],
[ AC_MSG_ERROR([Sorry, your operating system has not been supported
yet!])
])dnl
some additional os specific flags for automake files
AM_CONDITIONAL([OS_WIN32], [ test "x$ac_sys_os_type" = "xwin32" ])dnl
])
**************************************************************************
***************
#
# This is sample Makefile.am to compiler sander. Now, it is only a blind
wrapper to old Makefile
#
## Process this file with automake to produce Makefile.in
# Note: Makefile is automatically generated from Makefile.in by the
configure
# script, and Makefile.in is automatically from Makefile.am by automake.
# additional local compile flags for fortran sources
AM_FCFLAGS = $(LOADLIB)
# sander Fortran source files are free format
AM_FCFLAGS += $(FCFLAG_FREEFORM)
SANDER_SRC= \
trace.f \
lmod.f \
decomp.f \
icosasurf.f \
egb.f \
findmask.f \
pb_force.f \
fastwt.f sander.f cshf.f noecalc.f noeread.f caldis.f \
calrate.f dinten.f drates.f indexn.f kmat.f pearsn.f \
plane.f remarc.f nmrcal.f nmrred.f \
restal.f getnat.f nmrnrg.f modwt.f disnrg.f angnrg.f \
tornrg.f nmrprt.f nmrgrp.f nmrcms.f nmrcmf.f \
impnum.f nmrsht.f at2res.f chklin.f opnmrg.f \
printe.f runmin.f ndvprt.f force.f rdparm.f \
mdread.f locmem.f runmd.f getcor.f \
r6ave.f r6drv.f aveint.f degcnt.f corf.f \
threeb.f tripl.f nmrrad.f decnvh.f \
echoin.f parallel.f jnrg.f \
shake.f ene.f mdwrit.f minrit.f \
set.f setmm.f dynlib.f mdfil.f nmlsrc.f \
ew_force.f ew_setup.f ew_box.f ew_bspline.f\
ew_fft.f ew_direct.f ew_recip.f pcshift.f align.f \
rstack.f istack.f rfree.f rgroup.f \
random.f lsqfit.f amopen.f \
debug.f ew_recip_reg.f ew_handle_dips.f ew_dipole_recip.f \
mexit.f new_time.f extra_pts.f thermo_int.f \
matinv.f assert.f \
mmtsb.f mmtsb_client.c erfcfun.f veclib.f mdm.f \
pb_init.f constantph.f prn_dipoles.f
SANDER_LES_SRC= \
trace.f \
lmod.f \
decomp.f \
icosasurf.f \
egb.f \
findmask.f \
pb_force.f \
sander.f cshf.f noecalc.f noeread.f caldis.f \
calrate.f dinten.f drates.f indexn.f kmat.f pearsn.f \
plane.f remarc.f nmrcal.f nmrred.f \
restal.f getnat.f nmrnrg.f modwt.f disnrg.f angnrg.f \
tornrg.f nmrprt.f nmrgrp.f nmrcms.f nmrcmf.f \
impnum.f nmrsht.f at2res.f chklin.f opnmrg.f \
printe.f runmin.f ndvprt.f force.f rdparm.f \
mdread.f locmem.f runmd.f getcor.f \
r6ave.f r6drv.f aveint.f degcnt.f corf.f \
threeb.f tripl.f nmrrad.f decnvh.f \
fastwt.f echoin.f parallel.f jnrg.f \
shake.f ene.f mdwrit.f minrit.f \
set.f setmm.f dynlib.f mdfil.f nmlsrc.f \
ew_force.f ew_setup.f ew_box.f ew_bspline.f\
ew_fft.f ew_direct.f ew_recip.f pcshift.f align.f \
rstack.f istack.f rfree.f rgroup.f \
random.f lsqfit.f amopen.f egb_les.f \
debug.f ew_recip_reg.f ew_handle_dips.f ew_dipole_recip.f \
mexit.f new_time.f extra_pts.f \
thermo_int.f matinv.f assert.f \
mmtsb.f mmtsb_client.c erfcfun.f veclib.f mdm.f \
pb_init.f constantph.f prn_dipoles.f
SANDER_QMMM_SRC= \
trace.f debug.f \
findmask.f \
pb_force.f \
sander.f cshf.f noecalc.f noeread.f caldis.f \
calrate.f dinten.f drates.f indexn.f kmat.f pearsn.f \
plane.f remarc.f nmrcal.f nmrred.f \
restal.f getnat.f nmrnrg.f modwt.f disnrg.f angnrg.f \
tornrg.f nmrprt.f nmrgrp.f nmrcms.f nmrcmf.f \
impnum.f nmrsht.f at2res.f chklin.f opnmrg.f \
printe.f runmin.f ndvprt.f rdparm.f \
mdread.f locmem.f runmd.f getcor.f \
r6ave.f r6drv.f aveint.f degcnt.f corf.f \
threeb.f tripl.f nmrrad.f decnvh.f \
fastwt.f echoin.f parallel.f jnrg.f \
shake.f ene.f mdwrit.f minrit.f \
set.f setmm.f dynlib.f mdfil.f nmlsrc.f \
pcshift.f align.f \
rstack.f istack.f rfree.f rgroup.f \
random.f lsqfit.f amopen.f \
mexit.f new_time.f thermo_int.f \
matinv.f decomp.f assert.f \
erfcfun.f veclib.f mdm.f pb_init.f \
constantph.f prn_dipoles.f \
mmtsb.f mmtsb_client.c delbad.f link_atoms.f \
qmcompare.f qmsort.f forcecp.f ifshk.f resnba.f nonbon.f
PSANDER_SRC= \
trace.f \
lmod.f \
decomp.f \
icosasurf.f \
egb.f \
findmask.f \
pb_force.f \
cshf.f noecalc.f noeread.f caldis.f \
calrate.f dinten.f drates.f indexn.f kmat.f pearsn.f \
plane.f remarc.f nmrcal.f nmrred.f \
restal.f getnat.f nmrnrg.f modwt.f disnrg.f angnrg.f \
tornrg.f nmrprt.f nmrgrp.f nmrcms.f nmrcmf.f \
impnum.f nmrsht.f at2res.f chklin.f opnmrg.f \
printe.f runmin.f ndvprt.f rdparm.f \
getcor.f \
r6ave.f r6drv.f aveint.f degcnt.f corf.f \
threeb.f tripl.f nmrrad.f decnvh.f \
echoin.f jnrg.f \
mdwrit.f minrit.f \
set.f setmm.f dynlib.f mdfil.f nmlsrc.f \
ew_box.f \
ew_fft.f pcshift.f align.f \
rstack.f istack.f rfree.f rgroup.f \
random.f lsqfit.f amopen.f \
debug.f ew_recip_reg.f ew_handle_dips.f \
mexit.f thermo_int.f \
matinv.f assert.f \
mmtsb.f mmtsb_client.c erfcfun.f veclib.f \
sander.f mdread.f ew_force.f ew_setup.f \
shake.f ene.f ew_direct.f new_time.f extra_pts.f \
force.f runmd.f ew_recip.f \
ew_dipole_recip.f ew_bspline.f \
fastwt.f locmem.f parallel.f \
spatial_comm.f spatial_shake.f spatial_bonds.f spatial_startup.f \
spatial_newcells.f \
pb_init.f constantph.f prn_dipoles.f
bin_PROGRAMS =
if COMPILE_PARALLEL_SANDER
bin_PROGRAMS += sander_p sander_p.LES psander
sander_p_SOURCES = $(SANDER_SRC)
# fixme: old Makefile has a solitary variable $(UHOBJ)
sander_p_LDADD = ../lmod/liblmod.a \
../lib/libsys.a ../lib/nxtsec.o \
../lapack/liblapack.a ../blas/libblas.a
sander_p_LES_SOURCES = $(SANDER_LES_SRC)
sander_p_LES_FFLAGS = $(AM_FCFLAGS) -DPSANDER
sander_p_LES_LDADD = ../lmod/liblmod.a \
../lib/libsys.a ../lib/nxtsec.o \
../lapack/liblapack.a ../blas/libblas.a
psander_SOURCES = $(PSANDER_SRC)
psander_FFLAGS = $(AM_FCFLAGS) -DPSANDER
psander_LDADD = ../lmod/liblmod.a \
../lib/libsys.a ../lib/nxtsec.o \
../lapack/liblapack.a ../blas/libblas.a
else
bin_PROGRAMS += sander sander.LES sander.QMMM ambmask
sander_SOURCES = $(SANDER_SRC)
sander_LDADD = ../lmod/liblmod.a \
../lapack/liblapack.a ../blas/libblas.a \
../lib/nxtsec.o ../lib/libsys.a
sander_LES_SOURCES = $(SANDER_LES_SRC)
sander_LES_FFLAGS = $(AM_FCFLAGS) -DLES
sander_LES_LDADD = ../lmod/liblmod.a \
../lapack/liblapack.a ../blas/libblas.a \
../lib/nxtsec.o ../lib/libsys.a
sander_QMMM_FFLAGS = $(AM_FCFLAGS) -DQMMM
sander_QMMM_SOURCES = $(SANDER_QMMM_SRC)
sander_QMMM_LDADD = ../lmod/liblmod.a \
../lapack/liblapack.a ../blas/libblas.a \
../divcon/libdivcon.a ../divcon/block.o \
../lib/libsys.a ../lib/nxtsec.o
ambmask_SOURCES = ambmask.f findmask.f amopen.f
ambmask_LDADD = ../lib/mexit.o ../lib/nxtsec.o
endif
EXTRA_DIST = *.h
# what gets cleaned
CLEANFILES = *.mod
DISTCLEANFILES = *.mod
Received on Wed Apr 05 2006 - 23:49:52 PDT