~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
dnl By default, many hosts wont let programs access large files;
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
2
dnl one must use special compiler options to get large-file access to work.
1 by brian
clean slate
3
dnl For more details about this brain damage please see:
4
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
5
6
dnl Written by Paul Eggert <eggert@twinsun.com>.
7
8
dnl Internal subroutine of AC_SYS_LARGEFILE.
9
dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
10
AC_DEFUN([AC_SYS_LARGEFILE_FLAGS],
11
  [AC_CACHE_CHECK([for $1 value to request large file support],
12
     ac_cv_sys_largefile_$1,
13
     [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
14
      then
15
        ac_cv_sys_largefile_$1=`cat conftest.1`
16
      else
17
	ac_cv_sys_largefile_$1=no
18
	ifelse($1, CFLAGS,
19
	  [case "$host_os" in
20
	   # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
21
changequote(, )dnl
22
	   hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
23
changequote([, ])dnl
24
	     if test "$GCC" = yes; then
25
	        case `$CC --version 2>/dev/null` in
26
	          2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;;
27
		esac
28
	     fi
29
	     ;;
30
	   # IRIX 6.2 and later require cc -n32.
31
changequote(, )dnl
32
	   irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
33
changequote([, ])dnl
34
	     if test "$GCC" != yes; then
35
	       ac_cv_sys_largefile_CFLAGS=-n32
36
	     fi
37
	   esac
38
	   if test "$ac_cv_sys_largefile_CFLAGS" != no; then
39
	     ac_save_CC="$CC"
40
	     CC="$CC $ac_cv_sys_largefile_CFLAGS"
41
	     AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
42
	     CC="$ac_save_CC"
43
	   fi])
44
      fi
45
      rm -f conftest*])])
46
47
dnl Internal subroutine of AC_SYS_LARGEFILE.
48
dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
49
AC_DEFUN([AC_SYS_LARGEFILE_SPACE_APPEND],
50
  [case $2 in
51
   no) ;;
52
   ?*)
53
     case "[$]$1" in
54
     '') $1=$2 ;;
55
     *) $1=[$]$1' '$2 ;;
56
     esac ;;
57
   esac])
58
59
dnl Internal subroutine of AC_SYS_LARGEFILE.
60
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
61
AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
62
  [AC_CACHE_CHECK([for $1], $2,
63
     [$2=no
64
changequote(, )dnl
65
      for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
66
	case "$ac_flag" in
67
	-D$1)
68
	  $2=1 ;;
69
	-D$1=*)
70
	  $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
71
	esac
72
      done
73
      $4
74
changequote([, ])dnl
75
      ])
76
   if test "[$]$2" != no; then
77
     AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
78
   fi])
79
80
AC_DEFUN([DRIZZLE_SYS_LARGEFILE],
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
81
  [AC_REQUIRE([AC_CANONICAL_HOST])
1 by brian
clean slate
82
      AC_ARG_ENABLE([largefile],
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
83
	  [AS_HELP_STRING([--disable-largefile],
84
		  [Omit support for large files])])
85
   if test "$enable_largefile" != no; then
1 by brian
clean slate
86
     AC_CHECK_TOOL(GETCONF, getconf)
87
     AC_SYS_LARGEFILE_FLAGS(CFLAGS)
88
     AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
89
     AC_SYS_LARGEFILE_FLAGS(LIBS)
90
91
     for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
92
       case "$ac_flag" in
93
       no) ;;
94
       -D_FILE_OFFSET_BITS=*) ;;
95
       -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
96
       -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
97
       -D?* | -I?*)
98
	 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
99
       *)
100
	 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
101
       esac
102
     done
103
     AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
104
     AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
105
106
     AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
107
       ac_cv_sys_file_offset_bits,
108
       [Number of bits in a file offset, on hosts where this is settable.],
109
       [case "$host_os" in
110
	# HP-UX 10.20 and later
111
	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
112
	  ac_cv_sys_file_offset_bits=64 ;;
113
	# We can't declare _FILE_OFFSET_BITS here as this will cause
114
	# compile errors as AC_PROG_CC adds include files in confdefs.h
115
	# We solve this (until autoconf is fixed) by instead declaring it
116
	# as define instead
117
	solaris2.[8,9])
118
	  CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
119
	  CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
120
	  ac_cv_sys_file_offset_bits=no ;;
121
	esac])
122
     AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
123
       ac_cv_sys_largefile_source,
124
       [makes fseeko etc. visible, on some hosts.],
125
       [case "$host_os" in
126
	# HP-UX 10.20 and later
127
	hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
128
	  ac_cv_sys_largefile_source=1 ;;
129
	esac])
130
131
     AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
132
       ac_cv_sys_large_files,
133
       [Large files support on AIX-style hosts.],
134
       [case "$host_os" in
135
       # Large file support on AIX is available starting from version 4.2
136
       # Tested only on 5.2 and up
137
       aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
138
         ac_cv_sys_large_files=1 ;;
139
       esac])
140
   fi
141
  ])
142
143