1
dnl By default, many hosts won't let programs access large files;
2
dnl one must use special compiler options to get large-file access to work.
3
dnl For more details about this brain damage please see:
4
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
6
dnl Written by Paul Eggert <eggert@twinsun.com>.
8
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
9
dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
10
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
11
[AC_CACHE_CHECK([for $1 value to request large file support],
12
ac_cv_sys_largefile_$1,
13
[ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
14
ac_cv_sys_largefile_$1=no
17
# IRIX 6.2 and later require cc -n32.
19
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
21
if test "$GCC" != yes; then
22
ac_cv_sys_largefile_CFLAGS=-n32
25
CC="$CC $ac_cv_sys_largefile_CFLAGS"
26
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
31
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
32
dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
33
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
43
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
44
dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
45
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
46
[AC_CACHE_CHECK([for $1], $2,
50
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
55
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
60
if test "[$]$2" != no; then
61
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
64
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
65
[AC_REQUIRE([AC_CANONICAL_HOST])
66
AC_ARG_ENABLE(largefile,
67
[ --disable-largefile omit support for large files])
68
if test "$enable_largefile" != no; then
69
AC_CHECK_TOOL(GETCONF, getconf)
70
AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
71
AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
72
AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
74
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
77
-D_FILE_OFFSET_BITS=*) ;;
78
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
79
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
81
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
83
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
86
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
87
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
88
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
89
ac_cv_sys_file_offset_bits,
90
[Number of bits in a file offset, on hosts where this is settable.])
92
# HP-UX 10.20 and later
93
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
94
ac_cv_sys_file_offset_bits=64 ;;
96
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
97
ac_cv_sys_largefile_source,
98
[Define to make fseeko etc. visible, on some hosts.],
100
# HP-UX 10.20 and later
101
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
102
ac_cv_sys_largefile_source=1 ;;
104
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
105
ac_cv_sys_large_files,
106
[Define for large files, on AIX-style hosts.],
109
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
110
ac_cv_sys_large_files=1 ;;
120
dnl @synopsis AC_C_FIND_ENDIAN
122
dnl Determine endian-ness of target processor.
123
dnl @version 1.1 Mar 03 2002
124
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
126
dnl Majority written from scratch to replace the standard autoconf macro
127
dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
128
dnl of the AC_TRY_RUN macro.
130
dnl Permission to use, copy, modify, distribute, and sell this file for any
131
dnl purpose is hereby granted without fee, provided that the above copyright
132
dnl and this permission notice appear in all copies. No representations are
133
dnl made about the suitability of this software for any purpose. It is
134
dnl provided "as is" without express or implied warranty.
136
dnl Find endian-ness in the following way:
137
dnl 1) Look in <endian.h>.
138
dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
139
dnl 3) If 1) and 2) fails and not cross compiling run a test program.
140
dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
142
AC_DEFUN([AC_C_FIND_ENDIAN],
143
[AC_CACHE_CHECK(processor byte ordering,
146
# Initialize to unknown
147
ac_cv_c_byte_order=unknown
149
if test x$ac_cv_header_endian_h = xyes ; then
151
# First try <endian.h> which should set BYTE_ORDER.
155
#if BYTE_ORDER != LITTLE_ENDIAN
159
ac_cv_c_byte_order=little
164
#if BYTE_ORDER != BIG_ENDIAN
168
ac_cv_c_byte_order=big
173
if test $ac_cv_c_byte_order = unknown ; then
176
#include <sys/types.h>
177
#include <sys/param.h>
178
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
184
#include <sys/types.h>
185
#include <sys/param.h>
186
#if BYTE_ORDER != LITTLE_ENDIAN
190
ac_cv_c_byte_order=little
194
#include <sys/types.h>
195
#include <sys/param.h>
196
#if BYTE_ORDER != LITTLE_ENDIAN
200
ac_cv_c_byte_order=little
207
if test $ac_cv_c_byte_order = unknown ; then
208
if test $cross_compiling = yes ; then
209
# This is the last resort. Try to guess the target processor endian-ness
210
# by looking at the target CPU type.
212
case "$target_cpu" in
213
alpha* | i?86* | mipsel* | ia64*)
215
ac_cv_c_little_endian=1
218
m68* | mips* | powerpc* | hppa* | sparc*)
220
ac_cv_c_little_endian=0
229
{ /* Are we little or big endian? From Harbison&Steele. */
232
char c [sizeof (long)] ;
235
return (u.c [sizeof (long) - 1] == 1);
237
]], , ac_cv_c_byte_order=big,
238
ac_cv_c_byte_order=unknown
243
{ /* Are we little or big endian? From Harbison&Steele. */
246
char c [sizeof (long)] ;
249
return (u.c [0] == 1);
250
}]], , ac_cv_c_byte_order=little,
251
ac_cv_c_byte_order=unknown
259
if test $ac_cv_c_byte_order = big ; then
261
ac_cv_c_little_endian=0
262
elif test $ac_cv_c_byte_order = little ; then
264
ac_cv_c_little_endian=1
267
ac_cv_c_little_endian=0
269
AC_MSG_WARN([[*****************************************************************]])
270
AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
271
AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
272
AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]])
273
AC_MSG_WARN([[*****************************************************************]])
282
dnl @synopsis AC_C99_FLEXIBLE_ARRAY
284
dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
285
dnl @version 1.1 Mar 15 2004
286
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
288
dnl Permission to use, copy, modify, distribute, and sell this file for any
289
dnl purpose is hereby granted without fee, provided that the above copyright
290
dnl and this permission notice appear in all copies. No representations are
291
dnl made about the suitability of this software for any purpose. It is
292
dnl provided "as is" without express or implied warranty.
294
AC_DEFUN([AC_C99_FLEXIBLE_ARRAY],
295
[AC_CACHE_CHECK(C99 struct flexible array support,
296
ac_cv_c99_flexible_array,
298
# Initialize to unknown
299
ac_cv_c99_flexible_array=no
308
[ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
309
ac_cv_c99_flexible_array=yes,
310
ac_cv_c99_flexible_array=no
312
) # AC_C99_FLEXIBLE_ARRAY
318
dnl @synopsis AC_C99_FUNC_LRINT
320
dnl Check whether C99's lrint function is available.
321
dnl @version 1.3 Feb 12 2002
322
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
324
dnl Permission to use, copy, modify, distribute, and sell this file for any
325
dnl purpose is hereby granted without fee, provided that the above copyright
326
dnl and this permission notice appear in all copies. No representations are
327
dnl made about the suitability of this software for any purpose. It is
328
dnl provided "as is" without express or implied warranty.
330
AC_DEFUN([AC_C99_FUNC_LRINT],
331
[AC_CACHE_CHECK(for lrint,
334
lrint_save_CFLAGS=$CFLAGS
337
#define _ISOC9X_SOURCE 1
338
#define _ISOC99_SOURCE 1
339
#define __USE_ISOC99 1
340
#define __USE_ISOC9X 1
343
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
345
CFLAGS=$lrint_save_CFLAGS
349
if test "$ac_cv_c99_lrint" = yes; then
350
AC_DEFINE(HAVE_LRINT, 1,
351
[Define if you have C99's lrint function.])
353
])# AC_C99_FUNC_LRINT
354
dnl @synopsis AC_C99_FUNC_LRINTF
356
dnl Check whether C99's lrintf function is available.
357
dnl @version 1.3 Feb 12 2002
358
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
360
dnl Permission to use, copy, modify, distribute, and sell this file for any
361
dnl purpose is hereby granted without fee, provided that the above copyright
362
dnl and this permission notice appear in all copies. No representations are
363
dnl made about the suitability of this software for any purpose. It is
364
dnl provided "as is" without express or implied warranty.
366
AC_DEFUN([AC_C99_FUNC_LRINTF],
367
[AC_CACHE_CHECK(for lrintf,
370
lrintf_save_CFLAGS=$CFLAGS
373
#define _ISOC9X_SOURCE 1
374
#define _ISOC99_SOURCE 1
375
#define __USE_ISOC99 1
376
#define __USE_ISOC9X 1
379
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
381
CFLAGS=$lrintf_save_CFLAGS
385
if test "$ac_cv_c99_lrintf" = yes; then
386
AC_DEFINE(HAVE_LRINTF, 1,
387
[Define if you have C99's lrintf function.])
389
])# AC_C99_FUNC_LRINTF
394
dnl @synopsis AC_C99_FUNC_LLRINT
396
dnl Check whether C99's llrint function is available.
397
dnl @version 1.1 Sep 30 2002
398
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
400
dnl Permission to use, copy, modify, distribute, and sell this file for any
401
dnl purpose is hereby granted without fee, provided that the above copyright
402
dnl and this permission notice appear in all copies. No representations are
403
dnl made about the suitability of this software for any purpose. It is
404
dnl provided "as is" without express or implied warranty.
406
AC_DEFUN([AC_C99_FUNC_LLRINT],
407
[AC_CACHE_CHECK(for llrint,
410
llrint_save_CFLAGS=$CFLAGS
413
#define _ISOC9X_SOURCE 1
414
#define _ISOC99_SOURCE 1
415
#define __USE_ISOC99 1
416
#define __USE_ISOC9X 1
420
], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
422
CFLAGS=$llrint_save_CFLAGS
426
if test "$ac_cv_c99_llrint" = yes; then
427
AC_DEFINE(HAVE_LLRINT, 1,
428
[Define if you have C99's llrint function.])
430
])# AC_C99_FUNC_LLRINT
434
dnl @synopsis AC_C_CLIP_MODE
436
dnl Determine the clipping mode when converting float to int.
437
dnl @version 1.0 May 17 2003
438
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
440
dnl Permission to use, copy, modify, distribute, and sell this file for any
441
dnl purpose is hereby granted without fee, provided that the above copyright
442
dnl and this permission notice appear in all copies. No representations are
443
dnl made about the suitability of this software for any purpose. It is
444
dnl provided "as is" without express or implied warranty.
448
dnl Find the clipping mode in the following way:
449
dnl 1) If we are not cross compiling test it.
450
dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
452
AC_DEFUN([AC_C_CLIP_MODE],
453
[AC_CACHE_CHECK(processor clipping capabilities,
456
# Initialize to unknown
457
ac_cv_c_clip_positive=unknown
458
ac_cv_c_clip_negative=unknown
460
if test $ac_cv_c_clip_positive = unknown ; then
463
#define _ISOC9X_SOURCE 1
464
#define _ISOC99_SOURCE 1
465
#define __USE_ISOC99 1
466
#define __USE_ISOC9X 1
472
fval = 1.0 * 0x7FFFFFFF ;
473
for (k = 0 ; k < 100 ; k++)
474
{ ival = (lrint (fval)) >> 24 ;
484
ac_cv_c_clip_positive=yes,
485
ac_cv_c_clip_positive=no,
486
ac_cv_c_clip_positive=unknown
491
#define _ISOC9X_SOURCE 1
492
#define _ISOC99_SOURCE 1
493
#define __USE_ISOC99 1
494
#define __USE_ISOC9X 1
500
fval = -8.0 * 0x10000000 ;
501
for (k = 0 ; k < 100 ; k++)
502
{ ival = (lrint (fval)) >> 24 ;
512
ac_cv_c_clip_negative=yes,
513
ac_cv_c_clip_negative=no,
514
ac_cv_c_clip_negative=unknown
518
if test $ac_cv_c_clip_positive = yes ; then
519
ac_cv_c_clip_positive=1
521
ac_cv_c_clip_positive=0
524
if test $ac_cv_c_clip_negative = yes ; then
525
ac_cv_c_clip_negative=1
527
ac_cv_c_clip_negative=0
531
case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
533
ac_cv_c_clip_type="none"
536
ac_cv_c_clip_type="positive"
539
ac_cv_c_clip_type="negative"
542
ac_cv_c_clip_type="both"
553
dnl @synopsis AC_ADD_CFLAGS
555
dnl Add the given option to CFLAGS, if it doesn't break the compiler
557
AC_DEFUN([AC_ADD_CFLAGS],
558
[AC_MSG_CHECKING([if $CC accepts $1])
559
ac_add_cflags__old_cflags="$CFLAGS"
561
AC_TRY_LINK([#include <stdio.h>],
562
[printf("Hello, World!\n"); return 0;],
563
AC_MSG_RESULT([yes]),
565
CFLAGS="$ac_add_cflags__old_cflags")
573
Do not edit or modify anything in this comment block.
574
The arch-tag line is a file identity tag for the GNU Arch
575
revision control system.
577
arch-tag: bc38294d-bb5c-42ad-90b9-779def5eaab7