cmake support for user-defined binary prefixes, custom mdrun-gpu target, and make...
[gromacs/rigid-bodies.git] / configure.ac
blobcd4c2e7ee46cdbcbea6d9c57f36f1e9c67c1a726
1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
4  
5 AC_PREREQ(2.50)
6 AC_INIT(gromacs, 4.0.99-dev-20100305, [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(tar-ustar)
12 AC_PREFIX_DEFAULT(/usr/local/gromacs)
14 AM_CONFIG_HEADER(src/config.h)
15 dnl This is the version info according to the libtool versioning system.
16 dnl It does *not* correspond to the release number.
17 SHARED_VERSION_INFO="5:0:0"
18 AC_SUBST(SHARED_VERSION_INFO)
20 AC_DISABLE_SHARED
23 #######################################################################
24 # Simple options and makefile variables
25 #######################################################################
27 ### Single/Double
28 AC_ARG_ENABLE(float,
29              [AC_HELP_STRING([--disable-float],
30                              [Use double instead of single precision])],, enable_float=yes)
32 AC_ARG_ENABLE(double,
33              [AC_HELP_STRING([--enable-double],
34                              [Same effect as --disable-float])],, enable_double=no)
35 if test "$enable_double" = "yes"; then
36    enable_float=no;
38 if test "$enable_float" = "no"; then
39   AC_DEFINE(GMX_DOUBLE,,[Compile in double precision])
41 AM_CONDITIONAL([GMX_DOUBLE],[test "$enable_float" = "no"])
45 ### Fortran or not
46 AC_ARG_ENABLE(fortran,
47              [AC_HELP_STRING([--enable-fortran],
48                              [Use Fortran kernels])],, 
49 [case "${host_cpu}-${host_os}" in
50   sparc*-solaris* | alpha*-* | rs6000*-aix* | powerpc*-aix* | mips*-irix*) enable_fortran=yes ;;
51   *) enable_fortran=no ;;
52  esac])
53 if test "$enable_fortran" = "yes"; then
54   AC_DEFINE(GMX_FORTRAN,,[Enable Fortran support])
56 # Generic fortran kernels will be turned off below if you enable power6-specific optimization!
57 # always use CC for linking:
58 AC_SUBST(F77LINK,"\$(LINK)")
64 ### MPI or not
65 AC_ARG_ENABLE(mpi,
66               [AC_HELP_STRING([--enable-mpi],
67                               [Compile for parallel runs using MPI]
68                               [(instead of threads)])],,enable_mpi=no)
71 ### MPI environment
72 AC_ARG_ENABLE(mpi-environment,
73               [AC_HELP_STRING([--enable-mpi-environment=VAR],
74                               [Only start parallel runs when VAR is set])],,
75 [case "${host_cpu}" in
76   mips*-irix*) enable_mpi_environment="MPI_ENVIRONMENT" ;;
77   *) enable_mpi_environment=no ;;
78 esac])
79 if test "$enable_mpi_environment" != "no"; then
80   AC_DEFINE_UNQUOTED(GMX_CHECK_MPI_ENV,"$enable_mpi_environment",[If defined, only start MPI runs when this variable is set])
83 ### MPI_IN_PLACE
84 AC_ARG_ENABLE(mpi-in-place,
85               [AC_HELP_STRING([--disable-mpi-in-place],
86                               [Disable MPI_IN_PLACE. For MPI implementations]
87                               [that have broken support for it ]
88                               [(some versions of MPICH, for example).])],, enable_mpi_in_place=yes)
92 AC_ARG_ENABLE(debug,
93               [AC_HELP_STRING([--enable-debug],
94                               [Add -g to other command line arguments])],,enable_debug=no)
96 ### IA32 assembly code
97 AC_ARG_ENABLE(ia32_sse,
98               [AC_HELP_STRING([--disable-ia32-sse],
99                               [Don't build SSE/SSE2 assembly loops on ia32])],,enable_ia32_sse=yes)
101 case "${host_cpu}-${host_vendor}" in
102    i?86-*) ;;
103    *) enable_ia32_sse=no ;;
104 esac
106 ### AMD64 assembly code
107 AC_ARG_ENABLE(x86_64_sse,
108               [AC_HELP_STRING([--disable-x86-64-sse],
109                               [Don't build SSE assembly loops on X86_64])],,enable_x86_64_sse=yes)
110 case "${host_cpu}-${host_vendor}" in
111    x86_64-* | amd64-*) ;;
112    i?86-apple) ;;
113    *) enable_x86_64_sse=no ;;
114 esac
117 ### Altivec on powerpc (motorola)
118 AC_ARG_ENABLE(ppc_altivec,
119               [AC_HELP_STRING([--disable-ppc-altivec],
120                               [Don't build Altivec loops on PowerPC])],,enable_ppc_altivec=undef)
121 # Power3/4/5 running AIX does not support altivec. We identify this with vendor=IBM.
122 # IBM powerpc 970 boxes run linux, and have vendor=unknown.
123 if test "$enable_ppc_altivec" = "undef"; then
124   case "${host_cpu}-${host_vendor}" in
125     ppc*-ibm* | powerpc*-ibm*) enable_ppc_altivec=no ;;
126     ppc*-* | powerpc*-*) enable_ppc_altivec=yes ;; 
127     *) enable_ppc_altivec=no ;;
128   esac
133 ### ia64 assembly code
134 AC_ARG_ENABLE(ia64_asm,
135               [AC_HELP_STRING([--disable-ia64-asm],
136                               [Don't build assembly loops on ia64])],,enable_ia64_asm=yes)
137 case "${host_cpu}" in
138    ia64) ;;
139    *) enable_ia64_asm=no ;;
140 esac
143 # IBM Power6-specific optimization
144 AC_ARG_ENABLE(power6,
145              [AC_HELP_STRING([--enable-power6],
146                              [Use IBM Pwr6/PPC440/PPC450-specific F77 kernels])],,enable_power6=no)
147 # Turn off generic fortran loops if we are using power6-specific optimization
148 if test "$enable_power6" = "yes"; then
149   enable_fortran=no;
152 AC_ARG_ENABLE(bluegene,
153               [AC_HELP_STRING([--enable-bluegene],
154                               [Build assembly intrinsics kernels on bluegene])],,enable_bluegene=no)
157 ### Optimize for host cpu version
158 AC_ARG_ENABLE(cpu-optimization,     
159               [AC_HELP_STRING([--disable-cpu-optimization],
160                               [No detection or tuning flags for cpu version])],, enable_cpu_optimization=yes)
163 ### Do software 1/sqrt(x)                                                                                                            
164 AC_ARG_ENABLE(software-invsqrt,
165               [AC_HELP_STRING([--disable-software-invsqrt],
166                               [No software 1/sqrt (disabled on sgi,ibm,ia64)])],,
167 [case "${host_cpu}-${host_os}" in
168   mips*-irix* | rs6000*-aix* | powerpc*-aix | ia64*-*) enable_software_invsqrt=no ;;
169   *) enable_software_invsqrt=yes ;;
170 esac])
171 if test "$enable_software_invsqrt" = "yes"; then
172   AC_DEFINE(GMX_SOFTWARE_INVSQRT,,[Use the GROMACS software 1/sqrt(x)])
174 AM_CONDITIONAL([GMX_SOFTWARE_INVSQRT],[test "$enable_software_invsqrt" = "yes"])
176 AC_ARG_ENABLE(fahcore,
177               [AC_HELP_STRING([--enable-fahcore],
178                               [Create a library with mdrun functionality])],, enable_fahcore=no)
182 # The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
183 # instructions dynamically at runtime, so they might not make much difference now:
186 AC_ARG_ENABLE(all-static,
187               [AC_HELP_STRING([--enable-all-static],
188                               [Make completely static binaries])],, enable_all_static=no)
189 # Dont add the -all-static flag until after the compiler test.
192 # FFT libraries - only use one...
193 AC_ARG_WITH(fft,
194             [AC_HELP_STRING([--with-fft=@<:@fftw3/fftw2/mkl(>=6.0)/fftpack@:>@],
195                             [FFT library to use. fftw3 is default, fftpack built in.])],,
196                              with_fft=fftw3)
198 AC_ARG_ENABLE(fftw-measure,
199             [AC_HELP_STRING([--disable-fftw-measure],
200                             [Dont optimize FFTs. This produces binary exactly]
201                             [reproducible runs (as the -reprod flag to mdrun),]
202                             [and if you are using FFTW on x86 and specified its]
203                             [--enable-sse/sse2 flag (NOT default in FFTW!) the]
204                             [kernels used are close-to-optimal anyway.])],,
205                              enable_fftw_measure=yes)
208 AC_ARG_ENABLE(threads,
209               [AC_HELP_STRING([--disable-threads],    
210                               [Disable parallel runs using threads])],,enable_threads=yes)
213 ### Use external BLAS/LAPACK libraries if the user wants to.
215 AC_ARG_WITH(external_blas,
216             [AC_HELP_STRING([--with-external-blas],
217                             [Use system BLAS library (add to LIBS). Automatic on OS X.])],,
219 # default action - check if we are on OS X
220 case "${host_vendor}-${host_os}" in
221   apple-darwin*) with_external_blas="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
222   *)             with_external_blas="no"  ;;
223 esac
225 AM_CONDITIONAL([GMX_EXTERNAL_BLAS], [test "$with_external_blas" = "yes"])
228 AC_ARG_WITH(external_lapack,
229             [AC_HELP_STRING([--with-external-lapack],
230                             [Use system LAPACK library (add to LIBS). Automatic on OS X.])],,
232 # default action - check if we are on OS X
233 case "${host_vendor}-${host_os}" in
234   apple-darwin*) with_external_lapack="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
235   *)             with_external_lapack="no"  ;;
236 esac
238 AM_CONDITIONAL([GMX_EXTERNAL_LAPACK], [test "$with_external_lapack" = "yes"])
243 AC_ARG_WITH(qmmm_gaussian,
244               [AC_HELP_STRING([--without-qmmm-gaussian],
245                               [Use modified Gaussian0x for QM-MM (see website)])],,with_qmmm_gaussian=yes)
246 if test "$with_qmmm_gaussian" = "yes"; then
247   AC_DEFINE(GMX_QMMM_GAUSSIAN,,[Use (modified) Gaussian0x for QM-MM calculations])
251 AC_ARG_WITH(qmmm_gamess,
252               [AC_HELP_STRING([--without-qmmm-gamess],
253                               [Use modified Gamess-UK for QM-MM (see website)])],,with_qmmm_gamess=no)
254 if test "$with_qmmm_gamess" = "yes"; then
255   AC_DEFINE(GMX_QMMM_GAMESS,,[Use (modified) Gamess-UK for QM-MM calculations])
259 AC_ARG_WITH(qmmm_mopac,
260               [AC_HELP_STRING([--without-qmmm-mopac],
261                               [Use modified Mopac 7 for QM-MM (see website)])],,with_qmmm_mopac=no)
262 if test "$with_qmmm_mopac" = "yes"; then
263   AC_DEFINE(GMX_QMMM_MOPAC,,[Use (modified) Mopac 7 for QM-MM calculations])
266 AC_ARG_WITH(dlopen,
267             [AC_HELP_STRING([--without-dlopen],
268                             [do not compile with dlopen, needed to read VMD]
269                             [supported file formats])],,with_dlopen=yes)
273    
275 ############################################################
276 # Add some debug info: Who is building, and on what machine?
277 ############################################################
278 AC_DEFINE_UNQUOTED([BUILD_TIME],["`date`"],[Date and time for build])
279 AC_DEFINE_UNQUOTED([BUILD_USER],["`whoami`@`hostname`"],[User doing build])
280 AC_DEFINE_UNQUOTED([BUILD_MACHINE],["`uname -srm`"],[Hardware and OS version for build host])
283 ############################################################
284 # Checks for requirements for version information generation
285 ############################################################
286 generate_version=no
287 if test -d $srcdir/.git ; then
288     AC_CHECK_PROG(have_git, git, yes, no)
289     if test "$have_git" = "yes" ; then
290         AC_MSG_CHECKING(for git >= 1.5.1)
291         if test "`git --version`" \< "git version 1.5.1" ; then
292             AC_MSG_RESULT(no)
293         else
294             AC_MSG_RESULT(yes)
295             generate_version=yes
296             AC_DEFINE(USE_VERSION_H,,[Use generated version info])
297         fi
298     fi
299     if test "$generate_version" = "no" ; then
300         AC_MSG_WARN([No compatible git version found, won't be able to generate proper development version information.])
301     fi
303 AM_CONDITIONAL([USE_VERSION_H],[test "$generate_version" = "yes"])
306 ############################################################
307 # Checks for programs
308 ############################################################
310 # normally we use the default compiler, but on alpha/linux we try the compaq ones first
311 case "${host_cpu}-${host_os}" in
312   alpha*-linux*)
313     cc_names="ccc cc gcc"
314     f77_names="fort f77 g77"
315     ;;
316   *) 
317     cc_names="cc icc xlc gcc"
318     f77_names="f77 ifort xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
319     ;;
320 esac
321 # the (non-mpi) c compiler, which is also used for programs executed during build stage
322 AC_PROG_CC( $cc_names )
323 # Check for environment variable CC_FOR_BUILD before overwriting it
324 if test -z "$CC_FOR_BUILD"; then
325   CC_FOR_BUILD=$CC
327 AC_SUBST(CC_FOR_BUILD) 
329 if test "$enable_fortran" = "yes"; then 
330   AC_PROG_F77( $f77_names )
331   if test -z "$F77"; then
332     AC_MSG_ERROR([No fortran compiler found])
333   fi
336 AM_PROG_AS( $CC )
338 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
339 # above, since autoconf checks that the created file can be executed. This would
340 # fail on platforms where MPI executables can only be run through a batchqueue.
342 if test "$enable_mpi" = "yes"; then
343   enable_threads="no"
344   AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)
345 # now change the normal cc to the MPI one - see the comment above.
346   CC=$MPICC
347   CXX=$MPICC
348   AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
349   AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
350 AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
351   AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
352   AC_DEFINE(GMX_LIB_MPI,,[Use a real MPI library])
354   if test "$enable_mpi_in_place" = "yes"; then
355     # not all MPIs support MPI_IN_PLACE:
356     AC_MSG_CHECKING([for MPI_IN_PLACE in collective operations])
357     AC_TRY_COMPILE([
358 #include <mpi.h>
359 void test(void)
361     void *buf;
362     MPI_Allreduce(MPI_IN_PLACE, buf, 10, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD);
364     ],,[
365         AC_MSG_RESULT([yes])
366         AC_DEFINE(MPI_IN_PLACE_EXISTS,[],[MPI_IN_PLACE available for collective operations])
367     ],[
368         AC_MSG_RESULT([no])
369     ]) 
370   fi
372 # on the cray xt3 we have to tell autoconf that we 
373 # are actually cross-compiling even if the architecture
374 # of host and target are the same. so we enforce 
375 # cross-compilation if __QK_USER__ is defined
376   AC_MSG_CHECKING([for catamount])
377   AC_TRY_COMPILE([
378 #if defined __QK_USER__
379 #else
380 #error not catamount
381 #endif
382 ],,[
383   AC_MSG_RESULT([yes])
384   cross_compiling=yes 
385   AC_DEFINE(GMX_CRAY_XT3,[],[Enable special hacks for Cray XT3])
386   AC_DEFINE(GMX_NO_SYSTEM,[],[Ignore calls to system(3)])
387   AC_DEFINE(GMX_NO_NICE,[],[Ignore calls to nice(3)])
388   AC_DEFINE(GMX_BROKEN_CALLOC,[],[Don't use calloc(3)])
389   extra_LDFLAGS="$extra_LDFLAGS -lgmalloc -lacml"
391   AC_MSG_RESULT([no])
393 # end of "$enable_mpi" = "yes"
397 AH_TEMPLATE([F77_OR_C_FUNC],
398             [Set to F77_FUNC(name,NAME) if Fortran used, otherwise 'name' for C.])
399 AH_TEMPLATE([F77_OR_C_FUNC_],
400             [Set to F77_FUNC_(name,NAME) if Fortran used, otherwise 'name' for C.])
404 if test "$enable_fortran" = "yes"; then
405   AC_F77_LIBRARY_LDFLAGS
406   AC_F77_WRAPPERS
407   AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[F77_FUNC(name,NAME)])
408   AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[F77_FUNC_(name,NAME)])
409 else
410   AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[name])
411   AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[name])
416 AC_PROG_CPP
417 # Needed by libtool scripts?
418 AC_PROG_EGREP
420 if test "$enable_cpu_optimization" = "yes"; then
421   ACX_DETECT_GMXCPU
422 else
423   gmxcpu=""
425 ACX_COMPILER_MAXOPT
428 # We've postponed the threads check because we need to check with the right
429 # compilers/flags 
430 if test "$enable_threads" = "yes"; then 
431   if test "$enable_mpi" = "yes"; then
432     AC_MSG_ERROR([Cannot use both threads and MPI - yet.])
433   fi
434   if test "$with_fft" = "fftw2"; then
435     AC_MSG_ERROR([fftw2 can't be used with threads. Use fftw3 or mkl.])
436   fi 
437   AC_CHECK_HEADERS(unistd.h)
438   AC_CHECK_HEADERS(sys/time.h)
439   AC_CHECK_HEADERS(sched.h)
440   AC_CHECK_FUNCS(sysconf)
442   # for now we just assume pthreads
443   ACX_PTHREAD(,AC_MSG_ERROR([Cannot find POSIX threads - required for thread support using configure!]))
444   LIBS="$PTHREAD_LIBS $LIBS"
445   CFLAGS="$CFLAGS $PTHREAD_CFLAGS -I$srcdir/include"
446   CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS -I$srcdir/include"
447   CC="$PTHREAD_CC "
448   AC_DEFINE(THREAD_PTHREADS,,[Use pthreads for thread_mpi multithreading])
450   # profiling
451   AC_ARG_ENABLE(tmpi-profiling,
452               [AC_HELP_STRING([--enable-tmpi-profiling],
453               [Enables profiling of thread_mpi calls and wait times])],,
454               enable_tmpi_profiling=no)
455   if test "x$enable_tmpi_profiling" = "xyes"; then
456     AC_DEFINE(TMPI_PROFILE,,[Enable profiling for call and wait times])
457   fi
459   # check the atomics
460   AC_MSG_CHECKING(if atomic operations are supported)
461   CFLAGS_RET="$CFLAGS"
462   CXXFLAGS_RET="$CXXFLAGS"
463   CFLAGS="$CFLAGS -I$srcdir/include -DTMPI_CHECK_ATOMICS"
464   CXXFLAGS="$CXXFLAGS -I$srcdir/include -DTMPI_CHECK_ATOMICS"
465   # this sets a variable 'tmpi_atomics' to 'yes' if there are atomics. 
466   AC_COMPILE_IFELSE([#include "thread_mpi/atomic.h" ],
467                       [AC_MSG_RESULT(yes); tmpi_atomics=yes],
468                       [AC_MSG_WARN(
469 [No atomics.
471 This compiler+CPU combination doesn't have working atomics.
472 Thread support will be unbearably slow: disable threads.
474 Atomics should work on all but the most obscure CPU+compiler combinations;
475 if your system is not obscure -- like, for example, x86 with gcc --  please
476 contact the developers.
477 ]); tmpi_atomics=no])
478   CFLAGS="$CFLAGS_RET"
479   CXXFLAGS="$CXXFLAGS_RET"
481   AC_DEFINE(GMX_THREADS,,[Use threads for parallelization])
482   AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
483   AM_CONDITIONAL(THREAD_PARALLEL,true)
484 else
485   AM_CONDITIONAL(THREAD_PARALLEL,false)
490 #############
491 # Check integer endian
492 #############
493 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
494 AC_MSG_ERROR([Cannot determine endian in compiled output])])
495 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
497 #############
498 # Make sure size_t can hold pointers.
499 # On some Nec machines, you reportedly need to specify a flag for size_t to be 64 bits wide.
500 #############
501 AC_MSG_CHECKING([that size_t can hold pointers])
502 AC_TRY_COMPILE([
503 #include <stdlib.h>
504 #include <stddef.h>
505 ],[int chk[sizeof(size_t)-sizeof(int *)+1];],AC_MSG_RESULT([yes]),[
506    AC_MSG_ERROR([size_t is smaller than int*. Check if your compiler needs a flag to make it 64 bit.])])
509 #############
510 # Check that SIGUSR1 is defined
511 #############
512 AC_MSG_CHECKING([for SIGUSR1])
513 AC_TRY_COMPILE([#include <signal.h>],[int i=SIGUSR1;],[
514 AC_MSG_RESULT([yes])
515 AC_DEFINE(HAVE_SIGUSR1,,[SIGUSR1 supported and defined])
516 ],AC_MSG_RESULT([no]))
518 #############
519 # Check if pipes are supported
520 #############
521 AC_MSG_CHECKING([for pipes])
522 AC_TRY_COMPILE([#include <stdio.h>],[
523 FILE *pipe=popen("/tmp/pipe","r");
525 AC_MSG_RESULT([yes])
526 AC_DEFINE(HAVE_PIPES,,[Pipes (popen/pclose) supported])
527 ],AC_MSG_RESULT([no]))
531 #############
532 # Check floating-point format and endian
533 #############
534 ACX_FLOAT_FORMAT
537 AC_PROG_INSTALL
538 AC_PROG_LN_S
539 AC_PROG_MAKE_SET
540 AC_LIBTOOL_WIN32_DLL
541 AC_PROG_LIBTOOL
542 AC_SYS_LARGEFILE
544 # Use our own version of AC_FUNC_FSEEKO from autoconf 2.63 instead
545 # of the broken one we might get from autoconf 2.61.
546 ACX_FUNC_FSEEKO_FIXED
551 ############################################################################
552 # Checks for libraries.
553 ############################################################################
555 # Don't add math library for intel compilers
556 if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
557   AC_MSG_NOTICE([Using built-in math library with intel compiler])
558 else
559   AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
562 #####
563 # Disable MASS support for now.
564 #####
567 case "$with_fft" in
568 fftw2)
569   if test "$enable_float" = "yes"; then
570     sizeof_real=4
571   else
572     sizeof_real=8
573   fi
574   ACX_CHECK_FFTW2(fftw,$sizeof_real)
575   ACX_CHECK_FFTW2(rfftw,$sizeof_real)
577   case ${ac_fftw_savedprefix} in
578    d) AC_DEFINE(FFTW2_NAME_DFFTW,,[Use the d prefix on fftw2 includes]) ;;
579    s) AC_DEFINE(FFTW2_NAME_SFFTW,,[Use the s prefix on fftw2 includes]) ;;
580    *) AC_DEFINE(FFTW2_NAME_FFTW,,[Dont use any prefix on fftw2 includes]) ;;
581   esac
583   AC_DEFINE(GMX_FFT_FFTW2,,[Use FFTW2 FFT library])
585   ;; #  end of fftw2 check
587 fftw3) # Much simpler check than fftw2
588 # Check for header <fftw3.h> AC_CHECK_HEADERS doesnt work, since we must
589 # use mpicc to get includes - cpp isnt always the same compiler.
590 AC_MSG_CHECKING([for fftw3.h])
591 AC_TRY_COMPILE([#include<fftw3.h>],,[
592 # ok, look for library file too
593 AC_MSG_RESULT(yes)
594 if test "$enable_float" = "yes"; then
595   AC_CHECK_LIB([fftw3f],main,,AC_MSG_ERROR([Cannot find fftw3f library]))
596   PKG_FFTW="fftw3f"
597 else
598   AC_CHECK_LIB([fftw3],main,,AC_MSG_ERROR([Cannot find fftw3 library]))
599   PKG_FFTW="fftw3"
601   AC_DEFINE(GMX_FFT_FFTW3,,[Use FFTW3 FFT library])
603 # not ok, echo a warning
604 AC_MSG_ERROR(
605 [Cannot find the default external FFT library (fftw3).
606 Other alternatives are 'fftw2', or 'mkl' for Intel MKL.
607 You are STRONGLY recommended to use one of these - fftw is free.
609 Use CPPFLAGS and LDFLAGS if the library is installed in a 
610 non-standard location. (see FAQ at http://www.gromacs.org)
611                                                           
612 If you dont care about performance you can also specify 'fftpack'
613 to use a slower set of FFTs built into Gromacs. 
614 (Just install FFTW3 unless you really know what you are doing).
617   AC_SUBST(PKG_FFTW)
618   ;;
620 mkl*)
621 ###########
622 # Intel Math Kernel Library version 6 and later.
623 ##########
624 AC_MSG_CHECKING([for mkl_dfti.h])
625 AC_TRY_COMPILE([#include<mkl_dfti.h>],,AC_MSG_RESULT(yes),AC_MSG_ERROR([Cannot find mkl_dfti.h header from Intel Math Kernel Library>=6.0.]\
627 ## Check for library
628 #  AC_CHECK_LIB([guide],main,,AC_MSG_ERROR([Cannot find libguide (Intel MKL)]))
629 #  AC_CHECK_LIB([mkl],DftiComputeForward,,
630 #    AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0]))
631   # first check for older MKLs
632   AC_CHECK_LIB([mkl],DftiComputeForward,,[have_mkl="no"])
633   if test "$have_mkl" == "no"; then
634     # we assume it's a new MKL
635     LIBS="$LIBS -liomp5 -lmkl_sequential -lmkl_core"
636     LMKL=" -liomp5 -lmkl_sequential -lmkl_core"
637     AC_CHECK_LIB([mkl_intel_lp64],DftiComputeForward,,[have_mkl10_64="no"])
638     if test "$have_mkl10_64" == "no"; then
639       AC_CHECK_LIB([mkl_intel],DftiComputeForward,,[have_mkl10_32="no"])
640       if test "$have_mkl10_32" == "no"; then
641         AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0])
642       fi
643     fi
644   fi
645   AC_DEFINE(GMX_FFT_MKL,,[Use Intel MKL FFT library])
646   AC_SUBST(LMKL)
647   ;;
649 fftpack | no)
650   AC_MSG_WARN([The built-in FFTPACK routines are slow.
651 Are you sure you don't want to use FFTW? It is free and much faster...])
652   AC_DEFINE(GMX_FFT_FFTPACK,,[Use Built-in FFTPACK FFT library])
653   ;;
655   AC_MSG_ERROR([Unknown FFT library])
656   ;;
657 esac
660 if test "$enable_fftw_measure" != "yes"; then
661    AC_DEFINE(GMX_DISABLE_FFTW_MEASURE,,[Do not optimize FFTW setups (not needed with SSE FFT kernels)])
664 ######
665 # check for xtc headers
666 case "${host_os}" in
667 cygwin* | mingw*)   # use our own xdr stuff for cygwin/mingw
668   ;;
670   AC_CHECK_HEADERS([rpc/rpc.h])
671   AC_CHECK_HEADERS([rpc/xdr.h],,,
672 [#if HAVE_RPC_RPC_H
673 # include <rpc/rpc.h>
674 #endif
676   AC_CHECK_LIB(nsl,xdr_float)
677   AC_TRY_LINK([
678 #if HAVE_RPC_RPC_H
679 #include<rpc/rpc.h> 
680 #else
681 #error NO rpc.h header
682 #endif
683 #if HAVE_RPC_XDR_H
684 #include<rpc/xdr.h>
685 #else
686 #error No xdr.h header
687 #endif
688 ],[ XDR *xd; float f; xdr_float(xd,&f);],[have_xdr="yes"])
690   if test "$have_xdr" != "yes"; then
691     AC_DEFINE(GMX_INTERNAL_XDR,,[Use our own instead of system XDR libraries])  
692     AC_MSG_WARN([Couldn't find XDR headers and/or libraries - using our own])
693   fi
694   ;;
695 esac
698 ########################################################################
699 # Checks for header files and types
700 ########################################################################
702 AC_CHECK_HEADERS([limits.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
703 AC_CHECK_HEADERS(unistd.h)
704 AC_CHECK_HEADERS(sys/types.h)
705 AC_CHECK_HEADERS(sys/time.h)
706 AC_CHECK_HEADERS(dirent.h)
707 AC_CHECK_HEADERS(copyfile.h)
708 AC_CHECK_HEADERS(regex.h,,[AC_MSG_WARN(
709 [No regex.h found.
710 Regular expression matching in selections will be disabled.
711 Selections still work, but the default groups can differ from
712 those obtained with regular expressions enabled.
713 Consider installing the regular expression library from GNU libc.])])
715 #####
716 # Checks for additional and/or optional functions or libraries.
717 #AC_FUNC_MALLOC
718 AC_FUNC_MEMCMP
719 AC_TYPE_SIGNAL
720 AC_TYPE_OFF_T
721 AC_FUNC_VPRINTF
722 AM_WITH_DMALLOC
723 AC_CHECK_FUNCS(strcasecmp)
724 AC_CHECK_FUNCS(strdup)
725 AC_CHECK_FUNCS(gettimeofday)
726 AC_CHECK_FUNCS(cbrt)
727 AC_CHECK_FUNCS(isnan)
728 AC_CHECK_FUNCS(_isnan)
729 AC_CHECK_FUNCS(isfinite)
730 AC_CHECK_FUNCS(_isfinite)
731 AC_CHECK_FUNCS(fsync)
732 AC_CHECK_FUNCS(fileno)
733 AC_CHECK_FUNCS(copyfile)
735 # check for bool (must come late, since CFLAGS/includes might affect it)
736 AC_CHECK_TYPES([bool])
742 #############
743 # Check integer sizes, set to zero if e.g. long long is not supported.
744 # (Note: this must come *after* type checks for the corresponding types!)
745 #############
746 AC_CHECK_SIZEOF(int)
747 AC_CHECK_SIZEOF(long int)
748 AC_CHECK_SIZEOF(long long int)
749 AC_CHECK_SIZEOF(off_t)
750 AC_CHECK_SIZEOF(void*)
754 # Apple OS X is a bit strange/braindead in that it always reports itself as i386, both for
755 # 32 and 64 bit builds (even with the 64 bit kernel!).
757 # To get the SSE support right we check for the size of void * that we detected above...
758 case "${host_vendor}-${host_os}" in
759   apple-darwin*)
760   if test $ac_cv_sizeof_voidp = 8; then
761      enable_ia32_sse=no;
762   else
763      enable_x86_64_sse=no;
764   fi
765   ;;
766   *) ;;
767 esac
772 #####
773 # Look for X
774 AC_PATH_XTRA
775 if test "$no_x" != "yes"; then
776   LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
777   INCLUDES="$INCLUDES $X_CFLAGS"
778   AM_CONDITIONAL(USE_X11,true)
779 else
780   AM_CONDITIONAL(USE_X11,false)
783 # GNU Scientific Library or not
784 AC_ARG_WITH(gsl,
785  [AC_HELP_STRING([--with-gsl],[Link to the GNU scientific library, ]
786                  [enables extra functions in analysis])],,with_gsl=no)
788 ######
789 if test "$with_gsl" = "yes"; then
790   ac_save_LDFLAGS="$LDFLAGS"
791   AC_CHECK_HEADERS([gsl/gsl_version.h],[
792 # header found, check for libraries 
793   AC_CHECK_LIB(gslcblas,main,[
794   LDFLAGS="$ac_save_LDFLAGS -lgslcblas"
795 # gslcblas library found, check main lib
796   AC_CHECK_LIB(gsl,main)])])
797   PKG_GSL="gsl"
798   AC_SUBST(PKG_GSL)
802 ######
803 # Use OpenMM libraries
804 ######
805 AC_ARG_WITH(openmm,
806  [  --with-openmm                 Use the OpenMM libraries to run on GPUs],,with_openmm=no)
808 if test "$with_openmm" = "yes"; then
810   AC_PROG_CXX
811   CPPFLAGS="$CPPFLAGS -I$OPENMM_INSTALL_DIR/include"
812   INCLUDES="$INCLUDES -I$OPENMM_INSTALL_DIR/include"
813   LDFLAGS="$LDFLAGS -L$OPENMM_INSTALL_DIR/lib -lOpenMM"
814   #AC_CHECK_HEADERS([OpenMM.h],AC_CHECK_LIB(OpenMM,main))
815   #AC_CHECK_HEADERS([OpenMM.h],,AC_MSG_ERROR([Cannot find OpenMM.h file. Please set OPENMM_INSTALL_DIR.]))
816   AC_DEFINE([USE_OPENMM],,[Use OpenMM libraries to run on GPUs])
818 #  AS_CASE([${host_cpu}-${host_os}-${host_vendor}],
819 #    [i?86-linux*], [OPENMM_HOST=linux32],
820 #    [x86_64-linux*], [OPENMM_HOST=linux64],
821 #    [amd64-linux*], [OPENMM_HOST=linux64],
822 #    [i?86-darwin*-apple], [OPENMM_HOST=apple],
823 #    [OPENMM_HOST=""])
824 #  AC_SUBST([OPENMM_HOST])
827 AM_CONDITIONAL([USE_OPENMM],[test "$with_openmm" = "yes"])
830 AC_ARG_WITH(xml,
831  [AC_HELP_STRING([--without-xml],[do not link to the xml2 library,] 
832                  [disallows the use of certain file formats])],,with_xml=yes)
834 #########
835 # Check for libxml2, but it is optional, so dont stop
836 # if it isnt there.
837 if test "$with_xml" = "yes"; then
838    ac_save_CPPFLAGS="$CPPFLAGS"
839    CPPFLAGS="$ac_save_CPPFLAGS -I/usr/include/libxml2"
840    AC_CHECK_HEADERS([libxml/parser.h],AC_CHECK_LIB(xml2,main))
841    if test "$ac_cv_lib_xml2_main" = "yes"; then
842      INCLUDES="$INCLUDES -I/usr/include/libxml2"
843      PKG_XML2="libxml-2.0"
844      AC_SUBST(PKG_XML2)
845      if test "$enable_all_static" = "yes"; then
846        LDFLAGS_RET=$LDFLAGS
847        LDFLAGS="-static $LDFLAGS"
848        LIBS_RET="$LIBS"
849        LIBS="$LIBS -lz"
850        AC_MSG_CHECKING(for broken libxml2)
851        AC_TRY_RUN([
852 #include <libxml/parser.h>
853 main() {
854   xmlInitParser();
855   return 0;
857        AC_MSG_RESULT([no]),[AC_MSG_RESULT([yes])
858        AC_MSG_ERROR([Your libxml2 is broken for static linking, recompile it without threads or build gromacs without libxml])],[-lz])
859        LDFLAGS=$LDFLAGS_RET
860        LIBS="$LIBS_RET"
861      fi
862    fi
863 # restore CPPFLAGS
864    CPPFLAGS="$ac_save_CPPFLAGS"
867 #### 
868 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
869 # and we need -L/usr/ucblib to find libucb... (stupid OS)
870 # On e.g. ibm the mass libraries must come before -lm... 
871 case "${host_cpu}-${host_os}" in
872   *-solaris*) 
873     LIBS="$FLIBS $LIBS" 
874     LDFLAGS="$LDFLAGS -L/usr/ucblib"
875     ;;
876   *) LIBS="$LIBS $FLIBS" ;;
877 esac
880 # add the Accelerate framework if enabled above.
881 # LDFLAGS might have been set in the CPU optimization, so we cant assign it directly before that.
882 LDFLAGS="$LDFLAGS $extra_LDFLAGS"
889 #####
890 # Checks for typedefs, structures, and compiler characteristics.
891 AC_C_CONST
892 AC_TYPE_SIZE_T
893 AC_STRUCT_TM
894 AC_C_INLINE
896 # AC_TYPE_UID_T is broken on Mac OS X, so use generic tests instead
897 AC_CHECK_TYPES([uid_t],[],[AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
898 AC_CHECK_TYPES([gid_t],[],[AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
900 AC_CHECK_TYPES([sig_atomic_t],[],[AC_DEFINE(sig_atomic_t, int, [Define to `int' (and hope it's atomic) if <signal.h> doesn't define it.])],[[#include <signal.h>]])
902     
905 # Test stuff for ia32 and x86_64 assembly, and add objects/libraries.
906 if test "$enable_ia32_sse" = "yes" -o "$enable_x86_64_sse" = "yes"; then
907   AC_MSG_CHECKING([whether your compiler can handle assembly files (*.s)])
909 # Use 64-bit registers (rsp/rbp) on x86_64
911 if test "$enable_x86_64_sse" = "yes"; then
912 cat > conftestasm.s << EOF
913 checkasm:
914         mov     %rsp, %rbp
915         ret
917 else
918 cat > conftestasm.s << EOF
919 checkasm:
920         movl    %esp, %ebp
921         ret
924   if AC_TRY_COMMAND($CC $CFLAGS -c conftestasm.s); then
925     if test -f conftestasm.o; then
926       AC_MSG_RESULT([yes])
927     else
928       AC_MSG_RESULT([no])
929       AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
930     fi
931   else
932     AC_MSG_RESULT([no])
933     AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
934   fi
936 # ok, cc understands assembly.
938 # If we are using double precision we need SSE2
939   if test "$enable_float" = "no"; then
940 #   test SSE2 on ia32:
941     if test "$enable_ia32_sse" = "yes"; then
942       AC_MSG_CHECKING([whether as fully supports ia32 SSE2])
943 cat > conftest.s << EOF
944 checkasm:
945         emms
946         movapd 32(%esi,%edx,8),%xmm4
947         emms
948         ret
950       if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
951         AC_MSG_RESULT([yes])
952       else
953         AC_MSG_RESULT([no])
954         AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
955       fi
956       AC_DEFINE([GMX_IA32_SSE2],,[Double-precision SSE2 instructions on ia32])
957     fi
958 #   test SSE2 on X86_64:
959     if test "$enable_x86_64_sse" = "yes"; then
960       AC_MSG_CHECKING([whether as fully supports X86_64 SSE2])
961 cat > conftest.s << EOF
962 checkasm:
963         emms
964         movapd 32(%rsi,%rdx,8),%xmm4
965         emms
966         ret
968       if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
969         AC_MSG_RESULT([yes])
970       else
971         AC_MSG_RESULT([no])
972         AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
973       fi
974       AC_DEFINE([GMX_X86_64_SSE2],,[Double-precision SSE2 instructions on X86_64])
975     fi
976   else
977 # end of double precision testing, now do single.
978     if test "$enable_ia32_sse" = "yes"; then
979       AC_MSG_CHECKING([whether as fully supports ia32 SSE])
980 cat > conftest.s << EOF
981 checkasm:
982         emms
983         movaps 32(%esi,%edx,8),%xmm4
984         emms
985         ret
987       if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
988         AC_MSG_RESULT([yes])
989       else
990         AC_MSG_RESULT([no])
991         AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
992       fi
993       AC_DEFINE([GMX_IA32_SSE],,[Single-precision SSE instructions on ia32])
994     fi
995 #   test SSE2 on X86_64:
996     if test "$enable_x86_64_sse" = "yes"; then
997       AC_MSG_CHECKING([whether as fully supports X86_64 SSE instructions])
998 cat > conftest.s << EOF
999 checkasm:
1000         emms
1001         movaps 32(%rsi,%rdx,8),%xmm4
1002         emms
1003         ret
1005       if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
1006         AC_MSG_RESULT([yes])
1007       else
1008         AC_MSG_RESULT([no])
1009         AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
1010       fi
1011       AC_DEFINE([GMX_X86_64_SSE],,[Single-precision SSE instructions on X86_64])
1012     fi
1013   fi
1017 # Test stuff for ia64 assembly
1019 # Nothing to test right now.
1022   
1025 # Test altivec support.
1027 if test "$enable_ppc_altivec" = "yes"; then
1028   if test "$enable_float" = "no"; then
1029     AC_MSG_WARN([PowerPC Altivec loops can only be used in single precision - disabling])
1030     enable_ppc_altivec=no
1031   else 
1032     # On FSF (vanilla) GCC we must include altivec.h, and on apple we 
1033     # should NOT do it after using -faltivec. Go figure...
1034     case "${host_os}" in
1035     darwin*)                            
1036         # do nothing on Apple systems
1037        ;;
1038     *)
1039         AC_CHECK_HEADERS([altivec.h])
1040        ;;
1041     esac
1043     AC_MSG_CHECKING([whether the compiler supports altivec extensions])
1044     AC_TRY_COMPILE([],[
1045 #ifndef __VEC__
1046 choke_me
1047 #endif
1049     AC_MSG_RESULT([yes])
1050     AC_DEFINE([GMX_PPC_ALTIVEC],,[Use PowerPC Altivec inner loops])],[
1051       AC_MSG_RESULT([no])
1052       AC_MSG_WARN([no altivec support found - On recent PowerPC CPUs]
1053 [you can get a huge performance gain by using an altivec-enabled compiler.]
1054 [On OS X, you need GCC>=3.3, or the IBM compilers. If you are using standard]
1055 [GCC, you need at least version 4.0])
1056       enable_ppc_altivec=no])
1057   fi  
1060 if test "$enable_ia64_asm" = "yes"; then
1061   AC_DEFINE(GMX_IA64_ASM,,[Use ia64 assembly tuned for Itanium2])
1062   AC_DEFINE(DISABLE_WATER_NLIST,,[Turn off all water neighborlist optimization])
1063   AC_DEFINE(DISABLE_WATERWATER_NLIST,,[Turn off water-water neighborlist optimization only])
1066 if test "$enable_bluegene" = "yes"; then
1067   AC_DEFINE(GMX_BLUEGENE,,[Use assembly intrinsics kernels for BlueGene])
1071 # Add the appropriate assembly loops 
1073 AM_CONDITIONAL([GMX_IA32_SSE],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "yes"])
1074 AM_CONDITIONAL([GMX_IA32_SSE2],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "no"])
1075 AM_CONDITIONAL([GMX_X86_64_SSE],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "yes"])
1076 AM_CONDITIONAL([GMX_X86_64_SSE2],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "no"])
1077 AM_CONDITIONAL([GMX_FORTRAN],[test "$enable_fortran" = "yes"])
1078 AM_CONDITIONAL([GMX_PPC_ALTIVEC],[test "$enable_ppc_altivec" = "yes" -a "$enable_float" = "yes"])
1079 AM_CONDITIONAL([GMX_IA64_ASM],[test "$enable_ia64_asm" = "yes"])
1080 AM_CONDITIONAL([GMX_BLUEGENE],[test "$enable_bluegene" = "yes"])
1081 AM_CONDITIONAL([GMX_POWER6],[test "$enable_power6" = "yes"])
1084 #############
1085 # Check integer endian
1086 #############
1087 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
1088 AC_MSG_ERROR([Cannot determine endian in compiled output])])
1089 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
1093 case "${host_cpu}" in
1094    i?86) 
1095          # Check if inline assembly works
1096          AC_MSG_CHECKING(if the compiler supports gcc inline assembly)
1097       AC_TRY_LINK([],[float f;int i; asm("fld %1\nfistpl %0\n" : "=m" (*&i) : "f" (f));],[AC_MSG_RESULT(yes)
1098 AC_DEFINE(GMX_X86_GCC_INLINE_ASM,,[Enable x86 gcc inline assembly])],[AC_MSG_RESULT(no)])
1099          # Check for MSVC inline assembly
1100      AC_MSG_CHECKING(if the compiler supports MSVC inline assembly)
1101       AC_TRY_LINK([],[float f;int i; _asm { fld f } ; _asm { fistpl i };],[AC_MSG_RESULT(yes)
1102 AC_DEFINE(GMX_X86_MSVC_INLINE_ASM,,[Enable x86 MSVC inline assembly])],[AC_MSG_RESULT(no)])
1103         ;;              
1104    *) ;;
1105 esac
1108 ############
1109 # Check dlopen
1110 ###########
1111 if test "$with_dlopen" = "yes"; then
1112       AC_MSG_CHECKING(if dlopen supported)
1113       CFLAGS_RET=$CFLAGS
1114       #LDFLAGS="$lt_cv_dlopen_libs $LDFLAGS" #can't make the macro, which is getting lt_cv_dlopen_libs, to work
1115       LDFLAGS_RET=$LDFLAGS
1116       if test "$enable_all_static" = "yes"; then  #make sure we test also whether it works static
1117          LDFLAGS="$LDFLAGS -static"
1118       fi
1119       CFLAGS="-I$srcdir/include -DGMX_DLOPEN $CFLAGS"
1120       AC_TRY_LINK([#include "$srcdir/src/gmxlib/vmddlopen.c"],,[AC_MSG_RESULT([yes])\
1121         AC_DEFINE(GMX_DLOPEN,,[Compile with dlopen])],AC_MSG_RESULT([no]))
1122       CFLAGS=$CFLAGS_RET
1123       LDFLAGS=$LDFLAGS_RET
1129 ########################################################################
1130 # Final output stage
1131 ########################################################################
1132 AS="$CC"
1133 AC_SUBST(ASFLAGS)
1134 AC_SUBST(AS)
1135 AC_SUBST(INCLUDES)          # should be automatic, but doesnt seem to be?
1137 # To tell libraries apart, we use four versions of the name. For instance, libgmx:
1138 # libgmx                single prec, no mpi.
1139 # libgmx_d              double prec, no mpi.
1140 # libgmx_mpi            single prec, mpi.
1141 # libgmx_mpi_d          double prec, mpi.
1142 # However, the non-suffixed names are linked to the _mpi and/or _d suffixed
1143 # ones upon installation if that is the only version available.
1145 if test "$enable_mpi" = "yes"; then
1146   LIBSUFFIX="_mpi"
1148 if test "$enable_float" = "no"; then
1149   LIBSUFFIX="${LIBSUFFIX}_d"
1151 AC_SUBST(LIBSUFFIX) 
1153 # Unless the user has explicitly requested a prefix/suffix/transform, we
1154 # use _d on double precision files. Don't add anything for mpi, but at the
1155 # end we tell the user it is possible and smart to do in some cases!
1156 if test "$program_transform_name" = "s,x,x,"; then
1157   name_transform_provided=no;
1158   if test "$enable_float" = "no"; then
1159     program_transform_name="s,\$\$,_d,"
1160   fi
1161 else
1162   name_transform_provided=yes;
1166 # Use a variable for RPM - this way it can be 
1167 # overridden with make RPM=rpm3 rpm
1168 RPM=rpm
1169 AC_SUBST(RPM)
1171 if test "$enable_fahcore" = "yes"; then  
1172   CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/../corewrap -include swindirect.h -DFULLINDIRECT -DUSE_FAH_XDR"  
1173   if test "$enable_mpi" = "yes"; then 
1174     CFLAGS="$CFLAGS -DMPI"  
1175   fi
1177 AM_CONDITIONAL([GMX_FAHCORE],[test "$enable_fahcore" = "yes"])
1180 if test "$enable_all_static" = "yes"; then
1181   LDFLAGS="$LDFLAGS -all-static"
1184 # we have asm source, so this is necessary for automake 1.6
1185 CCAS=$CC
1186 CCASFLAGS=$CFLAGS
1188 AC_SUBST(CCAS)
1189 AC_SUBST(CCASFLAGS)
1191 AC_CONFIG_FILES([ Makefile ])
1192 AC_CONFIG_FILES([ src/Makefile ])
1193 AC_CONFIG_FILES([ src/gmxlib/Makefile ])
1194 AC_CONFIG_FILES([ src/gmxlib/libgmx${LIBSUFFIX}.pc:src/gmxlib/libgmx.pc.in ])
1195 AC_CONFIG_FILES([ src/gmxlib/gmx_blas/Makefile ])
1196 AC_CONFIG_FILES([ src/gmxlib/gmx_lapack/Makefile ])
1197 AC_CONFIG_FILES([ src/gmxlib/selection/Makefile ])
1198 AC_CONFIG_FILES([ src/gmxlib/statistics/Makefile ])
1199 AC_CONFIG_FILES([ src/gmxlib/trajana/Makefile ])
1200 AC_CONFIG_FILES([ src/gmxlib/thread_mpi/Makefile ])
1201 AC_CONFIG_FILES([ src/gmxlib/nonbonded/Makefile ])
1202 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_c/Makefile ])
1203 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse/Makefile ])
1204 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse2/Makefile ])
1205 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse/Makefile ])
1206 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse2/Makefile ])
1207 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ppc_altivec/Makefile ])
1208 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_single/Makefile ])
1209 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_double/Makefile ])
1210 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_bluegene/Makefile ])
1211 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_power6/Makefile ])
1212 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_single/Makefile ])
1213 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_double/Makefile ])
1214 AC_CONFIG_FILES([ include/Makefile ])
1215 AC_CONFIG_FILES([ include/types/Makefile ])
1216 AC_CONFIG_FILES([ include/thread_mpi/Makefile ])
1217 AC_CONFIG_FILES([ include/thread_mpi/atomic/Makefile ])
1218 AC_CONFIG_FILES([ src/mdlib/Makefile ])
1219 AC_CONFIG_FILES([ src/mdlib/libmd${LIBSUFFIX}.pc:src/mdlib/libmd.pc.in ])
1220 AC_CONFIG_FILES([ src/kernel/Makefile ])
1221 AC_CONFIG_FILES([ src/kernel/libgmxpreprocess${LIBSUFFIX}.pc:src/kernel/libgmxpreprocess.pc.in ])
1222 AC_CONFIG_FILES([ src/tools/Makefile ])
1223 AC_CONFIG_FILES([ src/tools/libgmxana${LIBSUFFIX}.pc:src/tools/libgmxana.pc.in ])
1224 AC_CONFIG_FILES([ src/ngmx/Makefile ])
1225 AC_CONFIG_FILES([ src/contrib/Makefile ])
1226 AC_CONFIG_FILES([ scripts/Makefile ])
1227 AC_CONFIG_FILES([ admin/Makefile ])
1228 AC_CONFIG_FILES([ share/Makefile ])
1229 AC_CONFIG_FILES([ share/tutor/Makefile ])
1230 AC_CONFIG_FILES([ share/tutor/gmxdemo/Makefile ])
1231 AC_CONFIG_FILES([ share/tutor/nmr1/Makefile ])
1232 AC_CONFIG_FILES([ share/tutor/nmr2/Makefile ])
1233 AC_CONFIG_FILES([ share/tutor/water/Makefile ])
1234 AC_CONFIG_FILES([ share/tutor/mixed/Makefile ])
1235 AC_CONFIG_FILES([ share/tutor/methanol/Makefile ])
1236 AC_CONFIG_FILES([ share/tutor/speptide/Makefile ])
1237 AC_CONFIG_FILES([ share/template/Makefile ])
1238 AC_CONFIG_FILES([ share/top/Makefile ])
1239 AC_CONFIG_FILES([ share/top/gmx.ff/Makefile ])
1240 AC_CONFIG_FILES([ share/top/gmx2.ff/Makefile ])
1241 AC_CONFIG_FILES([ share/top/encadv.ff/Makefile ])
1242 AC_CONFIG_FILES([ share/top/encads.ff/Makefile ])
1243 AC_CONFIG_FILES([ share/top/oplsaa.ff/Makefile ])
1244 AC_CONFIG_FILES([ share/top/gromos43a1.ff/Makefile ])
1245 AC_CONFIG_FILES([ share/top/gromos43a2.ff/Makefile ])
1246 AC_CONFIG_FILES([ share/top/gromos45a3.ff/Makefile ])
1247 AC_CONFIG_FILES([ share/top/gromos53a5.ff/Makefile ])
1248 AC_CONFIG_FILES([ share/top/gromos53a6.ff/Makefile ])
1249 AC_CONFIG_FILES([ share/top/charmm27.ff/Makefile ])
1250 AC_CONFIG_FILES([ share/html/Makefile ])
1251 AC_CONFIG_FILES([ share/html/images/Makefile ])
1252 AC_CONFIG_FILES([ share/html/online/Makefile ])
1253 AC_CONFIG_FILES([ man/Makefile man/man1/Makefile man/man7/Makefile ])
1254 AC_CONFIG_FILES([ Doxyfile ])
1255 AC_OUTPUT
1263 #########################################################
1264 # Echo some important info, to avoid stupid mistakes
1267 if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
1268   echo ""
1269   echo "* You are compiling a double precision version of Gromacs -"
1270   echo "  program names will be suffixed with _d to avoid overwriting single"
1271   echo "  precision files. You can override it with --program-suffix"
1274 if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
1275   echo ""
1276   echo "* Seems you are compiling with MPI support. You can install the MPI-"
1277   echo "  enabled programs with suffixed names to have both MPI and non-MPI"
1278   echo "  versions. This is useful e.g. on supercomputers where you usually"
1279   echo "  cannot run MPI-linked programs on the login node."
1280   echo "  Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
1281   echo "  You only need MPI for mdrun, so if you already have non-MPI stuff"
1282   echo "  installed you can issue make mdrun; make install-mdrun."
1285 if test "$enable_shared" = "no"; then
1286   echo ""
1287   echo "* On most platforms you can save 10X space with dynamic libraries, although"
1288   echo "  the binaries might be less portable. Why not try --enable-shared ?"
1289 fi  
1292 if test "$tmpi_atomics" = "no"; then
1293   echo ""
1294   echo "* This compiler+CPU combination doesn't have working atomic operations."
1295   echo "  Thread support will be unbearably slow: the default number of threads"
1296   echo "  is set to 1."
1297   echo "  Atomics should work on all but the most obscure CPU+compiler"
1298   echo "  combinations; if your system is not obscure (like, for example, x86"
1299   echo "  with gcc) please contact the developers."
1300   echo ""