1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
6 AC_INIT(gromacs, 4.0.7, [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 (default on sgi,ibm,sun,axp)])],,
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 AM_CONDITIONAL([GMX_FORTRAN],[test "$enable_fortran" = "yes"])
55 if test "$enable_fortran" = "yes"; then
56 AC_DEFINE(GMX_FORTRAN,,[Use Fortran kernels])
58 # always use CC for linking:
59 AC_SUBST(F77LINK,"\$(LINK)")
63 [AC_HELP_STRING([--enable-mpi],
64 [Compile for parallel runs using MPI])],,enable_mpi=no)
68 AC_ARG_ENABLE(mpi-environment,
69 [AC_HELP_STRING([--enable-mpi-environment=VAR],
70 [Only start parallel runs when VAR is set])],,
71 [case "${host_cpu}" in
72 mips*-irix*) enable_mpi_environment="MPI_ENVIRONMENT" ;;
73 *) enable_mpi_environment=no ;;
75 if test "$enable_mpi_environment" != "no"; then
76 AC_DEFINE_UNQUOTED(GMX_CHECK_MPI_ENV,"$enable_mpi_environment",[If defined, only start MPI runs when this variable is set])
80 AC_ARG_ENABLE(mpi-in-place,
81 [AC_HELP_STRING([--disable-mpi-in-place],
82 [Disable MPI_IN_PLACE. For MPI implementations that have broken support for it (some versions of MPICH, for example).])],, enable_mpi_in_place=yes)
87 [AC_HELP_STRING([--enable-debug],
88 [Add -g to other command line arguments])],,enable_debug=no)
90 ### IA32 assembly code
91 AC_ARG_ENABLE(ia32_3dnow,
92 [AC_HELP_STRING([--disable-ia32-3dnow],
93 [Don't build 3DNow! assembly loops on ia32])],,enable_ia32_3dnow=yes)
94 case "${host_cpu}-${host_vendor}" in
96 *) enable_ia32_3dnow=no ;;
100 ### IA32 assembly code
101 AC_ARG_ENABLE(ia32_sse,
102 [AC_HELP_STRING([--disable-ia32-sse],
103 [Don't build SSE/SSE2 assembly loops on ia32])],,enable_ia32_sse=yes)
105 case "${host_cpu}-${host_vendor}" in
107 *) enable_ia32_sse=no ;;
110 ### AMD64 assembly code
111 AC_ARG_ENABLE(x86_64_sse,
112 [AC_HELP_STRING([--disable-x86-64-sse],
113 [Don't build SSE assembly loops on X86_64])],,enable_x86_64_sse=yes)
114 case "${host_cpu}-${host_vendor}" in
115 x86_64-* | amd64-*) ;;
117 *) enable_x86_64_sse=no ;;
121 ### Altivec on powerpc (motorola)
122 AC_ARG_ENABLE(ppc_altivec,
123 [AC_HELP_STRING([--disable-ppc-altivec],
124 [Don't build Altivec loops on PowerPC])],,enable_ppc_altivec=undef)
125 # Power3/4/5 running AIX does not support altivec. We identify this with vendor=IBM.
126 # IBM powerpc 970 boxes run linux, and have vendor=unknown.
127 if test "$enable_ppc_altivec" = "undef"; then
128 case "${host_cpu}-${host_vendor}" in
129 ppc*-ibm* | powerpc*-ibm*) enable_ppc_altivec=no ;;
130 ppc*-* | powerpc*-*) enable_ppc_altivec=yes ;;
131 *) enable_ppc_altivec=no ;;
137 ### ia64 assembly code
138 AC_ARG_ENABLE(ia64_asm,
139 [AC_HELP_STRING([--disable-ia64-asm],
140 [Don't build assembly loops on ia64])],,enable_ia64_asm=yes)
141 case "${host_cpu}" in
143 *) enable_ia64_asm=no ;;
145 if test "$enable_ia64_asm" = "yes"; then
146 AC_DEFINE(GMX_IA64_ASM,,[Use ia64 assembly tuned for Itanium2])
147 AC_DEFINE(DISABLE_WATER_NLIST,,[Turn off all water neighborlist optimization])
148 AC_DEFINE(DISABLE_WATERWATER_NLIST,,[Turn off water-water neighborlist optimization only])
152 AC_ARG_ENABLE(bluegene,
153 [AC_HELP_STRING([--enable-bluegene],
154 [Build assembly intrinsics kernels on bluegene])],,enable_bluegene=no)
155 if test "$enable_bluegene" = "yes"; then
156 AC_DEFINE(GMX_BLUEGENE,,[Use assembly intrinsics kernels for BlueGene])
159 ### Optimize for host cpu version
160 AC_ARG_ENABLE(cpu-optimization,
161 [AC_HELP_STRING([--disable-cpu-optimization],
162 [No detection or tuning flags for cpu version])],, enable_cpu_optimization=yes)
165 ### Do software 1/sqrt(x)
166 AC_ARG_ENABLE(software-sqrt,
167 [AC_HELP_STRING([--disable-software-sqrt],
168 [No software 1/sqrt (disabled on sgi,ibm,ia64)])],,
169 [case "${host_cpu}-${host_os}" in
170 mips*-irix* | rs6000*-aix* | powerpc*-aix | ia64*-*) enable_software_sqrt=no ;;
171 *) enable_software_sqrt=yes ;;
173 # We might turn off software sqrt on PowerPC, so the
174 # define and makefile conditional is set below that check.
176 ### Do PowerPC 1/sqrt(x)
177 AC_ARG_ENABLE(ppc-sqrt,
178 [AC_HELP_STRING([--enable-ppc-sqrt],
179 [PowerPC 1/sqrt table lookup. Single precision]
180 [requires Power5 or later. By default we]
181 [use 2 iterations, but if you only run on]
182 [Power6,PPC440,PPC450 or later CPUs you can]
183 [set --enable-ppc-sqrt=1 for better speed.])],,
185 if test "$enable_ppc_sqrt" != "no"; then
186 if test "$enable_ppc_sqrt" == "1"; then
191 AC_DEFINE_UNQUOTED(GMX_POWERPC_SQRT,$ppc_sqrt_niter,[Use PowerPC 1/sqrt(x) table lookup (number of iterations)])
192 # Turn off generic software sqrt
193 enable_software_sqrt="no";
195 AM_CONDITIONAL([GMX_POWERPC_SQRT],[test "$enable_ppc_sqrt" != "no"])
196 AM_CONDITIONAL([GMX_POWERPC_SQRT_SINGLE_ITERATION],[test "$ppc_sqrt_niter" == "1"])
199 if test "$enable_software_sqrt" = "yes"; then
200 AC_DEFINE(GMX_SOFTWARE_SQRT,,[Use the GROMACS software 1/sqrt(x)])
202 AM_CONDITIONAL([GMX_SOFTWARE_SQRT],[test "$enable_software_sqrt" = "yes"])
207 # The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
208 # instructions dynamically at runtime, so they might not make much difference now:
210 ### Force prefetching
211 AC_ARG_ENABLE(prefetch,
212 [AC_HELP_STRING([--enable-prefetch-forces],
213 [Prefetch forces in innerloops])],, enable_prefetch=no)
214 # processing of prefetch choices is done just before the final output stage!
215 AM_CONDITIONAL([GMX_PREFETCH_FORCES],[test "$enable_prefetch" = "yes"])
220 AC_ARG_ENABLE(all-static,
221 [AC_HELP_STRING([--enable-all-static],
222 [Make completely static binaries])],, enable_all_static=no)
223 # Dont add the -all-static flag until after the compiler test.
226 # FFT libraries - only use one...
228 [AC_HELP_STRING([--with-fft=@<:@fftw3/fftw2/mkl(>=6.0)/fftpack@:>@],
229 [FFT library to use. fftw3 is default, fftpack built in.])],,
232 AC_ARG_ENABLE(fftw-measure,
233 [AC_HELP_STRING([--disable-fftw-measure],
234 [Dont optimize FFTs. This produces binary exactly]
235 [reproducible runs (as the -reprod flag to mdrun),]
236 [and if you are using FFTW on x86 and specified its]
237 [--enable-sse/sse2 flag (NOT default in FFTW!) the]
238 [kernels used are close-to-optimal anyway.])],,
239 enable_fftw_measure=yes)
243 ### Use external BLAS/LAPACK libraries if the user wants to.
245 AC_ARG_WITH(external_blas,
246 [AC_HELP_STRING([--with-external-blas],
247 [Use system BLAS library (add to LIBS). Automatic on OS X.])],,
249 # default action - check if we are on OS X
250 case "${host_vendor}-${host_os}" in
251 apple-darwin*) with_external_blas="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
252 *) with_external_blas="no" ;;
255 AM_CONDITIONAL([GMX_EXTERNAL_BLAS], [test "$with_external_blas" = "yes"])
258 AC_ARG_WITH(external_lapack,
259 [AC_HELP_STRING([--with-external-lapack],
260 [Use system LAPACK library (add to LIBS). Automatic on OS X.])],,
262 # default action - check if we are on OS X
263 case "${host_vendor}-${host_os}" in
264 apple-darwin*) with_external_lapack="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
265 *) with_external_lapack="no" ;;
268 AM_CONDITIONAL([GMX_EXTERNAL_LAPACK], [test "$with_external_lapack" = "yes"])
273 AC_ARG_WITH(qmmm_gaussian,
274 [AC_HELP_STRING([--without-qmmm-gaussian],
275 [Use modified Gaussian0x for QM-MM (see website)])],,with_qmmm_gaussian=yes)
276 if test "$with_qmmm_gaussian" = "yes"; then
277 AC_DEFINE(GMX_QMMM_GAUSSIAN,,[Use (modified) Gaussian0x for QM-MM calculations])
278 MDLIB_LIBOBJS="$MDLIB_LIBOBJS qm_gaussian.lo"
282 AC_ARG_WITH(qmmm_gamess,
283 [AC_HELP_STRING([--without-qmmm-gamess],
284 [Use modified Gamess-UK for QM-MM (see website)])],,with_qmmm_gamess=no)
285 if test "$with_qmmm_gamess" = "yes"; then
286 AC_DEFINE(GMX_QMMM_GAMESS,,[Use (modified) Gamess-UK for QM-MM calculations])
287 MDLIB_LIBOBJS="$MDLIB_LIBOBJS qm_gamess.lo"
291 AC_ARG_WITH(qmmm_mopac,
292 [AC_HELP_STRING([--without-qmmm-mopac],
293 [Use modified Mopac 7 for QM-MM (see website)])],,with_qmmm_mopac=no)
294 if test "$with_qmmm_mopac" = "yes"; then
295 AC_DEFINE(GMX_QMMM_MOPAC,,[Use (modified) Mopac 7 for QM-MM calculations])
296 MDLIB_LIBOBJS="$MDLIB_LIBOBJS qm_mopac.lo"
300 ############################################################
301 # Add some debug info: Who is building, and on what machine?
302 ############################################################
303 AC_DEFINE_UNQUOTED([BUILD_TIME],["`date`"],[Date and time for build])
304 AC_DEFINE_UNQUOTED([BUILD_USER],["`whoami`@`hostname`"],[User doing build])
305 AC_DEFINE_UNQUOTED([BUILD_MACHINE],["`uname -srm`"],[Hardware and OS version for build host])
309 ############################################################
310 # Checks for programs
311 ############################################################
313 # normally we use the default compiler, but on alpha/linux we try the compaq ones first
314 case "${host_cpu}-${host_os}" in
316 cc_names="ccc cc gcc"
317 f77_names="fort f77 g77"
320 cc_names="cc icc xlc gcc"
321 f77_names="f77 ifort xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
324 # the (non-mpi) c compiler, which is also used for programs executed during build stage
325 AC_PROG_CC( $cc_names )
326 # Check for environment variable CC_FOR_BUILD before overwriting it
327 if test -z "$CC_FOR_BUILD"; then
330 AC_SUBST(CC_FOR_BUILD)
332 if test "$enable_fortran" = "yes"; then
333 AC_PROG_F77( $f77_names )
334 if test -z "$F77"; then
335 AC_MSG_ERROR([No fortran compiler found])
341 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
342 # above, since autoconf checks that the created file can be executed. This would
343 # fail on platforms where MPI executables can only be run through a batchqueue.
345 if test "$enable_mpi" = "yes"; then
346 AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)
347 # now change the normal cc to the MPI one - see the comment above.
349 AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
350 AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
351 AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
352 AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
354 # on the cray xt3 we have to tell autoconf that we
355 # are actually cross-compiling even if the architecture
356 # of host and target are the same. so we enforce
357 # cross-compilation if __QK_USER__ is defined
358 AC_MSG_CHECKING([for catamount])
360 #if defined __QK_USER__
367 AC_DEFINE(GMX_CRAY_XT3,[],[Enable special hacks for Cray XT3])
368 AC_DEFINE(GMX_NO_SYSTEM,[],[Ignore calls to system(3)])
369 AC_DEFINE(GMX_NO_NICE,[],[Ignore calls to nice(3)])
370 AC_DEFINE(GMX_BROKEN_CALLOC,[],[Don't use calloc(3)])
371 extra_LDFLAGS="$extra_LDFLAGS -lgmalloc -lacml"
375 # end of "$enable_mpi" = "yes"
378 if test "$enable_threads" = "yes"; then
379 AC_MSG_CHECKING([for pthreads])
381 AC_DEFINE([GMX_THREAD_PTHREAD],,[Use pthreads for Gromacs multithreading])
382 # ACX_PTHREAD([],AC_MSG_ERROR([Cannot compile with pthreads; use --disable-threads])
387 AH_TEMPLATE([F77_OR_C_FUNC],
388 [Set to F77_FUNC(name,NAME) if Fortran used, otherwise 'name' for C.])
389 AH_TEMPLATE([F77_OR_C_FUNC_],
390 [Set to F77_FUNC_(name,NAME) if Fortran used, otherwise 'name' for C.])
394 if test "$enable_fortran" = "yes"; then
395 AC_F77_LIBRARY_LDFLAGS
397 AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[F77_FUNC(name,NAME)])
398 AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[F77_FUNC_(name,NAME)])
400 AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[name])
401 AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[name])
408 if test "$enable_cpu_optimization" = "yes"; then
419 # Check integer endian
421 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
422 AC_MSG_ERROR([Cannot determine endian in compiled output])])
423 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
426 # Check integer sizes, set to zero if e.g. long long is not supported.
429 AC_CHECK_SIZEOF(long int)
430 AC_CHECK_SIZEOF(long long int)
431 AC_CHECK_SIZEOF(off_t)
434 # Make sure size_t can hold pointers.
435 # On some Nec machines, you reportedly need to specify a flag for size_t to be 64 bits wide.
437 AC_MSG_CHECKING([that size_t can hold pointers])
441 ],[int chk[sizeof(size_t)-sizeof(int *)+1];],AC_MSG_RESULT([yes]),[
442 AC_MSG_ERROR([size_t is smaller than int*. Check if your compiler needs a flag to make it 64 bit.])])
447 # Check floating-point format and endian
459 # Use our own version of AC_FUNC_FSEEKO from autoconf 2.63 instead
460 # of the broken one we might get from autoconf 2.61.
461 ACX_FUNC_FSEEKO_FIXED
466 ############################################################################
467 # Checks for libraries.
468 ############################################################################
470 # Don't add math library for intel compilers
471 if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
472 AC_MSG_NOTICE([Using built-in math library with intel compiler])
474 AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
478 # Disable MASS support for now.
484 if test "$enable_float" = "yes"; then
489 ACX_CHECK_FFTW2(fftw,$sizeof_real)
490 ACX_CHECK_FFTW2(rfftw,$sizeof_real)
492 case ${ac_fftw_savedprefix} in
493 d) AC_DEFINE(FFTW2_NAME_DFFTW,,[Use the d prefix on fftw2 includes]) ;;
494 s) AC_DEFINE(FFTW2_NAME_SFFTW,,[Use the s prefix on fftw2 includes]) ;;
495 *) AC_DEFINE(FFTW2_NAME_FFTW,,[Dont use any prefix on fftw2 includes]) ;;
498 MDLIB_LIBOBJS="$MDLIB_LIBOBJS gmx_fft_fftw2.lo"
500 ;; # end of fftw2 check
502 fftw3) # Much simpler check than fftw2
503 # Check for header <fftw3.h> AC_CHECK_HEADERS doesnt work, since we must
504 # use mpicc to get includes - cpp isnt always the same compiler.
505 AC_MSG_CHECKING([for fftw3.h])
506 AC_TRY_COMPILE([#include<fftw3.h>],,[
507 # ok, look for library file too
509 if test "$enable_float" = "yes"; then
510 AC_CHECK_LIB([fftw3f],main,,AC_MSG_ERROR([Cannot find fftw3f library]))
512 AC_CHECK_LIB([fftw3],main,,AC_MSG_ERROR([Cannot find fftw3 library]))
514 MDLIB_LIBOBJS="$MDLIB_LIBOBJS gmx_fft_fftw3.lo"
516 # not ok, echo a warning
518 [Cannot find the default external FFT library (fftw3).
519 Other alternatives are 'fftw2', or 'mkl' for Intel MKL.
520 You are STRONGLY recommended to use one of these - fftw is free.
522 Use CPPFLAGS and LDFLAGS if the library is installed in a
523 non-standard location. (see FAQ at http://www.gromacs.org)
525 If you dont care about performance you can also specify 'fftpack'
526 to use a slower set of FFTs built into Gromacs.
527 (Just install FFTW3 unless you really know what you are doing).
534 # Intel Math Kernel Library version 6 and later.
536 AC_MSG_CHECKING([for mkl_dfti.h])
537 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.]\
540 # AC_CHECK_LIB([guide],main,,AC_MSG_ERROR([Cannot find libguide (Intel MKL)]))
541 AC_CHECK_LIB([mkl],DftiComputeForward,,
542 AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0]))
544 MDLIB_LIBOBJS="$MDLIB_LIBOBJS gmx_fft_mkl.lo"
548 AC_MSG_WARN([The built-in FFTPACK routines are slow.
549 Are you sure you don't want to use FFTW? It is free and much faster...])
550 MDLIB_LIBOBJS="$MDLIB_LIBOBJS gmx_fft_fftpack.lo"
553 AC_MSG_ERROR([Unknown FFT library])
558 if test "$enable_fftw_measure" != "yes"; then
559 AC_DEFINE(GMX_DISABLE_FFTW_MEASURE,,[Do not optimize FFTW setups (not needed with SSE FFT kernels)])
563 # check for xtc headers
565 cygwin* | mingw*) # use our own xdr stuff for cygwin/mingw
566 GMXLIB_LIBOBJS="$GMXLIB_LIBOBJS gmx_system_xdr.lo"
569 AC_CHECK_HEADERS([rpc/rpc.h])
570 AC_CHECK_HEADERS([rpc/xdr.h],,,
572 # include <rpc/rpc.h>
575 AC_CHECK_LIB(nsl,xdr_float)
580 #error NO rpc.h header
585 #error No xdr.h header
587 ],[ XDR *xd; float f; xdr_float(xd,&f);],[have_xdr="yes"])
589 if test "$have_xdr" != "yes"; then
590 AC_DEFINE(GMX_INTERNAL_XDR,,[Use our own instead of system XDR libraries])
591 GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} gmx_system_xdr.lo"
592 AC_MSG_WARN([Couldn't find XDR headers and/or libraries - using our own])
598 # Checks for additional and/or optional functions or libraries.
605 AC_CHECK_FUNCS(strcasecmp)
606 AC_CHECK_FUNCS(strdup)
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)
622 AC_CHECK_SIZEOF(void*)
626 # Apple OS X is a bit strange/braindead in that it always reports itself as i386, both for
627 # 32 and 64 bit builds (even with the 64 bit kernel!).
629 # To get the SSE support right we check for the size of void * that we detected above...
630 case "${host_vendor}-${host_os}" in
632 enable_ia32_3dnow=no;
633 if test $ac_cv_sizeof_voidp = 8; then
636 enable_x86_64_sse=no;
649 if test "$no_x" != "yes"; then
650 LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
651 INCLUDES="$INCLUDES $X_CFLAGS"
652 AM_CONDITIONAL(USE_X11,true)
654 AM_CONDITIONAL(USE_X11,false)
657 # GNU Scientific Library or not
659 [ --with-gsl Link to the GNU scientific library, enables extra functions in analysis],,with_gsl=no)
662 if test "$with_gsl" = "yes"; then
663 ac_save_LDFLAGS="$LDFLAGS"
664 AC_CHECK_HEADERS([gsl/gsl_version.h],[
665 # header found, check for libraries
666 AC_CHECK_LIB(gslcblas,main,[
667 LDFLAGS="$ac_save_LDFLAGS -lgslcblas"
668 # gslcblas library found, check main lib
669 AC_CHECK_LIB(gsl,main)])])
675 [ --without-xml do not link to the xml2 library, disallows the use of certain file formats],,with_xml=yes)
678 # Check for libxml2, but it is optional, so dont stop
680 if test "$with_xml" = "yes"; then
681 ac_save_CPPFLAGS="$CPPFLAGS"
682 CPPFLAGS="$ac_save_CPPFLAGS -I/usr/include/libxml2"
683 AC_CHECK_HEADERS([libxml/parser.h],AC_CHECK_LIB(xml2,main))
684 if test "$ac_cv_lib_xml2_main" = "yes"; then
685 INCLUDES="$INCLUDES -I/usr/include/libxml2"
688 CPPFLAGS="$ac_save_CPPFLAGS"
692 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
693 # and we need -L/usr/ucblib to find libucb... (stupid OS)
694 # On e.g. ibm the mass libraries must come before -lm...
695 case "${host_cpu}-${host_os}" in
698 LDFLAGS="$LDFLAGS -L/usr/ucblib"
700 *) LIBS="$LIBS $FLIBS" ;;
704 # add the Accelerate framework if enabled above.
705 # LDFLAGS might have been set in the CPU optimization, so we cant assign it directly before that.
706 LDFLAGS="$LDFLAGS $extra_LDFLAGS"
713 ########################################################################
714 # Checks for header files and types
715 ########################################################################
717 AC_CHECK_HEADERS([limits.h strings.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
718 AC_CHECK_HEADERS(unistd.h)
721 # Checks for typedefs, structures, and compiler characteristics.
730 # Test stuff for ia32 and x86_64 assembly, and add objects/libraries.
731 if test "$enable_ia32_sse" = "yes" -o "$enable_ia32_3dnow" = "yes" -o "$enable_x86_64_sse" = "yes"; then
732 AC_MSG_CHECKING([whether your compiler can handle assembly files (*.s)])
734 # Use 64-bit registers (rsp/rbp) on x86_64
736 if test "$enable_x86_64_sse" = "yes"; then
737 cat > conftestasm.s << EOF
743 cat > conftestasm.s << EOF
749 if AC_TRY_COMMAND($CC $CFLAGS -c conftestasm.s); then
750 if test -f conftestasm.o; then
754 AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
758 AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
761 # ok, cc understands assembly.
763 # If we are using double precision we need SSE2
764 if test "$enable_float" = "no"; then
766 if test "$enable_ia32_sse" = "yes"; then
767 AC_MSG_CHECKING([whether as fully supports ia32 SSE2])
768 cat > conftest.s << EOF
771 movapd 32(%esi,%edx,8),%xmm4
775 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
779 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
781 AC_DEFINE([GMX_IA32_SSE2],,[Double-precision SSE2 instructions on ia32])
783 # test SSE2 on X86_64:
784 if test "$enable_x86_64_sse" = "yes"; then
785 AC_MSG_CHECKING([whether as fully supports X86_64 SSE2])
786 cat > conftest.s << EOF
789 movapd 32(%rsi,%rdx,8),%xmm4
793 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
797 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
799 AC_DEFINE([GMX_X86_64_SSE2],,[Double-precision SSE2 instructions on X86_64])
802 # end of double precision testing, now do single.
803 if test "$enable_ia32_sse" = "yes"; then
804 AC_MSG_CHECKING([whether as fully supports ia32 SSE])
805 cat > conftest.s << EOF
808 movaps 32(%esi,%edx,8),%xmm4
812 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
816 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
818 AC_DEFINE([GMX_IA32_SSE],,[Single-precision SSE instructions on ia32])
820 # test SSE2 on X86_64:
821 if test "$enable_x86_64_sse" = "yes"; then
822 AC_MSG_CHECKING([whether as fully supports X86_64 SSE instructions])
823 cat > conftest.s << EOF
826 movaps 32(%rsi,%rdx,8),%xmm4
830 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
834 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
836 AC_DEFINE([GMX_X86_64_SSE],,[Single-precision SSE instructions on X86_64])
838 if test "$enable_ia32_3dnow" = "yes"; then
839 AC_MSG_CHECKING([whether as fully supports ia32 3DNow! instructions])
840 cat > conftest.s << EOF
847 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
851 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
853 AC_DEFINE([GMX_IA32_3DNOW],,[Single-precision 3DNow! instructions on ia32])
859 # Test stuff for ia64 assembly
861 # Nothing to test right now.
867 # Test altivec support.
869 if test "$enable_ppc_altivec" = "yes"; then
870 if test "$enable_float" = "no"; then
871 AC_MSG_WARN([PowerPC Altivec loops can only be used in single precision - disabling])
872 enable_ppc_altivec=no
874 # On FSF (vanilla) GCC we must include altivec.h, and on apple we
875 # should NOT do it after using -faltivec. Go figure...
878 # do nothing on Apple systems
881 AC_CHECK_HEADERS([altivec.h])
885 AC_MSG_CHECKING([whether the compiler supports altivec extensions])
892 ### GMX_LIBOBJS="${GMX_LIBOBJS} inner_altivec.lo"
893 AC_DEFINE([GMX_PPC_ALTIVEC],,[Use PowerPC Altivec inner loops])],[
895 AC_MSG_WARN([no altivec support found - On recent PowerPC CPUs]
896 [you can get a huge performance gain by using an altivec-enabled compiler.]
897 [On OS X, you need GCC>=3.3, or the IBM compilers. If you are using standard]
898 [GCC, you need at least version 4.0])
899 enable_ppc_altivec=no])
906 # Add the appropriate assembly loops
908 AM_CONDITIONAL([GMX_IA32_SSE],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "yes"])
909 AM_CONDITIONAL([GMX_IA32_SSE2],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "no"])
910 AM_CONDITIONAL([GMX_X86_64_SSE],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "yes"])
911 AM_CONDITIONAL([GMX_X86_64_SSE2],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "no"])
912 AM_CONDITIONAL([GMX_IA32_3DNOW],[test "$enable_ia32_3dnow" = "yes" -a "$enable_float" = "yes"])
913 AM_CONDITIONAL([GMX_PPC_ALTIVEC],[test "$enable_ppc_altivec" = "yes" -a "$enable_float" = "yes"])
914 AM_CONDITIONAL([GMX_IA64_ASM_SINGLE],[test "$enable_ia64_asm" = "yes" -a "$enable_float" = "yes"])
915 AM_CONDITIONAL([GMX_IA64_ASM_DOUBLE],[test "$enable_ia64_asm" = "yes" -a "$enable_float" = "no"])
916 AM_CONDITIONAL([GMX_BLUEGENE],[test "$enable_bluegene" = "yes"])
920 # Check integer endian
922 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
923 AC_MSG_ERROR([Cannot determine endian in compiled output])])
924 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
928 case "${host_cpu}" in
930 # Check if inline assembly works
931 AC_MSG_CHECKING(if the compiler supports gcc inline assembly)
932 AC_TRY_LINK([],[float f;int i; asm("fld %1\nfistpl %0\n" : "=m" (*&i) : "f" (f));],[AC_MSG_RESULT(yes)
933 AC_DEFINE(GMX_X86_GCC_INLINE_ASM,,[Enable x86 gcc inline assembly])],[AC_MSG_RESULT(no)])
934 # Check for MSVC inline assembly
935 AC_MSG_CHECKING(if the compiler supports MSVC inline assembly)
936 AC_TRY_LINK([],[float f;int i; _asm { fld f } ; _asm { fistpl i };],[AC_MSG_RESULT(yes)
937 AC_DEFINE(GMX_X86_MSVC_INLINE_ASM,,[Enable x86 MSVC inline assembly])],[AC_MSG_RESULT(no)])
947 ########################################################################
949 ########################################################################
953 AC_SUBST(INCLUDES) # should be automatic, but doesnt seem to be?
954 AC_SUBST(GMXLIB_LIBOBJS)
955 AC_SUBST(MDLIB_LIBOBJS)
956 AC_SUBST(GMXANA_LIBOBJS)
958 # To tell libraries apart, we use four versions of the name. For instance, libgmx:
959 # libgmx single prec, no mpi.
960 # libgmx_d double prec, no mpi.
961 # libgmx_mpi single prec, mpi.
962 # libgmx_mpi_d double prec, mpi.
963 # However, the non-suffixed names are linked to the _mpi and/or _d suffixed
964 # ones upon installation if that is the only version available.
966 if test "$enable_mpi" = "yes"; then
969 if test "$enable_float" = "no"; then
970 LIBSUFFIX="${LIBSUFFIX}_d"
974 # Unless the user has explicitly requested a prefix/suffix/transform, we
975 # use _d on double precision files. Don't add anything for mpi, but at the
976 # end we tell the user it is possible and smart to do in some cases!
977 if test "$program_transform_name" = "s,x,x,"; then
978 name_transform_provided=no;
979 if test "$enable_float" = "no"; then
980 program_transform_name="s,\$\$,_d,"
983 name_transform_provided=yes;
987 # Use a variable for RPM - this way it can be
988 # overridden with make RPM=rpm3 rpm
993 if test "$enable_all_static" = "yes"; then
994 LDFLAGS="$LDFLAGS -all-static"
997 # we have asm source, so this is necessary for automake 1.6
1004 AC_CONFIG_FILES([ Makefile ])
1005 AC_CONFIG_FILES([ src/Makefile ])
1006 AC_CONFIG_FILES([ src/gmxlib/Makefile ])
1007 AC_CONFIG_FILES([ src/gmxlib/gmx_blas/Makefile ])
1008 AC_CONFIG_FILES([ src/gmxlib/gmx_lapack/Makefile ])
1009 AC_CONFIG_FILES([ src/gmxlib/nonbonded/Makefile ])
1010 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel/Makefile ])
1011 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_3dnow/Makefile ])
1012 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse/Makefile ])
1013 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse2/Makefile ])
1014 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse/Makefile ])
1015 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse2/Makefile ])
1016 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ppc_altivec/Makefile ])
1017 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_single/Makefile ])
1018 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_double/Makefile ])
1019 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_bluegene/Makefile ])
1020 AC_CONFIG_FILES([ include/Makefile ])
1021 AC_CONFIG_FILES([ include/types/Makefile ])
1022 AC_CONFIG_FILES([ src/mdlib/Makefile ])
1023 AC_CONFIG_FILES([ src/kernel/Makefile ])
1024 AC_CONFIG_FILES([ src/tools/Makefile ])
1025 AC_CONFIG_FILES([ src/ngmx/Makefile ])
1026 AC_CONFIG_FILES([ src/contrib/Makefile ])
1027 AC_CONFIG_FILES([ scripts/Makefile ])
1028 AC_CONFIG_FILES([ admin/Makefile ])
1029 AC_CONFIG_FILES([ share/Makefile ])
1030 AC_CONFIG_FILES([ share/tutor/Makefile ])
1031 AC_CONFIG_FILES([ share/tutor/gmxdemo/Makefile ])
1032 AC_CONFIG_FILES([ share/tutor/nmr1/Makefile ])
1033 AC_CONFIG_FILES([ share/tutor/nmr2/Makefile ])
1034 AC_CONFIG_FILES([ share/tutor/water/Makefile ])
1035 AC_CONFIG_FILES([ share/tutor/mixed/Makefile ])
1036 AC_CONFIG_FILES([ share/tutor/methanol/Makefile ])
1037 AC_CONFIG_FILES([ share/tutor/speptide/Makefile ])
1038 AC_CONFIG_FILES([ share/template/Makefile ])
1039 AC_CONFIG_FILES([ share/top/Makefile ])
1040 AC_CONFIG_FILES([ share/html/Makefile ])
1041 AC_CONFIG_FILES([ share/html/images/Makefile ])
1042 AC_CONFIG_FILES([ share/html/online/Makefile ])
1043 AC_CONFIG_FILES([ man/Makefile man/man1/Makefile ])
1053 #########################################################
1054 # Echo some important info, to avoid stupid mistakes
1057 if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
1059 echo "* You are compiling a double precision version of Gromacs -"
1060 echo " program names will be suffixed with _d to avoid overwriting single"
1061 echo " precision files. You can override it with --program-suffix"
1064 if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
1066 echo "* Seems you are compiling with MPI support. You can install the MPI-"
1067 echo " enabled programs with suffixed names to have both MPI and non-MPI"
1068 echo " versions. This is useful e.g. on supercomputers where you usually"
1069 echo " cannot run MPI-linked programs on the login node."
1070 echo " Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
1071 echo " You only need MPI for mdrun, so if you already have non-MPI stuff"
1072 echo " installed you can issue make mdrun; make install-mdrun."
1075 if test "$enable_shared" = "no"; then
1077 echo "* On most platforms you can save 10X space with dynamic libraries, although"
1078 echo " the binaries might be less portable. Why not try --enable-shared ?"