Removed David's extra inclusion of config.h
[gromacs.git] / configure.ac
blob0a479a151aa1b60e4591dcc8684938554789fdbb
1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
5 AC_PREREQ(2.50)
6 AC_INIT(GROMACS, 3.2.0, gmx-users@gromacs.org)
7 AC_CONFIG_SRCDIR(src/gmxlib/3dview.c)
8 AC_CONFIG_AUX_DIR(config)
9 AC_CANONICAL_HOST
11 AM_INIT_AUTOMAKE(gromacs, 3.2.0)
12 AC_PREFIX_DEFAULT(/usr/local/gromacs)
13 AM_CONFIG_HEADER(src/config.h)
14 dnl This is the version info according to the libtool versioning system.
15 dnl It does *not* correspond to the release number.
16 SHARED_VERSION_INFO="3:0:0"
17 AC_SUBST(SHARED_VERSION_INFO)
20 #######################################################################
21 # Simple options and makefile variables
22 #######################################################################
25 ### Single/Double
26 AC_ARG_ENABLE(float,
27  [  --disable-float               use double instead of single precision],, enable_float=yes)
28 if test "$enable_float" = "no"; then
29   AC_DEFINE(DOUBLE,,[Compile in double precision])
30   AM_CONDITIONAL(DOUBLE,true)
31 else
32   AM_CONDITIONAL(DOUBLE,false)
35 ### Fortran or not
36 AC_ARG_ENABLE(fortran,
37  [  --enable-fortran              use fortran (default on sgi,ibm,sun,axp)],, 
38 [case "${host_cpu}-${host_os}" in
39   sparc*-solaris* | alpha*-* | rs6000*-aix* | powerpc*-aix* | mips*-irix*) enable_fortran=yes ;;
40   *) enable_fortran=no ;;
41  esac])
42 if test "$enable_fortran" = "yes"; then
43   AC_DEFINE(USE_FORTRAN,,[Use Fortran for innerloops and some other core stuff])
44   GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} innerf.lo f77_wrappers.lo"
45   if test "$enable_float" = "yes"; then
46     MDLIB_LIBOBJS="${MDLIB_LIBOBJS} flincs.lo fsettle.lo fshake.lo"
47   else
48     MDLIB_LIBOBJS="${MDLIB_LIBOBJS} flincsd.lo fsettled.lo fshaked.lo"
49   fi
50   GMXANA_LIBOBJS=""
51 else
52   GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} innerc.lo"
53   MDLIB_LIBOBJS="${MDLIB_LIBOBJS} clincs.lo csettle.lo"
54   GMXANA_LIBOBJS=""
56 # always use CC for linking:
57 AC_SUBST(F77LINK,"\$(LINK)")
60 ### MPI or not
61 AC_ARG_ENABLE(mpi,
62  [  --enable-mpi                  compile for parallel runs using MPI],,enable_mpi=no)
64 ### Threads
65 AC_ARG_ENABLE(threads,
66  [  --disable-threads             don't try to use multithreading],,enable_threads=yes)
69 ### MPI environment
70 AC_ARG_ENABLE(mpi-environment,
71  [  --enable-mpi-environment=VAR  only start parallel runs when VAR is set],,
72 [case "${host_cpu}" in
73   mips*-irix*) enable_mpi_environment="MPI_ENVIRONMENT" ;;
74   *) enable_mpi_environment=no ;;
75 esac])
76 if test "$enable_mpi_environment" != "no"; then
77   AC_DEFINE_UNQUOTED(CHECK_MPI_ENV,"$enable_mpi_environment",[If defined, only start MPI runs when this variable is set])
81 ### X86 assembly code
82 AC_ARG_ENABLE(x86_asm,     
83  [  --disable-x86-asm             don't build assembly loops on x86],,enable_x86_asm=yes)
84 case "${host_cpu}" in
85    i?86) ;;     
86    *) enable_x86_asm=no ;;
87 esac
89 ### Altivec on powerpc (motorola)
90 AC_ARG_ENABLE(ppc_altivec,
91  [  --disable-ppc-altivec         don't build Altivec loops on PowerPC],,enable_ppc_altivec=yes)
92 case "${host_cpu}-${host_vendor}" in
93    ppc*-ibm* | powerpc*-ibm*) enable_ppc_altivec=no ;;
94    ppc*-* | powerpc*-*) ;; 
95    *) enable_ppc_altivec=no ;;
96 esac
98 AC_ARG_ENABLE(axp_asm,
99  [  --enable-axp-asm              include vectorized sqrt routines for alpha],,enable_axp_asm=no)
102 ### Optimize for host cpu version
103 AC_ARG_ENABLE(cpu-optimization,     
104  [  --disable-cpu-optimization    no detection or tuning flags for cpu version],, enable_cpu_optimization=yes)
107 ### Vector machine inner loops
108 AC_ARG_ENABLE(vector,     
109  [  --enable-vector               create inner loops for a vector machine],, enable_vector=no)
110 if test "$enable_vector" = "yes"; then
111   AC_DEFINE(USE_VECTOR,,[Optimize for a vector architecture])
115 ### Simplewater hack for SGI - disabled unrolling is the same as simplewater=yes
116 AC_ARG_ENABLE(waterloop-unrolling,     
117  [  --disable-waterloop-unrolling expand the loops instead (hack for sgi)],, 
118 [case "${host_cpu}-${host_os}" in
119   mips*-irix*) enable_waterloop_unrolling=yes ;;
120   *) enable_waterloop_unrolling=no ;;
121 esac])
122 if test "$enable_waterloops_unrolling" = "no"; then
123   AC_DEFINE(SIMPLEWATER,,[Expand the water loops to three inner loops])
127 ### Turn off the special water-water loops on SGI...
128 AC_ARG_ENABLE(waterwater-loops,     
129  [  --disable-waterwater-loops    turn off double unrolled loops (hack for sgi)],,
130 [case "${host_cpu}-${host_os}" in
131   mips*-irix*) enable_waterwater_loops=no ;;
132   *) enable_waterwater_loops=yes ;;
133 esac])
134 if test "$enable_waterwater_loops" = "no"; then
135   AC_DEFINE(DISABLE_WATERWATER_LOOPS,,[Don't use special loops for water-water interactions])
139 ### Do software 1/sqrt(x)
140 AC_ARG_ENABLE(software-sqrt,     
141  [  --disable-software-sqrt       no software 1/sqrt (disabled on sgi,ibm,ia64)],,
142 [case "${host_cpu}-${host_os}" in
143   mips*-irix* | rs6000*-aix* | powerpc*-aix | ia64*-*) enable_software_sqrt=no ;;
144   *) enable_software_sqrt=yes ;;
145 esac])
146 if test "$enable_software_sqrt" = "yes"; then
147   AC_DEFINE(SOFTWARE_INVSQRT,,[Use the GROMACS software 1/sqrt(x)])
151 ### Vectorize 1/x
152 AC_ARG_ENABLE(vectorized-recip,     
153  [  --enable-vectorized-recip     vectorize LJ-only inner loops],, enable_vectorized_recip=no)
154 if test "$enable_vectorized_recip" = "yes"; then
155   AC_DEFINE(VECTORIZE_RECIP,,[Vectorize the reciprocal calculation])
156 else 
157   if test "$enable_vectorized_recip" != "no"; then
158     AC_MSG_ERROR([Vectorized reciprocal is only meaningful for normal LJ-only loops])
159   fi
162 ### Vectorize 1/sqrt(x)
163 AC_ARG_ENABLE(vectorized-sqrt,     
164  [  --enable-vectorized-sqrt=A,B  vectorize selected inner loops (default none)
165                                 choices: normal,solvent,water,water-water],, enable_vectorized_sqrt=not_selected)
166 # processing of vectorized_sqrt choices is done just before the final output stage!
169 # The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
170 # instructions dynamically at runtime, so they might not make much difference now:
172 ### Force prefetching
173 AC_ARG_ENABLE(prefetch,     
174  [  --enable-prefetch=A,B         prefetch forces in selected innerloops],, enable_prefetch=no)
175 # processing of prefetch choices is done just before the final output stage!
180 AC_ARG_ENABLE(all-static,
181  [  --enable-all-static           make completely static binaries],enable_all_static=yes, enable_all_static=no)
182 # Dont add the -all-static flag until after the compiler test.
184 ### Compile without FFTW - disabling it means you can't use PME or PPPM!
185 ### N.B.: This is only intended as a last resort, or for tests - don't use it!
186 AC_ARG_WITH(fftw,
187  [  --without-fftw          if you turn this off you cannot use PME/PPPM],, with_fftw=yes)
188 if test "$with_fftw" = "no"; then
189   AC_DEFINE(WITHOUT_FFTW,,[Disable all FFTW (and thus PME/PPPM) support])
195 ############################################################
196 # Checks for programs
197 ############################################################
199 # normally we use the default compiler, but on alpha/linux we try the compaq ones first
200 case "${host_cpu}-${host_os}" in
201   alpha*-linux*)
202     cc_names="ccc cc gcc"
203     f77_names="fort f77 g77"
204     ;;
205   *) 
206     cc_names="cc xlc gcc"
207     f77_names="f77 xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
208     ;;
209 esac
210 # the (non-mpi) c compiler, which is also used for programs executed during build stage
211 AC_PROG_CC( $cc_names )
212 # Check for environment variable CC_FOR_BUILD before overwriting it
213 if test -z "$CC_FOR_BUILD"; then
214   CC_FOR_BUILD=$CC
216 AC_SUBST(CC_FOR_BUILD) 
218 if test "$enable_fortran" = "yes"; then 
219   AC_PROG_F77( $f77_names )
220   if test -z "$F77"; then
221     AC_MSG_ERROR([No fortran compiler found])
222   fi
225 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
226 # above, since autoconf checks that the created file can be executed. This would
227 # fail on platforms where MPI executables can only be run through a batchqueue.
229 if test "$enable_mpi" = "yes"; then
230   AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)
231 # now change the normal cc to the MPI one - see the comment above.
232   CC=$MPICC
233   AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
234   AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
235     AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
236   AC_DEFINE(USE_MPI,,[Make a parallel version of GROMACS using MPI])
239 if test "$enable_threads" = "yes"; then
240    AC_MSG_CHECKING([for pthreads])
241    AC_MSG_RESULT([yes])
242 #  ACX_PTHREAD([],AC_MSG_ERROR([Cannot compile with pthreads; use --disable-threads])
245 if test "$enable_fortran" = "yes"; then
246   AC_F77_LIBRARY_LDFLAGS
247   AC_F77_WRAPPERS
250 AC_PROG_CPP
252 if test "$enable_cpu_optimization" = "yes"; then
253   ACX_DETECT_GMXCPU
254 else
255   gmxcpu=""
257 ACX_COMPILER_MAXOPT
259 # Check x86 asm prerequisites and the capabilities of as
260 if test "$enable_x86_asm" = "yes"; then
261   AC_MSG_CHECKING([whether your compiler can handle assembly files (*.s)])
262 cat > conftestasm.s << EOF
263 checkasm:
264         movl    %esp, %ebp
265         ret
267   if AC_TRY_COMMAND($CC -c conftestasm.s); then
268     if test -f conftestasm.o; then
269       AC_MSG_RESULT([yes])
270     else
271       AC_MSG_RESULT([no])
272       AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
273     fi
274   else
275     AC_MSG_RESULT([no])
276     AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
277   fi
279 # ok, gcc understands assembly, but can it handle SSE/3DNow/SSE2 instructions?
281   if test "$enable_float" = "no"; then
282     AC_MSG_CHECKING([whether as fully supports intel syntax SSE2])
283 cat > conftest.s << EOF
284 .intel_syntax noprefix 
285 checkasm:
286         emms
287         movupd xmm0,[[checkasm]]
288         emms
289         ret
291     if AC_TRY_COMMAND($CC -c conftest.s); then
292       AC_MSG_RESULT([yes])
293     else
294       AC_MSG_RESULT([no]) 
295       AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
296     fi
297     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} x86_cpuid.lo x86_sse2.lo"
298     AC_DEFINE([USE_X86_SSE2],,[Use X86 SSE2 multimedia assembly code])
299   else 
300     AC_MSG_CHECKING([whether as fully supports intel syntax SSE & 3DNow])
301 cat > conftest.s << EOF
302 .intel_syntax noprefix 
303 checkasm:
304         emms
305         pswapd mm0,mm0
306         movups xmm0,[[checkasm]]
307         emms
308         ret
310     if AC_TRY_COMMAND($CC -c conftest.s); then
311       AC_MSG_RESULT([yes])
312     else
313       AC_MSG_RESULT([no]) 
314       AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
315     fi
316     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} x86_cpuid.lo x86_sse.lo x86_3dnow.lo"
317     AC_DEFINE([USE_X86_SSE_AND_3DNOW],,[Use X86 SSE/3DNow multimedia assembly code])
318   fi
321 if test "$enable_ppc_altivec" = "yes"; then
322   if test "$enable_float" = "no"; then
323     AC_MSG_WARN([PowerPC Altivec loops can only be used in single precision - disabling])
324     enable_ppc_altivec=no
325   else 
326     AC_MSG_CHECKING([whether the compiler supports altivec extensions])
327     AC_TRY_COMPILE([],[
328 #ifndef __VEC__
329 choke_me
330 #endif
332     AC_MSG_RESULT([yes])
333     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} inner_altivec.lo"
334     AC_DEFINE([USE_PPC_ALTIVEC],,[Use PowerPC Altivec inner loops])],[
335       AC_MSG_RESULT([no])
336       AC_MSG_WARN([no altivec support found - On G4 and later Motorola PowerPC]
337 [CPUs you can get a HUGE performance gain by using an altivec-enabled compiler.]
338 [Download the latest devtools from Apple, or gcc-3.1 from ftp.gnu.org])
339       enable_ppc_altivec=no])
340   fi  
343 if test "$enable_axp_asm" = "yes"; then
344   case "${host_cpu}" in
345     alpha*) 
346       AC_DEFINE([USE_AXP_ASM],,[Use Alpha assembly for vectorized 1/sqrt])
347       cat > conftest.s << EOF
348 #ifdef __ELF__
349 .section .rodata
350 #else                   
351          .rdata
352 #endif  
354       if AC_TRY_COMMAND($CC -c conftest.s); then
355         AM_CONDITIONAL(AXP_ASM_CAPITAL_S,false)
356       else
357         AM_CONDITIONAL(AXP_ASM_CAPITAL_S,true)
358       fi
359       GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} axp_asm.lo"
360        ;;
361     *) ;;
362   esac
363 else
364   AM_CONDITIONAL(AXP_ASM_CAPITAL_S,false)
367 AC_PATH_PROG(IDENT,ident,no)
368 if test "$IDENT" != "no"; then
369   # seems as if we have the ident program, but does the
370   # compiler support it?
371   AC_MSG_CHECKING([whether the compiler supports ident])        
372   AC_TRY_CPP([#ident  "@(#) file.h 1.1 12/16/92"],[
373     AC_MSG_RESULT([yes]) 
374     AC_DEFINE(HAVE_IDENT,,[Does this machine have the ident command])],
375     AC_MSG_RESULT([no]))
378 # MPI builds on aix break with shared libs.
379 AC_DISABLE_SHARED
380 AC_PROG_LIBTOOL
381 AC_PROG_LN_S
382 AC_SYS_LARGEFILE
383 AC_FUNC_FSEEKO
388 ############################################################################
389 # Checks for libraries.
390 ############################################################################
392 # Don't add math library for intel compilers
393 if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
394   AC_MSG_NOTICE([Using built-in math library with intel compiler])
395 else
396   AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
399 #####
400 # IBM provides a MASS library with vectorized and optimized math stuff,
401 # and an xlopt library which partly overlaps this. They must come before
402 # libm in the link list, thus the test goes after that for libm!
403 if test "${host_vendor}" = "ibm"; then
404   AC_CHECK_LIB(xlopt,main)
405   AC_CHECK_LIB(mass,main)  
406   vectmass=no
407   case "$gmxcpu" in
408     power4*)
409         # first check for a power4 lib, then power3, power2.
410       AC_SEARCH_LIBS(vsrsqrt,massvp4 massvp3 massvp2 massv,[vectmass=yes]) ;;
411     power3*)
412       AC_SEARCH_LIBS(vsrsqrt,massvp3 massvp2 massv,[vectmass=yes]) ;;
413     power2*)
414       AC_SEARCH_LIBS(vsrsqrt,massvp2 massv,[vectmass=yes]) ;;
415     *)
416       AC_CHECK_LIB(massv,vsrsqrt,[vectmass=yes LIBS="$LIBS -lmassv"]) ;;
417   esac
418   if test "$vectmass" = "yes"; then
419     AC_DEFINE(HAVE_LIBMASSV_ANY,,[Use vectorized routines in the IBM MASS library])
420     if test "$enable_vectorized_recip" = "not_selected"; then
421       AC_MSG_NOTICE([vector MASS lib present - vectorizing 1/x inner loops])
422       enable_vectorized_recip="yes"
423     fi
424     if test "$enable_vectorized_sqrt" = "not_selected"; then
425       AC_MSG_NOTICE([vector MASS lib present - vectorizing 1/sqrt inner loops])
426       enable_vectorized_sqrt="yes"
427     fi    
428   else
429     echo "******************************************************************************"
430     echo "*Didn't find the IBM MASS library. It's not necessary, but can provide 20%   *"
431     echo "*performance improvement by loop vectorization. Add the library search path  *"
432     echo "*with -L in the LDFLAGS variable. If you cannot find MASS, download it from  *"
433     echo "*http://www.research.ibm.com/mass                                            *"
434     echo "******************************************************************************"
435   fi
436 fi 
438 if test "$with_fftw" = "yes"; then
439   if test "$enable_float" = "yes"; then
440     sizeof_real=4
441   else 
442     sizeof_real=8
443   fi
445   ACX_CHECK_FFTW(fftw,$sizeof_real)
446   ACX_CHECK_FFTW(rfftw,$sizeof_real)
448   if test "$enable_mpi" = "yes"; then
449     ACX_CHECK_FFTW(fftw_mpi,$sizeof_real)
450     ACX_CHECK_FFTW(rfftw_mpi,$sizeof_real)
451   fi
453   case ${ac_fftw_savedprefix} in
454    d) AC_DEFINE(FFTW_NAME_DFFTW,,[Use the d prefix on fftw includes]) ;;
455    s) AC_DEFINE(FFTW_NAME_SFFTW,,[Use the s prefix on fftw includes]) ;;
456    *) AC_DEFINE(FFTW_NAME_FFTW,,[Dont use any prefix on fftw includes]) ;;
457   esac
458 else
459   echo "*******************************************************************"
460   echo "*             WARNING! You have disabled FFTW support!            *"
461   echo "* You will not be able to use PME (Particle Mesh Ewald) summation *"
462   echo "* in your simulations. Unless you are absolutely sure you won't   *"
463   echo "* ever need this we suggest you install FFTW instead of compiling *"
464   echo "* a version of GROMACS that will be crippled!                     *"
465   echo "*******************************************************************"
466 fi # end of fftw check
468 ######
469 # check for xtc headers
470 case "${host_os}" in
471 cygwin* | mingw*)   # use our own xdr stuff for cygwin/mingw
472   GMXLIB_LIBOBJS="$GMXLIB_LIBOBJS gmx_system_xdr.lo"
473   ;;
475   AC_CHECK_HEADERS([rpc/rpc.h])
476   AC_CHECK_HEADERS([rpc/xdr.h],,,
477 [#if HAVE_RPC_RPC_H
478 # include <rpc/rpc.h>
479 #endif
481   AC_CHECK_LIB(nsl,xdr_float)
482   AC_TRY_LINK([
483 #if HAVE_RPC_RPC_H
484 #include<rpc/rpc.h> 
485 #else
486 #error NO rpc.h header
487 #endif
488 #if HAVE_RPC_XDR_H
489 #include<rpc/xdr.h>
490 #else
491 #error No xdr.h header
492 #endif
493 ],[ XDR *xd; float f; xdr_float(xd,&f);],[have_xdr="yes"])
495   if test "$have_xdr" != "yes"; then
496     AC_DEFINE(USE_GMX_XDR,,[Use our own instead of system XDR libraries])       
497       GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} gmx_system_xdr.lo"
498     AC_MSG_WARN([Couldn't find XDR headers and/or libraries - using our own])
499   fi
500   ;;
501 esac
503 #####
504 # Checks for additional and/or optional functions or libraries.
505 #AC_FUNC_MALLOC
506 AC_FUNC_MEMCMP
507 AC_TYPE_SIGNAL
508 AC_FUNC_VPRINTF
509 AM_WITH_DMALLOC
510 AC_CHECK_FUNCS(strcasecmp)
511 AC_CHECK_FUNCS(strdup)
513 #####
514 # Look for X
515 AC_PATH_XTRA
516 # try to find motif headers and libraries
517 AC_FIND_MOTIF
518 use_motif=no
519 if test "$motif_libraries" != "no"; then
520   if test "$motif_includes" != "no"; then
521     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} mgmx.lo widget.lo"
522     use_motif=yes
523   else
524     AC_MSG_NOTICE([Both libraries and includes are needed for Motif - disabling.])
525     motif_includes=no
526   fi
528 if test "$no_x" != "yes"; then
529   LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
530   INCLUDES="$INCLUDES $X_CFLAGS $MOTIF_CFLAGS" 
531   AM_CONDITIONAL(USE_X11,true)
532 else
533   AM_CONDITIONAL(USE_X11,false)
536 #########
537 # Check for libxml2, but it is optional, so dont stop
538 # if it isnt there.
539 AC_CHECK_LIB(xml2,main)
540 # This should really only be done when the library is found. Doesn't hurt though.
541 INCLUDES="$INCLUDES -I/usr/include/libxml2"
544 #### 
545 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
546 # and we need -L/usr/ucblib to find libucb... (stupid OS)
547 # On e.g. ibm the mass libraries must come before -lm... 
548 case "${host_cpu}-${host_os}" in
549   *-solaris*) 
550     LIBS="$FLIBS $LIBS" 
551     LDFLAGS="$LDFLAGS -L/usr/ucblib"
552     ;;
553   *) LIBS="$LIBS $FLIBS" ;;
554 esac
563 ########################################################################
564 # Checks for header files and types
565 ########################################################################
567 AC_CHECK_HEADERS([limits.h strings.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
568 AC_CHECK_HEADERS(unistd.h)
570 #####
571 # Checks for typedefs, structures, and compiler characteristics.
572 AC_C_CONST
573 AC_TYPE_SIZE_T
574 AC_STRUCT_TM
575 AC_TYPE_UID_T
576 AC_C_INLINE
577     
583 case "${host_cpu}" in
584    i?86) 
585       # disable x86trunc if inlined assembly doesnt work 
586       AC_MSG_CHECKING(if the C compiler supports inline assembly)
587       AC_TRY_LINK([],[float f;int i; asm("fld %1\nfistpl %0\n" : "=m" (*&i) : "f" (f));],[AC_MSG_RESULT(yes)
588 AC_DEFINE(USE_X86TRUNC,,[Use inline assembly truncation for x86 cpu])],[AC_MSG_RESULT(no)])
589         ;;      
590    *) enable_x86_asm=no ;;
591 esac
598 ########################################################################
599 # Process vectorization and prefetch options for inner loops
600 ########################################################################
601 # check which loops to vectorize
602 list_of_vectorized_sqrt=""
603 if test "$enable_vectorized_sqrt" != "no"; then
604   if test "$enable_vectorized_sqrt" = "yes" -o "$enable_vectorized_sqrt" = "all" ; then
605     enable_vectorized_sqrt="normal,solvent,water,water-water"
606   fi
607   if echo $enable_vectorized_sqrt | grep "normal" >/dev/null; then
608     list_of_vectorized_sqrt="normal "
609     AC_DEFINE(VECTORIZE_INVSQRT,,[Vectorize 1/sqrt(x) in normal loops])
610   fi
611   if echo $enable_vectorized_sqrt | grep "solvent" >/dev/null; then
612     list_of_vectorized_sqrt="${list_of_vectorized_sqrt}solvent "
613     AC_DEFINE(VECTORIZE_INVSQRT_S,,[Vectorize 1/sqrt(x) in solvent loops])
614   fi
615   if echo $enable_vectorized_sqrt | sed 's/water-water//' | grep "water" >/dev/null; then
616     list_of_vectorized_sqrt="${list_of_vectorized_sqrt}water "
617     AC_DEFINE(VECTORIZE_INVSQRT_W,,[Vectorize 1/sqrt(x) in water loops])
618   fi
619   if echo $enable_vectorized_sqrt | grep "water-water" >/dev/null; then
620     list_of_vectorized_sqrt="${list_of_vectorized_sqrt}water-water "
621     AC_DEFINE(VECTORIZE_INVSQRT_WW,,[Vectorize 1/sqrt(x) in water-water loops])
622   fi
624 if test -z "$list_of_vectorized_sqrt"; then
625   list_of_vectorized_sqrt="no"
630 # check loops to prefetch forces in
631 list_of_prefetch=""
632 if test "$enable_prefetch" != "no"; then
633   if test "$enable_prefetch" = "yes" -o "$enable_prefetch" = "all"; then
634     enable_prefetch="normal,solvent,water,water-water"
635   fi
636   if echo $enable_prefetch | grep "normal" >/dev/null; then
637     list_of_prefetch="normal "
638     AC_DEFINE(PREFETCH,,[Prefetch coordinates in normal loops])
639   fi
640   if echo $enable_prefetch | grep "solvent" >/dev/null; then
641     list_of_prefetch="${list_of_prefetch}solvent "
642     AC_DEFINE(PREFETCH_S,,[Prefetch coordinates in solvent loops])
643   fi
644   if echo $enable_prefetch | sed 's/water-water//' | grep "water"; then
645     list_of_prefetch="${list_of_prefetch}water "
646     AC_DEFINE(PREFETCH_W,,[Prefetch coordinates in water loops])
647   fi
648   if echo $enable_prefetch | grep "water-water" >/dev/null; then
649     list_of_prefetch="${list_of_prefetch}water-water "
650     AC_DEFINE(PREFETCH_WW,,[Prefetch coordinates in water-water loops])
651   fi
653 if test -z "$list_of_prefetch"; then
654   list_of_prefetch="no"
664 ########################################################################
665 # Final output stage
666 ########################################################################
667 AS="$CC"
668 AC_SUBST(ASFLAGS)
669 AC_SUBST(AS)
670 AC_SUBST(INCLUDES)          # should be automatic, but doesnt seem to be?
671 AC_SUBST(GMXLIB_LIBOBJS)
672 AC_SUBST(MDLIB_LIBOBJS)
673 AC_SUBST(GMXANA_LIBOBJS)
675 # To tell libraries apart, we use four versions of the name. For instance, libgmx:
676 # libgmx                single prec, no mpi.
677 # libgmx_d              double prec, no mpi.
678 # libgmx_mpi            single prec, mpi.
679 # libgmx_mpi_d          double prec, mpi.
680 # However, the non-suffixed names are linked to the _mpi and/or _d suffixed
681 # ones upon installation if that is the only version available.
683 if test "$enable_mpi" = "yes"; then
684   LIBSUFFIX="_mpi"
686 if test "$enable_float" = "no"; then
687   LIBSUFFIX="${LIBSUFFIX}_d"
689 AC_SUBST(LIBSUFFIX) 
691 # Unless the user has explicitly requested a prefix/suffix/transform, we
692 # use _d on double precision files. Don't add anything for mpi, but at the
693 # end we tell the user it is possible and smart to do in some cases!
694 if test "$program_transform_name" = "s,x,x,"; then
695   name_transform_provided=no;
696   if test "$enable_float" = "no"; then
697     program_transform_name="s,\$\$,_d,"
698   fi
699 else
700   name_transform_provided=yes;
703 # Set exec-prefix from the architecture and cpu, unless it was 
704 # explicitly given by the user.
705 if test "$exec_prefix" = "NONE"; then
706   arch_exec_prefix=yes; 
707   if test -n "$gmxcpu"; then
708     exec_prefix="\${prefix}/${host}/${gmxcpu}"
709   else
710     exec_prefix="\${prefix}/${host}"
711   fi
713 AC_SUBST(exec_prefix)
717 #If the prefix doesn't contain "gromacs" or "gmx" and the datadir
718 #wasn't explicitly specified we add gromacs to the end of datadir:
719 if test "$datadir" = "\${prefix}/share" -a -z "`echo ${prefix} | grep gromacs`"; then
720   if test "${prefix}" != "NONE" -a -z "`echo ${prefix} | grep gromacs`" -a -z "`echo ${prefix} | grep gmx`"; then
721     datadir="\${prefix}/share/gromacs"
722   fi
724 AC_SUBST(datadir)
726 #If the prefix doesn't contain "gromacs" or "gmx" and the includedir
727 #wasn't explicitly specified we add gromacs to the end of includedir:
728 if test "$includedir" = "\${prefix}/include" -a -z "`echo ${prefix} | grep gromacs`"; then
729   if test "${prefix}" != "NONE" -a -z "`echo ${prefix} | grep gromacs`" -a -z "`echo ${prefix} | grep gmx`"; then
730     includedir="\${prefix}/include/gromacs"
731   fi
733 AC_SUBST(includedir)
735 # automake has started to put the man pages under share, and says it
736 # should be so according to FHS, but this is still debated so we keep
737 # the old setup unless the user says different.
738 if test "$mandir" = "\${prefix}/share/man"; then
739   mandir="\${prefix}/man"
740   AC_SUBST(mandir)
743 # Use a variable for RPM - this way it can be 
744 # overridden with make RPM=rpm3 rpm
745 RPM=rpm
746 AC_SUBST(RPM)
749 if test "$enable_all_static" = "yes"; then
750   LDFLAGS="$LDFLAGS -all-static"
753 # we have asm source, so this is necessary for automake 1.6
754 CCAS=$CC
755 CCASFLAGS=$CFLAGS
757 AC_SUBST(CCAS)
758 AC_SUBST(CCASFLAGS)
760 AC_CONFIG_FILES([ Makefile src/Makefile src/gmxlib/Makefile include/Makefile include/types/Makefile src/mdlib/Makefile src/kernel/Makefile src/tools/Makefile src/ngmx/Makefile src/contrib/Makefile scripts/Makefile admin/Makefile share/Makefile share/tutor/Makefile share/tutor/gmxdemo/Makefile share/tutor/nmr1/Makefile share/tutor/nmr2/Makefile share/tutor/water/Makefile share/tutor/mixed/Makefile share/tutor/methanol/Makefile share/tutor/speptide/Makefile share/template/Makefile share/top/Makefile share/html/Makefile share/html/images/Makefile share/html/online/Makefile man/Makefile man/man1/Makefile ])
762 AC_OUTPUT
770 #########################################################
771 # Echo some important info, to avoid stupid mistakes
774 echo ""
775 echo "GROMACS is ready to compile."
777 eval "show_path=`echo ${exec_prefix} | sed -e s,NONE,${ac_default_prefix},`"
778 eval "show_datadir=`echo ${datadir} | sed -e s,NONE,${ac_default_prefix},`"
779 echo ""
780 echo "* Binaries and libraries for this host will be installed in"
781 echo "    ${show_path}/bin" 
782 echo "    ${show_path}/lib" 
783 echo "  and shared data will placed in"
784 echo "    ${show_datadir}"
785 echo "  (You can set this with --prefix, --exec-prefix and --datadir)"
788 if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
789   echo ""
790   echo "* You are compiling a double precision version of the package -"
791   echo "  program names will be suffixed with _d to avoid overwriting single"
792   echo "  precision files. You can override it with --program-suffix"
795 if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
796   echo ""
797   echo "* Seems you are compiling with MPI support. You can install the MPI-"
798   echo "  enabled programs with suffixed names to have both MPI and non-MPI"
799   echo "  versions. This is useful e.g. on supercomputers where you usually"
800   echo "  cannot run MPI-linked programs on the login node."
801   echo "  Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
802   echo "  You only need MPI for mdrun, so if you already have non-MPI stuff"
803   echo "  installed you can issue make mdrun; make install-mdrun."
806 if test "$enable_shared" = "yes"; then
807   echo ""
808   echo "* To save space, you might want to use shared libraries."
809   echo "  This should work on almost any platform, but since there are"
810   echo "  a few exceptions (MPI builds on aix) it is not used by default."
811   echo "  Turn it on with --enable-shared."
813 echo ""