File: configure.in

package info (click to toggle)
bar 1.11.0%2Bdebian-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 964 kB
  • sloc: ansic: 4,378; sh: 3,334; makefile: 139
file content (817 lines) | stat: -rw-r--r-- 18,901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
AC_INIT(bar.c)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(bar,1.11.0)
AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_AWK

AC_HEADER_STDC
AC_CHECK_HEADERS([ \
	assert.h \
	ctype.h \
	errno.h \
	fcntl.h \
	malloc.h \
	stdarg.h \
	stdio.h \
	stdlib.h \
	string.h \
	strings.h \
	sys/ioctl.h \
	sys/select.h \
	sys/stat.h \
	sys/time.h \
	sys/uio.h \
	unistd.h \
	signal.h \
	termios.h \
	])

AC_CHECK_FUNCS([ \
	posix_memalign \
	select \
	strerror \
	sysconf \
	sprintf \
	])
AC_FUNC_MALLOC
AC_HEADER_TIME

dnl
dnl The following tests for Large File support reverse-engineered from 
dnl the GNU core utilities: ftp://alpha.gnu.org/gnu/coreutils/
dnl
AC_MSG_CHECKING([if filesystem supports Large Files natively])
if test "${ac_cv_c_native_large_file_support+set}" = set; then
	AC_MSG_RESULT([(cached)] $ac_cv_c_native_large_file_support)
else
	AC_TRY_COMPILE(
		[
#include <sys/types.h>
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
		]
,
		[
  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
		       && LARGE_OFF_T % 2147483647 == 1)
		      ? 1 : -1];
		]
,
		ac_cv_c_native_large_file_support=yes
,
		ac_cv_c_native_large_file_support=no
	)
	AC_MSG_RESULT($ac_cv_c_native_large_file_support)
fi

if test $ac_cv_c_native_large_file_support = no; then
	AC_MSG_CHECKING([if _FILE_OFFSET_BITS needed for Large Files])
	AC_TRY_COMPILE(
		[
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
		]
		,
		[
  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
		       && LARGE_OFF_T % 2147483647 == 1)
		      ? 1 : -1];
		]
		,
		ac_cv_c_need_file_offset_bits=yes
		AC_DEFINE(_FILE_OFFSET_BITS,64,[Define if OS needs it for Large Files])
		AC_MSG_RESULT([yes])
		,
		ac_cv_c_need_file_offset_bits=no
		AC_MSG_RESULT([no])
	)
fi

if test $ac_cv_c_native_large_file_support = no; then
	AC_MSG_CHECKING([if _LARGE_FILES needed for Large Files])
	if test $ac_cv_c_need_file_offset_bits = yes; then
		ac_cv_c_need_large_files=no
		AC_MSG_RESULT([no])
	else
		AC_TRY_COMPILE(
			[
#define _LARGE_FILES 1
#include <sys/types.h>
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
			]
			,
			[
  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
		       && LARGE_OFF_T % 2147483647 == 1)
		      ? 1 : -1];
			]
			,
			ac_cv_c_need_large_files=yes
			AC_DEFINE(_LARGE_FILES,1,[Define if OS needs it for Large Files])
			AC_MSG_RESULT([yes])
			,
			ac_cv_c_need_large_files=no
			AC_MSG_RESULT([no])
		)
	fi
fi

dnl
dnl Check to see if struct iovec is available
dnl
AC_MSG_CHECKING([for vectored I/O support])
if test "${ac_cv_have_struct_iovec+set}" = set; then
	AC_MSG_RESULT([(cached)] $ac_cv_have_struct_iovec)
else
	AC_TRY_COMPILE(
		[
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
		],
		[
	struct iovec vec[2];

	vec[0].iov_base = 0;
	vec[0].iov_len = 0;
		],
		[ac_cv_have_struct_iovec=yes]
		AC_DEFINE(HAVE_STRUCT_IOVEC,1,[Define if struct iovec found])
		,
		[ac_cv_have_struct_iovec=no]
	)
	AC_MSG_RESULT($ac_cv_have_struct_iovec)
fi

AC_CHECK_SIZEOF(unsigned char)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_DECLS(_SC_PAGE_SIZE)
AC_CHECK_DECLS(_SC_PAGESIZE)

ac_cv_default_sw_minus_one=0
case "$target" in
*-pc-cygwin) ac_cv_default_sw_minus_one=1 ;;
esac
AC_ARG_ENABLE(
	sw-1,
	AC_HELP_STRING(
		[--enable-sw-1],
		[Assume screen width - 1]
		),
	[ac_cv_default_sw_minus_one=1],
	[ac_cv_default_sw_minus_one=0]
	)
AC_ARG_ENABLE(
	sw-0,
	AC_HELP_STRING(
		[--enable-sw-0],
		[Assume full screen width]
		),
	[ac_cv_default_sw_minus_one=0],
	)
AC_ARG_ENABLE(
	sh-1,
	AC_HELP_STRING(
		[--enable-sh-1],
		[Assume screen height - 1]
		),
	[ac_cv_default_sh_minus_one=1],
	[ac_cv_default_sh_minus_one=0]
	)
AC_ARG_ENABLE(
	sh-0,
	AC_HELP_STRING(
		[--enable-sh-0],
		[Assume full screen height]
		),
	[ac_cv_default_sh_minus_one=0],
	)
AC_CACHE_CHECK(
	[for default screen width adjustment],
	[ac_cv_default_sw_minus_one],
	[ac_cv_default_sw_minus_one=0]
	)
AC_CACHE_CHECK(
	[for default screen height adjustment],
	[ac_cv_default_sh_minus_one],
	[ac_cv_default_sh_minus_one=0]
	)
AC_DEFINE_UNQUOTED(
	DEFAULT_SW_MINUS_ONE,
	$ac_cv_default_sw_minus_one,
	[Use a screen width adjustment of -1 by default]
	)
AC_SUBST(DEFAULT_SW_MINUS_ONE)
AC_DEFINE_UNQUOTED(
	DEFAULT_SH_MINUS_ONE,
	$ac_cv_default_sh_minus_one,
	[Use a screen height adjustment of -1 by default]
	)
AC_SUBST(DEFAULT_SH_MINUS_ONE)

AC_ARG_ENABLE(
	[display-twiddle],
	AC_HELP_STRING(
		[--enable-display-twiddle],
		[Enable twiddle display by default]
		),
	[ac_cv_default_display_twiddle=1],
	[ac_cv_default_display_twiddle=0]
	)
AC_CACHE_CHECK(
	[if twiddle display should be enabled by default],
	[ac_cv_default_display_twiddle],
	[ac_cv_default_display_twiddle=0]
	)
AC_DEFINE_UNQUOTED(
	DEFAULT_DISPLAY_TWIDDLE,
	$ac_cv_default_display_twiddle,
	[Default twiddle display setting]
	)
AC_SUBST(DEFAULT_DISPLAY_TWIDDLE)

AC_ARG_WITH(
	[buffer-size],
	AC_HELP_STRING([--with-buffer-size=SIZE],
		[Default buffer size = SIZE bytes (default: 52488 (or 512KB))]
		),
	[ac_cv_default_buffer_size=$withval],
	[ac_cv_default_buffer_size=52488]
	)
AC_CACHE_CHECK(
	[default buffer size],
	[ac_cv_default_buffer_size],
	[ac_cv_default_buffer_size=52488]
	)
AC_DEFINE_UNQUOTED(
	DEFAULT_BUFFER_SIZE,
	$ac_cv_default_buffer_size,
	[Use this default buffer size]
	)
AC_SUBST(DEFAULT_BUFFER_SIZE)

if test "${ac_cv_func_sysconf}" = "yes"; then
	AC_MSG_CHECKING([sysconf usability])
	if test "${ac_cv_sysconf_works+set}" = set; then
		AC_MSG_RESULT([(cached)] $ac_cv_sysconf_works)
	else
		AC_TRY_RUN(
			[
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>

#ifdef HAVE_SYSCONF
#	if HAVE_DECL__SC_PAGE_SIZE == 1
#		define PAGESIZE _SC_PAGE_SIZE
#	else
#		if HAVE_DECL__SC_PAGESIZE == 1
#			define PAGESIZE _SC_PAGESIZE
#		endif
#	endif
#	ifndef PAGESIZE
#		error I dont know how to retrieve the size of a page using sysconf.
#		undef HAVE_SYSCONF
#	endif
#endif

int main(int argc, char *argv[])
{
	long page_size = 0;

#ifdef HAVE_SYSCONF
	page_size = sysconf(PAGESIZE);
#endif
	fprintf(stderr, "sysconf says the page size is: %ld\n", page_size);
	assert(page_size != 0);
	assert(page_size > 0);
	assert(page_size % sizeof(void *) == 0);
	return(0);
}
			]
			,
			ac_cv_sysconf_works="yes"
			,
			ac_cv_sysconf_works="no"
		)
		AC_MSG_RESULT($ac_cv_sysconf_works)
	fi
fi
if test "${ac_cv_sysconf_works}" = "yes"; then
	ac_cv_default_page_size=`cat config.log | grep '^sysconf says the page size is: ' | awk -F: '{print $2}' | sed 's, ,,g'`;
fi
AC_ARG_WITH(
	[page-size],
	AC_HELP_STRING([--with-page-size=SIZE],
		[Default page size = SIZE bytes (default: as reported by sysconf, or 8192 (or 8KB))]
		),
	[ac_cv_default_page_size=$withval],
	)
if test "${ac_cv_default_page_size+set}" != set; then
	ac_cv_default_page_size=8192
fi
AC_CACHE_CHECK(
	[default page size],
	[ac_cv_default_page_size],
	[ac_cv_default_page_size=8192]
	)
AC_DEFINE_UNQUOTED(
	DEFAULT_PAGE_SIZE,
	$ac_cv_default_page_size,
	[Use this default page size if cannot determine through sysconf]
	)
AC_SUBST(DEFAULT_PAGE_SIZE)

AC_ARG_ENABLE(
	[use-memalign],
	AC_HELP_STRING(
		[--disable-use-memalign],
		[Disable aligned memory allocation (save memory, less than 1% performance decrease) (default: enabled)]
		),
	[ac_cv_use_memalign=$enableval],
	[ac_cv_use_memalign="yes"]
	)
AC_CACHE_CHECK(
	[if aligned memory allocation is enabled],
	[ac_cv_use_memalign],
	[ac_cv_use_memalign]
	)
if test "${ac_cv_use_memalign}" = "yes"; then
	if test "${ac_cv_func_posix_memalign}" = "no"; then
		ac_cv_use_memalign="no"
	else
		AC_MSG_CHECKING([for posix_memalign usability])
		if test "${ac_cv_posix_memalign_works+set}" = set; then
			AC_MSG_RESULT([(cached)] $ac_cv_posix_memalign_works)
		else
			AC_TRY_RUN(
				[
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>

#ifdef HAVE_SYSCONF
#	if HAVE_DECL__SC_PAGE_SIZE == 1
#		define PAGESIZE _SC_PAGE_SIZE
#	else
#		if HAVE_DECL__SC_PAGESIZE == 1
#			define PAGESIZE _SC_PAGESIZE
#		endif
#	endif
#	ifndef PAGESIZE
#		warning I dont know how to retrieve the size of a page using sysconf.
#		warning Assuming page size is DEFAULT_PAGE_SIZE bytes.
#		undef HAVE_SYSCONF
#	endif
#endif

int main(int argc, char *argv[])
{
	long page_size = DEFAULT_PAGE_SIZE;
	unsigned long long buffer_size = DEFAULT_PAGE_SIZE;
	unsigned long long count = 0;
	char * ptr = 0;
	int ret_val = 0;
	int einval = EINVAL;
	int enomem = ENOMEM;

#ifdef HAVE_SYSCONF
	page_size = sysconf(PAGESIZE);
#endif
	assert(page_size > 0);
	assert(page_size % sizeof(void *) == 0);
	if (page_size > buffer_size) { buffer_size = page_size; }
	buffer_size /= sizeof(void *);
	buffer_size *= 2*sizeof(void *);
	ret_val = posix_memalign((void *)&ptr,page_size,buffer_size);
	assert(!(ret_val == einval));
	assert(!(ret_val == enomem));
	assert(ret_val == 0);
	for (count = 0; count < buffer_size; count++) {
		ptr[count] = 0;
	}
	free(ptr);
	return(0);
}
				]
,
				ac_cv_posix_memalign_works=yes
,
				ac_cv_posix_memalign_works=no
			)
			AC_MSG_RESULT($ac_cv_posix_memalign_works)
		fi

		if test "${ac_cv_posix_memalign_works}" = "no"; then
			AC_MSG_CHECKING([if posix_memalign requires _GNU_SOURCE to be defined])
			if test "${ac_cv_posix_memalign_gnu_source+set}" = set; then
				AC_MSG_RESULT([(cached)] $ac_cv_posix_memalign_gnu_source)
			else
				AC_TRY_RUN(
					[
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>

#ifdef HAVE_SYSCONF
#	if HAVE_DECL__SC_PAGE_SIZE == 1
#		define PAGESIZE _SC_PAGE_SIZE
#	else
#		if HAVE_DECL__SC_PAGESIZE == 1
#			define PAGESIZE _SC_PAGESIZE
#		endif
#	endif
#	ifndef PAGESIZE
#		warning I dont know how to retrieve the size of a page using sysconf.
#		warning Assuming page size is DEFAULT_PAGE_SIZE bytes.
#		undef HAVE_SYSCONF
#	endif
#endif

#define _GNU_SOURCE 1

int main(int argc, char *argv[])
{
	long page_size = DEFAULT_PAGE_SIZE;
	unsigned long long buffer_size = DEFAULT_PAGE_SIZE;
	unsigned long long count = 0;
	char * ptr = 0;
	int ret_val = 0;
	int einval = EINVAL;
	int enomem = ENOMEM;

#ifdef HAVE_SYSCONF
	page_size = sysconf(PAGESIZE);
#endif
	assert(page_size > 0);
	assert(page_size % sizeof(void *) == 0);
	if (page_size > buffer_size) { buffer_size = page_size; }
	buffer_size /= sizeof(void *);
	buffer_size *= 2*sizeof(void *);
	ret_val = posix_memalign((void *)&ptr,page_size,buffer_size);
	assert(!(ret_val == einval));
	assert(!(ret_val == enomem));
	assert(ret_val == 0);
	for (count = 0; count < buffer_size; count++) {
		ptr[count] = 0;
	}
	free(ptr);
	return(0);
}
					]
,
					ac_cv_posix_memalign_gnu_source=yes
					ac_cv_posix_memalign_works=yes
					AC_DEFINE(_GNU_SOURCE,1,[Define if posix_memalign needs _GNU_SOURCE])
					AC_MSG_RESULT([yes])
,
					ac_cv_posix_memalign_gnu_source=no
					AC_MSG_RESULT([no])
				)
			fi
		fi

		if test "${ac_cv_posix_memalign_works}" = "no"; then
			AC_MSG_CHECKING([if posix_memalign requires _XOPEN_SOURCE=600 to be defined])
			if test "${ac_cv_posix_memalign_xopen_source+set}" = set; then
				AC_MSG_RESULT([(cached)] $ac_cv_posix_memalign_xopen_source)
			else
				AC_TRY_RUN(
					[
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>

#ifdef HAVE_SYSCONF
#	if HAVE_DECL__SC_PAGE_SIZE == 1
#		define PAGESIZE _SC_PAGE_SIZE
#	else
#		if HAVE_DECL__SC_PAGESIZE == 1
#			define PAGESIZE _SC_PAGESIZE
#		endif
#	endif
#	ifndef PAGESIZE
#		warning I dont know how to retrieve the size of a page using sysconf.
#		warning Assuming page size is DEFAULT_PAGE_SIZE bytes.
#		undef HAVE_SYSCONF
#	endif
#endif

#define _XOPEN_SOURCE 600

int main(int argc, char *argv[])
{
	long page_size = DEFAULT_PAGE_SIZE;
	unsigned long long buffer_size = DEFAULT_PAGE_SIZE;
	unsigned long long count = 0;
	char * ptr = 0;
	int ret_val = 0;
	int einval = EINVAL;
	int enomem = ENOMEM;

#ifdef HAVE_SYSCONF
	page_size = sysconf(PAGESIZE);
#endif
	assert(page_size > 0);
	assert(page_size % sizeof(void *) == 0);
	if (page_size > buffer_size) { buffer_size = page_size; }
	buffer_size /= sizeof(void *);
	buffer_size *= 2*sizeof(void *);
	ret_val = posix_memalign((void *)&ptr,page_size,buffer_size);
	assert(!(ret_val == einval));
	assert(!(ret_val == enomem));
	assert(ret_val == 0);
	for (count = 0; count < buffer_size; count++) {
		ptr[count] = 0;
	}
	free(ptr);
	return(0);
}
					]
,
					ac_cv_posix_memalign_xopen_source=yes
					ac_cv_posix_memalign_works=yes
					AC_DEFINE(_XOPEN_SOURCE,600,[Define if posix_memalign needs _XOPEN_SOURCE >= 600])
					AC_MSG_RESULT([yes])
,
					ac_cv_posix_memalign_xopen_source=no
					AC_MSG_RESULT([no])
				)
			fi
		fi

	fi
fi
AC_CACHE_CHECK(
	[if aligned memory allocation is available],
	[ac_cv_use_memalign],
	[ac_cv_use_memalign]
	)
if test "${ac_cv_use_memalign}" = "yes"; then
	AC_MSG_CHECKING([if aligned memory allocation is usable])
	if test "${ac_cv_posix_memalign_works}" = "yes"; then
		AC_MSG_RESULT([yes])
	else
		AC_MSG_RESULT([no])
		ac_cv_use_memalign="no"
	fi
fi
if test "${ac_cv_use_memalign}" = "yes"; then
	AC_DEFINE(USE_MEMALIGN,1,[Use aligned memory allocation (if available)])
fi

AC_ARG_ENABLE(
	[use-iovec],
	AC_HELP_STRING(
		[--disable-use-iovec],
		[Disable vectored I/O (30-50% performance decrease) (default: enabled)]
		),
	[ac_cv_use_iovec=$enableval],
	[ac_cv_use_iovec="yes"]
	)
AC_CACHE_CHECK(
	[if vectored I/O is enabled],
	[ac_cv_use_iovec],
	[ac_cv_use_iovec]
	)
if test "${ac_cv_have_struct_iovec}" = "no"; then
	ac_cv_use_iovec="no"
fi
AC_CACHE_CHECK(
	[if vectored I/O is available],
	[ac_cv_use_iovec],
	[ac_cv_use_iovec]
	)
if test "${ac_cv_use_iovec}" = "yes"; then
	AC_DEFINE(USE_IOVEC,1,[Use vectored I/O (if available)])
fi

dnl
dnl Check to see if CC supports -m64
dnl
AC_MSG_CHECKING([whether CC supports -m64])
if test "${ac_cv_m64_available+set}" = set; then
	AC_MSG_RESULT([(cached)] $ac_cv_m64_available)
else
	my_save_cflags="$CFLAGS"
	CFLAGS=-m64
	AC_TRY_COMPILE(
		[
#include <stdio.h>
		]
,
		[
	return(0);
		]
,
		ac_cv_m64_available=yes
,
		ac_cv_m64_available=no
	)
	CFLAGS="$my_save_cflags"
	AC_MSG_RESULT($ac_cv_m64_available)
fi

dnl
dnl Check to see if we should use -m64
dnl
AC_ARG_ENABLE(
	[use-m64],
	AC_HELP_STRING(
		[--disable-use-m64],
		[Disable the use of -m64 compiler flag (default: enabled)]
		),
	[ac_cv_use_m64=$enableval],
	[ac_cv_use_m64="yes"]
	)
AC_CACHE_CHECK(
	[if the use of -m64 compiler flag is enabled],
	[ac_cv_use_m64],
	[ac_cv_use_m64]
	)
if test "${ac_cv_m64_available}" = "yes"; then
	if test "${ac_cv_use_m64}" = "yes"; then
AM_CFLAGS="${AM_CFLAGS} -m64"
AC_SUBST([AM_CFLAGS])
	fi
fi

dnl
dnl Not all systems can count to 1 exabyte (apparently)
dnl This seems to be a bug in some compilers that do not natively generate
dnl 64-bit executables on 64-bit operating systems.
dnl
AC_MSG_CHECKING([if system supports counting to 1 exabyte])
if test "${ac_cv_c_exabyte_support+set}" = set; then
	AC_MSG_RESULT([(cached)] $ac_cv_c_exabyte_support)
else
	AC_TRY_COMPILE(
		[
#include <assert.h>
		]
,
		[
	unsigned long long n = 1;

	n *= 1000; /* 1K */
	n *= 1000; /* 1M */
	n *= 1000; /* 1G */
	n *= 1000; /* 1T */
	n *= 1000; /* 1P */
	n *= 1000; /* 1E */
	n /= 1000;
	n /= 1000;
	n /= 1000;
	n /= 1000;
	n /= 1000;
	n /= 1000;
	assert(n == 1);
		]
,
		[ac_cv_c_exabyte_support=yes]
		AC_DEFINE(HAVE_EXABYTE_SUPPORT,1,[Define if we can count to 1E])
,
		[ac_cv_c_exabyte_support=no]
	)
	AC_MSG_RESULT($ac_cv_c_exabyte_support)
fi

dnl
dnl Not all systems can count to 1 petabyte (apparently)
dnl This seems to be a bug in some compilers that do not natively generate
dnl 64-bit executables on 64-bit operating systems.
dnl
AC_MSG_CHECKING([if system supports counting to 1 petabyte])
if test "${ac_cv_c_petabyte_support+set}" = set; then
	AC_MSG_RESULT([(cached)] $ac_cv_c_petabyte_support)
else
	AC_TRY_COMPILE(
		[
#include <assert.h>
		]
,
		[
	unsigned long long n = 1;

	n *= 1000; /* 1K */
	n *= 1000; /* 1M */
	n *= 1000; /* 1G */
	n *= 1000; /* 1T */
	n *= 1000; /* 1P */
	n /= 1000;
	n /= 1000;
	n /= 1000;
	n /= 1000;
	n /= 1000;
	assert(n == 1);
		]
,
		[ac_cv_c_petabyte_support=yes]
		AC_DEFINE(HAVE_PETABYTE_SUPPORT,1,[Define if we can count to 1P])
,
		[ac_cv_c_petabyte_support=no]
	)
	AC_MSG_RESULT($ac_cv_c_petabyte_support)
fi

dnl
dnl Not all systems can count to 1 terabyte (apparently)
dnl This seems to be a bug in some compilers that do not natively generate
dnl 64-bit executables on 64-bit operating systems.
dnl
AC_MSG_CHECKING([if system supports counting to 1 terabyte])
if test "${ac_cv_c_terabyte_support+set}" = set; then
	AC_MSG_RESULT([(cached)] $ac_cv_c_terabyte_support)
else
	AC_TRY_COMPILE(
		[
#include <assert.h>
		]
,
		[
	unsigned long long n = 1;

	n *= 1000; /* 1K */
	n *= 1000; /* 1M */
	n *= 1000; /* 1G */
	n *= 1000; /* 1T */
	n /= 1000;
	n /= 1000;
	n /= 1000;
	n /= 1000;
	assert(n == 1);
		]
,
		[ac_cv_c_terabyte_support=yes]
		AC_DEFINE(HAVE_TERABYTE_SUPPORT,1,[Define if we can count to 1T])
,
		[ac_cv_c_terabyte_support=no]
	)
	AC_MSG_RESULT($ac_cv_c_terabyte_support)
fi

if test "${ac_cv_c_exabyte_support}" = "no"; then
	if test "${ac_cv_c_petabyte_support}" = "no"; then
		if test "${ac_cv_c_terabyte_support}" = "no"; then
			ac_cv_c_max_safe_multiplier=1000000000
		else
			ac_cv_c_max_safe_multiplier=1000000000000
		fi
	else
		ac_cv_c_max_safe_multiplier=1000000000000000
	fi
else
	ac_cv_c_max_safe_multiplier=1000000000000000000
fi
AC_DEFINE_UNQUOTED(
	MAX_SAFE_MULTIPLIER,
	$ac_cv_c_max_safe_multiplier,
	[Use this as the maximum safe multiplier value for safe_mul()]
	)
AC_SUBST(MAX_SAFE_MULTIPLIER)

AC_CONFIG_FILES([Makefile bar.1 doxygen.conf])
AC_CONFIG_COMMANDS([test-script-preparation],[chmod u+x test-00?])
AC_OUTPUT

AC_MSG_NOTICE([])
AC_MSG_NOTICE([Current Configuration:])
AC_MSG_NOTICE([----------------------])
if test "${ac_cv_default_sw_minus_one}" -eq 1; then
AC_MSG_NOTICE([     Screen width -1 modifier: yes])
else
AC_MSG_NOTICE([     Screen width -1 modifier: no])
fi
if test "${ac_cv_default_sh_minus_one}" -eq 1; then
AC_MSG_NOTICE([    Screen height -1 modifier: yes])
else
AC_MSG_NOTICE([    Screen height -1 modifier: no])
fi
if test "${ac_cv_default_display_twiddle}" -eq 1; then
AC_MSG_NOTICE([   Display twiddle by default: yes])
else
AC_MSG_NOTICE([   Display twiddle by default: no])
fi
if test "${ac_cv_use_memalign}" = "yes"; then
AC_MSG_NOTICE([Use aligned memory allocation:] $ac_cv_use_memalign [(default page size:] $ac_cv_default_page_size[)])
else
AC_MSG_NOTICE([Use aligned memory allocation:] $ac_cv_use_memalign)
fi
AC_MSG_NOTICE([             Use vectored I/O:] $ac_cv_use_iovec)
AC_MSG_NOTICE([      Default I/O buffer size:] $ac_cv_default_buffer_size)
AC_MSG_NOTICE([                 Install Path:] $prefix)
AC_MSG_NOTICE([])