1# m4_esyscmd_s implementation for autoconf < 2.64.
2# (Taken from m4sugar.m4 in autoconf 2.69.)
3m4_ifndef([m4_esyscmd_s], [m4_define([m4_esyscmd_s],
4[m4_chomp_all(m4_esyscmd([$1]))])])
5m4_ifndef([m4_chomp_all], [m4_define([m4_chomp_all],
6[m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [
7/], [/ ]), [/*$]), [$1])])])
8
9# Get the version from
10# (1) .version file available in a tarball, or
11# (2) the latest tag in the repository.
12m4_define([FORM_VERSION], m4_esyscmd_s([
13	if test -f .version; then
14		cat .version
15	else
16		scripts/git-version-gen.sh -C . -v || {
17			# As a fallback, try for form3.h.
18			major_version=`grep MAJORVERSION sources/form3.h | sed -e 's/ *#define  *MAJORVERSION *//'`
19			minor_version=`grep MINORVERSION sources/form3.h | sed -e 's/ *#define  *MINORVERSION *//'`
20			if test "x$major_version" != x && test "x$minor_version" != x; then
21				# Make the version files.
22				echo "$major_version.$minor_version" >.version
23				echo "#define REPO_MAJOR_VERSION $major_version"  >sources/version.h.in
24				echo "#define REPO_MINOR_VERSION $minor_version" >>sources/version.h.in
25				echo "\\def\\repomajorversion{$major_version}"  >doc/manual/version.tex.in
26				echo "\\def\\repominorversion{$minor_version}" >>doc/manual/version.tex.in
27				cp doc/manual/version.tex.in doc/devref/version.tex.in
28			fi
29			cat <<END >&2
30========================================================================
31Failed to determine the revision of the source code.
32
33The reason may be
34  - this is neither a source distribution (containing the configure
35    script) nor a cloned Git repository,
36  - this is a shallow clone and no version tags are reachable,
37  - some required utilities (e.g., git) are missing.
38
39Source distributions and some binaries can be found in:
40
41  http://www.nikhef.nl/~form/maindir/binaries/binaries.html
42  https://github.com/vermaseren/form/releases
43
44The latest source code can be cloned by:
45
46  git clone https://github.com/vermaseren/form.git
47END
48			test -f .version && cat <<END >&2
49
50You can continue the build, but binaries will not contain the revision
51information.
52END
53			cat <<END >&2
54========================================================================
55END
56			test -f .version && cat .version
57		}
58	fi
59]))
60
61# Use the serial-tests option of AM_INIT_AUTOMAKE if automake >= 1.13.
62# Assume the automake command is ${AUTOMAKE:-automake} as autoreconf does.
63# It may not work if "make" re-runs a different version of automake.
64m4_define([serial_tests], [m4_esyscmd_s([
65	${AUTOMAKE:-automake} --version | head -1 |
66	awk '{split ($NF,a,"."); if (a[1] >= 2 || (a[1] == 1 && a[2] >= 13)) { print "serial-tests" }}'
67])])
68
69AC_PREREQ(2.59)
70AC_INIT([FORM], FORM_VERSION, [https://github.com/vermaseren/form/issues])
71AC_CONFIG_SRCDIR([sources/form3.h])
72AC_CONFIG_HEADERS([config.h])
73AC_CONFIG_AUX_DIR([build-aux])
74AM_INIT_AUTOMAKE([1.7 foreign -Wall dist-bzip2] serial_tests)
75
76# Check for .version file
77AM_CONDITIONAL([FIXED_VERSION], [test -f $srcdir/.version])
78
79# Check for automake >= 1.10
80flag=false
81case $am__api_version in
82	1.6|1.7|1.8|1.9)
83		;;
84	*)
85		flag=:
86		;;
87esac
88AM_CONDITIONAL([AUTOMAKE_GE_110], [$flag])
89
90# Check for programs
91: ${CFLAGS=''}  # avoid autoconf's default CFLAGS/CXXFLAGS
92: ${CXXFLAGS=''}
93AC_PROG_CC([gcc cc icc])
94AM_PROG_CC_C_O
95AC_PROG_CXX([g++ c++ icpc])
96AC_PROG_LN_S
97
98# Checks for header files
99AC_HEADER_STDC
100AC_HEADER_TIME
101AC_CHECK_HEADERS([fcntl.h limits.h sys/file.h])
102
103AC_LANG_PUSH([C++])
104AC_CHECK_HEADERS([unordered_map tr1/unordered_map boost/unordered_map.hpp])
105AC_CHECK_HEADERS([unordered_set tr1/unordered_set boost/unordered_set.hpp])
106AC_LANG_POP([C++])
107
108# Checks for builtin functions
109ok=no
110AS_IF([test $ok != yes],
111	[AC_MSG_CHECKING([__builtin_popcount])
112	AC_LINK_IFELSE(
113		[AC_LANG_PROGRAM([], [
114			int x = __builtin_popcount((unsigned int)(-1));
115		])],
116		[ok=yes;
117		AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Define to 1 if you have __builtin_popcount function.])])
118	AC_MSG_RESULT($ok)])
119AS_IF([test $ok != yes],
120	[AC_MSG_CHECKING([__popcnt])
121	AC_LINK_IFELSE(
122		[AC_LANG_PROGRAM([#include <intrin.h>], [
123			unsigned int x = __popcnt((unsigned int)(-1));
124		])],
125		[ok=yes;
126		AC_DEFINE([HAVE_POPCNT], [1], [Define to 1 if you have __popcnt function.])])
127	AC_MSG_RESULT($ok)])
128
129# Check for inline
130AC_C_INLINE
131
132# Sets _FILE_OFFSET_BITS if possible
133AC_SYS_LARGEFILE
134
135# Check for architecture and OS
136AC_CANONICAL_HOST
137case $host_os in
138	darwin* )
139		print_os="OSX"
140		;;
141	linux* )
142		print_os="Linux"
143		# "LINUX" is still used in mallocprotect.h. (TU 16 Oct 2011)
144		AC_DEFINE(LINUX, , [Compiling for a Linux system.])
145		;;
146	cygwin* )
147		print_os="Cygwin"
148		;;
149	freebsd* )
150		print_os="FreeBSD"
151		;;
152	netbsd* )
153		print_os="NetBSD"
154		;;
155	openbsd* )
156		print_os="OpenBSD"
157		;;
158	* )
159		print_os="UNKNOWN OS"
160		;;
161esac
162case $host_cpu in
163	i?86 )
164		print_cpu="Pentium"
165		;;
166	x86_64 )
167		print_cpu="Opteron"
168		;;
169	alpha* )
170		print_cpu="Alpha"
171		;;
172	* )
173		print_cpu="UNKNOWN CPU"
174		;;
175esac
176
177# Check for C compiler vendor. We assume that all compilers (CC, CXX, MPICC and
178# MPICXX) have the same vendor and the same version. Clang most likely works
179# as GCC.
180vendors="
181intel:     __ICC,__ECC,__INTEL_COMPILER
182gnu:       __GNUC__
183microsoft: _MSC_VER
184unknown:   UNKNOWN
185"
186for ventest in $vendors; do
187	case $ventest in
188		*:)
189			vendor=$ventest
190			continue
191			;;
192		*)
193			vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
194			;;
195	esac
196	AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
197#if !($vencpp)
198choke me
199#endif
200])], [break])
201done
202vendor=`echo $vendor | cut -d: -f1`
203
204# POSIX or Windows API
205AC_ARG_WITH([api],
206	[AS_HELP_STRING([--with-api=API],
207		[use POSIX (posix) or Windows (windows) API @<:@default=posix@:>@])],
208	[AS_IF([test "x$withval" != xposix && test "x$withval" != xwindows],
209		[AC_MSG_FAILURE([Invalid argument for API. Use --with-api=posix or --with-api=windows])])],
210	[with_api=posix])
211AS_IF([test "x$with_api" = xposix],
212	[print_api=POSIX
213	AC_CHECK_HEADERS([unistd.h], [], [AC_MSG_FAILURE([unistd.h is not found])])
214	AC_DEFINE(UNIX, , [Compiling for UNIX system])])
215AS_IF([test "x$with_api" = xwindows],
216	[print_api=Windows
217	AC_CHECK_HEADERS([windows.h], [],[AC_MSG_FAILURE([windows.h is not found])] )
218	AC_DEFINE(WINDOWS, , [Compiling for WINDOWS system])])
219AM_CONDITIONAL([ONUNIX], [test "x$with_api" = xposix])
220AM_CONDITIONAL([ONWINDOWS], [test "x$with_api" = xwindows])
221
222# Check for data model
223AC_CHECK_SIZEOF([char])
224AC_CHECK_SIZEOF([short])
225AC_CHECK_SIZEOF([int])
226AC_CHECK_SIZEOF([long])
227AC_CHECK_SIZEOF([long long])
228AC_CHECK_SIZEOF([void *])
229AC_CHECK_SIZEOF([off_t])
230
231case $ac_cv_sizeof_char-$ac_cv_sizeof_short-$ac_cv_sizeof_int-$ac_cv_sizeof_long-$ac_cv_sizeof_long_long-$ac_cv_sizeof_void_p-$ac_cv_sizeof_off_t in
232	1-2-4-4-*-4-*)
233		# Most of today's 32 bit systems.
234		print_data_model="ILP32"
235		ac_cv_sizeof_WORD=$ac_cv_sizeof_short
236		ac_cv_sizeof_LONG=$ac_cv_sizeof_long
237		AC_DEFINE(ILP32, , [Compiling for ILP32 data model])
238		# We need INT64.
239		AS_IF([test $ac_cv_sizeof_long_long -ne 8],
240			[AC_MSG_FAILURE([64-bit integers are not available])])
241		;;
242	1-2-4-4-8-8-*)
243		# Microsoft Windows (X64/IA-64).
244		print_data_model="LLP64"
245		ac_cv_sizeof_WORD=$ac_cv_sizeof_int
246		ac_cv_sizeof_LONG=$ac_cv_sizeof_long_long
247		AC_DEFINE(LLP64, , [Compiling for LLP64 data model])
248		;;
249	1-2-4-8-*-8-*)
250		# Most Unix and Unix-like systems, e.g., Solaris, Linux and Mac OS X.
251		print_data_model="LP64"
252		ac_cv_sizeof_WORD=$ac_cv_sizeof_int
253		ac_cv_sizeof_LONG=$ac_cv_sizeof_long
254		AC_DEFINE(LP64, , [Compiling for LP64 data model])
255		;;
256	*)
257		AC_MSG_FAILURE([Cannot recognize the data model used in the compiler])
258		;;
259esac
260# Our basic assumption:
261#  sizeof(off_t) >= sizeof(LONG) >= sizeof(void *) >= sizeof(int)
262#                >= sizeof(WORD) >= sizeof(char) == 1.
263flag=:
264$flag && test $ac_cv_sizeof_off_t -lt $ac_cv_sizeof_LONG && flag=false
265$flag && test $ac_cv_sizeof_LONG -lt $ac_cv_sizeof_void_p && flag=false
266$flag && test $ac_cv_sizeof_void_p -lt $ac_cv_sizeof_int && flag=false
267$flag && test $ac_cv_sizeof_int -lt $ac_cv_sizeof_WORD && flag=false
268$flag && test $ac_cv_sizeof_WORD -lt $ac_cv_sizeof_char && flag=false
269$flag && test $ac_cv_sizeof_char -ne 1 && flag=false
270AS_IF([$flag], [], [AC_MSG_FAILURE([Basic assumption sizeof(off_t) >= sizeof(LONG) >= sizeof(void *) >= sizeof(int) >= sizeof(WORD) >= sizeof(char) == 1 does not hold.])])
271# sizeof(off_t) <= 4 means files must <= 2 GB.
272AS_IF([test $ac_cv_sizeof_off_t -le 4], [AC_MSG_WARN([Large files more than 2 GB are not supported])])
273AC_MSG_NOTICE([The data model is $print_data_model])
274
275# Check for gmp
276AC_ARG_WITH([gmp],
277	[AS_HELP_STRING([--with-gmp@<:@=DIR@:>@],
278		[use GMP for long integer arithmetic (installed in prefix DIR) @<:@default=check@:>@])],
279	[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
280		[with_gmp=yes
281		CPPFLAGS="$CPPFLAGS -I$withval/include"
282		LDFLAGS="$LDFLAGS -L$withval/lib"])],
283	[with_gmp=check])
284AS_IF([test "x$with_gmp" != xno],
285	[flag=:
286	AS_IF([$flag], [AC_CHECK_HEADER([gmp.h], [], [flag=false])])
287	AS_IF([$flag], [AC_CHECK_LIB([gmp], [__gmpz_init], [LIBS="-lgmp $LIBS"], [flag=false])])
288	AS_IF([$flag],
289		[AC_DEFINE(WITHGMP, [], [Define to use GMP for long integer arithmetic.])
290		with_gmp=yes],
291		[AS_IF([test "x$with_gmp" = xyes],
292			[AC_MSG_FAILURE([test for GMP failed. Give --without-gmp if you want to compile without GMP])])
293		AC_MSG_NOTICE([GMP is not available])
294		with_gmp=no])])
295
296# Check for zlib
297AC_ARG_WITH([zlib],
298	[AS_HELP_STRING([--with-zlib@<:@=DIR@:>@],
299		[use zlib for compression (installed in prefix DIR) @<:@default=check@:>@])],
300	[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
301		[with_zlib=yes
302		CPPFLAGS="$CPPFLAGS -I$withval/include"
303		LDFLAGS="$LDFLAGS -L$withval/lib"])],
304	[with_zlib=check])
305AS_IF([test "x$with_zlib" != xno],
306	[flag=:
307	AS_IF([$flag], [AC_CHECK_HEADER([zlib.h], [], [flag=false])])
308	AS_IF([$flag], [AC_CHECK_LIB([z], [get_crc_table], [LIBS="-lz $LIBS"], [flag=false])])
309	AS_IF([$flag],
310		[AC_DEFINE(WITHZLIB, [], [Define to use zlib for compression.])
311		with_zlib=yes],
312		[AS_IF([test "x$with_zlib" = xyes],
313			[AC_MSG_FAILURE([test for zlib failed. Give --without-zlib if you want to compile without zlib])])
314		AC_MSG_NOTICE([zlib is not available])
315		with_zlib=no])])
316
317# enable-scalar/threaded/parform/debug
318AC_ARG_ENABLE([scalar],
319	[AS_HELP_STRING([--enable-scalar],
320		[build scalar version (form) @<:@default=yes@:>@])],
321	[AS_IF([test "x$enableval" != xno], [enable_scalar=yes])],
322	[enable_scalar=yes])
323AC_ARG_ENABLE([threaded],
324	[AS_HELP_STRING([--enable-threaded],
325		[build multi-threaded version (tform) @<:@default=check@:>@])],
326	[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_threaded=yes])],
327	[enable_threaded=check])
328AC_ARG_ENABLE([parform],
329	[AS_HELP_STRING([--enable-parform],
330		[build parallel version using MPI (parform) @<:@default=no@:>@])],
331	[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_parform=yes])],
332	[enable_parform=no])
333AC_ARG_ENABLE([debug],
334	[AS_HELP_STRING([--enable-debug],
335		[build debugging versions (vorm/tvorm/parvorm) @<:@default=no@:>@])],
336	[AS_IF([test "x$enableval" != xno], [enable_debug=yes])],
337	[enable_debug=no])
338
339# Check for scalar version
340build_form=$enable_scalar
341AS_IF([test "x$enable_scalar" = xyes && test "x$enable_debug" = xyes], [build_vorm=yes], [build_vorm=no])
342AM_CONDITIONAL([BUILD_FORM], [test "x$build_form" = xyes])
343AM_CONDITIONAL([BUILD_VORM], [test "x$build_vorm" = xyes])
344
345# Check for threaded version
346PTHREAD_CFLAGS=
347PTHREAD_CPPFLAGS=
348PTHREAD_LIBS=
349AH_VERBATIM([WITHPOSIXCLOCK],
350[/* Define to use POSIX thread clock. */
351#ifdef WITHPTHREADS
352#undef WITHPOSIXCLOCK
353#endif])
354thread_clock_ok=no
355AS_IF([test "x$enable_threaded" != xno],
356	[flag=:
357	# Check the flag/library for pthreads
358	AS_IF([$flag],
359		[ok=no
360		#  none    : Cygwin
361		# -pthread : Linux/gcc (kernel threads), BSD/gcc (userland threads)
362		#  pthread : Linux, OSX
363		for a in none -pthread pthread; do
364			case $a in
365				none)
366					AC_MSG_CHECKING([whether pthreads works without any flags])
367					;;
368				-*)
369					AC_MSG_CHECKING([whether pthreads works with $a])
370					PTHREAD_CFLAGS="$a"
371					;;
372				*)
373					AC_MSG_CHECKING([for the pthreads library -l$a])
374					PTHREAD_LIBS="-l$a"
375					;;
376			esac
377			save_CFLAGS=$CFLAGS
378			save_LIBS=$LIBS
379			CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
380			LIBS="$PTHREAD_LIBS $LIBS"
381			AC_LINK_IFELSE([AC_LANG_PROGRAM([
382#include <pthread.h>
383static void *start_routine(void *a) { return a; }
384], [
385pthread_t th;
386pthread_condattr_t attr;
387pthread_create(&th, 0, start_routine, 0);
388pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
389])],
390				[ok=yes],
391				[])
392			CFLAGS=$save_CFLAGS
393			LIBS=$save_LIBS
394			AC_MSG_RESULT($ok)
395			test "x$ok" = xyes && break
396			PTHREAD_CFLAGS=
397			PTHREAD_LIBS=
398		done
399		test "x$ok" = xno && flag=false])
400	# Check pthread_rwlock_t
401	AS_IF([$flag],
402		[ok=no
403		# -D_XOPEN_SOURCE=500: Scientific Linux 4.8
404		for a in none -D_XOPEN_SOURCE=500; do
405			case $a in
406				none)
407					AC_MSG_CHECKING([for pthread_rwlock_t])
408					;;
409				-D*)
410					AC_MSG_CHECKING([for pthread_rwlock_t with $a])
411					PTHREAD_CPPFLAGS="$a"
412					;;
413			esac
414			save_CPPFLAGS=$CPPFLAGS
415			CPPFLAGS="$PTHREAD_CPPFLAGS $CPPFLAGS"
416			AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
417#include <errno.h>
418#include <pthread.h>
419pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
420], [
421while (pthread_rwlock_tryrdlock(&rwlock) == EBUSY) {}
422pthread_rwlock_unlock(&rwlock);
423])],
424				[ok=yes],
425				[])
426			CPPFLAGS=$save_CPPFLAGS
427			AC_MSG_RESULT($ok)
428			test "x$ok" = xyes && break
429			PTHREAD_CPPFLAGS=
430		done
431		test "x$ok" = xno && flag=false])
432	# Check clock_gettime with CLOCK_THREAD_CPUTIME_ID
433	AS_IF([$flag && test "x$with_api" = xposix],
434		[ok=yes
435		AS_IF([test "x$ok" = xyes],
436			[AC_MSG_CHECKING([for the POSIX thread clock])
437			save_CPPFLAGS=$CPPFLAGS
438			CPPFLAGS="$PTHREAD_CPPFLAGS $CPPFLAGS"
439			AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
440#include <time.h>
441], [
442struct timespec t;
443clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t);
444])],
445				[],
446				[ok=no])
447			CPPFLAGS=$save_CPPFLAGS
448			AC_MSG_RESULT($ok)])
449		AS_IF([test "x$ok" = xyes],
450			[save_LIBS=$LIBS
451			AC_SEARCH_LIBS([clock_gettime], [rt], [], [ok=no])
452			LIBS=$save_LIBS
453			if test "x$ac_cv_search_clock_gettime" != "xnone required" && test "x$ac_cv_search_clock_gettime" != "xno"; then
454				PTHREAD_LIBS="$ac_cv_search_clock_gettime $PTHREAD_LIBS"
455			fi])
456		AS_IF([test "x$ok" = xyes],
457			[cat >>confdefs.h <<END
458#ifdef WITHPTHREADS
459#define WITHPOSIXCLOCK /**/
460#endif
461END
462			thread_clock_ok=yes],
463			[AC_MSG_WARN([POSIX thread clock is not available.])])])
464	# Windows has GetThreadTimes().
465	$flag && test "x$with_api" = xwindows && thread_clock_ok=yes
466	AS_IF([$flag],
467		[enable_threaded=yes],
468		[AS_IF([test "x$enable_threaded" = xyes],
469			[AC_MSG_FAILURE([test for tform failed. Give --disable-threaded if you do not need to build tform])])
470		AC_MSG_NOTICE([building tform has been disabled])
471		AS_IF([test "x$enable_debug" = xyes],
472			[AC_MSG_NOTICE([building tvorm has been disabled])])
473		enable_threaded=no])])
474AC_SUBST([PTHREAD_CFLAGS])
475AC_SUBST([PTHREAD_CPPFLAGS])
476AC_SUBST([PTHREAD_LIBS])
477build_tform=$enable_threaded
478AS_IF([test "x$enable_threaded" = xyes && test "x$enable_debug" = xyes], [build_tvorm=yes], [build_tvorm=no])
479AM_CONDITIONAL([BUILD_TFORM], [test "x$build_tform" = xyes])
480AM_CONDITIONAL([BUILD_TVORM], [test "x$build_tvorm" = xyes])
481
482# AX_PROG_MPICC
483# -------------
484AC_DEFUN([AX_PROG_MPICC], [
485	AC_REQUIRE([AC_PROG_CC])
486	AC_ARG_VAR([MPICC], [C compiler with MPI support])
487	AS_IF([test "x$MPICC" != x], [
488		AC_CHECK_PROGS([MPICC], [$MPICC])
489	], [
490		AC_CHECK_PROGS([MPICC], [mpicc hcc mpxlc_r mpxlc mpcc cmpicc], $CC)
491	])
492	AC_LANG_PUSH([C])
493	save_CC=$CC
494	CC=$MPICC
495	_AX_CHECK_MPI([MPICC], [C])
496	CC=$save_CC
497	AC_LANG_POP([C])
498])
499
500# AX_PROG_MPICXX
501# --------------
502AC_DEFUN([AX_PROG_MPICXX], [
503	AC_REQUIRE([AC_PROG_CXX])
504	AC_ARG_VAR([MPICXX], [C++ compiler with MPI support])
505	AS_IF([test "x$MPICXX" != x], [
506		AC_CHECK_PROGS([MPICXX], [$MPICXX])
507	], [
508		AC_CHECK_PROGS([MPICXX], [mpic++ mpicxx mpiCC hcp mpxlC_r mpxlC mpCC cmpic++], $CXX)
509	])
510	AC_LANG_PUSH([C++])
511	save_CXX=$CXX
512	CXX=$MPICXX
513	_AX_CHECK_MPI([MPICXX], [CXX])
514	CXX=$save_CXX
515	AC_LANG_POP([C++])
516])
517
518# _AX_CHECK_MPI(compiler, output-var-prefix)
519# ------------------------------------------
520AC_DEFUN([_AX_CHECK_MPI], [
521	# Check whether MPI works or not.
522	AC_MSG_CHECKING([whether MPI works with $$1])
523	AC_LINK_IFELSE([AC_LANG_SOURCE([_AX_CHECK_MPI_SOURCE])], [
524		AC_MSG_RESULT([yes])
525		# Find a flag for showing the compile and link lines.
526		ax_ok=false
527		for ax_show in -show -showme -compile-info; do
528			AC_MSG_CHECKING([whether $$1 accepts $ax_show])
529			ax_mpi_cmdline=`$$1 $ax_show 2>/dev/null`
530			AS_IF([test $? -eq 0], [
531				AC_MSG_RESULT([yes])
532				ax_ok=:
533				break
534			], [
535				AC_MSG_RESULT([no])
536			])
537		done
538		AS_IF([$ax_ok], [], [AC_MSG_WARN([Cannot extract compiler and linker flags from $$1])])
539		# Extract the compile and link flags.
540		ax_mpi_cflags=
541		ax_mpi_cppflags=
542		ax_mpi_ldflags=
543		ax_mpi_libs=
544		ax_first=:
545		for ax_opt in $ax_mpi_cmdline; do
546			case $ax_opt in
547				-I*|-D*)
548					ax_mpi_cppflags="$ax_mpi_cppflags $ax_opt"
549					;;
550				-L*|-Wl,*)
551					ax_mpi_ldflags="$ax_mpi_ldflags $ax_opt"
552					;;
553				-l*)
554					ax_mpi_libs="$ax_mpi_libs $ax_opt"
555					;;
556				*)
557					$ax_first || ax_mpi_cflags="$ax_mpi_cflags $ax_opt"
558					;;
559			esac
560			ax_first=false
561		done
562		MPI_$2FLAGS=`  echo "$ax_mpi_cflags"   | sed 's/^ *//;s/ *$//;s/   */ /g'`
563		MPI_$2PPFLAGS=`echo "$ax_mpi_cppflags" | sed 's/^ *//;s/ *$//;s/   */ /g'`
564		MPI_$2LDFLAGS=`echo "$ax_mpi_ldflags"  | sed 's/^ *//;s/ *$//;s/   */ /g'`
565		MPI_$2LIBS=`   echo "$ax_mpi_libs"     | sed 's/^ *//;s/ *$//;s/   */ /g'`
566	], [
567		AC_MSG_RESULT([no])
568		$1=
569		MPI_$2FLAGS=
570		MPI_$2LDFLAGS=
571		MPI_$2LIBS=
572	])
573])
574
575AC_DEFUN([_AX_CHECK_MPI_SOURCE], [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
576
577m4_define([_AX_CHECK_MPI_SOURCE(C)],
578[#include <mpi.h>
579int main(int argc, char **argv) {
580	int rank, size;
581	MPI_Init(&argc, &argv);
582	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
583	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
584	MPI_Finalize();
585	return 0;
586}])
587
588m4_copy([_AX_CHECK_MPI_SOURCE(C)], [_AX_CHECK_MPI_SOURCE(C++)])
589
590# Check for MPI version
591AS_IF([test "x$enable_parform" != xno],
592	[flag=:
593	AS_IF([$flag], [AX_PROG_MPICC
594		AS_IF([test "x$MPICC" = x], [flag=false])])
595	AS_IF([$flag], [AX_PROG_MPICXX
596		AS_IF([test "x$MPICXX" = x], [flag=false])])
597	AS_IF([$flag],
598		[enable_parform=yes
599		AC_SUBST([MPI_CFLAGS])
600		AC_SUBST([MPI_CXXFLAGS])
601		AC_SUBST([MPI_CPPFLAGS])],
602		[AS_IF([test "x$enable_parform" = xyes],
603			[AC_MSG_FAILURE([test for parform failed. Give --disable-parform if you do not need to build parform])])
604		AC_MSG_NOTICE([building parform has been disabled])
605		AS_IF([test "x$enable_debug" = xyes],
606			[AC_MSG_NOTICE([building parvorm has been disabled])])
607		enable_parform=no])])
608build_parform=$enable_parform
609AS_IF([test "x$enable_parform" = xyes && test "x$enable_debug" = xyes], [build_parvorm=yes], [build_parvorm=no])
610AM_CONDITIONAL([BUILD_PARFORM], [test "x$build_parform" = xyes])
611AM_CONDITIONAL([BUILD_PARVORM], [test "x$build_parvorm" = xyes])
612
613
614# Check for wall-clock time
615ok=no
616AS_IF([test $ok != yes],
617	[AC_SEARCH_LIBS([clock_gettime], [rt],
618		[AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define to 1 if you have clock_gettime.])
619		ok=yes])])
620AS_IF([test $ok != yes],
621	# TODO: gettimeofday is also deprecated.
622	[AC_SEARCH_LIBS([gettimeofday], [],
623		[AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define to 1 if you have gettimeofday.])
624		ok=yes])])
625AS_IF([test $ok != yes],
626	# Fallback: ftime. Available also on Windows. Some BSDs require -lcompat.
627	[AC_SEARCH_LIBS([ftime], [compat],
628		[AC_DEFINE([HAVE_FTIME], [1], [Define to 1 if you have ftime.])
629		ok=yes])])
630AS_IF([test $ok != yes],
631[AC_MSG_FAILURE([Wall-clock time not available])])
632
633
634# Check for static linking
635STATIC_LDFLAGS=
636MPI_STATIC_LDFLAGS=
637AC_ARG_ENABLE([static-link],
638	[AS_HELP_STRING([--enable-static-link],
639		[link with static libraries (release versions) @<:@default=no@:>@])],
640	[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_static_link=yes])],
641	[enable_static_link=no])
642AS_IF([test "x$enable_static_link" != xno],
643	[flag=:
644	if test "x$vendor" = xgnu; then
645		static_list='-static -static-libgcc,-static-libstdc++ -static-libgcc'
646	elif test "x$vendor" = xintel; then
647		static_list='-static -static-libgcc,-static-intel -static-intel -static-libgcc'
648	else
649		static_list='-static -static-libgcc'
650	fi
651	for a in $static_list; do
652		a=`echo $a | sed 's/,/ /g'`
653		AC_MSG_CHECKING([for static linking with $CXX $a])
654		AC_LANG_PUSH([C++])
655		save_CFLAGS=$CFLAGS
656		save_LDFLAGS=$LDFLAGS
657		save_LIBS=$LIBS
658		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
659		LDFLAGS="$LDFLAGS $a"
660		LIBS="$PTHREAD_LIBS $LIBS"
661		AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
662			[AC_MSG_RESULT([yes]); STATIC_LDFLAGS=$a],
663			[AC_MSG_RESULT([no]); flag=false])
664		CFLAGS=$save_CFLAGS
665		LDFLAGS=$save_LDFLAGS
666		LIBS=$save_LIBS
667		AC_LANG_POP([C++])
668		test "x$STATIC_LDFLAGS" != x && break
669	done
670	AS_IF([test "x$enable_parform" = xyes],
671	[for a in $static_list; do
672		a=`echo $a | sed 's/,/ /g'`
673		AC_MSG_CHECKING([for static linking with $MPICXX $a])
674		AC_LANG_PUSH([C++])
675		save_CXX=$CXX
676		save_LDFLAGS=$LDFLAGS
677		CXX=$MPICXX
678		LDFLAGS="$LDFLAGS $a"
679		AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
680			[AC_MSG_RESULT([yes]); MPI_STATIC_LDFLAGS=$a],
681			[AC_MSG_RESULT([no]); flag=false])
682		CXX=$save_CXX
683		LDFLAGS=$save_LDFLAGS
684		AC_LANG_POP([C++])
685		test "x$MPI_STATIC_LDFLAGS" != x && break
686	done])
687	AS_IF([$flag],
688		[enable_static_link=yes],
689		[AS_IF([test "x$enable_static_link" = xyes],
690			[AC_MSG_FAILURE([test for static linking failed. Give --disable-static-link if you want to build without static libraries.])])
691		AS_IF([test "x$STATIC_LDFLAGS" = x && test "x$MPI_STATIC_LDFLAGS" = x],
692			[AC_MSG_NOTICE([static linking has been disabled])],
693			[AC_MSG_NOTICE([static linking has been partially disabled])])
694		enable_static_link=no])])
695AC_SUBST([STATIC_LDFLAGS])
696AC_SUBST([MPI_STATIC_LDFLAGS])
697
698# Check for native/universal build
699AC_ARG_ENABLE([native],
700	[AS_HELP_STRING([--enable-native],
701		[tune for the compiling machine (release versions) @<:@default=yes@:>@])],
702	[AS_IF([test "x$enableval" = xno || test "x$cross_compiling" = xyes],
703		[enable_native=no], [enable_native=yes])],
704	[enable_native=yes])
705
706# Check for profiling option
707AC_ARG_ENABLE([profile],
708	[AS_HELP_STRING([--enable-profile@<:@=PROFILER@:>@],
709		[build with profiling (release versions) @<:@default=no@:>@ PROFILER: gprof (default) or gperftools])],
710	[AS_IF([test "x$enableval" = xyes],
711		[enable_profile=gprof],
712		[AS_IF([test "x$enableval" = xgprof || test "x$enableval" = xgperftools],
713			[enable_profile=$enableval],
714			[enable_profile=no])])],
715	[enable_profile=no])
716
717# Check for coverage option
718AC_ARG_ENABLE([coverage],
719	[AS_HELP_STRING([--enable-coverage],
720		[generate coverage files (debugging versions) @<:@default=no@:>@])],
721	[AS_IF([test "x$enableval" = xyes && test "x$enable_debug" = xyes],
722		[enable_coverage=yes], [enable_coverage=no])],
723	[enable_coverage=no])
724
725# Check for sanitizers
726AC_ARG_ENABLE([sanitize],
727	[AS_HELP_STRING([--enable-sanitize@<:@=CHECKS@:>@],
728		[enable sanitizers (debugging versions) @<:@default=no@:>@ Optionally CHECKS will be passed via the compiler sanitizer option])],
729	[AS_IF([test "x$enable_debug" != xyes],
730		[enable_sanitize=no])],
731	[enable_sanitize=no])
732
733# Optimization/debugging flags
734AC_ARG_VAR([COMPILEFLAGS], [Compiler flags for release versions])
735AC_ARG_VAR([LINKFLAGS], [Linker flags for release versions])
736AC_ARG_VAR([DEBUGCOMPILEFLAGS], [Compiler flags for debugging versions])
737AC_ARG_VAR([DEBUGLINKFLAGS], [Linker flags for debugging versions])
738TOOL_LIBS=
739DEBUGTOOL_LIBS=
740
741my_test_COMPILEFLAGS=${COMPILEFLAGS+set}
742if test "$my_test_COMPILEFLAGS" != set; then
743	if test "x$vendor" = xgnu; then
744		# We don't use -pedantic option because of horrible warnings.
745		COMPILEFLAGS="-Wall -Wextra -Wpadded"
746		if test "x$enable_profile" != xgprof; then
747			# -pg conflicts with -fomit-frame-pointer.
748			COMPILEFLAGS="$COMPILEFLAGS -fomit-frame-pointer"
749		fi
750		if test "x$enable_native" = xyes; then
751			# Check for -march=native.
752			AC_MSG_CHECKING([whether compiler accepts -march=native])
753			ok=no
754			save_CFLAGS=$CFLAGS
755			CFLAGS="$CFLAGS -march=native"
756			AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
757			CFLAGS=$save_CFLAGS
758			AC_MSG_RESULT($ok)
759			if test "x$ok" = xyes; then
760				COMPILEFLAGS="$COMPILEFLAGS -march=native"
761			else
762				if test "x$print_data_model" = xILP32; then
763					if test "x$print_cpu" = xPentium; then
764						# NOTE: In a strict sense, i686 must be used for Pentium Pro or later.
765						COMPILEFLAGS="$COMPILEFLAGS -march=i686"
766					elif test "x$print_cpu" = xOpteron; then
767						COMPILEFLAGS="$COMPILEFLAGS -march=opteron"
768					fi
769				fi
770			fi
771		fi
772		# Profiling option.
773		if test "x$enable_profile" = xgprof; then
774			COMPILEFLAGS="$COMPILEFLAGS -g -pg"
775		elif test "x$enable_profile" = xgperftools; then
776			COMPILEFLAGS="$COMPILEFLAGS -g"
777			TOOL_LIBS="$TOOL_LIBS -lprofiler"
778		fi
779	elif test "x$vendor" = xintel; then
780		# NOTE: -fast option includes -static and may cause an error in linking.
781		COMPILEFLAGS="-Wall -ipo -O3 -no-prec-div"
782		if test "x$enable_native" = xyes; then
783			COMPILEFLAGS="$COMPILEFLAGS -xHost"
784		fi
785		if test "x$enable_profile" != xno; then
786			enable_profile=unavailable
787		fi
788	else
789		COMPILEFLAGS=-O2
790		if test "x$enable_profile" != xno; then
791			enable_profile=unavailable
792		fi
793	fi
794fi
795my_test_LINKFLAGS=${LINKFLAGS+set}
796if test "$my_test_LINKFLAGS" != set; then
797	if test "x$vendor" = xgnu && test "x$print_os" = xOSX; then
798		# On OS X Mavericks, -s option has a funny effect: though the linker
799		# warns the option is obsolete and being ignored, it causes an internal
800		# error "atom not found in symbolIndex...".
801		LINKFLAGS=
802	elif test "x$enable_profile" != xno && test "x$enable_profile" != xunavailable; then
803		# Profilers needs symbol tables.
804		LINKFLAGS=
805	else
806		LINKFLAGS=-s
807	fi
808fi
809my_test_DEBUGCOMPILEFLAGS=${DEBUGCOMPILEFLAGS+set}
810if test "$my_test_DEBUGCOMPILEFLAGS" != set && test "x$enable_debug" = xyes; then
811	if test "x$vendor" = xgnu; then
812		DEBUGCOMPILEFLAGS='-g3 -Wall -Wextra'
813		if test "x$enable_sanitize" = xno; then
814			# UBSan puts many paddings (at least in gcc 5.3).
815			DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -Wpadded"
816		fi
817		# Check for -Og.
818		AC_MSG_CHECKING([whether compiler accepts -Og])
819		ok=no
820		save_CFLAGS=$CFLAGS
821		CFLAGS="$CFLAGS -Og"
822		AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
823		CFLAGS=$save_CFLAGS
824		AC_MSG_RESULT($ok)
825		if test "x$ok" = xyes; then
826			DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -Og"
827		else
828			DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -O0"
829		fi
830		# Coverage option.
831		if test "x$enable_coverage" = xyes; then
832			DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -coverage"
833		fi
834		# Sanitizer option.
835		if test "x$enable_sanitize" = xyes; then
836			enable_sanitize=
837			for san in address undefined; do
838				if test "x$enable_sanitize" = x; then
839					tmp_sanitize=$san
840				else
841					tmp_sanitize=$enable_sanitize,$san
842				fi
843				AC_MSG_CHECKING([whether compiler accepts -fsanitize=$tmp_sanitize])
844				ok=no
845				save_CFLAGS=$CFLAGS
846				CFLAGS="$CFLAGS -fsanitize=$tmp_sanitize"
847				AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
848				CFLAGS=$save_CFLAGS
849				AC_MSG_RESULT($ok)
850				if test "x$ok" = xyes; then
851					enable_sanitize=$tmp_sanitize
852				fi
853			done
854			if test "x$enable_sanitize" = x; then
855				enable_sanitize=failed
856			fi
857		elif test "x$enable_sanitize" != xno; then
858			AC_MSG_CHECKING([whether compiler accepts -fsanitize=$enable_sanitize])
859			ok=no
860			save_CFLAGS=$CFLAGS
861			CFLAGS="$CFLAGS -fsanitize=$enable_sanitize"
862			AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
863			CFLAGS=$save_CFLAGS
864			AC_MSG_RESULT($ok)
865			if test "x$ok" != xyes; then
866				enable_sanitize=failed
867			fi
868		fi
869		if test "x$enable_sanitize" = xfailed; then
870			AC_MSG_FAILURE([test for sanitizer failed. Give --disable-sanitize if you want to compile without sanitizer])
871		fi
872		if test "x$enable_sanitize" != xno; then
873			DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -fsanitize=$enable_sanitize"
874		fi
875	elif test "x$vendor" = xintel; then
876		DEBUGCOMPILEFLAGS='-g3 -Wall -O0'
877		if test "x$enable_coverage" != xno; then
878			enable_coverage=unavailable
879		fi
880		if test "x$enable_sanitize" != xno; then
881			enable_sanitize=unavailable
882		fi
883	else
884		DEBUGCOMPILEFLAGS=-g
885		if test "x$enable_coverage" != xno; then
886			enable_coverage=unavailable
887		fi
888		if test "x$enable_sanitize" != xno; then
889			enable_sanitize=unavailable
890		fi
891	fi
892fi
893my_test_DEBUGLINKFLAGS=${DEBUGLINKFLAGS+set}
894if test "$my_test_DEBUGLINKFLAGS" != set && test "x$enable_debug" = xyes; then
895	DEBUGLINKFLAGS=
896	if test "x$vendor" = xgnu; then
897		# Coverage option.
898		if test "x$enable_coverage" = xyes; then
899			DEBUGLINKFLAGS="$DEBUGLINKFLAGS -coverage"
900		fi
901		# Sanitizer option.
902		if test "x$enable_sanitize" != xno; then
903			# Workaround for https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1650186
904			ok=no
905			save_CFLAGS=$CFLAGS
906			save_LDFLAGS=$LDFLAGS
907			CFLAGS="$CFLAGS -fsanitize=$enable_sanitize"
908			AC_LINK_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
909			if test "x$ok" != xyes; then
910				LDFLAGS="$LDFLAGS -fuse-ld=gold"
911				AC_LINK_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
912				if test "x$ok" = xyes; then
913					DEBUGLINKFLAGS="$DEBUGLINKFLAGS -fuse-ld=gold"
914				fi
915			fi
916			CFLAGS=$save_CFLAGS
917			LDFLAGS=$save_LDFLAGS
918		fi
919	fi
920fi
921
922AC_SUBST([TOOL_LIBS])
923AC_SUBST([DEBUGTOOL_LIBS])
924
925# Check for doxygen
926AC_PATH_PROG(DOXYGEN, doxygen, "")
927AM_CONDITIONAL(CONFIG_DOXYGEN, [test "x$DOXYGEN" != x])
928
929# Check for LaTeX programs
930AC_PATH_PROG(LATEX, latex, "")
931AC_PATH_PROG(PDFLATEX, pdflatex, "")
932AC_PATH_PROG(DVIPS, dvips, "")
933AC_PATH_PROG(MAKEINDEX, makeindex, "")
934AC_PATH_PROG(HTLATEX, htlatex, "")
935AC_PATH_PROG(LATEX2HTML, latex2html, "")
936AM_CONDITIONAL(CONFIG_TEX, [test "x$LATEX" != x])
937AM_CONDITIONAL(CONFIG_PS, [test "x$LATEX" != x && test "x$DVIPS" != x])
938AM_CONDITIONAL(CONFIG_PDF, [test "x$PDFLATEX" != x])
939AM_CONDITIONAL(CONFIG_MAKEINDEX, [test "x$MAKEINDEX" != x])
940AM_CONDITIONAL(CONFIG_HTLATEX, [test "x$HTLATEX" != x])
941AM_CONDITIONAL(CONFIG_LATEX2HTML, [test "x$LATEX2HTML" != x])
942
943# Check for Ruby >= 1.8 and test/unit.
944AC_PATH_PROG(RUBY, ruby, "")
945ok=yes
946test "x$RUBY" = x && ok=no
947if test "x$ok" = xyes; then
948	AC_MSG_CHECKING([whether ruby >= 1.8])
949	$RUBY -e 'exit(1) if RUBY_VERSION < "1.8.0"' >/dev/null 2>&1 || ok=no
950	AC_MSG_RESULT([$ok])
951fi
952if test "x$ok" = xyes; then
953	AC_MSG_CHECKING([for ruby test/unit])
954	{ cat >conftest.rb <<EOF && $RUBY conftest.rb; } >/dev/null 2>&1 || ok=no
955require 'test/unit'
956EOF
957	AC_MSG_RESULT([$ok])
958fi
959with_ruby_test=$ok
960AM_CONDITIONAL(CONFIG_RUBY, [test "x$with_ruby_test" = xyes])
961
962AC_CONFIG_FILES([
963	Makefile
964	sources/Makefile
965	doc/Makefile
966	doc/manual/Makefile
967	doc/manual/manual.tex
968	doc/devref/Makefile
969	doc/devref/devref.tex
970	doc/doxygen/Makefile
971	doc/doxygen/DoxyfileHTML
972	doc/doxygen/DoxyfileLATEX
973	doc/doxygen/DoxyfilePDFLATEX
974	check/Makefile
975])
976
977AC_OUTPUT
978
979# Print configuration
980
981echo
982echo "##################### CONFIGURATION #####################"
983echo
984outputdir=$(eval "echo $bindir")
985outputdir=$(eval "echo $outputdir")
986manoutputdir=$(eval "echo $mandir")
987manoutputdir=$(eval "echo $manoutputdir")
988echo "FORM $VERSION"
989echo
990echo "Compiling for: $print_cpu $print_os ($print_data_model $print_api)"
991echo
992echo "Optionally linked libraries:"
993atleastone=no
994if test "x$with_gmp" = xyes; then
995	echo "    gmp"
996	atleastone=yes
997fi
998if test "x$with_zlib" = xyes; then
999	echo "    zlib"
1000	atleastone=yes
1001fi
1002if test $atleastone = no; then
1003	echo "    <NONE>"
1004fi
1005echo
1006echo "The following executables can be compiled:"
1007atleastone=no
1008if test "x$build_form" = xyes; then
1009	opts=
1010	if test "x$enable_native" = xyes; then
1011		if test "x$opts" != x; then
1012			opts="${opts}, "
1013		fi
1014		opts="${opts}native"
1015	fi
1016	if test "x$STATIC_LDFLAGS" != x; then
1017		if test "x$opts" != x; then
1018			opts="${opts}, "
1019		fi
1020		opts="${opts}statically linked"
1021	fi
1022	if test "x$enable_profile" = xgprof; then
1023		if test "x$opts" != x; then
1024			opts="${opts}, "
1025		fi
1026		opts="${opts}gprof"
1027	fi
1028	if test "x$enable_profile" = xgperftools; then
1029		if test "x$opts" != x; then
1030			opts="${opts}, "
1031		fi
1032		opts="${opts}gperftools"
1033	fi
1034	if test "x$opts" != x; then
1035		opts=" (${opts})"
1036	fi
1037	echo "    form       scalar version$opts"
1038	atleastone=yes
1039fi
1040if test "x$build_vorm" = xyes; then
1041	opts=
1042	if test "x$enable_coverage" = xyes; then
1043		if test "x$opts" != x; then
1044			opts="${opts}, "
1045		fi
1046		opts="${opts}gcov"
1047	fi
1048	if test "x$enable_sanitize" != xno; then
1049		if test "x$opts" != x; then
1050			opts="${opts}, "
1051		fi
1052		opts="${opts}sanitize=$enable_sanitize"
1053	fi
1054	if test "x$opts" != x; then
1055		opts=" (${opts})"
1056	fi
1057	echo "    vorm       debugging version$opts"
1058	atleastone=yes
1059fi
1060if test "x$build_tform" = xyes; then
1061	opts=
1062	if test "x$enable_native" = xyes; then
1063		if test "x$opts" != x; then
1064			opts="${opts}, "
1065		fi
1066		opts="${opts}native"
1067	fi
1068	if test "x$STATIC_LDFLAGS" != x; then
1069		if test "x$opts" != x; then
1070			opts="${opts}, "
1071		fi
1072		opts="${opts}statically linked"
1073	fi
1074	if test "x$enable_profile" = xgprof; then
1075		if test "x$opts" != x; then
1076			opts="${opts}, "
1077		fi
1078		opts="${opts}gprof"
1079	fi
1080	if test "x$enable_profile" = xgperftools; then
1081		if test "x$opts" != x; then
1082			opts="${opts}, "
1083		fi
1084		opts="${opts}gperftools"
1085	fi
1086	if test "x$opts" != x; then
1087		opts=" (${opts})"
1088	fi
1089	echo "    tform      multi-threaded version$opts"
1090	atleastone=yes
1091fi
1092if test "x$build_tvorm" = xyes; then
1093	opts=
1094	if test "x$enable_coverage" = xyes; then
1095		if test "x$opts" != x; then
1096			opts="${opts}, "
1097		fi
1098		opts="${opts}gcov"
1099	fi
1100	if test "x$enable_sanitize" != xno; then
1101		if test "x$opts" != x; then
1102			opts="${opts}, "
1103		fi
1104		opts="${opts}sanitize=$enable_sanitize"
1105	fi
1106	if test "x$opts" != x; then
1107		opts=" (${opts})"
1108	fi
1109	echo "    tvorm      multi-threaded debugging version$opts"
1110	atleastone=yes
1111fi
1112if test "x$build_parform" = xyes; then
1113	opts=
1114	if test "x$enable_native" = xyes; then
1115		if test "x$opts" != x; then
1116			opts="${opts}, "
1117		fi
1118		opts="${opts}native"
1119	fi
1120	if test "x$MPI_STATIC_LDFLAGS" != x; then
1121		if test "x$opts" != x; then
1122			opts="${opts}, "
1123		fi
1124		opts="${opts}statically linked"
1125	fi
1126	if test "x$enable_profile" = xgprof; then
1127		if test "x$opts" != x; then
1128			opts="${opts}, "
1129		fi
1130		opts="${opts}gprof"
1131	fi
1132	if test "x$enable_profile" = xgperftools; then
1133		if test "x$opts" != x; then
1134			opts="${opts}, "
1135		fi
1136		opts="${opts}gperftools"
1137	fi
1138	if test "x$opts" != x; then
1139		opts=" (${opts})"
1140	fi
1141	echo "    parform    parallel version using MPI$opts"
1142	atleastone=yes
1143fi
1144if test "x$build_parvorm" = xyes; then
1145	opts=
1146	if test "x$enable_coverage" = xyes; then
1147		if test "x$opts" != x; then
1148			opts="${opts}, "
1149		fi
1150		opts="${opts}gcov"
1151	fi
1152	if test "x$enable_sanitize" != xno; then
1153		if test "x$opts" != x; then
1154			opts="${opts}, "
1155		fi
1156		opts="${opts}sanitize=$enable_sanitize"
1157	fi
1158	if test "x$opts" != x; then
1159		opts=" (${opts})"
1160	fi
1161	echo "    parvorm    parallel debugging version using MPI$opts"
1162	atleastone=yes
1163fi
1164if test $atleastone = no; then
1165	echo "    <NONE>"
1166fi
1167if test $ac_cv_sizeof_off_t -le 4; then
1168	echo
1169	echo "***CAUTION***  Large files more than 2 GB will be"
1170	echo "not supported."
1171fi
1172if test "x$thread_clock_ok" = xno; then
1173	s="none"
1174	if test "x$build_tform" = xyes && test "x$build_tvorm" = xyes; then
1175		s="tform and tvorm"
1176	elif test "x$build_tform" = xyes; then
1177		s="tform"
1178	elif test "x$build_tvorm" = xyes; then
1179		s="tvorm"
1180	fi
1181	if test "x$s" != xnone; then
1182		echo
1183		echo "***CAUTION***  $s may have clock"
1184		echo "problems which make that each worker registers"
1185		echo "the complete time used by all workers and the master."
1186	fi
1187fi
1188echo
1189echo "Type 'make <executable name>' in the source directory to"
1190echo "build a specific version. Type 'make' to build all."
1191echo
1192echo "Type 'make install' to install the executables in"
1193echo "    $outputdir"
1194echo "and the man page in"
1195echo "    $manoutputdir"
1196echo
1197if test "x$with_ruby_test" = xyes; then
1198	echo "Type 'make check' to run automatic tests."
1199else
1200	echo "Automatic tests are not available."
1201fi
1202echo
1203echo "Available documentation:"
1204atleastone=no
1205if test "x$DOXYGEN" != x; then
1206	atleastone=yes
1207	str='    doxygen    ( html '
1208	if test "x$MAKEINDEX" != x; then
1209		if test "x$LATEX" != x; then
1210			str=$str'dvi '
1211			if test "x$DVIPS" != x; then
1212				str=$str'ps '
1213			fi
1214		fi
1215		if test "x$PDFLATEX" != x; then
1216			str=$str'pdf '
1217		fi
1218	fi
1219	str=$str')'
1220	echo "$str"
1221fi
1222if test "x$LATEX" != x || test "x$PDFLATEX" != x; then
1223	atleastone=yes
1224	str='    manual     ( '
1225	if test "x$HTLATEX" != x; then
1226		str=$str'html '
1227	fi
1228	if test "x$LATEX" != x; then
1229		str=$str'dvi '
1230		if test "x$DVIPS" != x; then
1231			str=$str'ps '
1232		fi
1233	fi
1234	if test "x$PDFLATEX" != x; then
1235			str=$str'pdf '
1236	fi
1237	str=$str')'
1238	echo "$str"
1239fi
1240if test $atleastone = no; then
1241	echo "    <NONE>"
1242else
1243	echo
1244	echo "Type 'make <format>' in the directories doc/manual or"
1245	echo "doc/doxygen to generate the respective documentation with"
1246	echo "the specified format."
1247fi
1248echo
1249echo "#########################################################"
1250echo
1251