Tagged files with gromacs 3.0 header and added some license info
[alexxy/gromacs.git] / configure.in
1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
4 AC_INIT(src/gmxlib/3dview.c)
5 AC_PREREQ(2.13)
6 AC_CONFIG_AUX_DIR(./config)
7 AM_INIT_AUTOMAKE(gromacs, 3.0)
8 AC_PREFIX_DEFAULT(/usr/local/gromacs)
9 AM_CONFIG_HEADER(src/include/config.h)
10
11 #######################################################################
12 # User options
13 #######################################################################
14
15 #####
16
17 AC_ARG_ENABLE(mpi,     
18  [  --enable-mpi                  Compile parallel version of Gromacs], 
19  enable_mpi=$enableval, enable_mpi=no)
20
21
22 #####
23
24 AC_ARG_ENABLE(vector,     
25  [  --enable-vector               Compile for a vector machine], 
26  enable_vector=$enableval, enable_vector=no)
27
28
29 #####
30
31 AC_ARG_ENABLE(fortran, 
32  [  --enable-fortran              Dortran loops (default on sgi,ibm,sun,tru64/dec)], 
33  enable_fortran=$enableval,enable_fortran=check)
34
35
36 #####
37
38 AC_ARG_ENABLE(double,  
39  [  --enable-double               Compile double precision Gromacs], 
40  enable_double=$enableval, enable_double=no)
41
42
43 #####
44
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)
48
49
50 #####
51
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)
55
56
57 #####
58
59 AC_ARG_ENABLE(simplewater,     
60  [  --enable-simplewater          Unroll water innerloops (default on sgi)], 
61  enable_simplewater=$enableval, enable_simplewater=check)
62
63
64 #####
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)
68
69
70 #####
71
72 AC_ARG_ENABLE(nice,
73  [  --disable-nice                Disable the nice priority on mdrun], 
74  enable_nice=$enableval, enable_nice=yes)
75
76
77 #####
78
79 AC_ARG_ENABLE(sse,     
80  [  --disable-sse                 Disable SSE assembly loops on x86], 
81  enable_sse=$enableval, enable_sse=yes)
82
83
84 #####
85
86 AC_ARG_ENABLE(3dnow,     
87  [  --disable-3dnow               Disable 3DNow assembly loops on x86], 
88  enable_3dnow=$enableval, enable_3dnow=yes)
89
90
91 #####
92
93 AC_ARG_ENABLE(xdr,     
94  [  --disable-xdr                 Disable portable trajectory routines], 
95  enable_xdr=$enableval, enable_xdr=yes)
96
97
98 #####
99
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)
103
104
105 #####
106
107 AC_ARG_ENABLE(software-recip,     
108 [  --enable-software-recip       Do software 1/x (might be slower)], 
109  enable_softwarerecip=$enableval, enable_softwarerecip=no)
110
111
112 #####
113
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)
117
118
119 #####
120
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)
124
125
126 #####
127
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)
132
133
134 #####
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)
138
139
140 #####
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)
144
145
146 #####
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)
150
151
152 #####
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)
156
157
158 #####
159
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)
163
164
165 ########################################################################
166 # Process the options
167 ########################################################################
168
169 AC_CANONICAL_HOST
170
171 case "${host_cpu}" in
172  i?86)  
173    x86=yes 
174    ;;   
175  *)      
176    x86=false 
177    ;;
178 esac
179
180 if test "$enable_fortran" = "check"; then
181 case "${host_cpu}-${host_os}" in
182
183   sparc*-solaris* | alpha*-osf* | rs6000*-aix* | mips*-irix*)
184     enable_fortran=yes 
185     ;;
186
187   *)
188     enable_fortran=no 
189     ;;
190  esac  
191 fi
192
193 if test "$enable_mpi_suffix" = "check"; then
194 case "${host_cpu}-${host_os}" in
195
196   rs6000*-aix* | powerpc*-aix*)
197     enable_mpi_suffix=yes
198     ;;
199   *)
200     enable_mpi_suffix=no 
201     ;;
202  esac  
203 fi
204
205 if test "$enable_simplewater" = "check"; then
206 case "${host_cpu}-${host_os}" in
207
208   mips*-irix*)
209     enable_simplewater=yes 
210     ;;
211
212   *)
213     enable_simplewater=no 
214     ;;
215 esac    
216 fi
217
218 if test "$enable_waterwater_loops" = "check"; then
219 case "${host_cpu}-${host_os}" in
220
221    mips*-irix*)
222      enable_waterwater_loops=no 
223      ;;
224
225    *)
226      enable_waterwater_loops=yes 
227      ;;
228 esac
229 fi
230
231 if test "$enable_softwaresqrt" = "check"; then
232 case "${host_cpu}-${host_os}" in
233
234   mips*-irix* | rs6000*-aix*)
235     enable_softwaresqrt=no 
236     ;;
237
238   *)
239     enable_softwaresqrt=yes 
240     ;;
241 esac
242 fi
243
244 if [test "$with_mpi_environment" = "check" -a "$enable_mpi" = "yes"]; then
245 case "${host_cpu}" in
246   mips*-irix*)
247     with_mpi_environment="MPI_ENVIRONMENT"
248     ;;
249    *)
250     with_mpi_environment=no
251     ;;
252 esac
253 fi  
254
255 case "${host_cpu}" in
256  alpha*)  
257    AC_DEFINE(USE_AXP_ASM,,[Include Alpha AXP assembly for vectorized sqrt/invsqrt]) 
258    ;;   
259  *)      
260    ;;
261 esac
262
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)
266   AC_PROG_F77
267   if test -z "$F77"; then
268     AC_MSG_ERROR([No fortran compiler found])
269   fi
270 fi
271
272 # Checks for programs.
273 AC_PROG_MAKE_SET
274
275 AC_CHECK_PROG(CC, cc, cc) # do vendor cc before gcc
276 AC_PROG_CC
277 BUILD_CC=$CC
278 AC_SUBST(BUILD_CC)
279
280 if test "$enable_fortran" = "yes"; then
281   AC_F77_LIBRARY_LDFLAGS  
282   ACX_F77_NAME_MANGLING
283 fi
284
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.
288
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.
292   CC=$MPICC
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)
298 else
299   AM_CONDITIONAL(USE_MPI,false)
300 fi
301
302 AC_PROG_INSTALL
303 AC_PROG_CPP
304
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])
311       enable_sse=no
312       enable_3dnow=no
313     else 
314       AC_PATH_PROG(NASM,nasm,no)
315       NASMFLAGS="-f elf" 
316       AC_SUBST(NASMFLAGS)
317       if test "$NASM" = "no"; then 
318           AC_MSG_ERROR([Nasm is required for SSE and 3DNow loops.])
319       fi
320       if test "$enable_sse" = "yes"; then
321         AC_MSG_CHECKING([whether nasm supports SSE instructions])
322 cat > conftest_sse.s << EOF
323         global checksse 
324 checksse:
325         emms
326         xorps xmm0,xmm0
327         emms
328         ret
329 EOF
330         if AC_TRY_COMMAND($NASM conftest_sse.s); then
331           AC_MSG_RESULT([yes])
332         else
333           AC_MSG_RESULT([no]) 
334           AC_MSG_ERROR([Download a patched nasm from the Gromacs homepage,]     
335                        [or disable SSE assembly.])
336         fi
337       fi        
338       if test "$enable_3dnow" = "yes"; then
339         AC_MSG_CHECKING([whether nasm supports extended 3DNow instructions])
340 cat > conftest_3dnow.s << EOF
341         global check3dnow       
342 check3dnow:     
343         femms
344         pswapd mm0,mm0
345         femms
346         ret
347 EOF
348         if AC_TRY_COMMAND([$NASM -f elf conftest_3dnow.s]); then
349           AC_MSG_RESULT([yes])
350         else
351           AC_MSG_RESULT([no])
352           AC_MSG_ERROR([Download a patched nasm from the Gromacs homepage,]
353                        [or disable 3DNow assembly.])
354         fi
355       fi
356     fi
357   fi
358 else # not x86
359 enable_sse=no
360 enable_3dnow=no
361 fi
362
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"],[
369     AC_MSG_RESULT([yes]) 
370     AC_DEFINE(HAVE_IDENT,,[Does this machine have the ident command])],
371     AC_MSG_RESULT([no]))
372 fi
373
374 AC_PROG_RANLIB
375 AC_CHECK_FUNCS(strcasecmp)
376 AC_CHECK_FUNCS(strdup)
377
378 # Try to detect the cpu - must be done before some lib searches
379 if test "$enable_cpu_detection" = "yes"; then
380   ACX_DETECT_GMXCPU
381 else
382   gmxcpu=""
383 fi
384
385 ############################################################################
386 # Checks for libraries.
387 ############################################################################
388 AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
389
390 #####
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)  
397   vectmass=no
398   case "$gmxcpu" in
399     power4*)
400       AC_CHECK_LIB(massvp4,main,[vectmass=yes LIBS="$LIBS -lmassvp4"])  ;;
401     power3*)
402       AC_CHECK_LIB(massvp3,main,[vectmass=yes LIBS="$LIBS -lmassvp3"])  ;;
403     power2*)
404       AC_CHECK_LIB(massvp3,main,[vectmass=yes LIBS="$LIBS -lmassvp2"])  ;;
405     *)
406       AC_CHECK_LIB(massv,main,[vectmass=yes LIBS="$LIBS -lmassv"])  ;;
407   esac
408   if test "$vectmass" = "yes"; then
409     AC_DEFINE(USE_IBM_MASS,,[Use the vectorized routines in IBM MASS library])
410   fi
411 fi 
412
413 if test "$enable_double" = "yes"; then
414   precision=8
415 else
416   precision=4
417 fi
418
419 if test "$enable_mpi" = "yes"; then
420   ACX_CHECK_FFTW(fftw_mpi,$precision)
421   ACX_CHECK_FFTW(rfftw_mpi,$precision)
422 fi
423
424 ACX_CHECK_FFTW(fftw,$precision)
425 ACX_CHECK_FFTW(rfftw,$precision)
426
427 case ${ac_fftw_savedprefix} in
428  d)
429    AC_DEFINE(FFTW_NAME_DFFTW,,[Use the d prefix on fftw includes])
430    ;;   
431  s)
432    AC_DEFINE(FFTW_NAME_SFFTW,,[Use the s prefix on fftw includes])
433    ;;   
434  *)
435    AC_DEFINE(FFTW_NAME_FFTW,,[Dont use any prefixing on fftw includes])
436    ;;   
437 esac
438
439 ######
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!    *])
444 else
445 # check for xtc headers
446   AC_CHECK_HEADERS(rpc/rpc.h rpc/xdr.h,,AC_MSG_ERROR([RPC/XDR include headers not found]))
447 # check for xtc libs
448 # on solaris the xdr stuff is in -lnsl
449   AC_CHECK_LIB(nsl,xdr_float)
450   AC_TRY_LINK(
451 [#include<rpc/rpc.h> 
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)
455 fi
456
457 #####
458 # Look for X
459 AC_PATH_XTRA
460
461 # try to find motif headers and libraries
462 AC_FIND_MOTIF
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.])
465   motif_include=none
466 fi
467
468 if test "$motif_includes" != "none"; then
469   use_motif="yes"
470 else
471   use_motif="no"
472 fi
473
474 #####
475 # Checks for header files.
476
477 AC_CHECK_HEADERS([limits.h malloc.h strings.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
478
479 #####
480 # Checks for typedefs, structures, and compiler characteristics.
481 AC_C_CONST
482 AC_TYPE_SIZE_T
483 AC_STRUCT_TM
484 AC_TYPE_UID_T
485 AC_C_INLINE
486
487 #####
488 # Checks for library functions.
489 #AC_FUNC_MALLOC
490 AC_FUNC_MEMCMP
491 AC_TYPE_SIGNAL
492 AC_FUNC_VPRINTF
493
494 #####
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)
500   use_x11="yes"
501 else
502   use_x11="no"
503   AM_CONDITIONAL(USE_X11,false)
504 fi
505
506 #### 
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
510   sparc*-solaris*)
511     LIBS="$FLIBS $LIBS"
512     ;;
513   *)
514     LIBS="$LIBS $FLIBS"
515     ;;
516 esac
517     
518 ########################################################################
519 # Substitute things in output and header files.
520 ########################################################################
521 SUFFIX=""
522
523 if test "$enable_mpi" = "yes"; then
524         AC_DEFINE(USE_MPI,,[Make a parallel version of Gromacs using MPI])
525         PAR_OBJ='${mpi_obj}'
526         if test "$enable_mpi_suffix" = "yes"; then
527           SUFFIX="_mpi"
528         fi
529 else
530         PAR_OBJ='${libnet_obj}' 
531 fi
532
533 if test "$enable_vector" = "yes"; then
534         AC_DEFINE(USE_VECTOR,,[Optimize for a vector architecture])
535 fi
536
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)
541 else
542         INNER_C_OBJ='${inner_c_obj}'
543         AM_CONDITIONAL(USE_FORTRAN,false)
544 fi
545
546 if test "$enable_double" = "yes"; then
547         AC_DEFINE(DOUBLE,,[Compile in double precision])
548         if test "$enable_type_suffix" = "yes"; then
549           SUFFIX="${SUFFIX}_d"
550         fi
551         AM_CONDITIONAL(USE_DOUBLE,true)
552 else
553         AM_CONDITIONAL(USE_DOUBLE,false)
554 fi
555
556 if test "$enable_simplewater" = "yes"; then
557         AC_DEFINE(SIMPLEWATER,,[Expand the water loops to three inner loops])
558 fi
559
560 if test "$enable_waterwater_loops" = "no"; then
561         AC_DEFINE(DISABLE_WATERWATER_LOOPS,,[Don't use special loops for all-water interactions])
562 fi
563
564 if test "$enable_nice" = "no"; then
565         AC_DEFINE(NO_NICE,,[Turn off the automatic nicing of gromacs])
566 fi
567
568 if test "$enable_sse" = "yes"; then
569         AC_DEFINE(USE_SSE,,[Use x86 assembly with SSE instructions])
570         SSE_OBJ='${sse_obj}'
571 fi
572
573 if test "$enable_3dnow" = "yes"; then
574         AC_DEFINE(USE_3DNOW,,[Use x86 assembly with 3DNow instructions])
575         TDN_OBJ='${tdn_obj}'
576 fi
577
578 if [test "$enable_sse" = "yes" -o "$enable_3dnow" = "yes"]; then
579         X86_ASM_OBJ='${x86_asm_obj}'    
580 fi
581
582 if [test "$motif_includes" != "none" -a "$motif_libraries" != "none"]; then
583         MOTIF_OBJ='${motif_obj}'
584 fi
585
586 if test "$enable_xdr" = "yes"; then
587         AC_DEFINE(USE_XDR,,[Use xdr routines to make trajectories portable])
588         XDR_OBJ='${xdr_obj}'
589 else
590         XDR_OBJ='${noxdr_obj}'
591 fi
592
593 if test "$enable_softwaresqrt" = "yes"; then
594         AC_DEFINE(SOFTWARE_SQRT,,[Use the Gromacs software 1/sqrt(x)])
595 fi
596
597 if test "$enable_softwarerecip" = "yes"; then
598         AC_DEFINE(SOFTWARE_RECIP,,[Use the Gromacs software 1/x])
599 fi
600
601 if test "$enable_hide_square_latency" = "yes"; then
602         AC_DEFINE(DECREASE_SQUARE_LATENCY,,[Try to get coordinates to cache before using them])
603 fi
604
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])
607 fi
608
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])
612 fi
613
614
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"
619   fi
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])
623   fi
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])
627   fi
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])
631   fi
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])
635   fi
636 fi
637 if test -z "$list_of_vectorized_sqrt"; then
638   list_of_vectorized_sqrt="no"
639 fi
640
641
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"
646   fi
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])
650   fi
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])
654   fi
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])
658   fi
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])
662   fi
663 fi
664 if test -z "$list_of_prefetch_x"; then
665   list_of_prefetch_x="no"
666 fi
667
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"
672   fi
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])
676   fi
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])
680   fi
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])
684   fi
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])
688   fi
689 fi
690 if test -z "$list_of_prefetch_f"; then
691   list_of_prefetch_f="no"
692 fi
693
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])
696 fi
697
698 if test "$enable_vectorized_recip" = "yes"; then
699   AC_DEFINE(VECTORIZE_RECIP,,[Vectorize the reciprocal calculation])
700 fi
701
702 if test "${prefix}" = "NONE"; then
703   AC_DEFINE_UNQUOTED(GMXLIBDIR,"${ac_default_prefix}/top",[Default topology file location])
704 else
705   AC_DEFINE_UNQUOTED(GMXLIBDIR,"${prefix}/top",[Default topology file location])
706 fi
707
708 AC_SUBST(PAR_OBJ)
709 AC_SUBST(INNER_F77_OBJ)
710 AC_SUBST(INNER_C_OBJ)
711 AC_SUBST(SSE_OBJ)
712 AC_SUBST(TDN_OBJ)
713 AC_SUBST(X86_ASM_OBJ)
714 AC_SUBST(MOTIF_OBJ)
715 AC_SUBST(XDR_OBJ)
716 AC_SUBST(AXP_ASM_OBJ) # not used right now
717 ACX_SUBST_XXX(SUFFIX)
718 AC_SUBST(SUFFIX)
719
720 # Check if there are any optimizations and options for this arch and cpu
721 ACX_COMPILER_MAXOPT
722 AC_SUBST(INCLUDES)          # should be automatic, but doesnt seem to be?
723
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}"
728 else
729   bindir="\${exec_prefix}/bin/${host}"
730   libdir="\${exec_prefix}/lib/${host}"
731 fi
732
733 AC_SUBST(bindir)
734 AC_SUBST(libdir)
735
736
737 AC_OUTPUT([Makefile
738                  src/Makefile
739                  src/gmxlib/Makefile
740                  src/mdlib/Makefile
741                  src/kernel/Makefile
742                  src/tools/Makefile
743                  src/ngmx/Makefile
744                  src/include/Makefile
745                  src/include/types/Makefile
746                  src/contrib/Makefile
747                  tutor/Makefile
748                  tutor/gmxdemo/Makefile
749                  tutor/nmr1/Makefile
750                  tutor/nmr2/Makefile
751                  tutor/water/Makefile
752                  tutor/speptide/Makefile
753                  tutor/template/Makefile
754                  tutor/template/Template.mak
755                  top/Makefile
756                  html/Makefile
757                  html/gif/Makefile
758                  html/online/Makefile])
759
760 echo ""
761 echo "Gromacs is ready to compile. Summary of options used:"
762 echo "Architecture                  : $host"
763 if test "$enable_cpu_detection" = "yes"; then
764 if test -n "$gmxcpu"; then
765 echo "Optimize for CPU              : $gmxcpu"
766 else
767 echo "(Extra CPU detection not necessary or unavailable on this host)"  
768 fi
769 fi
770 echo "MPI parallelization           : $enable_mpi"
771 if test "$enable_mpi" = "yes"; then
772 echo "Checking MPI environment      : $with_mpi_environment"
773 echo "MPI suffix on files           : $enable_mpi_suffix"
774 fi
775 echo "Vector architecture           : $enable_vector"
776 echo "Using Fortran code            : $enable_fortran"
777 echo "Double precision              : $enable_double"
778 if test "$enable_double" = "yes"; then
779 echo "Type suffix on files          : $enable_type_suffix"
780 fi
781 echo "Expanding water loops         : $enable_simplewater"
782 echo "Using water-water loops       : $enable_waterwater_loops"
783 echo "Automatically nice mdrun      : $enable_nice"
784 echo "Using x86 SSE assembly        : $enable_sse"
785 echo "Using x86 3DNow assembly      : $enable_3dnow"
786 echo "Portable trajectories (xdr)   : $enable_xdr"
787 echo "Software 1/x                  : $enable_softwarerecip"
788 echo "Software 1/sqrt(x)            : $enable_softwaresqrt"
789 echo "Vectorize 1/x                 : $enable_vectorized_recip"
790 echo "Vectorize 1/sqrt(x)           : $list_of_vectorized_sqrt"
791 echo "Prefetch coordinates in loops : $list_of_prefetch_x"
792 echo "Prefetch forces in loops      : $list_of_prefetch_f"
793 echo "Hide square latency           : $enable_hide_square_latency"
794 echo "Hide table lookup latency     : $enable_hide_table_latency"
795 echo "Using X11                     : $use_x11"
796 echo "Motif support                 : $use_motif"
797 echo ""