1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
6 AC_INIT(gromacs, 4.0.99_development_20090605, [gmx-users@gromacs.org])
7 AC_CONFIG_SRCDIR(src/gmxlib/3dview.c)
8 AC_CONFIG_AUX_DIR(config)
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)
23 #######################################################################
24 # Simple options and makefile variables
25 #######################################################################
30 [AC_HELP_STRING([--disable-float],
31 [Use double instead of single precision])],, enable_float=yes)
34 [AC_HELP_STRING([--enable-double],
35 [Same effect as --disable-float])],, enable_double=no)
36 if test "$enable_double" = "yes"; then
39 if test "$enable_float" = "no"; then
40 AC_DEFINE(GMX_DOUBLE,,[Compile in double precision])
42 AM_CONDITIONAL([GMX_DOUBLE],[test "$enable_float" = "no"])
47 AC_ARG_ENABLE(fortran,
48 [AC_HELP_STRING([--enable-fortran],
49 [Use Fortran kernels])],,
50 [case "${host_cpu}-${host_os}" in
51 sparc*-solaris* | alpha*-* | rs6000*-aix* | powerpc*-aix* | mips*-irix*) enable_fortran=yes ;;
52 *) enable_fortran=no ;;
54 if test "$enable_fortran" = "yes"; then
55 AC_DEFINE(GMX_FORTRAN,,[Enable Fortran support])
57 # Generic fortran kernels will be turned off below if you enable power6-specific optimization!
58 # always use CC for linking:
59 AC_SUBST(F77LINK,"\$(LINK)")
67 [AC_HELP_STRING([--enable-mpi],
68 [Compile for parallel runs using MPI])],,enable_mpi=no)
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 ;;
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 AC_ARG_ENABLE(apple_64bit,
84 [AC_HELP_STRING([--enable-apple-64bit],
85 [Build 64bit binaries for newer Macs])],,enable_apple_64bit=no)
88 [AC_HELP_STRING([--enable-debug],
89 [Add -g to other command line arguments])],,enable_debug=no)
91 ### IA32 assembly code
92 AC_ARG_ENABLE(ia32_sse,
93 [AC_HELP_STRING([--disable-ia32-sse],
94 [Don't build SSE/SSE2 assembly loops on ia32])],,enable_ia32_sse=yes)
95 case "${host_cpu}-${host_vendor}" in
97 if test "$enable_apple_64bit" = "yes"; then
102 *) enable_ia32_sse=no ;;
105 ### AMD64 assembly code
106 AC_ARG_ENABLE(x86_64_sse,
107 [AC_HELP_STRING([--disable-x86-64-sse],
108 [Don't build SSE assembly loops on X86_64])],,enable_x86_64_sse=yes)
109 case "${host_cpu}-${host_vendor}" in
110 x86_64-* | amd64-*) ;;
112 if test "$enable_apple_64bit" != "yes"; then
113 enable_x86_64_sse=no;
116 *) enable_x86_64_sse=no ;;
120 ### Altivec on powerpc (motorola)
121 AC_ARG_ENABLE(ppc_altivec,
122 [AC_HELP_STRING([--disable-ppc-altivec],
123 [Don't build Altivec loops on PowerPC])],,enable_ppc_altivec=undef)
124 # Power3/4/5 running AIX does not support altivec. We identify this with vendor=IBM.
125 # IBM powerpc 970 boxes run linux, and have vendor=unknown.
126 if test "$enable_ppc_altivec" = "undef"; then
127 case "${host_cpu}-${host_vendor}" in
128 ppc*-ibm* | powerpc*-ibm*) enable_ppc_altivec=no ;;
129 ppc*-* | powerpc*-*) enable_ppc_altivec=yes ;;
130 *) enable_ppc_altivec=no ;;
136 ### ia64 assembly code
137 AC_ARG_ENABLE(ia64_asm,
138 [AC_HELP_STRING([--disable-ia64-asm],
139 [Don't build assembly loops on ia64])],,enable_ia64_asm=yes)
140 case "${host_cpu}" in
142 *) enable_ia64_asm=no ;;
146 # IBM Power6-specific optimization
147 AC_ARG_ENABLE(power6,
148 [AC_HELP_STRING([--enable-power6],
149 [Use IBM Pwr6/PPC440/PPC450-specific F77 kernels])],,enable_power6=no)
150 # Turn off generic fortran loops if we are using power6-specific optimization
151 if test "$enable_power6" = "yes"; then
155 AC_ARG_ENABLE(bluegene,
156 [AC_HELP_STRING([--enable-bluegene],
157 [Build assembly intrinsics kernels on bluegene])],,enable_bluegene=no)
160 ### Optimize for host cpu version
161 AC_ARG_ENABLE(cpu-optimization,
162 [AC_HELP_STRING([--disable-cpu-optimization],
163 [No detection or tuning flags for cpu version])],, enable_cpu_optimization=yes)
166 ### Do software 1/sqrt(x)
167 AC_ARG_ENABLE(software-invsqrt,
168 [AC_HELP_STRING([--disable-software-invsqrt],
169 [No software 1/sqrt (disabled on sgi,ibm,ia64)])],,
170 [case "${host_cpu}-${host_os}" in
171 mips*-irix* | rs6000*-aix* | powerpc*-aix | ia64*-*) enable_software_invsqrt=no ;;
172 *) enable_software_invsqrt=yes ;;
174 if test "$enable_software_invsqrt" = "yes"; then
175 AC_DEFINE(GMX_SOFTWARE_INVSQRT,,[Use the GROMACS software 1/sqrt(x)])
177 AM_CONDITIONAL([GMX_SOFTWARE_INVSQRT],[test "$enable_software_invsqrt" = "yes"])
179 AC_ARG_ENABLE(fahcore,
180 [AC_HELP_STRING([--enable-fahcore],
181 [Create a library with mdrun functionality])],, enable_fahcore=no)
185 # The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
186 # instructions dynamically at runtime, so they might not make much difference now:
189 AC_ARG_ENABLE(all-static,
190 [AC_HELP_STRING([--enable-all-static],
191 [Make completely static binaries])],, enable_all_static=no)
192 # Dont add the -all-static flag until after the compiler test.
195 # FFT libraries - only use one...
197 [AC_HELP_STRING([--with-fft=@<:@fftw3/fftw2/mkl(>=6.0)/fftpack@:>@],
198 [FFT library to use. fftw3 is default, fftpack built in.])],,
201 AC_ARG_ENABLE(fftw-measure,
202 [AC_HELP_STRING([--disable-fftw-measure],
203 [Dont optimize FFTs. This produces binary exactly]
204 [reproducible runs (as the -reprod flag to mdrun),]
205 [and if you are using FFTW on x86 and specified its]
206 [--enable-sse/sse2 flag (NOT default in FFTW!) the]
207 [kernels used are close-to-optimal anyway.])],,
208 enable_fftw_measure=yes)
212 [AC_HELP_STRING([--with-threads=@<:@pthreads@:>@],
213 [Use threads instead of MPI for decomposition])],,with_threads=no)
214 if test "$with_threads" = "yes"; then
215 with_threads=pthreads;
219 ### Use external BLAS/LAPACK libraries if the user wants to.
221 AC_ARG_WITH(external_blas,
222 [AC_HELP_STRING([--with-external-blas],
223 [Use system BLAS library (add to LIBS). Automatic on OS X.])],,
225 # default action - check if we are on OS X
226 case "${host_vendor}-${host_os}" in
227 apple-darwin*) with_external_blas="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
228 *) with_external_blas="no" ;;
231 AM_CONDITIONAL([GMX_EXTERNAL_BLAS], [test "$with_external_blas" = "yes"])
234 AC_ARG_WITH(external_lapack,
235 [AC_HELP_STRING([--with-external-lapack],
236 [Use system LAPACK library (add to LIBS). Automatic on OS X.])],,
238 # default action - check if we are on OS X
239 case "${host_vendor}-${host_os}" in
240 apple-darwin*) with_external_lapack="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
241 *) with_external_lapack="no" ;;
244 AM_CONDITIONAL([GMX_EXTERNAL_LAPACK], [test "$with_external_lapack" = "yes"])
249 AC_ARG_WITH(qmmm_gaussian,
250 [AC_HELP_STRING([--without-qmmm-gaussian],
251 [Use modified Gaussian0x for QM-MM (see website)])],,with_qmmm_gaussian=yes)
252 if test "$with_qmmm_gaussian" = "yes"; then
253 AC_DEFINE(GMX_QMMM_GAUSSIAN,,[Use (modified) Gaussian0x for QM-MM calculations])
257 AC_ARG_WITH(qmmm_gamess,
258 [AC_HELP_STRING([--without-qmmm-gamess],
259 [Use modified Gamess-UK for QM-MM (see website)])],,with_qmmm_gamess=no)
260 if test "$with_qmmm_gamess" = "yes"; then
261 AC_DEFINE(GMX_QMMM_GAMESS,,[Use (modified) Gamess-UK for QM-MM calculations])
265 AC_ARG_WITH(qmmm_mopac,
266 [AC_HELP_STRING([--without-qmmm-mopac],
267 [Use modified Mopac 7 for QM-MM (see website)])],,with_qmmm_mopac=no)
268 if test "$with_qmmm_mopac" = "yes"; then
269 AC_DEFINE(GMX_QMMM_MOPAC,,[Use (modified) Mopac 7 for QM-MM calculations])
273 ############################################################
274 # Add some debug info: Who is building, and on what machine?
275 ############################################################
276 AC_DEFINE_UNQUOTED([BUILD_TIME],["`date`"],[Date and time for build])
277 AC_DEFINE_UNQUOTED([BUILD_USER],["`whoami`@`hostname`"],[User doing build])
278 AC_DEFINE_UNQUOTED([BUILD_MACHINE],["`uname -srm`"],[Hardware and OS version for build host])
282 ############################################################
283 # Checks for programs
284 ############################################################
286 # normally we use the default compiler, but on alpha/linux we try the compaq ones first
287 case "${host_cpu}-${host_os}" in
289 cc_names="ccc cc gcc"
290 f77_names="fort f77 g77"
293 cc_names="cc icc xlc gcc"
294 f77_names="f77 ifort xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
297 # the (non-mpi) c compiler, which is also used for programs executed during build stage
298 AC_PROG_CC( $cc_names )
299 # Check for environment variable CC_FOR_BUILD before overwriting it
300 if test -z "$CC_FOR_BUILD"; then
303 AC_SUBST(CC_FOR_BUILD)
305 if test "$enable_fortran" = "yes"; then
306 AC_PROG_F77( $f77_names )
307 if test -z "$F77"; then
308 AC_MSG_ERROR([No fortran compiler found])
314 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
315 # above, since autoconf checks that the created file can be executed. This would
316 # fail on platforms where MPI executables can only be run through a batchqueue.
318 if test "$enable_mpi" = "yes"; then
319 AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)
320 # now change the normal cc to the MPI one - see the comment above.
322 AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
323 AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
324 AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
325 AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
326 AC_DEFINE(GMX_LIB_MPI,,[Use a real MPI library])
328 # on the cray xt3 we have to tell autoconf that we
329 # are actually cross-compiling even if the architecture
330 # of host and target are the same. so we enforce
331 # cross-compilation if __QK_USER__ is defined
332 AC_MSG_CHECKING([for catamount])
334 #if defined __QK_USER__
341 AC_DEFINE(GMX_CRAY_XT3,[],[Enable special hacks for Cray XT3])
342 AC_DEFINE(GMX_NO_SYSTEM,[],[Ignore calls to system(3)])
343 AC_DEFINE(GMX_NO_NICE,[],[Ignore calls to nice(3)])
344 AC_DEFINE(GMX_BROKEN_CALLOC,[],[Don't use calloc(3)])
345 extra_LDFLAGS="$extra_LDFLAGS -lgmalloc -lacml"
349 # end of "$enable_mpi" = "yes"
352 if test "$with_threads" = "pthreads"; then
353 AC_CHECK_HEADER([pthread.h],,[AC_MSG_ERROR([Cannot find pthread.h - required for pthread support!])])
354 if test "$enable_mpi" = "yes"; then
355 AC_MSG_ERROR([Cannot use both threads and MPI - yet.])
357 AC_DEFINE([GMX_THREAD_PTHREADS],,[Use pthreads for Gromacs multithreading])
362 AH_TEMPLATE([F77_OR_C_FUNC],
363 [Set to F77_FUNC(name,NAME) if Fortran used, otherwise 'name' for C.])
364 AH_TEMPLATE([F77_OR_C_FUNC_],
365 [Set to F77_FUNC_(name,NAME) if Fortran used, otherwise 'name' for C.])
369 if test "$enable_fortran" = "yes"; then
370 AC_F77_LIBRARY_LDFLAGS
372 AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[F77_FUNC(name,NAME)])
373 AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[F77_FUNC_(name,NAME)])
375 AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[name])
376 AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[name])
382 # Needed by libtool scripts?
385 if test "$enable_cpu_optimization" = "yes"; then
396 # Check integer endian
398 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
399 AC_MSG_ERROR([Cannot determine endian in compiled output])])
400 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
403 # Make sure size_t can hold pointers.
404 # On some Nec machines, you reportedly need to specify a flag for size_t to be 64 bits wide.
406 AC_MSG_CHECKING([that size_t can hold pointers])
410 ],[int chk[sizeof(size_t)-sizeof(int *)+1];],AC_MSG_RESULT([yes]),[
411 AC_MSG_ERROR([size_t is smaller than int*. Check if your compiler needs a flag to make it 64 bit.])])
415 # Check that SIGUSR1 is defined
417 AC_MSG_CHECKING([for SIGUSR1])
418 AC_TRY_COMPILE([#include <signal.h>],[int i=SIGUSR1;],[
420 AC_DEFINE(HAVE_SIGUSR1,,[SIGUSR1 supported and defined])
421 ],AC_MSG_RESULT([no]))
424 # Check if pipes are supported
426 AC_MSG_CHECKING([for pipes])
427 AC_TRY_COMPILE([#include <stdio.h>],[
428 FILE *pipe=popen("/tmp/pipe","r");
431 AC_DEFINE(HAVE_PIPES,,[Pipes (popen/pclose) supported])
432 ],AC_MSG_RESULT([no]))
437 # Check floating-point format and endian
449 # Use our own version of AC_FUNC_FSEEKO from autoconf 2.63 instead
450 # of the broken one we might get from autoconf 2.61.
451 ACX_FUNC_FSEEKO_FIXED
456 ############################################################################
457 # Checks for libraries.
458 ############################################################################
460 # Don't add math library for intel compilers
461 if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
462 AC_MSG_NOTICE([Using built-in math library with intel compiler])
464 AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
468 # Disable MASS support for now.
474 if test "$enable_float" = "yes"; then
479 ACX_CHECK_FFTW2(fftw,$sizeof_real)
480 ACX_CHECK_FFTW2(rfftw,$sizeof_real)
482 case ${ac_fftw_savedprefix} in
483 d) AC_DEFINE(FFTW2_NAME_DFFTW,,[Use the d prefix on fftw2 includes]) ;;
484 s) AC_DEFINE(FFTW2_NAME_SFFTW,,[Use the s prefix on fftw2 includes]) ;;
485 *) AC_DEFINE(FFTW2_NAME_FFTW,,[Dont use any prefix on fftw2 includes]) ;;
488 AC_DEFINE(GMX_FFT_FFTW2,,[Use FFTW2 FFT library])
490 ;; # end of fftw2 check
492 fftw3) # Much simpler check than fftw2
493 # Check for header <fftw3.h> AC_CHECK_HEADERS doesnt work, since we must
494 # use mpicc to get includes - cpp isnt always the same compiler.
495 AC_MSG_CHECKING([for fftw3.h])
496 AC_TRY_COMPILE([#include<fftw3.h>],,[
497 # ok, look for library file too
499 if test "$enable_float" = "yes"; then
500 AC_CHECK_LIB([fftw3f],main,,AC_MSG_ERROR([Cannot find fftw3f library]))
502 AC_CHECK_LIB([fftw3],main,,AC_MSG_ERROR([Cannot find fftw3 library]))
504 AC_DEFINE(GMX_FFT_FFTW3,,[Use FFTW3 FFT library])
506 # not ok, echo a warning
508 [Cannot find the default external FFT library (fftw3).
509 Other alternatives are 'fftw2', or 'mkl' for Intel MKL.
510 You are STRONGLY recommended to use one of these - fftw is free.
512 Use CPPFLAGS and LDFLAGS if the library is installed in a
513 non-standard location. (see FAQ at http://www.gromacs.org)
515 If you dont care about performance you can also specify 'fftpack'
516 to use a slower set of FFTs built into Gromacs.
517 (Just install FFTW3 unless you really know what you are doing).
524 # Intel Math Kernel Library version 6 and later.
526 AC_MSG_CHECKING([for mkl_dfti.h])
527 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.]\
530 # AC_CHECK_LIB([guide],main,,AC_MSG_ERROR([Cannot find libguide (Intel MKL)]))
531 AC_CHECK_LIB([mkl],DftiComputeForward,,
532 AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0]))
534 AC_DEFINE(GMX_FFT_MKL,,[Use Intel MKL FFT library])
538 AC_MSG_WARN([The built-in FFTPACK routines are slow.
539 Are you sure you don't want to use FFTW? It is free and much faster...])
540 AC_DEFINE(GMX_FFT_FFTPACK,,[Use Built-in FFTPACK FFT library])
543 AC_MSG_ERROR([Unknown FFT library])
548 if test "$enable_fftw_measure" != "yes"; then
549 AC_DEFINE(GMX_DISABLE_FFTW_MEASURE,,[Do not optimize FFTW setups (not needed with SSE FFT kernels)])
553 # check for xtc headers
555 cygwin* | mingw*) # use our own xdr stuff for cygwin/mingw
558 AC_CHECK_HEADERS([rpc/rpc.h])
559 AC_CHECK_HEADERS([rpc/xdr.h],,,
561 # include <rpc/rpc.h>
564 AC_CHECK_LIB(nsl,xdr_float)
569 #error NO rpc.h header
574 #error No xdr.h header
576 ],[ XDR *xd; float f; xdr_float(xd,&f);],[have_xdr="yes"])
578 if test "$have_xdr" != "yes"; then
579 AC_DEFINE(GMX_INTERNAL_XDR,,[Use our own instead of system XDR libraries])
580 AC_MSG_WARN([Couldn't find XDR headers and/or libraries - using our own])
586 ########################################################################
587 # Checks for header files and types
588 ########################################################################
590 AC_CHECK_HEADERS([limits.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
591 AC_CHECK_HEADERS(unistd.h)
592 AC_CHECK_HEADERS(sys/types.h)
593 AC_CHECK_HEADERS(sys/time.h)
596 # Checks for additional and/or optional functions or libraries.
603 AC_CHECK_FUNCS(strcasecmp)
604 AC_CHECK_FUNCS(strdup)
605 AC_CHECK_FUNCS(gettimeofday)
607 # check for bool (must come late, since CFLAGS/includes might affect it)
608 AC_CHECK_TYPES([bool])
615 # Check integer sizes, set to zero if e.g. long long is not supported.
616 # (Note: this must come *after* type checks for the corresponding types!)
619 AC_CHECK_SIZEOF(long int)
620 AC_CHECK_SIZEOF(long long int)
621 AC_CHECK_SIZEOF(off_t)
628 if test "$no_x" != "yes"; then
629 LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
630 INCLUDES="$INCLUDES $X_CFLAGS"
631 AM_CONDITIONAL(USE_X11,true)
633 AM_CONDITIONAL(USE_X11,false)
636 # GNU Scientific Library or not
638 [ --with-gsl Link to the GNU scientific library, enables extra functions in analysis],,with_gsl=no)
641 if test "$with_gsl" = "yes"; then
642 ac_save_LDFLAGS="$LDFLAGS"
643 AC_CHECK_HEADERS([gsl/gsl_version.h],[
644 # header found, check for libraries
645 AC_CHECK_LIB(gslcblas,main,[
646 LDFLAGS="$ac_save_LDFLAGS -lgslcblas"
647 # gslcblas library found, check main lib
648 AC_CHECK_LIB(gsl,main)])])
654 [ --without-xml do not link to the xml2 library, disallows the use of certain file formats],,with_xml=yes)
657 # Check for libxml2, but it is optional, so dont stop
659 if test "$with_xml" = "yes"; then
660 ac_save_CPPFLAGS="$CPPFLAGS"
661 CPPFLAGS="$ac_save_CPPFLAGS -I/usr/include/libxml2"
662 AC_CHECK_HEADERS([libxml/parser.h],AC_CHECK_LIB(xml2,main))
663 if test "$ac_cv_lib_xml2_main" = "yes"; then
664 INCLUDES="$INCLUDES -I/usr/include/libxml2"
667 CPPFLAGS="$ac_save_CPPFLAGS"
671 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
672 # and we need -L/usr/ucblib to find libucb... (stupid OS)
673 # On e.g. ibm the mass libraries must come before -lm...
674 case "${host_cpu}-${host_os}" in
677 LDFLAGS="$LDFLAGS -L/usr/ucblib"
679 *) LIBS="$LIBS $FLIBS" ;;
683 # add the Accelerate framework if enabled above.
684 # LDFLAGS might have been set in the CPU optimization, so we cant assign it directly before that.
685 LDFLAGS="$LDFLAGS $extra_LDFLAGS"
693 # Checks for typedefs, structures, and compiler characteristics.
699 # AC_TYPE_UID_T is broken on Mac OS X, so use generic tests instead
700 AC_CHECK_TYPES([uid_t],[],[AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
701 AC_CHECK_TYPES([gid_t],[],[AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
704 # Test stuff for ia32 and x86_64 assembly, and add objects/libraries.
705 if test "$enable_ia32_sse" = "yes" -o "$enable_x86_64_sse" = "yes"; then
706 AC_MSG_CHECKING([whether your compiler can handle assembly files (*.s)])
708 # Use 64-bit registers (rsp/rbp) on x86_64
710 if test "$enable_x86_64_sse" = "yes"; then
711 cat > conftestasm.s << EOF
717 cat > conftestasm.s << EOF
723 if AC_TRY_COMMAND($CC $CFLAGS -c conftestasm.s); then
724 if test -f conftestasm.o; then
728 AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
732 AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
735 # ok, cc understands assembly.
737 # If we are using double precision we need SSE2
738 if test "$enable_float" = "no"; then
740 if test "$enable_ia32_sse" = "yes"; then
741 AC_MSG_CHECKING([whether as fully supports ia32 SSE2])
742 cat > conftest.s << EOF
745 movapd 32(%esi,%edx,8),%xmm4
749 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
753 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
755 AC_DEFINE([GMX_IA32_SSE2],,[Double-precision SSE2 instructions on ia32])
757 # test SSE2 on X86_64:
758 if test "$enable_x86_64_sse" = "yes"; then
759 AC_MSG_CHECKING([whether as fully supports X86_64 SSE2])
760 cat > conftest.s << EOF
763 movapd 32(%rsi,%rdx,8),%xmm4
767 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
771 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
773 AC_DEFINE([GMX_X86_64_SSE2],,[Double-precision SSE2 instructions on X86_64])
776 # end of double precision testing, now do single.
777 if test "$enable_ia32_sse" = "yes"; then
778 AC_MSG_CHECKING([whether as fully supports ia32 SSE])
779 cat > conftest.s << EOF
782 movaps 32(%esi,%edx,8),%xmm4
786 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
790 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
792 AC_DEFINE([GMX_IA32_SSE],,[Single-precision SSE instructions on ia32])
794 # test SSE2 on X86_64:
795 if test "$enable_x86_64_sse" = "yes"; then
796 AC_MSG_CHECKING([whether as fully supports X86_64 SSE instructions])
797 cat > conftest.s << EOF
800 movaps 32(%rsi,%rdx,8),%xmm4
804 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
808 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
810 AC_DEFINE([GMX_X86_64_SSE],,[Single-precision SSE instructions on X86_64])
816 # Test stuff for ia64 assembly
818 # Nothing to test right now.
822 # Test altivec support.
824 if test "$enable_ppc_altivec" = "yes"; then
825 if test "$enable_float" = "no"; then
826 AC_MSG_WARN([PowerPC Altivec loops can only be used in single precision - disabling])
827 enable_ppc_altivec=no
829 # On FSF (vanilla) GCC we must include altivec.h, and on apple we
830 # should NOT do it after using -faltivec. Go figure...
833 # do nothing on Apple systems
836 AC_CHECK_HEADERS([altivec.h])
840 AC_MSG_CHECKING([whether the compiler supports altivec extensions])
847 AC_DEFINE([GMX_PPC_ALTIVEC],,[Use PowerPC Altivec inner loops])],[
849 AC_MSG_WARN([no altivec support found - On recent PowerPC CPUs]
850 [you can get a huge performance gain by using an altivec-enabled compiler.]
851 [On OS X, you need GCC>=3.3, or the IBM compilers. If you are using standard]
852 [GCC, you need at least version 4.0])
853 enable_ppc_altivec=no])
857 if test "$enable_ia64_asm" = "yes"; then
858 AC_DEFINE(GMX_IA64_ASM,,[Use ia64 assembly tuned for Itanium2])
859 AC_DEFINE(DISABLE_WATER_NLIST,,[Turn off all water neighborlist optimization])
860 AC_DEFINE(DISABLE_WATERWATER_NLIST,,[Turn off water-water neighborlist optimization only])
863 if test "$enable_bluegene" = "yes"; then
864 AC_DEFINE(GMX_BLUEGENE,,[Use assembly intrinsics kernels for BlueGene])
868 # Add the appropriate assembly loops
870 AM_CONDITIONAL([GMX_IA32_SSE],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "yes"])
871 AM_CONDITIONAL([GMX_IA32_SSE2],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "no"])
872 AM_CONDITIONAL([GMX_X86_64_SSE],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "yes"])
873 AM_CONDITIONAL([GMX_X86_64_SSE2],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "no"])
874 AM_CONDITIONAL([GMX_FORTRAN],[test "$enable_fortran" = "yes"])
875 AM_CONDITIONAL([GMX_PPC_ALTIVEC],[test "$enable_ppc_altivec" = "yes" -a "$enable_float" = "yes"])
876 AM_CONDITIONAL([GMX_IA64_ASM],[test "$enable_ia64_asm" = "yes"])
877 AM_CONDITIONAL([GMX_BLUEGENE],[test "$enable_bluegene" = "yes"])
878 AM_CONDITIONAL([GMX_POWER6],[test "$enable_power6" = "yes"])
882 # Check integer endian
884 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
885 AC_MSG_ERROR([Cannot determine endian in compiled output])])
886 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
890 case "${host_cpu}" in
892 # Check if inline assembly works
893 AC_MSG_CHECKING(if the compiler supports gcc inline assembly)
894 AC_TRY_LINK([],[float f;int i; asm("fld %1\nfistpl %0\n" : "=m" (*&i) : "f" (f));],[AC_MSG_RESULT(yes)
895 AC_DEFINE(GMX_X86_GCC_INLINE_ASM,,[Enable x86 gcc inline assembly])],[AC_MSG_RESULT(no)])
896 # Check for MSVC inline assembly
897 AC_MSG_CHECKING(if the compiler supports MSVC inline assembly)
898 AC_TRY_LINK([],[float f;int i; _asm { fld f } ; _asm { fistpl i };],[AC_MSG_RESULT(yes)
899 AC_DEFINE(GMX_X86_MSVC_INLINE_ASM,,[Enable x86 MSVC inline assembly])],[AC_MSG_RESULT(no)])
909 ########################################################################
911 ########################################################################
915 AC_SUBST(INCLUDES) # should be automatic, but doesnt seem to be?
917 # To tell libraries apart, we use four versions of the name. For instance, libgmx:
918 # libgmx single prec, no mpi.
919 # libgmx_d double prec, no mpi.
920 # libgmx_mpi single prec, mpi.
921 # libgmx_mpi_d double prec, mpi.
922 # However, the non-suffixed names are linked to the _mpi and/or _d suffixed
923 # ones upon installation if that is the only version available.
925 if test "$enable_mpi" = "yes"; then
928 if test "$enable_float" = "no"; then
929 LIBSUFFIX="${LIBSUFFIX}_d"
933 # Unless the user has explicitly requested a prefix/suffix/transform, we
934 # use _d on double precision files. Don't add anything for mpi, but at the
935 # end we tell the user it is possible and smart to do in some cases!
936 if test "$program_transform_name" = "s,x,x,"; then
937 name_transform_provided=no;
938 if test "$enable_float" = "no"; then
939 program_transform_name="s,\$\$,_d,"
942 name_transform_provided=yes;
946 # Use a variable for RPM - this way it can be
947 # overridden with make RPM=rpm3 rpm
951 if test "$enable_fahcore" = "yes"; then
952 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/../corewrap -include swindirect.h -DFULLINDIRECT -DUSE_FAH_XDR"
953 if test "$enable_mpi" = "yes"; then
954 CFLAGS="$CFLAGS -DMPI"
957 AM_CONDITIONAL([GMX_FAHCORE],[test "$enable_fahcore" = "yes"])
960 if test "$enable_all_static" = "yes"; then
961 LDFLAGS="$LDFLAGS -all-static"
964 # we have asm source, so this is necessary for automake 1.6
971 AC_CONFIG_FILES([ Makefile ])
972 AC_CONFIG_FILES([ src/Makefile ])
973 AC_CONFIG_FILES([ src/gmxlib/Makefile ])
974 AC_CONFIG_FILES([ src/gmxlib/gmx_blas/Makefile ])
975 AC_CONFIG_FILES([ src/gmxlib/gmx_lapack/Makefile ])
976 AC_CONFIG_FILES([ src/gmxlib/selection/Makefile ])
977 AC_CONFIG_FILES([ src/gmxlib/statistics/Makefile ])
978 AC_CONFIG_FILES([ src/gmxlib/trajana/Makefile ])
979 AC_CONFIG_FILES([ src/gmxlib/nonbonded/Makefile ])
980 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_c/Makefile ])
981 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse/Makefile ])
982 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse2/Makefile ])
983 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse/Makefile ])
984 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse2/Makefile ])
985 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ppc_altivec/Makefile ])
986 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_single/Makefile ])
987 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_double/Makefile ])
988 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_bluegene/Makefile ])
989 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_power6/Makefile ])
990 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_single/Makefile ])
991 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_double/Makefile ])
992 AC_CONFIG_FILES([ include/Makefile ])
993 AC_CONFIG_FILES([ include/types/Makefile ])
994 AC_CONFIG_FILES([ src/mdlib/Makefile ])
995 AC_CONFIG_FILES([ src/kernel/Makefile ])
996 AC_CONFIG_FILES([ src/tools/Makefile ])
997 AC_CONFIG_FILES([ src/ngmx/Makefile ])
998 AC_CONFIG_FILES([ src/contrib/Makefile ])
999 AC_CONFIG_FILES([ scripts/Makefile ])
1000 AC_CONFIG_FILES([ admin/Makefile ])
1001 AC_CONFIG_FILES([ share/Makefile ])
1002 AC_CONFIG_FILES([ share/tutor/Makefile ])
1003 AC_CONFIG_FILES([ share/tutor/gmxdemo/Makefile ])
1004 AC_CONFIG_FILES([ share/tutor/nmr1/Makefile ])
1005 AC_CONFIG_FILES([ share/tutor/nmr2/Makefile ])
1006 AC_CONFIG_FILES([ share/tutor/water/Makefile ])
1007 AC_CONFIG_FILES([ share/tutor/mixed/Makefile ])
1008 AC_CONFIG_FILES([ share/tutor/methanol/Makefile ])
1009 AC_CONFIG_FILES([ share/tutor/speptide/Makefile ])
1010 AC_CONFIG_FILES([ share/template/Makefile ])
1011 AC_CONFIG_FILES([ share/top/Makefile ])
1012 AC_CONFIG_FILES([ share/html/Makefile ])
1013 AC_CONFIG_FILES([ share/html/images/Makefile ])
1014 AC_CONFIG_FILES([ share/html/online/Makefile ])
1015 AC_CONFIG_FILES([ man/Makefile man/man1/Makefile man/man7/Makefile ])
1024 #########################################################
1025 # Echo some important info, to avoid stupid mistakes
1028 if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
1030 echo "* You are compiling a double precision version of Gromacs -"
1031 echo " program names will be suffixed with _d to avoid overwriting single"
1032 echo " precision files. You can override it with --program-suffix"
1035 if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
1037 echo "* Seems you are compiling with MPI support. You can install the MPI-"
1038 echo " enabled programs with suffixed names to have both MPI and non-MPI"
1039 echo " versions. This is useful e.g. on supercomputers where you usually"
1040 echo " cannot run MPI-linked programs on the login node."
1041 echo " Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
1042 echo " You only need MPI for mdrun, so if you already have non-MPI stuff"
1043 echo " installed you can issue make mdrun; make install-mdrun."
1046 if test "$host_vendor" = "apple" -a "$enable_apple_64bit" = "no"; then
1048 echo "* Did you know that you can compile a 64-bit version of Gromacs to improve"
1049 echo " performance on recent Intel Macs? You need to install a 64-bit version"
1050 echo " of FFTW first (add -m64 to CFLAGS, or download it from the Gromacs site)"
1051 echo " after which you can simply specify --enable-apple-64bit to this script."
1054 if test "$enable_shared" = "no"; then
1056 echo "* On most platforms you can save 10X space with dynamic libraries, although"
1057 echo " the binaries might be less portable. Why not try --enable-shared ?"