Fixed several compiler warnings, and a bug in PME that I caused in pme.c version...
[alexxy/gromacs.git] / configure.ac
1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
4
5 AC_PREREQ(2.50)
6 AC_INIT(GROMACS, 3.0, gromacs@gromacs.org)
7 AC_CONFIG_SRCDIR(src/gmxlib/3dview.c)
8 AC_CONFIG_AUX_DIR(config)
9 AC_CANONICAL_HOST
10
11 AM_INIT_AUTOMAKE(gromacs, 3.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="1:0:0"
17 AC_SUBST(SHARED_VERSION_INFO)
18
19
20
21
22
23
24 #######################################################################
25 # Simple options and makefile variables
26 #######################################################################
27
28
29 ### Single/Double
30 AC_ARG_ENABLE(float,
31  [  --disable-float               use double instead of single precision],, enable_float=yes)
32 if test "$enable_float" = "no"; then
33   AC_DEFINE(DOUBLE,,[Compile in double precision])
34   AM_CONDITIONAL(DOUBLE,true)
35 fi
36
37 ### Fortran or not
38 AC_ARG_ENABLE(fortran,
39  [  --enable-fortran              use fortran (default on sgi,ibm,sun,axp)],, 
40 [case "${host_cpu}-${host_os}" in
41   sparc*-solaris* | alpha*-* | rs6000*-aix* | powerpc*-aix* | mips*-irix*) enable_fortran=yes ;;
42   *) enable_fortran=no ;;
43  esac])
44 if test "$enable_fortran" = "yes"; then
45   AC_DEFINE(USE_FORTRAN,,[Use Fortran for innerloops and some other core stuff])
46   GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} innerf.lo f77_wrappers.lo"
47   if test "$enable_float" = "yes"; then
48     MDLIB_LIBOBJS="${MDLIB_LIBOBJS} flincs.lo fsettle.lo fshake.lo"
49   else
50     MDLIB_LIBOBJS="${MDLIB_LIBOBJS} flincsd.lo fsettled.lo fshaked.lo"
51   fi
52 else
53   GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} innerc.lo"
54   MDLIB_LIBOBJS="${MDLIB_LIBOBJS} clincs.lo csettle.lo cshake.lo"
55 fi
56
57
58 ### MPI or not
59 AC_ARG_ENABLE(mpi,
60  [  --enable-mpi                  compile for parallel runs using MPI],,enable_mpi=no)
61
62
63 ### MPI environment
64 AC_ARG_WITH(mpi-environment,
65  [  --enable-mpi-environment=VAR  only start parallel runs when VAR is set],,
66 [case "${host_cpu}" in
67   mips*-irix*) enable_mpi_environment="MPI_ENVIRONMENT" ;;
68   *) enable_mpi_environment=no ;;
69 esac])
70 if test "$enable_mpi_environment" != "no"; then
71   AC_DEFINE_UNQUOTED(CHECK_MPI_ENV,"$enable_mpi_environment",[If defined, only start MPI runs when this variable is set])
72 fi
73
74
75 ### X86 assembly code
76 AC_ARG_ENABLE(x86_asm,     
77  [  --disable-x86-asm             don't build assembly loops on x86],,enable_x86_asm=yes)
78 case "${host_cpu}" in
79    i?86) ;;     
80    *) enable_x86_asm=no ;;
81 esac
82
83
84 ### Optimize for host cpu version
85 AC_ARG_ENABLE(cpu-optimization,     
86  [  --disable-cpu-optimization    no detection or tuning flags for cpu version],, enable_cpu_optimization=yes)
87
88
89 ### Vector machine inner loops
90 AC_ARG_ENABLE(vector,     
91  [  --enable-vector               create inner loops for a vector machine],, enable_vector=no)
92 if test "$enable_vector" = "yes"; then
93   AC_DEFINE(USE_VECTOR,,[Optimize for a vector architecture])
94 fi
95
96
97 ### Simplewater hack for SGI - disabled unrolling is the same as simplewater=yes
98 AC_ARG_ENABLE(waterloop-unrolling,     
99  [  --disable-waterloop-unrolling expand the loops instead (hack for sgi)],, 
100 [case "${host_cpu}-${host_os}" in
101   mips*-irix*) enable_waterloop_unrolling=yes ;;
102   *) enable_waterloop_unrolling=no ;;
103 esac])
104 if test "$enable_waterloops_unrolling" = "no"; then
105   AC_DEFINE(SIMPLEWATER,,[Expand the water loops to three inner loops])
106 fi
107
108
109 ### Turn off the special water-water loops on SGI...
110 AC_ARG_ENABLE(waterwater-loops,     
111  [  --disable-waterwater-loops    turn off double unrolled loops (hack for sgi)],,
112 [case "${host_cpu}-${host_os}" in
113   mips*-irix*) enable_waterwater_loops=no ;;
114   *) enable_waterwater_loops=yes ;;
115 esac])
116 if test "$enable_waterwater_loops" = "no"; then
117   AC_DEFINE(DISABLE_WATERWATER_LOOPS,,[Don't use special loops for water-water interactions])
118 fi
119
120
121 ### Do software 1/x
122 AC_ARG_ENABLE(software-recip,     
123  [  --enable-software-recip       perform software 1/x],, enable_software_recip=no)
124 if test "$enable_software_recip" = "yes"; then
125   AC_DEFINE(SOFTWARE_RECIP,,[Use the GROMACS software 1/x])
126 fi
127
128
129 ### Do software 1/sqrt(x)
130 AC_ARG_ENABLE(software-sqrt,     
131  [  --disable-software-sqrt       no software 1/sqrt (disabled on sgi,rs6000)],,
132 [case "${host_cpu}-${host_os}" in
133   mips*-irix* | rs6000*-aix*) enable_software_sqrt=no ;;
134   *) enable_software_sqrt=yes ;;
135 esac])
136 if test "$enable_software_sqrt" = "yes"; then
137   AC_DEFINE(SOFTWARE_SQRT,,[Use the GROMACS software 1/sqrt(x)])
138 fi
139
140
141 ### Vectorize 1/x
142 AC_ARG_ENABLE(vectorized-recip,     
143  [  --enable-vectorized-recip     vectorize LJ-only inner loops],, enable_vectorized_recip=no)
144 if test "$enable_vectorized_recip" = "yes"; then
145   AC_DEFINE(VECTORIZE_RECIP,,[Vectorize the reciprocal calculation])
146 else 
147   if test "$enable_vectorized_recip" != "no"; then
148     AC_MSG_ERROR([Vectorized reciprocal is only meaningful for normal LJ-only loops])
149   fi
150 fi
151
152 ### Vectorize 1/sqrt(x)
153 AC_ARG_ENABLE(vectorized-sqrt,     
154  [  --enable-vectorized-sqrt=A,B  vectorize selected inner loops (default none)
155                                 choices: normal,solvent,water,water-water],, enable_vectorized_sqrt=not_selected)
156 # processing of vectorized_sqrt choices is done just before the final output stage!
157
158
159 # The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
160 # instructions dynamically at runtime, so they might not make much difference now:
161
162 ### Coordinate prefetching
163 AC_ARG_ENABLE(prefetch-x,     
164  [  --enable-prefetch-x=A,B       prefetch coordinates in selected innerloops],, enable_prefetch_x=no)
165 # processing of prefetch-x choices is done just before the final output stage!
166
167
168 ### Force prefetching
169 AC_ARG_ENABLE(prefetch-f,     
170  [  --enable-prefetch-f=A,B       prefetch forces in selected innerloops],, enable_prefetch_f=no)
171 # processing of prefetch-f choices is done just before the final output stage!
172
173
174 ### First load all coords in a water-water iteration, then square all pairs, then add the sums to get r2.
175 AC_ARG_ENABLE(hide-square-latency,     
176  [  --enable-hide-square-latency  load coords to cache in advance],, enable_hide_square_latency=no)
177 if test "$enable_hide_square_latency" = "yes"; then
178   AC_DEFINE(DECREASE_SQUARE_LATENCY,,[Try to get coordinates to cache before using them])
179 fi
180
181
182 ### Do the table lookups for all interactions between two water molecules before using the results
183 AC_ARG_ENABLE(hide-table-latency,     
184  [  --enable-hide-table-latency   load table data to cache in advance],, enable_hide_table_latency=no)
185 if test "$enable_hide_table_latency" = "yes"; then
186   AC_DEFINE(DECREASE_LOOKUP_LATENCY,,[Try to get table data to cache before using it])
187 fi
188
189
190
191 ### Compile without FFTW - disabling it means you can't use PME or PPPM!
192 ### N.B.: This is only intended as a last resort, or for tests - don't use it!
193 AC_ARG_WITH(fftw,
194  [  --without-fftw          if you turn this off you cannot use PME/PPPM],, with_fftw=yes)
195 if test "$with_fftw" = "no"; then
196   AC_DEFINE(WITHOUT_FFTW,,[Disable all FFTW (and thus PME/PPPM) support])
197 fi
198
199
200
201
202
203
204
205
206 ############################################################
207 # Checks for programs
208 ############################################################
209
210 # normally we use the default compiler, but on alpha/linux we try the compaq ones first
211 case "${host_cpu}-${host_os}" in
212   alpha*-linux*)
213     cc_names="ccc cc gcc"
214     f77_names="fort f77 g77"
215     ;;
216   *) 
217     cc_names="cc xlc gcc"
218     f77_names="f77 xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
219     ;;
220 esac
221 # the (non-mpi) c compiler, which is also used for programs executed during build stage
222 AC_PROG_CC( $cc_names )
223 # Check for environment variable CC_FOR_BUILD before overwriting it
224 if test -z "$CC_FOR_BUILD"; then
225   CC_FOR_BUILD=$CC
226 fi
227 AC_SUBST(CC_FOR_BUILD) 
228
229
230 if test "$enable_fortran" = "yes"; then
231   AC_PROG_F77( $f77_names )
232   if test -z "$F77"; then
233     AC_MSG_ERROR([No fortran compiler found])
234   fi
235 fi
236
237 # This is a libtool hack. We never use c++, but libtool supports it and
238 # thus there are macros that require it. For some reason, these macros are
239 # always expanded by the libtool scripts, unless the are already present 
240 # in the file. Thus, we include them here but never run them...
241 if test 1 = 0; then
242   AC_PROG_CXX
243   AC_PROG_CXXCPP
244 fi
245
246 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
247 # above, since autoconf checks that the created file can be executed. This would
248 # fail on platforms where MPI executables can only be run through a batchqueue.
249
250 if test "$enable_mpi" = "yes"; then
251   AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)      
252 # now change the normal cc to the MPI one - see the comment above.
253   CC=$MPICC
254   AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
255   AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
256     AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
257   AC_DEFINE(USE_MPI,,[Make a parallel version of GROMACS using MPI])
258   GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} mpiio.lo" 
259 else
260   GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} libnet.lo" 
261 fi
262
263 if test "$enable_fortran" = "yes"; then
264   AC_F77_LIBRARY_LDFLAGS  
265   AC_F77_WRAPPERS 
266 fi
267
268 AC_PROG_CPP
269
270 if test "$enable_cpu_optimization" = "yes"; then
271   ACX_DETECT_GMXCPU
272 else
273   gmxcpu=""
274 fi
275 ACX_COMPILER_MAXOPT
276
277 # Check x86 asm prerequisites and the capabilities of as
278 if test "$enable_x86_asm" = "yes"; then
279   if test "$enable_float" = "no"; then
280     AC_MSG_WARN([x86 assembly loops can only be used in single precision - disabling])
281     enable_x86_asm=no
282   else 
283     AC_MSG_CHECKING([whether as fully supports intel syntax])
284 cat > conftest.s << EOF
285 .intel_syntax noprefix 
286 checkasm:
287         emms
288         pswapd mm0,mm0
289         movups xmm0,[checkasm]
290         emms
291         ret
292 EOF
293     if AC_TRY_COMMAND($CC -c conftest.s); then
294       AC_MSG_RESULT([yes])
295     else
296       AC_MSG_RESULT([no]) 
297       AC_MSG_ERROR([Upgrade to a more recent binutils, download the as executable]     
298                    [from www.gromacs.org, or disable assembly loops.])
299     fi
300     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} x86_cpuid.lo x86_sse.lo x86_3dnow.lo"
301     AC_DEFINE([USE_X86_ASM],,[Use X86 SSE/3DNow multimedia assembly code])
302   fi
303 fi
304
305 case "${host_cpu}" in
306   alpha*) 
307     AC_DEFINE([USE_AXP_ASM],,[Use Alpha assembly for vectorized 1/sqrt])
308     cat > conftest.s << EOF
309 #ifdef __ELF__
310 .section .rodata
311 #else                   
312          .rdata
313 #endif  
314 EOF
315     AM_CONDITIONAL(AXP_ASM_CAPITAL_S,!(AC_TRY_COMMAND($CC -c conftest.s)))
316     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} axp_asm.lo"
317      ;;
318   *) ;;
319 esac
320
321 AC_PATH_PROG(IDENT,ident,no)
322 if test "$IDENT" != "no"; then
323   # seems as if we have the ident program, but does the
324   # compiler support it?
325   AC_MSG_CHECKING([whether the compiler supports ident])        
326   AC_TRY_CPP([#ident  "@(#) file.h 1.1 12/16/92"],[
327     AC_MSG_RESULT([yes]) 
328     AC_DEFINE(HAVE_IDENT,,[Does this machine have the ident command])],
329     AC_MSG_RESULT([no]))
330 fi
331
332 AC_PROG_LIBTOOL
333 AC_PROG_LN_S
334
335
336
337
338
339
340 ############################################################################
341 # Checks for libraries.
342 ############################################################################
343 AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
344
345 #####
346 # IBM provides a MASS library with vectorized and optimized math stuff,
347 # and an xlopt library which partly overlaps this. They must come before
348 # libm in the link list, thus the test goes after that for libm!
349 if test "${host_vendor}" = "ibm"; then
350   AC_CHECK_LIB(xlopt,main)
351   AC_CHECK_LIB(mass,main)  
352   vectmass=no
353   case "$gmxcpu" in
354     power4*)
355         # first check for a power4 lib, then power3, power2.
356       AC_SEARCH_LIBS(vsrsqrt,massvp4 massvp3 massvp2 massv,[vectmass=yes]) ;;
357     power3*)
358       AC_SEARCH_LIBS(vsrsqrt,massvp3 massvp2 massv,[vectmass=yes]) ;;
359     power2*)
360       AC_SEARCH_LIBS(vsrsqrt,massvp2 massv,[vectmass=yes]) ;;
361     *)
362       AC_CHECK_LIB(massv,vsrsqrt,[vectmass=yes LIBS="$LIBS -lmassv"]) ;;
363   esac
364   if test "$vectmass" = "yes"; then
365     AC_DEFINE(HAVE_LIBMASSV_ANY,,[Use vectorized routines in the IBM MASS library])
366     if test "$enable_vectorized_recip" = "not_selected"; then
367       AC_MSG_NOTICE([vector MASS lib present - vectorizing 1/x inner loops])
368       enable_vectorized_recip="yes"
369     fi
370     if test "$enable_vectorized_sqrt" = "not_selected"; then
371       AC_MSG_NOTICE([vector MASS lib present - vectorizing 1/sqrt inner loops])
372       enable_vectorized_sqrt="yes"
373     fi    
374   else
375     echo "******************************************************************************"
376     echo "*Didn't find the IBM MASS library. It's not necessary, but can provide 20%   *"
377     echo "*performance improvement by loop vectorization. Add the library search path  *"
378     echo "*with -L in the LDFLAGS variable. If you cannot find MASS, download it from  *"
379     echo "*http://www.research.ibm.com/mass                                            *"
380     echo "******************************************************************************"
381   fi
382 fi 
383
384 if test "$with_fftw" = "yes"; then
385   if test "$enable_float" = "yes"; then
386     sizeof_real=4
387   else 
388     sizeof_real=8
389   fi
390
391   ACX_CHECK_FFTW(fftw,$sizeof_real)
392   ACX_CHECK_FFTW(rfftw,$sizeof_real)
393
394   if test "$enable_mpi" = "yes"; then
395     ACX_CHECK_FFTW(fftw_mpi,$sizeof_real)
396     ACX_CHECK_FFTW(rfftw_mpi,$sizeof_real)
397   fi
398
399   case ${ac_fftw_savedprefix} in
400    d) AC_DEFINE(FFTW_NAME_DFFTW,,[Use the d prefix on fftw includes]) ;;
401    s) AC_DEFINE(FFTW_NAME_SFFTW,,[Use the s prefix on fftw includes]) ;;
402    *) AC_DEFINE(FFTW_NAME_FFTW,,[Dont use any prefix on fftw includes]) ;;
403   esac
404 else
405   echo "*******************************************************************"
406   echo "*             WARNING! You have disabled FFTW support!            *"
407   echo "* You will not be able to use PME (Particle Mesh Ewald) summation *"
408   echo "* in your simulations. Unless you are absolutely sure you won't   *"
409   echo "* ever need this we suggest you install FFTW instead of compiling *"
410   echo "* a version of GROMACS that will be crippled!                     *"
411   echo "*******************************************************************"
412 fi # end of fftw check
413
414 ######
415 # check for xtc headers
416 AC_CHECK_HEADERS(rpc/rpc.h rpc/xdr.h,
417 [# check for xtc libs if we found headers - on solaris the xdr stuff is in libnsl
418 AC_CHECK_LIB(nsl,xdr_float)
419 AC_TRY_LINK([#include<rpc/rpc.h> 
420 #include<rpc/xdr.h>],[ XDR *xd; float f; xdr_float(xd,&f);],
421 [have_xdr=yes],AC_MSG_WARN([RPC/XDR libraries not found - disabling xtc]))
422 ],AC_MSG_WARN([RPC/XDR include headers not found - disabling xtc]))
423
424 if test "$have_xdr" = "yes"; then
425   AC_DEFINE(USE_XDR,,[Use portable trajectory routines])
426 else
427   echo "*****************************************************************************"
428   echo "*WARNING - XDR not found. This cripples GROMACS significantly - you cannot  *"
429   echo "*read/write portable trajectories. No choice on windows, but locate the RPC *"
430   echo "*header files and libraries if you run UNIX - they do exist!                *"
431   echo "*****************************************************************************"
432 fi
433
434 #####
435 # Checks for additional and/or optional functions or libraries.
436 #AC_FUNC_MALLOC
437 AC_FUNC_MEMCMP
438 AC_TYPE_SIGNAL
439 AC_FUNC_VPRINTF
440 AM_WITH_DMALLOC
441 AC_CHECK_FUNCS(strcasecmp)
442 AC_CHECK_FUNCS(strdup)
443
444 #####
445 # Look for X
446 AC_PATH_XTRA
447 # try to find motif headers and libraries
448 AC_FIND_MOTIF
449 use_motif=no
450 if test "$motif_libraries" != "no"; then
451   if test "$motif_includes" != "no"; then
452     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} mgmx.lo widget.lo"
453     use_motif=yes
454   else
455     AC_MSG_NOTICE([Both libraries and includes are needed for Motif - disabling.])
456     motif_includes=no
457   fi
458 fi
459 if test "$no_x" != "yes"; then
460   LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
461   INCLUDES="$INCLUDES $X_CFLAGS $MOTIF_CFLAGS" 
462   AM_CONDITIONAL(USE_X11,true)
463 else
464   AM_CONDITIONAL(USE_X11,false)
465 fi
466
467 #### 
468 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
469 # and we need -L/usr/ucblib to find libucb... (stupid OS)
470 # On e.g. ibm the mass libraries must come before -lm... 
471 case "${host_cpu}-${host_os}" in
472   *-solaris*) 
473     LIBS="$FLIBS $LIBS" 
474     LDFLAGS="$LDFLAGS -L/usr/ucblib"
475     ;;
476   *) LIBS="$LIBS $FLIBS" ;;
477 esac
478
479
480
481
482
483
484
485
486 ########################################################################
487 # Checks for header files and types
488 ########################################################################
489
490 AC_CHECK_HEADERS([limits.h malloc.h strings.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
491 AC_CHECK_HEADERS(unistd.h)
492
493 #####
494 # Checks for typedefs, structures, and compiler characteristics.
495 AC_C_CONST
496 AC_TYPE_SIZE_T
497 AC_STRUCT_TM
498 AC_TYPE_UID_T
499 AC_C_INLINE
500     
501
502
503
504
505
506
507
508
509
510
511
512 ########################################################################
513 # Process vectorization and prefetch options for inner loops
514 ########################################################################
515 # check which loops to vectorize
516 list_of_vectorized_sqrt=""
517 if test "$enable_vectorized_sqrt" != "no"; then
518   if test "$enable_vectorized_sqrt" = "yes" -o "$enable_vectorized_sqrt" = "all" ; then
519     enable_vectorized_sqrt="normal,solvent,water,water-water"
520   fi
521   if echo $enable_vectorized_sqrt | grep "normal" >/dev/null; then
522     list_of_vectorized_sqrt="normal "
523     AC_DEFINE(VECTORIZE_INVSQRT,,[Vectorize 1/sqrt(x) in normal loops])
524   fi
525   if echo $enable_vectorized_sqrt | grep "solvent" >/dev/null; then
526     list_of_vectorized_sqrt="${list_of_vectorized_sqrt}solvent "
527     AC_DEFINE(VECTORIZE_INVSQRT_S,,[Vectorize 1/sqrt(x) in solvent loops])
528   fi
529   if echo $enable_vectorized_sqrt | sed 's/water-water//' | grep "water" >/dev/null; then
530     list_of_vectorized_sqrt="${list_of_vectorized_sqrt}water "
531     AC_DEFINE(VECTORIZE_INVSQRT_W,,[Vectorize 1/sqrt(x) in water loops])
532   fi
533   if echo $enable_vectorized_sqrt | grep "water-water" >/dev/null; then
534     list_of_vectorized_sqrt="${list_of_vectorized_sqrt}water-water "
535     AC_DEFINE(VECTORIZE_INVSQRT_WW,,[Vectorize 1/sqrt(x) in water-water loops])
536   fi
537 fi
538 if test -z "$list_of_vectorized_sqrt"; then
539   list_of_vectorized_sqrt="no"
540 fi
541
542
543 # check loops to prefetch coordinates in
544 list_of_prefetch_x=""
545 if test "$enable_prefetch_x" != "no"; then
546   if test "$enable_prefetch_x" = "yes" -o "$enable_prefetch_x" = "all"; then
547     enable_prefetch_x="normal,solvent,water,water-water"
548   fi
549   if echo $enable_prefetch_x | grep "normal" >/dev/null; then
550     list_of_prefetch_x="normal "
551     AC_DEFINE(PREFETCH_X,,[Prefetch coordinates in normal loops])
552   fi
553   if echo $enable_prefetch_x | grep "solvent" >/dev/null; then
554     list_of_prefetch_x="${list_of_prefetch_x}solvent "
555     AC_DEFINE(PREFETCH_X_S,,[Prefetch coordinates in solvent loops])
556   fi
557   if echo $enable_prefetch_x | sed 's/water-water//' | grep "water" >/dev/null; then
558     list_of_prefetch_x="${list_of_prefetch_x}water "
559     AC_DEFINE(PREFETCH_X_W,,[Prefetch coordinates in water loops])
560   fi
561   if echo $enable_prefetch_x | grep "water-water" >/dev/null; then
562     list_of_prefetch_x="${list_of_prefetch_x}water-water "
563     AC_DEFINE(PREFETCH_X_WW,,[Prefetch coordinates in water-water loops])
564   fi
565 fi
566 if test -z "$list_of_prefetch_x"; then
567   list_of_prefetch_x="no"
568 fi
569
570
571 # check loops to prefetch forces in
572 list_of_prefetch_f=""
573 if test "$enable_prefetch_f" != "no"; then
574   if test "$enable_prefetch_f" = "yes" -o "$enable_prefetch_f" = "all"; then
575     enable_prefetch_f="normal,solvent,water,water-water"
576   fi
577   if echo $enable_prefetch_f | grep "normal" >/dev/null; then
578     list_of_prefetch_f="normal "
579     AC_DEFINE(PREFETCH_F,,[Prefetch coordinates in normal loops])
580   fi
581   if echo $enable_prefetch_f | grep "solvent" >/dev/null; then
582     list_of_prefetch_f="${list_of_prefetch_f}solvent "
583     AC_DEFINE(PREFETCH_F_S,,[Prefetch coordinates in solvent loops])
584   fi
585   if echo $enable_prefetch_f | sed 's/water-water//' | grep "water"; then
586     list_of_prefetch_f="${list_of_prefetch_f}water "
587     AC_DEFINE(PREFETCH_F_W,,[Prefetch coordinates in water loops])
588   fi
589   if echo $enable_prefetch_f | grep "water-water" >/dev/null; then
590     list_of_prefetch_f="${list_of_prefetch_f}water-water "
591     AC_DEFINE(PREFETCH_F_WW,,[Prefetch coordinates in water-water loops])
592   fi
593 fi
594 if test -z "$list_of_prefetch_f"; then
595   list_of_prefetch_f="no"
596 fi
597
598
599
600
601
602
603
604
605 ########################################################################
606 # Final output stage
607 ########################################################################
608 AS="$CC"
609 AC_SUBST(ASFLAGS)
610 AC_SUBST(AS)
611 AC_SUBST(INCLUDES)          # should be automatic, but doesnt seem to be?
612 AC_SUBST(GMXLIB_LIBOBJS)
613 AC_SUBST(MDLIB_LIBOBJS)
614
615 # To tell libraries apart, we use four versions of the name. For instance, libgmx:
616 # libgmx                single prec, no mpi.
617 # libgmx_d              double prec, no mpi.
618 # libgmx_mpi            single prec, mpi.
619 # libgmx_mpi_d          double prec, mpi.
620 # However, the non-suffixed names are linked to the _mpi and/or _d suffixed
621 # ones upon installation if that is the only version available.
622
623 if test "$enable_mpi" = "yes"; then
624   LIBSUFFIX="_mpi"
625 fi
626 if test "$enable_float" = "no"; then
627   LIBSUFFIX="${LIBSUFFIX}_d"
628 fi
629 AC_SUBST(LIBSUFFIX) 
630
631 # Unless the user has explicitly requested a prefix/suffix/transform, we
632 # use _d on double precision files. Don't add anything for mpi, but at the
633 # end we tell the user it is possible and smart to do in some cases!
634 if test "$program_transform_name" = "s,x,x,"; then
635   name_transform_provided=no;
636   if test "$enable_float" = "no"; then
637     program_transform_name="s,\$\$,_d,"
638   fi
639 else
640   name_transform_provided=yes;
641 fi
642
643 # Set exec-prefix from the architecture and cpu.
644 if test "$exec_prefix" = "NONE"; then
645   arch_exec_prefix=yes; 
646   if test -n "$gmxcpu"; then
647     exec_prefix="\${prefix}/${host}/${gmxcpu}"
648   else
649     exec_prefix="\${prefix}/${host}"
650   fi
651 fi
652 AC_SUBST(exec_prefix)
653
654 AC_CONFIG_FILES([Makefile include/Makefile include/types/Makefile 
655 src/Makefile src/gmxlib/Makefile src/mdlib/Makefile src/kernel/Makefile
656 src/tools/Makefile src/ngmx/Makefile src/contrib/Makefile
657 scripts/Makefile admin/Makefile share/Makefile share/tutor/Makefile
658 share/tutor/gmxdemo/Makefile share/tutor/nmr1/Makefile 
659 share/tutor/nmr2/Makefile share/tutor/water/Makefile
660 share/tutor/speptide/Makefile share/template/Makefile 
661 share/top/Makefile share/html/Makefile share/html/images/Makefile 
662 share/html/online/Makefile man/Makefile man/man1/Makefile])
663
664 AC_OUTPUT 
665
666
667
668
669
670
671
672 #########################################################
673 # Echo some important info, to avoid stupid mistakes
674 #
675
676 echo ""
677 echo "GROMACS is ready to compile."
678
679 eval "show_path=`echo ${exec_prefix} | sed -e s,NONE,${ac_default_prefix},`"
680 echo ""
681 echo "* Binaries and libraries for this host will be installed under"
682 echo "  ${show_path}" 
683 echo "  (You can set it with the --prefix and --exec-prefix options.)"
684
685 if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
686   echo ""
687   echo "* You are compiling a double precision version of the package -"
688   echo "  program names will be suffixed with _d to avoid overwriting single"
689   echo "  precision files. You can override it with --program-suffix"
690 fi
691
692 if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
693   echo ""
694   echo "* Seems you are compiling with MPI support. You can install the MPI-"
695   echo "  enabled programs with suffixed names to have both MPI and non-MPI"
696   echo "  versions. This is useful e.g. on supercomputers where you usually"
697   echo "  cannot run MPI-linked programs on the login node."
698   echo "  Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
699   echo "  You only need MPI for mdrun, so if you already have non-MPI stuff"
700   echo "  installed you can issue make mdrun; make install-mdrun."
701 fi
702
703 if test "$enable_shared" = "yes"; then
704   echo ""
705   echo "* To save space, we use shared libraries. If this causes any problems,"
706   echo "  you can turn it off with --disable-shared."
707 fi
708 echo ""
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733