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