1 #######################################################################
2 # Process this file wth autoconf to produce a configure script.
3 #######################################################################
6 AC_INIT(gromacs, 4.0.99_development_20090927, [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])
84 AC_ARG_ENABLE(mpi-in-place,
85 [AC_HELP_STRING([--disable-mpi-in-place],
86 [Disable MPI_IN_PLACE. For MPI implementations that have broken support for it (some versions of MPICH, for example).])],, enable_mpi_in_place=yes)
91 [AC_HELP_STRING([--enable-debug],
92 [Add -g to other command line arguments])],,enable_debug=no)
94 ### IA32 assembly code
95 AC_ARG_ENABLE(ia32_sse,
96 [AC_HELP_STRING([--disable-ia32-sse],
97 [Don't build SSE/SSE2 assembly loops on ia32])],,enable_ia32_sse=yes)
99 case "${host_cpu}-${host_vendor}" in
101 *) enable_ia32_sse=no ;;
104 ### AMD64 assembly code
105 AC_ARG_ENABLE(x86_64_sse,
106 [AC_HELP_STRING([--disable-x86-64-sse],
107 [Don't build SSE assembly loops on X86_64])],,enable_x86_64_sse=yes)
108 case "${host_cpu}-${host_vendor}" in
109 x86_64-* | amd64-*) ;;
111 *) enable_x86_64_sse=no ;;
115 ### Altivec on powerpc (motorola)
116 AC_ARG_ENABLE(ppc_altivec,
117 [AC_HELP_STRING([--disable-ppc-altivec],
118 [Don't build Altivec loops on PowerPC])],,enable_ppc_altivec=undef)
119 # Power3/4/5 running AIX does not support altivec. We identify this with vendor=IBM.
120 # IBM powerpc 970 boxes run linux, and have vendor=unknown.
121 if test "$enable_ppc_altivec" = "undef"; then
122 case "${host_cpu}-${host_vendor}" in
123 ppc*-ibm* | powerpc*-ibm*) enable_ppc_altivec=no ;;
124 ppc*-* | powerpc*-*) enable_ppc_altivec=yes ;;
125 *) enable_ppc_altivec=no ;;
131 ### ia64 assembly code
132 AC_ARG_ENABLE(ia64_asm,
133 [AC_HELP_STRING([--disable-ia64-asm],
134 [Don't build assembly loops on ia64])],,enable_ia64_asm=yes)
135 case "${host_cpu}" in
137 *) enable_ia64_asm=no ;;
141 # IBM Power6-specific optimization
142 AC_ARG_ENABLE(power6,
143 [AC_HELP_STRING([--enable-power6],
144 [Use IBM Pwr6/PPC440/PPC450-specific F77 kernels])],,enable_power6=no)
145 # Turn off generic fortran loops if we are using power6-specific optimization
146 if test "$enable_power6" = "yes"; then
150 AC_ARG_ENABLE(bluegene,
151 [AC_HELP_STRING([--enable-bluegene],
152 [Build assembly intrinsics kernels on bluegene])],,enable_bluegene=no)
155 ### Optimize for host cpu version
156 AC_ARG_ENABLE(cpu-optimization,
157 [AC_HELP_STRING([--disable-cpu-optimization],
158 [No detection or tuning flags for cpu version])],, enable_cpu_optimization=yes)
161 ### Do software 1/sqrt(x)
162 AC_ARG_ENABLE(software-invsqrt,
163 [AC_HELP_STRING([--disable-software-invsqrt],
164 [No software 1/sqrt (disabled on sgi,ibm,ia64)])],,
165 [case "${host_cpu}-${host_os}" in
166 mips*-irix* | rs6000*-aix* | powerpc*-aix | ia64*-*) enable_software_invsqrt=no ;;
167 *) enable_software_invsqrt=yes ;;
169 if test "$enable_software_invsqrt" = "yes"; then
170 AC_DEFINE(GMX_SOFTWARE_INVSQRT,,[Use the GROMACS software 1/sqrt(x)])
172 AM_CONDITIONAL([GMX_SOFTWARE_INVSQRT],[test "$enable_software_invsqrt" = "yes"])
174 AC_ARG_ENABLE(fahcore,
175 [AC_HELP_STRING([--enable-fahcore],
176 [Create a library with mdrun functionality])],, enable_fahcore=no)
180 # The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
181 # instructions dynamically at runtime, so they might not make much difference now:
184 AC_ARG_ENABLE(all-static,
185 [AC_HELP_STRING([--enable-all-static],
186 [Make completely static binaries])],, enable_all_static=no)
187 # Dont add the -all-static flag until after the compiler test.
190 # FFT libraries - only use one...
192 [AC_HELP_STRING([--with-fft=@<:@fftw3/fftw2/mkl(>=6.0)/fftpack@:>@],
193 [FFT library to use. fftw3 is default, fftpack built in.])],,
196 AC_ARG_ENABLE(fftw-measure,
197 [AC_HELP_STRING([--disable-fftw-measure],
198 [Dont optimize FFTs. This produces binary exactly]
199 [reproducible runs (as the -reprod flag to mdrun),]
200 [and if you are using FFTW on x86 and specified its]
201 [--enable-sse/sse2 flag (NOT default in FFTW!) the]
202 [kernels used are close-to-optimal anyway.])],,
203 enable_fftw_measure=yes)
206 AC_ARG_ENABLE(threads,
207 [AC_HELP_STRING([--enable-threads],
208 [Compile for parallel runs using threads])],,enable_threads=no)
210 # if test "$enable_threads" = "yes"; then
211 # with_threads=pthreads;
215 ### Use external BLAS/LAPACK libraries if the user wants to.
217 AC_ARG_WITH(external_blas,
218 [AC_HELP_STRING([--with-external-blas],
219 [Use system BLAS library (add to LIBS). Automatic on OS X.])],,
221 # default action - check if we are on OS X
222 case "${host_vendor}-${host_os}" in
223 apple-darwin*) with_external_blas="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
224 *) with_external_blas="no" ;;
227 AM_CONDITIONAL([GMX_EXTERNAL_BLAS], [test "$with_external_blas" = "yes"])
230 AC_ARG_WITH(external_lapack,
231 [AC_HELP_STRING([--with-external-lapack],
232 [Use system LAPACK library (add to LIBS). Automatic on OS X.])],,
234 # default action - check if we are on OS X
235 case "${host_vendor}-${host_os}" in
236 apple-darwin*) with_external_lapack="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
237 *) with_external_lapack="no" ;;
240 AM_CONDITIONAL([GMX_EXTERNAL_LAPACK], [test "$with_external_lapack" = "yes"])
245 AC_ARG_WITH(qmmm_gaussian,
246 [AC_HELP_STRING([--without-qmmm-gaussian],
247 [Use modified Gaussian0x for QM-MM (see website)])],,with_qmmm_gaussian=yes)
248 if test "$with_qmmm_gaussian" = "yes"; then
249 AC_DEFINE(GMX_QMMM_GAUSSIAN,,[Use (modified) Gaussian0x for QM-MM calculations])
253 AC_ARG_WITH(qmmm_gamess,
254 [AC_HELP_STRING([--without-qmmm-gamess],
255 [Use modified Gamess-UK for QM-MM (see website)])],,with_qmmm_gamess=no)
256 if test "$with_qmmm_gamess" = "yes"; then
257 AC_DEFINE(GMX_QMMM_GAMESS,,[Use (modified) Gamess-UK for QM-MM calculations])
261 AC_ARG_WITH(qmmm_mopac,
262 [AC_HELP_STRING([--without-qmmm-mopac],
263 [Use modified Mopac 7 for QM-MM (see website)])],,with_qmmm_mopac=no)
264 if test "$with_qmmm_mopac" = "yes"; then
265 AC_DEFINE(GMX_QMMM_MOPAC,,[Use (modified) Mopac 7 for QM-MM calculations])
269 ############################################################
270 # Add some debug info: Who is building, and on what machine?
271 ############################################################
272 AC_DEFINE_UNQUOTED([BUILD_TIME],["`date`"],[Date and time for build])
273 AC_DEFINE_UNQUOTED([BUILD_USER],["`whoami`@`hostname`"],[User doing build])
274 AC_DEFINE_UNQUOTED([BUILD_MACHINE],["`uname -srm`"],[Hardware and OS version for build host])
278 ############################################################
279 # Checks for programs
280 ############################################################
282 # normally we use the default compiler, but on alpha/linux we try the compaq ones first
283 case "${host_cpu}-${host_os}" in
285 cc_names="ccc cc gcc"
286 f77_names="fort f77 g77"
289 cc_names="cc icc xlc gcc"
290 f77_names="f77 ifort xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
293 # the (non-mpi) c compiler, which is also used for programs executed during build stage
294 AC_PROG_CC( $cc_names )
295 # Check for environment variable CC_FOR_BUILD before overwriting it
296 if test -z "$CC_FOR_BUILD"; then
299 AC_SUBST(CC_FOR_BUILD)
301 if test "$enable_fortran" = "yes"; then
302 AC_PROG_F77( $f77_names )
303 if test -z "$F77"; then
304 AC_MSG_ERROR([No fortran compiler found])
310 # if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
311 # above, since autoconf checks that the created file can be executed. This would
312 # fail on platforms where MPI executables can only be run through a batchqueue.
314 if test "$enable_mpi" = "yes"; then
315 AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)
316 # now change the normal cc to the MPI one - see the comment above.
318 AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
319 AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
320 AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
321 AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
322 AC_DEFINE(GMX_LIB_MPI,,[Use a real MPI library])
324 if test "$enable_mpi_in_place" = "yes"; then
325 # not all MPIs support MPI_IN_PLACE:
326 AC_MSG_CHECKING([for MPI_IN_PLACE in collective operations])
332 MPI_Allreduce(MPI_IN_PLACE, buf, 10, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD);
336 AC_DEFINE(MPI_IN_PLACE_EXISTS,[],[MPI_IN_PLACE available for collective operations])
342 # on the cray xt3 we have to tell autoconf that we
343 # are actually cross-compiling even if the architecture
344 # of host and target are the same. so we enforce
345 # cross-compilation if __QK_USER__ is defined
346 AC_MSG_CHECKING([for catamount])
348 #if defined __QK_USER__
355 AC_DEFINE(GMX_CRAY_XT3,[],[Enable special hacks for Cray XT3])
356 AC_DEFINE(GMX_NO_SYSTEM,[],[Ignore calls to system(3)])
357 AC_DEFINE(GMX_NO_NICE,[],[Ignore calls to nice(3)])
358 AC_DEFINE(GMX_BROKEN_CALLOC,[],[Don't use calloc(3)])
359 extra_LDFLAGS="$extra_LDFLAGS -lgmalloc -lacml"
363 # end of "$enable_mpi" = "yes"
367 AH_TEMPLATE([F77_OR_C_FUNC],
368 [Set to F77_FUNC(name,NAME) if Fortran used, otherwise 'name' for C.])
369 AH_TEMPLATE([F77_OR_C_FUNC_],
370 [Set to F77_FUNC_(name,NAME) if Fortran used, otherwise 'name' for C.])
374 if test "$enable_fortran" = "yes"; then
375 AC_F77_LIBRARY_LDFLAGS
377 AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[F77_FUNC(name,NAME)])
378 AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[F77_FUNC_(name,NAME)])
380 AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[name])
381 AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[name])
387 # Needed by libtool scripts?
390 if test "$enable_cpu_optimization" = "yes"; then
398 # We've postponed the threads check because we need to check with the right
400 if test "$enable_threads" = "yes"; then
401 if test "$enable_mpi" = "yes"; then
402 AC_MSG_ERROR([Cannot use both threads and MPI - yet.])
404 if test "$with_fft" = "fftw2"; then
405 AC_MSG_ERROR([fftw2 can't be used with threads. Use fftw3 or mkl.])
407 # for now we just assume pthreads
408 ACX_PTHREAD(,AC_MSG_ERROR([Cannot find POSIX threads - required for thread support using configure!]))
409 LIBS="$PTHREAD_LIBS $LIBS"
410 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
411 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
413 AC_DEFINE(THREAD_PTHREADS,,[Use pthreads for thread_mpi multithreading])
414 AC_DEFINE(GMX_THREADS,,[Use threads for parallelization])
415 AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
416 AM_CONDITIONAL(THREAD_PARALLEL,true)
418 AM_CONDITIONAL(THREAD_PARALLEL,false)
424 # Check integer endian
426 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
427 AC_MSG_ERROR([Cannot determine endian in compiled output])])
428 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
431 # Make sure size_t can hold pointers.
432 # On some Nec machines, you reportedly need to specify a flag for size_t to be 64 bits wide.
434 AC_MSG_CHECKING([that size_t can hold pointers])
438 ],[int chk[sizeof(size_t)-sizeof(int *)+1];],AC_MSG_RESULT([yes]),[
439 AC_MSG_ERROR([size_t is smaller than int*. Check if your compiler needs a flag to make it 64 bit.])])
443 # Check that SIGUSR1 is defined
445 AC_MSG_CHECKING([for SIGUSR1])
446 AC_TRY_COMPILE([#include <signal.h>],[int i=SIGUSR1;],[
448 AC_DEFINE(HAVE_SIGUSR1,,[SIGUSR1 supported and defined])
449 ],AC_MSG_RESULT([no]))
452 # Check if pipes are supported
454 AC_MSG_CHECKING([for pipes])
455 AC_TRY_COMPILE([#include <stdio.h>],[
456 FILE *pipe=popen("/tmp/pipe","r");
459 AC_DEFINE(HAVE_PIPES,,[Pipes (popen/pclose) supported])
460 ],AC_MSG_RESULT([no]))
465 # Check floating-point format and endian
477 # Use our own version of AC_FUNC_FSEEKO from autoconf 2.63 instead
478 # of the broken one we might get from autoconf 2.61.
479 ACX_FUNC_FSEEKO_FIXED
484 ############################################################################
485 # Checks for libraries.
486 ############################################################################
488 # Don't add math library for intel compilers
489 if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
490 AC_MSG_NOTICE([Using built-in math library with intel compiler])
492 AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
496 # Disable MASS support for now.
502 if test "$enable_float" = "yes"; then
507 ACX_CHECK_FFTW2(fftw,$sizeof_real)
508 ACX_CHECK_FFTW2(rfftw,$sizeof_real)
510 case ${ac_fftw_savedprefix} in
511 d) AC_DEFINE(FFTW2_NAME_DFFTW,,[Use the d prefix on fftw2 includes]) ;;
512 s) AC_DEFINE(FFTW2_NAME_SFFTW,,[Use the s prefix on fftw2 includes]) ;;
513 *) AC_DEFINE(FFTW2_NAME_FFTW,,[Dont use any prefix on fftw2 includes]) ;;
516 AC_DEFINE(GMX_FFT_FFTW2,,[Use FFTW2 FFT library])
518 ;; # end of fftw2 check
520 fftw3) # Much simpler check than fftw2
521 # Check for header <fftw3.h> AC_CHECK_HEADERS doesnt work, since we must
522 # use mpicc to get includes - cpp isnt always the same compiler.
523 AC_MSG_CHECKING([for fftw3.h])
524 AC_TRY_COMPILE([#include<fftw3.h>],,[
525 # ok, look for library file too
527 if test "$enable_float" = "yes"; then
528 AC_CHECK_LIB([fftw3f],main,,AC_MSG_ERROR([Cannot find fftw3f library]))
530 AC_CHECK_LIB([fftw3],main,,AC_MSG_ERROR([Cannot find fftw3 library]))
532 AC_DEFINE(GMX_FFT_FFTW3,,[Use FFTW3 FFT library])
534 # not ok, echo a warning
536 [Cannot find the default external FFT library (fftw3).
537 Other alternatives are 'fftw2', or 'mkl' for Intel MKL.
538 You are STRONGLY recommended to use one of these - fftw is free.
540 Use CPPFLAGS and LDFLAGS if the library is installed in a
541 non-standard location. (see FAQ at http://www.gromacs.org)
543 If you dont care about performance you can also specify 'fftpack'
544 to use a slower set of FFTs built into Gromacs.
545 (Just install FFTW3 unless you really know what you are doing).
552 # Intel Math Kernel Library version 6 and later.
554 AC_MSG_CHECKING([for mkl_dfti.h])
555 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.]\
558 # AC_CHECK_LIB([guide],main,,AC_MSG_ERROR([Cannot find libguide (Intel MKL)]))
559 AC_CHECK_LIB([mkl],DftiComputeForward,,
560 AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0]))
562 AC_DEFINE(GMX_FFT_MKL,,[Use Intel MKL FFT library])
566 AC_MSG_WARN([The built-in FFTPACK routines are slow.
567 Are you sure you don't want to use FFTW? It is free and much faster...])
568 AC_DEFINE(GMX_FFT_FFTPACK,,[Use Built-in FFTPACK FFT library])
571 AC_MSG_ERROR([Unknown FFT library])
576 if test "$enable_fftw_measure" != "yes"; then
577 AC_DEFINE(GMX_DISABLE_FFTW_MEASURE,,[Do not optimize FFTW setups (not needed with SSE FFT kernels)])
581 # check for xtc headers
583 cygwin* | mingw*) # use our own xdr stuff for cygwin/mingw
586 AC_CHECK_HEADERS([rpc/rpc.h])
587 AC_CHECK_HEADERS([rpc/xdr.h],,,
589 # include <rpc/rpc.h>
592 AC_CHECK_LIB(nsl,xdr_float)
597 #error NO rpc.h header
602 #error No xdr.h header
604 ],[ XDR *xd; float f; xdr_float(xd,&f);],[have_xdr="yes"])
606 if test "$have_xdr" != "yes"; then
607 AC_DEFINE(GMX_INTERNAL_XDR,,[Use our own instead of system XDR libraries])
608 AC_MSG_WARN([Couldn't find XDR headers and/or libraries - using our own])
614 ########################################################################
615 # Checks for header files and types
616 ########################################################################
618 AC_CHECK_HEADERS([limits.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
619 AC_CHECK_HEADERS(unistd.h)
620 AC_CHECK_HEADERS(sys/types.h)
621 AC_CHECK_HEADERS(sys/time.h)
622 AC_CHECK_HEADERS(regex.h,,[AC_MSG_WARN(
624 Regular expression matching in selections will be disabled.
625 Selections still work, but the default groups can differ from
626 those obtained with regular expressions enabled.
627 Consider installing the regular expression library from GNU libc.])])
630 # Checks for additional and/or optional functions or libraries.
637 AC_CHECK_FUNCS(strcasecmp)
638 AC_CHECK_FUNCS(strdup)
639 AC_CHECK_FUNCS(gettimeofday)
640 AC_CHECK_FUNCS(isnan)
641 AC_CHECK_FUNCS(_isnan)
643 # check for bool (must come late, since CFLAGS/includes might affect it)
644 AC_CHECK_TYPES([bool])
651 # Check integer sizes, set to zero if e.g. long long is not supported.
652 # (Note: this must come *after* type checks for the corresponding types!)
655 AC_CHECK_SIZEOF(long int)
656 AC_CHECK_SIZEOF(long long int)
657 AC_CHECK_SIZEOF(off_t)
658 AC_CHECK_SIZEOF(void*)
662 # Apple OS X is a bit strange/braindead in that it always reports itself as i386, both for
663 # 32 and 64 bit builds (even with the 64 bit kernel!).
665 # To get the SSE support right we check for the size of void * that we detected above...
666 case "${host_vendor}-${host_os}" in
668 if test $ac_cv_sizeof_voidp = 8; then
671 enable_x86_64_sse=no;
683 if test "$no_x" != "yes"; then
684 LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
685 INCLUDES="$INCLUDES $X_CFLAGS"
686 AM_CONDITIONAL(USE_X11,true)
688 AM_CONDITIONAL(USE_X11,false)
691 # GNU Scientific Library or not
693 [ --with-gsl Link to the GNU scientific library, enables extra functions in analysis],,with_gsl=no)
696 if test "$with_gsl" = "yes"; then
697 ac_save_LDFLAGS="$LDFLAGS"
698 AC_CHECK_HEADERS([gsl/gsl_version.h],[
699 # header found, check for libraries
700 AC_CHECK_LIB(gslcblas,main,[
701 LDFLAGS="$ac_save_LDFLAGS -lgslcblas"
702 # gslcblas library found, check main lib
703 AC_CHECK_LIB(gsl,main)])])
709 [ --without-xml do not link to the xml2 library, disallows the use of certain file formats],,with_xml=yes)
712 # Check for libxml2, but it is optional, so dont stop
714 if test "$with_xml" = "yes"; then
715 ac_save_CPPFLAGS="$CPPFLAGS"
716 CPPFLAGS="$ac_save_CPPFLAGS -I/usr/include/libxml2"
717 AC_CHECK_HEADERS([libxml/parser.h],AC_CHECK_LIB(xml2,main))
718 if test "$ac_cv_lib_xml2_main" = "yes"; then
719 INCLUDES="$INCLUDES -I/usr/include/libxml2"
722 CPPFLAGS="$ac_save_CPPFLAGS"
726 # And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
727 # and we need -L/usr/ucblib to find libucb... (stupid OS)
728 # On e.g. ibm the mass libraries must come before -lm...
729 case "${host_cpu}-${host_os}" in
732 LDFLAGS="$LDFLAGS -L/usr/ucblib"
734 *) LIBS="$LIBS $FLIBS" ;;
738 # add the Accelerate framework if enabled above.
739 # LDFLAGS might have been set in the CPU optimization, so we cant assign it directly before that.
740 LDFLAGS="$LDFLAGS $extra_LDFLAGS"
748 # Checks for typedefs, structures, and compiler characteristics.
754 # AC_TYPE_UID_T is broken on Mac OS X, so use generic tests instead
755 AC_CHECK_TYPES([uid_t],[],[AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
756 AC_CHECK_TYPES([gid_t],[],[AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
760 # Test stuff for ia32 and x86_64 assembly, and add objects/libraries.
761 if test "$enable_ia32_sse" = "yes" -o "$enable_x86_64_sse" = "yes"; then
762 AC_MSG_CHECKING([whether your compiler can handle assembly files (*.s)])
764 # Use 64-bit registers (rsp/rbp) on x86_64
766 if test "$enable_x86_64_sse" = "yes"; then
767 cat > conftestasm.s << EOF
773 cat > conftestasm.s << EOF
779 if AC_TRY_COMMAND($CC $CFLAGS -c conftestasm.s); then
780 if test -f conftestasm.o; then
784 AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
788 AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
791 # ok, cc understands assembly.
793 # If we are using double precision we need SSE2
794 if test "$enable_float" = "no"; then
796 if test "$enable_ia32_sse" = "yes"; then
797 AC_MSG_CHECKING([whether as fully supports ia32 SSE2])
798 cat > conftest.s << EOF
801 movapd 32(%esi,%edx,8),%xmm4
805 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
809 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
811 AC_DEFINE([GMX_IA32_SSE2],,[Double-precision SSE2 instructions on ia32])
813 # test SSE2 on X86_64:
814 if test "$enable_x86_64_sse" = "yes"; then
815 AC_MSG_CHECKING([whether as fully supports X86_64 SSE2])
816 cat > conftest.s << EOF
819 movapd 32(%rsi,%rdx,8),%xmm4
823 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
827 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
829 AC_DEFINE([GMX_X86_64_SSE2],,[Double-precision SSE2 instructions on X86_64])
832 # end of double precision testing, now do single.
833 if test "$enable_ia32_sse" = "yes"; then
834 AC_MSG_CHECKING([whether as fully supports ia32 SSE])
835 cat > conftest.s << EOF
838 movaps 32(%esi,%edx,8),%xmm4
842 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
846 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
848 AC_DEFINE([GMX_IA32_SSE],,[Single-precision SSE instructions on ia32])
850 # test SSE2 on X86_64:
851 if test "$enable_x86_64_sse" = "yes"; then
852 AC_MSG_CHECKING([whether as fully supports X86_64 SSE instructions])
853 cat > conftest.s << EOF
856 movaps 32(%rsi,%rdx,8),%xmm4
860 if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
864 AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
866 AC_DEFINE([GMX_X86_64_SSE],,[Single-precision SSE instructions on X86_64])
872 # Test stuff for ia64 assembly
874 # Nothing to test right now.
880 # Test altivec support.
882 if test "$enable_ppc_altivec" = "yes"; then
883 if test "$enable_float" = "no"; then
884 AC_MSG_WARN([PowerPC Altivec loops can only be used in single precision - disabling])
885 enable_ppc_altivec=no
887 # On FSF (vanilla) GCC we must include altivec.h, and on apple we
888 # should NOT do it after using -faltivec. Go figure...
891 # do nothing on Apple systems
894 AC_CHECK_HEADERS([altivec.h])
898 AC_MSG_CHECKING([whether the compiler supports altivec extensions])
905 AC_DEFINE([GMX_PPC_ALTIVEC],,[Use PowerPC Altivec inner loops])],[
907 AC_MSG_WARN([no altivec support found - On recent PowerPC CPUs]
908 [you can get a huge performance gain by using an altivec-enabled compiler.]
909 [On OS X, you need GCC>=3.3, or the IBM compilers. If you are using standard]
910 [GCC, you need at least version 4.0])
911 enable_ppc_altivec=no])
915 if test "$enable_ia64_asm" = "yes"; then
916 AC_DEFINE(GMX_IA64_ASM,,[Use ia64 assembly tuned for Itanium2])
917 AC_DEFINE(DISABLE_WATER_NLIST,,[Turn off all water neighborlist optimization])
918 AC_DEFINE(DISABLE_WATERWATER_NLIST,,[Turn off water-water neighborlist optimization only])
921 if test "$enable_bluegene" = "yes"; then
922 AC_DEFINE(GMX_BLUEGENE,,[Use assembly intrinsics kernels for BlueGene])
926 # Add the appropriate assembly loops
928 AM_CONDITIONAL([GMX_IA32_SSE],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "yes"])
929 AM_CONDITIONAL([GMX_IA32_SSE2],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "no"])
930 AM_CONDITIONAL([GMX_X86_64_SSE],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "yes"])
931 AM_CONDITIONAL([GMX_X86_64_SSE2],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "no"])
932 AM_CONDITIONAL([GMX_FORTRAN],[test "$enable_fortran" = "yes"])
933 AM_CONDITIONAL([GMX_PPC_ALTIVEC],[test "$enable_ppc_altivec" = "yes" -a "$enable_float" = "yes"])
934 AM_CONDITIONAL([GMX_IA64_ASM],[test "$enable_ia64_asm" = "yes"])
935 AM_CONDITIONAL([GMX_BLUEGENE],[test "$enable_bluegene" = "yes"])
936 AM_CONDITIONAL([GMX_POWER6],[test "$enable_power6" = "yes"])
940 # Check integer endian
942 AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
943 AC_MSG_ERROR([Cannot determine endian in compiled output])])
944 # Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
948 case "${host_cpu}" in
950 # Check if inline assembly works
951 AC_MSG_CHECKING(if the compiler supports gcc inline assembly)
952 AC_TRY_LINK([],[float f;int i; asm("fld %1\nfistpl %0\n" : "=m" (*&i) : "f" (f));],[AC_MSG_RESULT(yes)
953 AC_DEFINE(GMX_X86_GCC_INLINE_ASM,,[Enable x86 gcc inline assembly])],[AC_MSG_RESULT(no)])
954 # Check for MSVC inline assembly
955 AC_MSG_CHECKING(if the compiler supports MSVC inline assembly)
956 AC_TRY_LINK([],[float f;int i; _asm { fld f } ; _asm { fistpl i };],[AC_MSG_RESULT(yes)
957 AC_DEFINE(GMX_X86_MSVC_INLINE_ASM,,[Enable x86 MSVC inline assembly])],[AC_MSG_RESULT(no)])
967 ########################################################################
969 ########################################################################
973 AC_SUBST(INCLUDES) # should be automatic, but doesnt seem to be?
975 # To tell libraries apart, we use four versions of the name. For instance, libgmx:
976 # libgmx single prec, no mpi.
977 # libgmx_d double prec, no mpi.
978 # libgmx_mpi single prec, mpi.
979 # libgmx_mpi_d double prec, mpi.
980 # However, the non-suffixed names are linked to the _mpi and/or _d suffixed
981 # ones upon installation if that is the only version available.
983 if test "$enable_mpi" = "yes"; then
986 if test "$enable_float" = "no"; then
987 LIBSUFFIX="${LIBSUFFIX}_d"
991 # Unless the user has explicitly requested a prefix/suffix/transform, we
992 # use _d on double precision files. Don't add anything for mpi, but at the
993 # end we tell the user it is possible and smart to do in some cases!
994 if test "$program_transform_name" = "s,x,x,"; then
995 name_transform_provided=no;
996 if test "$enable_float" = "no"; then
997 program_transform_name="s,\$\$,_d,"
1000 name_transform_provided=yes;
1004 # Use a variable for RPM - this way it can be
1005 # overridden with make RPM=rpm3 rpm
1009 if test "$enable_fahcore" = "yes"; then
1010 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/../corewrap -include swindirect.h -DFULLINDIRECT -DUSE_FAH_XDR"
1011 if test "$enable_mpi" = "yes"; then
1012 CFLAGS="$CFLAGS -DMPI"
1015 AM_CONDITIONAL([GMX_FAHCORE],[test "$enable_fahcore" = "yes"])
1018 if test "$enable_all_static" = "yes"; then
1019 LDFLAGS="$LDFLAGS -all-static"
1022 # we have asm source, so this is necessary for automake 1.6
1029 AC_CONFIG_FILES([ Makefile ])
1030 AC_CONFIG_FILES([ src/Makefile ])
1031 AC_CONFIG_FILES([ src/gmxlib/Makefile ])
1032 AC_CONFIG_FILES([ src/gmxlib/gmx_blas/Makefile ])
1033 AC_CONFIG_FILES([ src/gmxlib/gmx_lapack/Makefile ])
1034 AC_CONFIG_FILES([ src/gmxlib/selection/Makefile ])
1035 AC_CONFIG_FILES([ src/gmxlib/statistics/Makefile ])
1036 AC_CONFIG_FILES([ src/gmxlib/trajana/Makefile ])
1037 AC_CONFIG_FILES([ src/gmxlib/thread_mpi/Makefile ])
1038 AC_CONFIG_FILES([ src/gmxlib/nonbonded/Makefile ])
1039 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_c/Makefile ])
1040 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse/Makefile ])
1041 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse2/Makefile ])
1042 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse/Makefile ])
1043 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse2/Makefile ])
1044 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ppc_altivec/Makefile ])
1045 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_single/Makefile ])
1046 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_double/Makefile ])
1047 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_bluegene/Makefile ])
1048 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_power6/Makefile ])
1049 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_single/Makefile ])
1050 AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_double/Makefile ])
1051 AC_CONFIG_FILES([ include/Makefile ])
1052 AC_CONFIG_FILES([ include/types/Makefile ])
1053 AC_CONFIG_FILES([ include/thread_mpi/Makefile ])
1054 AC_CONFIG_FILES([ include/thread_mpi/atomic/Makefile ])
1055 AC_CONFIG_FILES([ src/mdlib/Makefile ])
1056 AC_CONFIG_FILES([ src/kernel/Makefile ])
1057 AC_CONFIG_FILES([ src/tools/Makefile ])
1058 AC_CONFIG_FILES([ src/ngmx/Makefile ])
1059 AC_CONFIG_FILES([ src/contrib/Makefile ])
1060 AC_CONFIG_FILES([ scripts/Makefile ])
1061 AC_CONFIG_FILES([ admin/Makefile ])
1062 AC_CONFIG_FILES([ share/Makefile ])
1063 AC_CONFIG_FILES([ share/tutor/Makefile ])
1064 AC_CONFIG_FILES([ share/tutor/gmxdemo/Makefile ])
1065 AC_CONFIG_FILES([ share/tutor/nmr1/Makefile ])
1066 AC_CONFIG_FILES([ share/tutor/nmr2/Makefile ])
1067 AC_CONFIG_FILES([ share/tutor/water/Makefile ])
1068 AC_CONFIG_FILES([ share/tutor/mixed/Makefile ])
1069 AC_CONFIG_FILES([ share/tutor/methanol/Makefile ])
1070 AC_CONFIG_FILES([ share/tutor/speptide/Makefile ])
1071 AC_CONFIG_FILES([ share/template/Makefile ])
1072 AC_CONFIG_FILES([ share/top/Makefile ])
1073 AC_CONFIG_FILES([ share/html/Makefile ])
1074 AC_CONFIG_FILES([ share/html/images/Makefile ])
1075 AC_CONFIG_FILES([ share/html/online/Makefile ])
1076 AC_CONFIG_FILES([ man/Makefile man/man1/Makefile man/man7/Makefile ])
1077 AC_CONFIG_FILES([ Doxyfile ])
1086 #########################################################
1087 # Echo some important info, to avoid stupid mistakes
1090 if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
1092 echo "* You are compiling a double precision version of Gromacs -"
1093 echo " program names will be suffixed with _d to avoid overwriting single"
1094 echo " precision files. You can override it with --program-suffix"
1097 if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
1099 echo "* Seems you are compiling with MPI support. You can install the MPI-"
1100 echo " enabled programs with suffixed names to have both MPI and non-MPI"
1101 echo " versions. This is useful e.g. on supercomputers where you usually"
1102 echo " cannot run MPI-linked programs on the login node."
1103 echo " Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
1104 echo " You only need MPI for mdrun, so if you already have non-MPI stuff"
1105 echo " installed you can issue make mdrun; make install-mdrun."
1108 if test "$enable_shared" = "no"; then
1110 echo "* On most platforms you can save 10X space with dynamic libraries, although"
1111 echo " the binaries might be less portable. Why not try --enable-shared ?"