1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
4 AC_INIT(src/gmxlib/3dview.c)
6 AC_CONFIG_AUX_DIR(./config)
7 AM_INIT_AUTOMAKE(gromacs, 3.0b)
8 AC_PREFIX_DEFAULT(/usr/local/gromacs)
9 AM_CONFIG_HEADER(src/include/config.h)
11 #######################################################################
13 #######################################################################
18 [ --enable-mpi Compile parallel version of Gromacs],
19 enable_mpi=$enableval, enable_mpi=no)
25 [ --enable-vector Compile for a vector machine],
26 enable_vector=$enableval, enable_vector=no)
31 AC_ARG_ENABLE(fortran,
32 [ --enable-fortran Dortran loops (default on sgi,ibm,sun,tru64/dec)],
33 enable_fortran=$enableval,enable_fortran=check)
39 [ --enable-double Compile double precision Gromacs],
40 enable_double=$enableval, enable_double=no)
45 AC_ARG_ENABLE(type-suffix,
46 [ --disable-type-suffix Don't add a suffix to double precision files],
47 enable_type_suffix=$enableval, enable_type_suffix=yes)
52 AC_ARG_ENABLE(mpi-suffix,
53 [ --enable-mpi-suffix Add a suffix to MPI files (default on ibm)],
54 enable_mpi_suffix=$enableval, enable_mpi_suffix=check)
59 AC_ARG_ENABLE(simplewater,
60 [ --enable-simplewater Unroll water innerloops (default on sgi)],
61 enable_simplewater=$enableval, enable_simplewater=check)
65 AC_ARG_ENABLE(waterwater-loops,
66 [ --disable-waterwater-loops No special water-water loops (default on sgi)],
67 enable_waterwater_loops=$enableval, enable_waterwater_loops=check)
73 [ --disable-nice Disable the nice priority on mdrun],
74 enable_nice=$enableval, enable_nice=yes)
80 [ --disable-sse Disable SSE assembly loops on x86],
81 enable_sse=$enableval, enable_sse=yes)
87 [ --disable-3dnow Disable 3DNow assembly loops on x86],
88 enable_3dnow=$enableval, enable_3dnow=yes)
94 [ --disable-xdr Disable portable trajectory routines],
95 enable_xdr=$enableval, enable_xdr=yes)
100 AC_ARG_ENABLE(cpu-detection,
101 [ --disable-cpu-detection Don't extend detection with exact cpu type],
102 enable_cpu_detection=$enableval, enable_cpu_detection=yes)
107 AC_ARG_ENABLE(software-recip,
108 [ --enable-software-recip Do software 1/x (might be slower)],
109 enable_softwarerecip=$enableval, enable_softwarerecip=no)
114 AC_ARG_ENABLE(software-sqrt,
115 [ --disable-software-sqrt No software 1/sqrt (default on sgi,rs6000)],
116 enable_softwaresqrt=$enableval, enable_softwaresqrt=check)
121 AC_ARG_ENABLE(vectorized_recip,
122 [ --enable-vectorized-recip Vectorize 1/x in LJ-only loops],
123 enable_vectorized_recip=$enableval, enable_vectorized_recip=no)
128 AC_ARG_ENABLE(vectorized_sqrt,
129 [ --enable-vectorized-sqrt=A,B Loops to vectorize (default none)
130 Choices: normal,solvent,water,water-water],
131 enable_vectorized_sqrt=$enableval, enable_vectorized_sqrt=no)
135 AC_ARG_ENABLE(prefetch_x,
136 [ --enable-prefetch-x=A,B Prefetch coordinates in selected innerloops],
137 enable_prefetch_x=$enableval, enable_prefetch_x=no)
141 AC_ARG_ENABLE(prefetch_f,
142 [ --enable-prefetch-f=A,B Prefetch forces in selected innerloops],
143 enable_prefetch_f=$enableval, enable_prefetch_f=no)
147 AC_ARG_ENABLE(hide_square_latency,
148 [ --enable-hide-square-latency Try to get coords to cache before using them],
149 enable_hide_square_latency=$enableval, enable_hide_square_latency=no)
153 AC_ARG_ENABLE(hide_table_latency,
154 [ --enable-hide-table-latency Try to get table data to cache before using it],
155 enable_hide_table_latency=$enableval, enable_hide_table_latency=no)
160 AC_ARG_WITH(mpi-environment,
161 [ --with-mpi-environment=VAR Only start MPI mdrun when VAR is set],
162 with_mpi_environment="$withval", with_mpi_environment=check)
165 ########################################################################
166 # Process the options
167 ########################################################################
171 case "${host_cpu}" in
180 if test "$enable_fortran" = "check"; then
181 case "${host_cpu}-${host_os}" in
183 sparc*-solaris* | alpha*-osf* | rs6000*-aix* | mips*-irix*)
193 if test "$enable_mpi_suffix" = "check"; then
194 case "${host_cpu}-${host_os}" in
196 rs6000*-aix* | powerpc*-aix*)
197 enable_mpi_suffix=yes
205 if test "$enable_simplewater" = "check"; then
206 case "${host_cpu}-${host_os}" in
209 enable_simplewater=yes
213 enable_simplewater=no
218 if test "$enable_waterwater_loops" = "check"; then
219 case "${host_cpu}-${host_os}" in
222 enable_waterwater_loops=no
226 enable_waterwater_loops=yes
231 if test "$enable_softwaresqrt" = "check"; then
232 case "${host_cpu}-${host_os}" in
234 mips*-irix* | rs6000*-aix*)
235 enable_softwaresqrt=no
239 enable_softwaresqrt=yes
244 if [test "$with_mpi_environment" = "check" -a "$enable_mpi" = "yes"]; then
245 case "${host_cpu}" in
247 with_mpi_environment="MPI_ENVIRONMENT"
250 with_mpi_environment=no
255 case "${host_cpu}" in
257 AC_DEFINE(USE_AXP_ASM,,[Include Alpha AXP assembly for vectorized sqrt/invsqrt])
263 if test "$enable_fortran" = "yes"; then
264 # vendor f77 before g77
265 AC_CHECK_PROGS(F77, f77 xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90)
267 if test -z "$F77"; then
268 AC_MSG_ERROR([No fortran compiler found])
272 # Checks for programs.
275 AC_CHECK_PROG(CC, cc, cc) # do vendor cc before gcc
280 if test "$enable_fortran" = "yes"; then
281 AC_F77_LIBRARY_LDFLAGS
282 ACX_F77_NAME_MANGLING
285 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
286 # above, since the autoconf checks that the created file can be executed. This would
287 # fail on platforms where MPI executables can only be run through a batchqueue.
289 if test "$enable_mpi" = "yes"; then
290 AC_CHECK_PROGS(MPICC, mpicc mpcc mpxlf hcc, $CC)
291 # now change the normal cc to the MPI one - see the comment above.
293 AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
294 AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
295 AC_MSG_RESULT([yes]),
296 AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
297 AM_CONDITIONAL(USE_MPI,true)
299 AM_CONDITIONAL(USE_MPI,false)
305 # A rather complicated check for the nasm program and x86 assembly capabilities
306 # to run under windows we must insert a test a change nasm "-f elf" to "-f win32"
307 if test "$x86" = "yes"; then
308 if [ test "$enable_sse" = "yes" -o "$enable_3dnow" = "yes"]; then
309 if test "$enable_double" = "yes"; then
310 AC_MSG_WARN([SSE/3Dnow assembly can only be used in single precision])
314 AC_PATH_PROG(NASM,nasm,no)
317 if test "$NASM" = "no"; then
318 AC_MSG_ERROR([Nasm is required for SSE and 3DNow loops.])
320 if test "$enable_sse" = "yes"; then
321 AC_MSG_CHECKING([whether nasm supports SSE instructions])
322 cat > conftest_sse.s << EOF
330 if AC_TRY_COMMAND($NASM conftest_sse.s); then
334 AC_MSG_ERROR([Download a patched nasm from the Gromacs homepage,]
335 [or disable SSE assembly.])
338 if test "$enable_3dnow" = "yes"; then
339 AC_MSG_CHECKING([whether nasm supports extended 3DNow instructions])
340 cat > conftest_3dnow.s << EOF
348 if AC_TRY_COMMAND([$NASM -f elf conftest_3dnow.s]); then
352 AC_MSG_ERROR([Download a patched nasm from the Gromacs homepage,]
353 [or disable 3DNow assembly.])
363 AC_PATH_PROG(IDENT,ident,no)
364 if test "$IDENT" != "no"; then
365 # seems as if we have the ident program, but does the
366 # compiler support it?
367 AC_MSG_CHECKING([whether the compiler supports ident])
368 AC_TRY_CPP([#ident "@(#) file.h 1.1 12/16/92"],[
370 AC_DEFINE(HAVE_IDENT,,[Does this machine have the ident command])],
375 AC_CHECK_FUNCS(strcasecmp)
376 AC_CHECK_FUNCS(strdup)
378 # Try to detect the cpu - must be done before some lib searches
379 if test "$enable_cpu_detection" = "yes"; then
385 ############################################################################
386 # Checks for libraries.
387 ############################################################################
388 AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
391 # IBM provides a MASS library with vectorized and optimized math stuff,
392 # and an xlopt library which partly overlaps this. They must come before
393 # libm in the link list, thus the test goes after m!
394 if test "${host_vendor}" = "ibm"; then
395 AC_CHECK_LIB(xlopt,main)
396 AC_CHECK_LIB(mass,main)
400 AC_CHECK_LIB(massvp4,main,[vectmass=yes LIBS="$LIBS -lmassvp4"]) ;;
402 AC_CHECK_LIB(massvp3,main,[vectmass=yes LIBS="$LIBS -lmassvp3"]) ;;
404 AC_CHECK_LIB(massvp3,main,[vectmass=yes LIBS="$LIBS -lmassvp2"]) ;;
406 AC_CHECK_LIB(massv,main,[vectmass=yes LIBS="$LIBS -lmassv"]) ;;
408 if test "$vectmass" = "yes"; then
409 AC_DEFINE(USE_IBM_MASS,,[Use the vectorized routines in IBM MASS library])
413 if test "$enable_double" = "yes"; then
419 if test "$enable_mpi" = "yes"; then
420 ACX_CHECK_FFTW(fftw_mpi,$precision)
421 ACX_CHECK_FFTW(rfftw_mpi,$precision)
424 ACX_CHECK_FFTW(fftw,$precision)
425 ACX_CHECK_FFTW(rfftw,$precision)
427 case ${ac_fftw_savedprefix} in
429 AC_DEFINE(FFTW_NAME_DFFTW,,[Use the d prefix on fftw includes])
432 AC_DEFINE(FFTW_NAME_SFFTW,,[Use the s prefix on fftw includes])
435 AC_DEFINE(FFTW_NAME_FFTW,,[Dont use any prefixing on fftw includes])
440 if test "$enable_xdr" = "no"; then
441 AC_MSG_WARN([* Not using XDR cripples Gromacs significantly. You won't be able to *]
442 [* read or write any hardware independent or compressed trajectories. *]
443 [* We strongly suggest you try to locate the RPC routines instead! *])
445 # check for xtc headers
446 AC_CHECK_HEADERS(rpc/rpc.h rpc/xdr.h,,AC_MSG_ERROR([RPC/XDR include headers not found]))
448 # on solaris the xdr stuff is in -lnsl
449 AC_CHECK_LIB(nsl,xdr_float)
452 #include<rpc/xdr.h>],
453 [ XDR *xd; float f; xdr_float(xd,&f);],,AC_MSG_ERROR([RPC/XDR libraries not found]))
454 AM_CONDITIONAL(GMX_USE_XDR,true)
461 # try to find motif headers and libraries
463 if [test "$motif_includes" = "none" -a "$motif_libraries" != "none"]; then
464 AC_MSG_WARN([ In addition to Motif/Lesstif libraries we also need includes. Disabling.])
468 if test "$motif_includes" != "none"; then
475 # Checks for header files.
477 AC_CHECK_HEADERS([limits.h malloc.h strings.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
480 # Checks for typedefs, structures, and compiler characteristics.
488 # Checks for library functions.
495 # Collect the libraries and includes for X and/or motif
496 if test "$no_x" != "yes"; then
497 LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
498 INCLUDES="$INCLUDES $X_CFLAGS $MOTIF_CFLAGS"
499 AM_CONDITIONAL(USE_X11,true)
503 AM_CONDITIONAL(USE_X11,false)
507 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
508 # but on e.g. ibm the mass libraries must come before -lm...
509 case "${host_cpu}-${host_os}" in
518 ########################################################################
519 # Substitute things in output and header files.
520 ########################################################################
523 if test "$enable_mpi" = "yes"; then
524 AC_DEFINE(USE_MPI,,[Make a parallel version of Gromacs using MPI])
526 if test "$enable_mpi_suffix" = "yes"; then
530 PAR_OBJ='${libnet_obj}'
533 if test "$enable_vector" = "yes"; then
534 AC_DEFINE(USE_VECTOR,,[Optimize for a vector architecture])
537 if test "$enable_fortran" = "yes"; then
538 AC_DEFINE(USE_FORTRAN,,[Use Fortran for innerloops and some other core stuff])
539 INNER_F77_OBJ='${inner_f77_obj}'
540 AM_CONDITIONAL(USE_FORTRAN,true)
542 INNER_C_OBJ='${inner_c_obj}'
543 AM_CONDITIONAL(USE_FORTRAN,false)
546 if test "$enable_double" = "yes"; then
547 AC_DEFINE(DOUBLE,,[Compile in double precision])
548 if test "$enable_type_suffix" = "yes"; then
551 AM_CONDITIONAL(USE_DOUBLE,true)
553 AM_CONDITIONAL(USE_DOUBLE,false)
556 if test "$enable_simplewater" = "yes"; then
557 AC_DEFINE(SIMPLEWATER,,[Expand the water loops to three inner loops])
560 if test "$enable_waterwater_loops" = "no"; then
561 AC_DEFINE(DISABLE_WATERWATER_LOOPS,,[Don't use special loops for all-water interactions])
564 if test "$enable_nice" = "no"; then
565 AC_DEFINE(NO_NICE,,[Turn off the automatic nicing of gromacs])
568 if test "$enable_sse" = "yes"; then
569 AC_DEFINE(USE_SSE,,[Use x86 assembly with SSE instructions])
573 if test "$enable_3dnow" = "yes"; then
574 AC_DEFINE(USE_3DNOW,,[Use x86 assembly with 3DNow instructions])
578 if [test "$enable_sse" = "yes" -o "$enable_3dnow" = "yes"]; then
579 X86_ASM_OBJ='${x86_asm_obj}'
582 if [test "$motif_includes" != "none" -a "$motif_libraries" != "none"]; then
583 MOTIF_OBJ='${motif_obj}'
586 if test "$enable_xdr" = "yes"; then
587 AC_DEFINE(USE_XDR,,[Use xdr routines to make trajectories portable])
590 XDR_OBJ='${noxdr_obj}'
593 if test "$enable_softwaresqrt" = "yes"; then
594 AC_DEFINE(SOFTWARE_SQRT,,[Use the Gromacs software 1/sqrt(x)])
597 if test "$enable_softwarerecip" = "yes"; then
598 AC_DEFINE(SOFTWARE_RECIP,,[Use the Gromacs software 1/x])
601 if test "$enable_hide_square_latency" = "yes"; then
602 AC_DEFINE(DECREASE_SQUARE_LATENCY,,[Try to get coordinates to cache before using them])
605 if test "$enable_hide_table_latency" = "yes"; then
606 AC_DEFINE(DECREASE_LOOKUP_LATENCY,,[Try to get table data to cache before using it])
609 if test "$with_mpi_environment" != "no" -a "$enable_mpi" = "yes"; then
610 AC_DEFINE_UNQUOTED(CHECK_MPI_ENV,"$with_mpi_environment",
611 [If defined, only start MPI runs when this variable is set])
615 list_of_vectorized_sqrt=""
616 if test "$enable_vectorized_sqrt" != "no"; then
617 if test "$enable_vectorized_sqrt" = "yes"; then
618 enable_vectorized_sqrt="normal,solvent,water,water-water"
620 if echo $enable_vectorized_sqrt | grep "normal" >/dev/null; then
621 list_of_vectorized_sqrt="normal "
622 AC_DEFINE(VECTORIZE_INVSQRT,,[Vectorize 1/sqrt(x) in normal loops])
624 if echo $enable_vectorized_sqrt | grep "solvent" >/dev/null; then
625 list_of_vectorized_sqrt="${list_of_vectorized_sqrt}solvent "
626 AC_DEFINE(VECTORIZE_INVSQRT_S,,[Vectorize 1/sqrt(x) in solvent loops])
628 if echo $enable_vectorized_sqrt | sed 's/water-water//' | grep "water" >/dev/null; then
629 list_of_vectorized_sqrt="${list_of_vectorized_sqrt}water "
630 AC_DEFINE(VECTORIZE_INVSQRT_W,,[Vectorize 1/sqrt(x) in water loops])
632 if echo $enable_vectorized_sqrt | grep "water-water" >/dev/null; then
633 list_of_vectorized_sqrt="${list_of_vectorized_sqrt}water-water "
634 AC_DEFINE(VECTORIZE_INVSQRT_WW,,[Vectorize 1/sqrt(x) in water-water loops])
637 if test -z "$list_of_vectorized_sqrt"; then
638 list_of_vectorized_sqrt="no"
642 list_of_prefetch_x=""
643 if test "$enable_prefetch_x" != "no"; then
644 if test "$enable_prefetch_x" = "yes"; then
645 enable_prefetch_x="normal,solvent,water,water-water"
647 if echo $enable_prefetch_x | grep "normal" >/dev/null; then
648 list_of_prefetch_x="normal "
649 AC_DEFINE(PREFETCH_X,,[Prefetch coordinates in normal loops])
651 if echo $enable_prefetch_x | grep "solvent" >/dev/null; then
652 list_of_prefetch_x="${list_of_prefetch_x}solvent "
653 AC_DEFINE(PREFETCH_X_S,,[Prefetch coordinates in solvent loops])
655 if echo $enable_prefetch_x | sed 's/water-water//' | grep "water" >/dev/null; then
656 list_of_prefetch_x="${list_of_prefetch_x}water "
657 AC_DEFINE(PREFETCH_X_W,,[Prefetch coordinates in water loops])
659 if echo $enable_prefetch_x | grep "water-water" >/dev/null; then
660 list_of_prefetch_x="${list_of_prefetch_x}water-water "
661 AC_DEFINE(PREFETCH_X_WW,,[Prefetch coordinates in water-water loops])
664 if test -z "$list_of_prefetch_x"; then
665 list_of_prefetch_x="no"
668 list_of_prefetch_f=""
669 if test "$enable_prefetch_f" != "no"; then
670 if test "$enable_prefetch_f" = "yes"; then
671 enable_prefetch_f="normal,solvent,water,water-water"
673 if echo $enable_prefetch_f | grep "normal" >/dev/null; then
674 list_of_prefetch_f="normal "
675 AC_DEFINE(PREFETCH_F,,[Prefetch coordinates in normal loops])
677 if echo $enable_prefetch_f | grep "solvent" >/dev/null; then
678 list_of_prefetch_f="${list_of_prefetch_f}solvent "
679 AC_DEFINE(PREFETCH_F_S,,[Prefetch coordinates in solvent loops])
681 if echo $enable_prefetch_f | sed 's/water-water//' | grep "water"; then
682 list_of_prefetch_f="${list_of_prefetch_f}water "
683 AC_DEFINE(PREFETCH_F_W,,[Prefetch coordinates in water loops])
685 if echo $enable_prefetch_f | grep "water-water" >/dev/null; then
686 list_of_prefetch_f="${list_of_prefetch_f}water-water "
687 AC_DEFINE(PREFETCH_F_WW,,[Prefetch coordinates in water-water loops])
690 if test -z "$list_of_prefetch_f"; then
691 list_of_prefetch_f="no"
694 if test "$enable_vectorized_recip" != "yes" -a "$enable_vectorized_recip" != "no"; then
695 AC_MSG_ERROR([Vectorized reciprocal is only meaningful for normal loops])
698 if test "$enable_vectorized_recip" = "yes"; then
699 AC_DEFINE(VECTORIZE_RECIP,,[Vectorize the reciprocal calculation])
702 if test "${prefix}" = "NONE"; then
703 AC_DEFINE_UNQUOTED(GMXLIBDIR,"${ac_default_prefix}/top",[Default topology file location])
705 AC_DEFINE_UNQUOTED(GMXLIBDIR,"${prefix}/top",[Default topology file location])
709 AC_SUBST(INNER_F77_OBJ)
710 AC_SUBST(INNER_C_OBJ)
713 AC_SUBST(X86_ASM_OBJ)
716 AC_SUBST(AXP_ASM_OBJ) # not used right now
717 ACX_SUBST_XXX(SUFFIX)
720 # Check if there are any optimizations and options for this arch and cpu
722 AC_SUBST(INCLUDES) # should be automatic, but doesnt seem to be?
724 # put binaries and libraries in subdirectories named as the arch
725 if test -n "$gmxcpu"; then
726 bindir="\${exec_prefix}/bin/${host}/${gmxcpu}"
727 libdir="\${exec_prefix}/lib/${host}/${gmxcpu}"
729 bindir="\${exec_prefix}/bin/${host}"
730 libdir="\${exec_prefix}/lib/${host}"
745 src/include/types/Makefile
747 tutor/gmxdemo/Makefile
751 tutor/speptide/Makefile
752 tutor/template/Makefile
753 tutor/template/Template.mak
757 html/online/Makefile])
760 echo "Gromacs is ready to compile. Summary of options used:"
761 echo "Architecture : $host"
762 if test "$enable_cpu_detection" = "yes"; then
763 if test -n "$gmxcpu"; then
764 echo "Optimize for CPU : $gmxcpu"
766 echo "(Extra CPU detection not necessary or unavailable on this host)"
769 echo "MPI parallelization : $enable_mpi"
770 if test "$enable_mpi" = "yes"; then
771 echo "Checking MPI environment : $with_mpi_environment"
772 echo "MPI suffix on files : $enable_mpi_suffix"
774 echo "Vector architecture : $enable_vector"
775 echo "Using Fortran code : $enable_fortran"
776 echo "Double precision : $enable_double"
777 if test "$enable_double" = "yes"; then
778 echo "Type suffix on files : $enable_type_suffix"
780 echo "Expanding water loops : $enable_simplewater"
781 echo "Using water-water loops : $enable_waterwater_loops"
782 echo "Automatically nice mdrun : $enable_nice"
783 echo "Using x86 SSE assembly : $enable_sse"
784 echo "Using x86 3DNow assembly : $enable_3dnow"
785 echo "Portable trajectories (xdr) : $enable_xdr"
786 echo "Software 1/x : $enable_softwarerecip"
787 echo "Software 1/sqrt(x) : $enable_softwaresqrt"
788 echo "Vectorize 1/x : $enable_vectorized_recip"
789 echo "Vectorize 1/sqrt(x) : $list_of_vectorized_sqrt"
790 echo "Prefetch coordinates in loops : $list_of_prefetch_x"
791 echo "Prefetch forces in loops : $list_of_prefetch_f"
792 echo "Hide square latency : $enable_hide_square_latency"
793 echo "Hide table lookup latency : $enable_hide_table_latency"
794 echo "Using X11 : $use_x11"
795 echo "Motif support : $use_motif"