View | Details | Raw Unified | Return to bug 54773
Collapse All | Expand All

(-)ChangeLog (+6 lines)
Lines 1-3 Link Here
1
2004-05-28  Derek Price  <derek@ximbiot.com>
2
3
	* NEWS: Note Stefan & Sebastian's security fixes.
4
	* acinclude.m4 (gl_SIZE_MAX, gl_XSIZE): Import from GNULIB.
5
	* configure.in: Call gl_XSIZE.
6
1
2004-05-19  Derek Price  <derek@ximbiot.com>
7
2004-05-19  Derek Price  <derek@ximbiot.com>
2
8
3
	* NEWS: Note CAN-2004-0396 fix.
9
	* NEWS: Note CAN-2004-0396 fix.
(-)NEWS (+8 lines)
Lines 1-6 Link Here
1
Changes since 1.11.16:
1
Changes since 1.11.16:
2
**********************
2
**********************
3
3
4
SERVER SECURITY FIXES
5
6
* Thanks to Stefan Esser & Sebastian Krahmer, several potential security
7
  problems have been fixed.  The ones which were considered dangerous enough
8
  to catalogue were assigned issue numbers CAN-2004-0416, CAN-2004-0417, &
9
  CAN-2004-0418 by the Common Vulnerabilities and Exposures Project.  Please
10
  see <http://www.cve.mitre.org> for more information.
11
4
Changes from 1.11.15 to 1.11.16:
12
Changes from 1.11.15 to 1.11.16:
5
********************************
13
********************************
6
14
(-)acinclude.m4 (+82 lines)
Lines 267-269 when using GSSAPI.]) Link Here
267
  AC_SEARCH_LIBS([gss_import_name], [gssapi_krb5 gssapi])
267
  AC_SEARCH_LIBS([gss_import_name], [gssapi_krb5 gssapi])
268
fi
268
fi
269
])dnl
269
])dnl
270
271
272
273
# size_max.m4 serial 2
274
dnl Copyright (C) 2003 Free Software Foundation, Inc.
275
dnl This file is free software, distributed under the terms of the GNU
276
dnl General Public License.  As a special exception to the GNU General
277
dnl Public License, this file may be distributed as part of a program
278
dnl that contains a configuration script generated by Autoconf, under
279
dnl the same distribution terms as the rest of that program.
280
281
dnl From Bruno Haible.
282
283
AC_DEFUN([gl_SIZE_MAX],
284
[
285
  AC_CHECK_HEADERS(stdint.h)
286
  dnl First test whether the system already has SIZE_MAX.
287
  AC_MSG_CHECKING([for SIZE_MAX])
288
  result=
289
  AC_EGREP_CPP([Found it], [
290
#include <limits.h>
291
#if HAVE_STDINT_H
292
#include <stdint.h>
293
#endif
294
#ifdef SIZE_MAX
295
Found it
296
#endif
297
], result=yes)
298
  if test -z "$result"; then
299
    dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
300
    dnl than the type 'unsigned long'.
301
    dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
302
    dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
303
    _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
304
      [#include <stddef.h>], result=?)
305
    _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
306
      [#include <stddef.h>], result=?)
307
    _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
308
      [#include <stddef.h>], result=?)
309
    if test "$fits_in_uint" = 1; then
310
      dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
311
      dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
312
      AC_TRY_COMPILE([#include <stddef.h>
313
        extern size_t foo;
314
        extern unsigned long foo;
315
        ], [], fits_in_uint=0)
316
    fi
317
    if test -z "$result"; then
318
      if test "$fits_in_uint" = 1; then
319
        result="$res_hi$res_lo"U
320
      else
321
        result="$res_hi$res_lo"UL
322
      fi
323
    else
324
      dnl Shouldn't happen, but who knows...
325
      result='~(size_t)0'
326
    fi
327
  fi
328
  AC_MSG_RESULT([$result])
329
  if test "$result" != yes; then
330
    AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
331
      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
332
  fi
333
])
334
335
336
337
# xsize.m4 serial 3
338
dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
339
dnl This file is free software, distributed under the terms of the GNU
340
dnl General Public License.  As a special exception to the GNU General
341
dnl Public License, this file may be distributed as part of a program
342
dnl that contains a configuration script generated by Autoconf, under
343
dnl the same distribution terms as the rest of that program.
344
345
AC_DEFUN([gl_XSIZE],
346
[
347
  dnl Prerequisites of lib/xsize.h.
348
  AC_REQUIRE([gl_SIZE_MAX])
349
  AC_REQUIRE([AC_C_INLINE])
350
  AC_CHECK_HEADERS(stdint.h)
351
])
(-)aclocal.m4 (+82 lines)
Lines 281-286 when using GSSAPI.]) Link Here
281
fi
281
fi
282
])dnl
282
])dnl
283
283
284
285
286
# size_max.m4 serial 2
287
dnl Copyright (C) 2003 Free Software Foundation, Inc.
288
dnl This file is free software, distributed under the terms of the GNU
289
dnl General Public License.  As a special exception to the GNU General
290
dnl Public License, this file may be distributed as part of a program
291
dnl that contains a configuration script generated by Autoconf, under
292
dnl the same distribution terms as the rest of that program.
293
294
dnl From Bruno Haible.
295
296
AC_DEFUN([gl_SIZE_MAX],
297
[
298
  AC_CHECK_HEADERS(stdint.h)
299
  dnl First test whether the system already has SIZE_MAX.
300
  AC_MSG_CHECKING([for SIZE_MAX])
301
  result=
302
  AC_EGREP_CPP([Found it], [
303
#include <limits.h>
304
#if HAVE_STDINT_H
305
#include <stdint.h>
306
#endif
307
#ifdef SIZE_MAX
308
Found it
309
#endif
310
], result=yes)
311
  if test -z "$result"; then
312
    dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
313
    dnl than the type 'unsigned long'.
314
    dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
315
    dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
316
    _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
317
      [#include <stddef.h>], result=?)
318
    _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
319
      [#include <stddef.h>], result=?)
320
    _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
321
      [#include <stddef.h>], result=?)
322
    if test "$fits_in_uint" = 1; then
323
      dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
324
      dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
325
      AC_TRY_COMPILE([#include <stddef.h>
326
        extern size_t foo;
327
        extern unsigned long foo;
328
        ], [], fits_in_uint=0)
329
    fi
330
    if test -z "$result"; then
331
      if test "$fits_in_uint" = 1; then
332
        result="$res_hi$res_lo"U
333
      else
334
        result="$res_hi$res_lo"UL
335
      fi
336
    else
337
      dnl Shouldn't happen, but who knows...
338
      result='~(size_t)0'
339
    fi
340
  fi
341
  AC_MSG_RESULT([$result])
342
  if test "$result" != yes; then
343
    AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
344
      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
345
  fi
346
])
347
348
349
350
# xsize.m4 serial 3
351
dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
352
dnl This file is free software, distributed under the terms of the GNU
353
dnl General Public License.  As a special exception to the GNU General
354
dnl Public License, this file may be distributed as part of a program
355
dnl that contains a configuration script generated by Autoconf, under
356
dnl the same distribution terms as the rest of that program.
357
358
AC_DEFUN([gl_XSIZE],
359
[
360
  dnl Prerequisites of lib/xsize.h.
361
  AC_REQUIRE([gl_SIZE_MAX])
362
  AC_REQUIRE([AC_C_INLINE])
363
  AC_CHECK_HEADERS(stdint.h)
364
])
365
284
# Do all the work for Automake.                            -*- Autoconf -*-
366
# Do all the work for Automake.                            -*- Autoconf -*-
285
367
286
# This macro actually does too much some checks are only needed if
368
# This macro actually does too much some checks are only needed if
(-)config.h.in (+10 lines)
Lines 425-430 Link Here
425
   */
425
   */
426
#undef SERVER_SUPPORT
426
#undef SERVER_SUPPORT
427
427
428
/* Define as the maximum value of type 'size_t', if the system doesn't define
429
   it. */
430
#undef SIZE_MAX
431
428
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
432
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
429
#undef STAT_MACROS_BROKEN
433
#undef STAT_MACROS_BROKEN
430
434
Lines 486-491 Link Here
486
/* Define to `int' if <sys/types.h> doesn't define. */
490
/* Define to `int' if <sys/types.h> doesn't define. */
487
#undef gid_t
491
#undef gid_t
488
492
493
/* Define to `__inline__' or `__inline' if that's what the C compiler
494
   calls it, or to nothing if 'inline' is not supported under any name.  */
495
#ifndef __cplusplus
496
#undef inline
497
#endif
498
489
/* Define to `int' if <sys/types.h> does not define. */
499
/* Define to `int' if <sys/types.h> does not define. */
490
#undef mode_t
500
#undef mode_t
491
501
(-)configure (+1455 lines)
Lines 6102-6107 done Link Here
6102
6102
6103
6103
6104
6104
6105
for ac_header in stdint.h
6106
do
6107
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
6108
if eval "test \"\${$as_ac_Header+set}\" = set"; then
6109
  echo "$as_me:$LINENO: checking for $ac_header" >&5
6110
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
6111
if eval "test \"\${$as_ac_Header+set}\" = set"; then
6112
  echo $ECHO_N "(cached) $ECHO_C" >&6
6113
fi
6114
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
6115
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
6116
else
6117
  # Is the header compilable?
6118
echo "$as_me:$LINENO: checking $ac_header usability" >&5
6119
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
6120
cat >conftest.$ac_ext <<_ACEOF
6121
/* confdefs.h.  */
6122
_ACEOF
6123
cat confdefs.h >>conftest.$ac_ext
6124
cat >>conftest.$ac_ext <<_ACEOF
6125
/* end confdefs.h.  */
6126
$ac_includes_default
6127
#include <$ac_header>
6128
_ACEOF
6129
rm -f conftest.$ac_objext
6130
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6131
  (eval $ac_compile) 2>conftest.er1
6132
  ac_status=$?
6133
  grep -v '^ *+' conftest.er1 >conftest.err
6134
  rm -f conftest.er1
6135
  cat conftest.err >&5
6136
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6137
  (exit $ac_status); } &&
6138
	 { ac_try='test -z "$ac_c_werror_flag"
6139
			 || test ! -s conftest.err'
6140
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6141
  (eval $ac_try) 2>&5
6142
  ac_status=$?
6143
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6144
  (exit $ac_status); }; } &&
6145
	 { ac_try='test -s conftest.$ac_objext'
6146
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6147
  (eval $ac_try) 2>&5
6148
  ac_status=$?
6149
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6150
  (exit $ac_status); }; }; then
6151
  ac_header_compiler=yes
6152
else
6153
  echo "$as_me: failed program was:" >&5
6154
sed 's/^/| /' conftest.$ac_ext >&5
6155
6156
ac_header_compiler=no
6157
fi
6158
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6159
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
6160
echo "${ECHO_T}$ac_header_compiler" >&6
6161
6162
# Is the header present?
6163
echo "$as_me:$LINENO: checking $ac_header presence" >&5
6164
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
6165
cat >conftest.$ac_ext <<_ACEOF
6166
/* confdefs.h.  */
6167
_ACEOF
6168
cat confdefs.h >>conftest.$ac_ext
6169
cat >>conftest.$ac_ext <<_ACEOF
6170
/* end confdefs.h.  */
6171
#include <$ac_header>
6172
_ACEOF
6173
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
6174
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
6175
  ac_status=$?
6176
  grep -v '^ *+' conftest.er1 >conftest.err
6177
  rm -f conftest.er1
6178
  cat conftest.err >&5
6179
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6180
  (exit $ac_status); } >/dev/null; then
6181
  if test -s conftest.err; then
6182
    ac_cpp_err=$ac_c_preproc_warn_flag
6183
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
6184
  else
6185
    ac_cpp_err=
6186
  fi
6187
else
6188
  ac_cpp_err=yes
6189
fi
6190
if test -z "$ac_cpp_err"; then
6191
  ac_header_preproc=yes
6192
else
6193
  echo "$as_me: failed program was:" >&5
6194
sed 's/^/| /' conftest.$ac_ext >&5
6195
6196
  ac_header_preproc=no
6197
fi
6198
rm -f conftest.err conftest.$ac_ext
6199
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
6200
echo "${ECHO_T}$ac_header_preproc" >&6
6201
6202
# So?  What about this header?
6203
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
6204
  yes:no: )
6205
    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
6206
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
6207
    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
6208
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
6209
    ac_header_preproc=yes
6210
    ;;
6211
  no:yes:* )
6212
    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
6213
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
6214
    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
6215
echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
6216
    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
6217
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
6218
    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
6219
echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
6220
    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
6221
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
6222
    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
6223
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
6224
    (
6225
      cat <<\_ASBOX
6226
## ------------------------------ ##
6227
## Report this to bug-cvs@gnu.org ##
6228
## ------------------------------ ##
6229
_ASBOX
6230
    ) |
6231
      sed "s/^/$as_me: WARNING:     /" >&2
6232
    ;;
6233
esac
6234
echo "$as_me:$LINENO: checking for $ac_header" >&5
6235
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
6236
if eval "test \"\${$as_ac_Header+set}\" = set"; then
6237
  echo $ECHO_N "(cached) $ECHO_C" >&6
6238
else
6239
  eval "$as_ac_Header=\$ac_header_preproc"
6240
fi
6241
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
6242
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
6243
6244
fi
6245
if test `eval echo '${'$as_ac_Header'}'` = yes; then
6246
  cat >>confdefs.h <<_ACEOF
6247
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6248
_ACEOF
6249
6250
fi
6251
6252
done
6253
6254
    echo "$as_me:$LINENO: checking for SIZE_MAX" >&5
6255
echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6
6256
  result=
6257
  cat >conftest.$ac_ext <<_ACEOF
6258
/* confdefs.h.  */
6259
_ACEOF
6260
cat confdefs.h >>conftest.$ac_ext
6261
cat >>conftest.$ac_ext <<_ACEOF
6262
/* end confdefs.h.  */
6263
6264
#include <limits.h>
6265
#if HAVE_STDINT_H
6266
#include <stdint.h>
6267
#endif
6268
#ifdef SIZE_MAX
6269
Found it
6270
#endif
6271
6272
_ACEOF
6273
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
6274
  $EGREP "Found it" >/dev/null 2>&1; then
6275
  result=yes
6276
fi
6277
rm -f conftest*
6278
6279
  if test -z "$result"; then
6280
                    if test "$cross_compiling" = yes; then
6281
  # Depending upon the size, compute the lo and hi bounds.
6282
cat >conftest.$ac_ext <<_ACEOF
6283
/* confdefs.h.  */
6284
_ACEOF
6285
cat confdefs.h >>conftest.$ac_ext
6286
cat >>conftest.$ac_ext <<_ACEOF
6287
/* end confdefs.h.  */
6288
#include <stddef.h>
6289
int
6290
main ()
6291
{
6292
static int test_array [1 - 2 * !((~(size_t)0 / 10) >= 0)];
6293
test_array [0] = 0
6294
6295
  ;
6296
  return 0;
6297
}
6298
_ACEOF
6299
rm -f conftest.$ac_objext
6300
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6301
  (eval $ac_compile) 2>conftest.er1
6302
  ac_status=$?
6303
  grep -v '^ *+' conftest.er1 >conftest.err
6304
  rm -f conftest.er1
6305
  cat conftest.err >&5
6306
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6307
  (exit $ac_status); } &&
6308
	 { ac_try='test -z "$ac_c_werror_flag"
6309
			 || test ! -s conftest.err'
6310
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6311
  (eval $ac_try) 2>&5
6312
  ac_status=$?
6313
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6314
  (exit $ac_status); }; } &&
6315
	 { ac_try='test -s conftest.$ac_objext'
6316
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6317
  (eval $ac_try) 2>&5
6318
  ac_status=$?
6319
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6320
  (exit $ac_status); }; }; then
6321
  ac_lo=0 ac_mid=0
6322
  while :; do
6323
    cat >conftest.$ac_ext <<_ACEOF
6324
/* confdefs.h.  */
6325
_ACEOF
6326
cat confdefs.h >>conftest.$ac_ext
6327
cat >>conftest.$ac_ext <<_ACEOF
6328
/* end confdefs.h.  */
6329
#include <stddef.h>
6330
int
6331
main ()
6332
{
6333
static int test_array [1 - 2 * !((~(size_t)0 / 10) <= $ac_mid)];
6334
test_array [0] = 0
6335
6336
  ;
6337
  return 0;
6338
}
6339
_ACEOF
6340
rm -f conftest.$ac_objext
6341
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6342
  (eval $ac_compile) 2>conftest.er1
6343
  ac_status=$?
6344
  grep -v '^ *+' conftest.er1 >conftest.err
6345
  rm -f conftest.er1
6346
  cat conftest.err >&5
6347
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6348
  (exit $ac_status); } &&
6349
	 { ac_try='test -z "$ac_c_werror_flag"
6350
			 || test ! -s conftest.err'
6351
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6352
  (eval $ac_try) 2>&5
6353
  ac_status=$?
6354
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6355
  (exit $ac_status); }; } &&
6356
	 { ac_try='test -s conftest.$ac_objext'
6357
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6358
  (eval $ac_try) 2>&5
6359
  ac_status=$?
6360
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6361
  (exit $ac_status); }; }; then
6362
  ac_hi=$ac_mid; break
6363
else
6364
  echo "$as_me: failed program was:" >&5
6365
sed 's/^/| /' conftest.$ac_ext >&5
6366
6367
ac_lo=`expr $ac_mid + 1`
6368
		    if test $ac_lo -le $ac_mid; then
6369
		      ac_lo= ac_hi=
6370
		      break
6371
		    fi
6372
		    ac_mid=`expr 2 '*' $ac_mid + 1`
6373
fi
6374
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6375
  done
6376
else
6377
  echo "$as_me: failed program was:" >&5
6378
sed 's/^/| /' conftest.$ac_ext >&5
6379
6380
cat >conftest.$ac_ext <<_ACEOF
6381
/* confdefs.h.  */
6382
_ACEOF
6383
cat confdefs.h >>conftest.$ac_ext
6384
cat >>conftest.$ac_ext <<_ACEOF
6385
/* end confdefs.h.  */
6386
#include <stddef.h>
6387
int
6388
main ()
6389
{
6390
static int test_array [1 - 2 * !((~(size_t)0 / 10) < 0)];
6391
test_array [0] = 0
6392
6393
  ;
6394
  return 0;
6395
}
6396
_ACEOF
6397
rm -f conftest.$ac_objext
6398
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6399
  (eval $ac_compile) 2>conftest.er1
6400
  ac_status=$?
6401
  grep -v '^ *+' conftest.er1 >conftest.err
6402
  rm -f conftest.er1
6403
  cat conftest.err >&5
6404
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6405
  (exit $ac_status); } &&
6406
	 { ac_try='test -z "$ac_c_werror_flag"
6407
			 || test ! -s conftest.err'
6408
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6409
  (eval $ac_try) 2>&5
6410
  ac_status=$?
6411
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6412
  (exit $ac_status); }; } &&
6413
	 { ac_try='test -s conftest.$ac_objext'
6414
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6415
  (eval $ac_try) 2>&5
6416
  ac_status=$?
6417
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6418
  (exit $ac_status); }; }; then
6419
  ac_hi=-1 ac_mid=-1
6420
  while :; do
6421
    cat >conftest.$ac_ext <<_ACEOF
6422
/* confdefs.h.  */
6423
_ACEOF
6424
cat confdefs.h >>conftest.$ac_ext
6425
cat >>conftest.$ac_ext <<_ACEOF
6426
/* end confdefs.h.  */
6427
#include <stddef.h>
6428
int
6429
main ()
6430
{
6431
static int test_array [1 - 2 * !((~(size_t)0 / 10) >= $ac_mid)];
6432
test_array [0] = 0
6433
6434
  ;
6435
  return 0;
6436
}
6437
_ACEOF
6438
rm -f conftest.$ac_objext
6439
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6440
  (eval $ac_compile) 2>conftest.er1
6441
  ac_status=$?
6442
  grep -v '^ *+' conftest.er1 >conftest.err
6443
  rm -f conftest.er1
6444
  cat conftest.err >&5
6445
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6446
  (exit $ac_status); } &&
6447
	 { ac_try='test -z "$ac_c_werror_flag"
6448
			 || test ! -s conftest.err'
6449
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6450
  (eval $ac_try) 2>&5
6451
  ac_status=$?
6452
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6453
  (exit $ac_status); }; } &&
6454
	 { ac_try='test -s conftest.$ac_objext'
6455
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6456
  (eval $ac_try) 2>&5
6457
  ac_status=$?
6458
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6459
  (exit $ac_status); }; }; then
6460
  ac_lo=$ac_mid; break
6461
else
6462
  echo "$as_me: failed program was:" >&5
6463
sed 's/^/| /' conftest.$ac_ext >&5
6464
6465
ac_hi=`expr '(' $ac_mid ')' - 1`
6466
		       if test $ac_mid -le $ac_hi; then
6467
			 ac_lo= ac_hi=
6468
			 break
6469
		       fi
6470
		       ac_mid=`expr 2 '*' $ac_mid`
6471
fi
6472
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6473
  done
6474
else
6475
  echo "$as_me: failed program was:" >&5
6476
sed 's/^/| /' conftest.$ac_ext >&5
6477
6478
ac_lo= ac_hi=
6479
fi
6480
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6481
fi
6482
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6483
# Binary search between lo and hi bounds.
6484
while test "x$ac_lo" != "x$ac_hi"; do
6485
  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
6486
  cat >conftest.$ac_ext <<_ACEOF
6487
/* confdefs.h.  */
6488
_ACEOF
6489
cat confdefs.h >>conftest.$ac_ext
6490
cat >>conftest.$ac_ext <<_ACEOF
6491
/* end confdefs.h.  */
6492
#include <stddef.h>
6493
int
6494
main ()
6495
{
6496
static int test_array [1 - 2 * !((~(size_t)0 / 10) <= $ac_mid)];
6497
test_array [0] = 0
6498
6499
  ;
6500
  return 0;
6501
}
6502
_ACEOF
6503
rm -f conftest.$ac_objext
6504
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6505
  (eval $ac_compile) 2>conftest.er1
6506
  ac_status=$?
6507
  grep -v '^ *+' conftest.er1 >conftest.err
6508
  rm -f conftest.er1
6509
  cat conftest.err >&5
6510
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6511
  (exit $ac_status); } &&
6512
	 { ac_try='test -z "$ac_c_werror_flag"
6513
			 || test ! -s conftest.err'
6514
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6515
  (eval $ac_try) 2>&5
6516
  ac_status=$?
6517
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6518
  (exit $ac_status); }; } &&
6519
	 { ac_try='test -s conftest.$ac_objext'
6520
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6521
  (eval $ac_try) 2>&5
6522
  ac_status=$?
6523
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6524
  (exit $ac_status); }; }; then
6525
  ac_hi=$ac_mid
6526
else
6527
  echo "$as_me: failed program was:" >&5
6528
sed 's/^/| /' conftest.$ac_ext >&5
6529
6530
ac_lo=`expr '(' $ac_mid ')' + 1`
6531
fi
6532
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6533
done
6534
case $ac_lo in
6535
?*) res_hi=$ac_lo;;
6536
'') result=? ;;
6537
esac
6538
else
6539
  if test "$cross_compiling" = yes; then
6540
  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
6541
See \`config.log' for more details." >&5
6542
echo "$as_me: error: cannot run test program while cross compiling
6543
See \`config.log' for more details." >&2;}
6544
   { (exit 1); exit 1; }; }
6545
else
6546
  cat >conftest.$ac_ext <<_ACEOF
6547
/* confdefs.h.  */
6548
_ACEOF
6549
cat confdefs.h >>conftest.$ac_ext
6550
cat >>conftest.$ac_ext <<_ACEOF
6551
/* end confdefs.h.  */
6552
#include <stddef.h>
6553
long longval () { return ~(size_t)0 / 10; }
6554
unsigned long ulongval () { return ~(size_t)0 / 10; }
6555
#include <stdio.h>
6556
#include <stdlib.h>
6557
int
6558
main ()
6559
{
6560
6561
  FILE *f = fopen ("conftest.val", "w");
6562
  if (! f)
6563
    exit (1);
6564
  if ((~(size_t)0 / 10) < 0)
6565
    {
6566
      long i = longval ();
6567
      if (i != (~(size_t)0 / 10))
6568
	exit (1);
6569
      fprintf (f, "%ld\n", i);
6570
    }
6571
  else
6572
    {
6573
      unsigned long i = ulongval ();
6574
      if (i != (~(size_t)0 / 10))
6575
	exit (1);
6576
      fprintf (f, "%lu\n", i);
6577
    }
6578
  exit (ferror (f) || fclose (f) != 0);
6579
6580
  ;
6581
  return 0;
6582
}
6583
_ACEOF
6584
rm -f conftest$ac_exeext
6585
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
6586
  (eval $ac_link) 2>&5
6587
  ac_status=$?
6588
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6589
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
6590
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6591
  (eval $ac_try) 2>&5
6592
  ac_status=$?
6593
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6594
  (exit $ac_status); }; }; then
6595
  res_hi=`cat conftest.val`
6596
else
6597
  echo "$as_me: program exited with status $ac_status" >&5
6598
echo "$as_me: failed program was:" >&5
6599
sed 's/^/| /' conftest.$ac_ext >&5
6600
6601
( exit $ac_status )
6602
result=?
6603
fi
6604
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
6605
fi
6606
fi
6607
rm -f conftest.val
6608
    if test "$cross_compiling" = yes; then
6609
  # Depending upon the size, compute the lo and hi bounds.
6610
cat >conftest.$ac_ext <<_ACEOF
6611
/* confdefs.h.  */
6612
_ACEOF
6613
cat confdefs.h >>conftest.$ac_ext
6614
cat >>conftest.$ac_ext <<_ACEOF
6615
/* end confdefs.h.  */
6616
#include <stddef.h>
6617
int
6618
main ()
6619
{
6620
static int test_array [1 - 2 * !((~(size_t)0 % 10) >= 0)];
6621
test_array [0] = 0
6622
6623
  ;
6624
  return 0;
6625
}
6626
_ACEOF
6627
rm -f conftest.$ac_objext
6628
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6629
  (eval $ac_compile) 2>conftest.er1
6630
  ac_status=$?
6631
  grep -v '^ *+' conftest.er1 >conftest.err
6632
  rm -f conftest.er1
6633
  cat conftest.err >&5
6634
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6635
  (exit $ac_status); } &&
6636
	 { ac_try='test -z "$ac_c_werror_flag"
6637
			 || test ! -s conftest.err'
6638
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6639
  (eval $ac_try) 2>&5
6640
  ac_status=$?
6641
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6642
  (exit $ac_status); }; } &&
6643
	 { ac_try='test -s conftest.$ac_objext'
6644
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6645
  (eval $ac_try) 2>&5
6646
  ac_status=$?
6647
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6648
  (exit $ac_status); }; }; then
6649
  ac_lo=0 ac_mid=0
6650
  while :; do
6651
    cat >conftest.$ac_ext <<_ACEOF
6652
/* confdefs.h.  */
6653
_ACEOF
6654
cat confdefs.h >>conftest.$ac_ext
6655
cat >>conftest.$ac_ext <<_ACEOF
6656
/* end confdefs.h.  */
6657
#include <stddef.h>
6658
int
6659
main ()
6660
{
6661
static int test_array [1 - 2 * !((~(size_t)0 % 10) <= $ac_mid)];
6662
test_array [0] = 0
6663
6664
  ;
6665
  return 0;
6666
}
6667
_ACEOF
6668
rm -f conftest.$ac_objext
6669
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6670
  (eval $ac_compile) 2>conftest.er1
6671
  ac_status=$?
6672
  grep -v '^ *+' conftest.er1 >conftest.err
6673
  rm -f conftest.er1
6674
  cat conftest.err >&5
6675
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6676
  (exit $ac_status); } &&
6677
	 { ac_try='test -z "$ac_c_werror_flag"
6678
			 || test ! -s conftest.err'
6679
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6680
  (eval $ac_try) 2>&5
6681
  ac_status=$?
6682
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6683
  (exit $ac_status); }; } &&
6684
	 { ac_try='test -s conftest.$ac_objext'
6685
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6686
  (eval $ac_try) 2>&5
6687
  ac_status=$?
6688
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6689
  (exit $ac_status); }; }; then
6690
  ac_hi=$ac_mid; break
6691
else
6692
  echo "$as_me: failed program was:" >&5
6693
sed 's/^/| /' conftest.$ac_ext >&5
6694
6695
ac_lo=`expr $ac_mid + 1`
6696
		    if test $ac_lo -le $ac_mid; then
6697
		      ac_lo= ac_hi=
6698
		      break
6699
		    fi
6700
		    ac_mid=`expr 2 '*' $ac_mid + 1`
6701
fi
6702
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6703
  done
6704
else
6705
  echo "$as_me: failed program was:" >&5
6706
sed 's/^/| /' conftest.$ac_ext >&5
6707
6708
cat >conftest.$ac_ext <<_ACEOF
6709
/* confdefs.h.  */
6710
_ACEOF
6711
cat confdefs.h >>conftest.$ac_ext
6712
cat >>conftest.$ac_ext <<_ACEOF
6713
/* end confdefs.h.  */
6714
#include <stddef.h>
6715
int
6716
main ()
6717
{
6718
static int test_array [1 - 2 * !((~(size_t)0 % 10) < 0)];
6719
test_array [0] = 0
6720
6721
  ;
6722
  return 0;
6723
}
6724
_ACEOF
6725
rm -f conftest.$ac_objext
6726
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6727
  (eval $ac_compile) 2>conftest.er1
6728
  ac_status=$?
6729
  grep -v '^ *+' conftest.er1 >conftest.err
6730
  rm -f conftest.er1
6731
  cat conftest.err >&5
6732
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6733
  (exit $ac_status); } &&
6734
	 { ac_try='test -z "$ac_c_werror_flag"
6735
			 || test ! -s conftest.err'
6736
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6737
  (eval $ac_try) 2>&5
6738
  ac_status=$?
6739
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6740
  (exit $ac_status); }; } &&
6741
	 { ac_try='test -s conftest.$ac_objext'
6742
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6743
  (eval $ac_try) 2>&5
6744
  ac_status=$?
6745
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6746
  (exit $ac_status); }; }; then
6747
  ac_hi=-1 ac_mid=-1
6748
  while :; do
6749
    cat >conftest.$ac_ext <<_ACEOF
6750
/* confdefs.h.  */
6751
_ACEOF
6752
cat confdefs.h >>conftest.$ac_ext
6753
cat >>conftest.$ac_ext <<_ACEOF
6754
/* end confdefs.h.  */
6755
#include <stddef.h>
6756
int
6757
main ()
6758
{
6759
static int test_array [1 - 2 * !((~(size_t)0 % 10) >= $ac_mid)];
6760
test_array [0] = 0
6761
6762
  ;
6763
  return 0;
6764
}
6765
_ACEOF
6766
rm -f conftest.$ac_objext
6767
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6768
  (eval $ac_compile) 2>conftest.er1
6769
  ac_status=$?
6770
  grep -v '^ *+' conftest.er1 >conftest.err
6771
  rm -f conftest.er1
6772
  cat conftest.err >&5
6773
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6774
  (exit $ac_status); } &&
6775
	 { ac_try='test -z "$ac_c_werror_flag"
6776
			 || test ! -s conftest.err'
6777
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6778
  (eval $ac_try) 2>&5
6779
  ac_status=$?
6780
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6781
  (exit $ac_status); }; } &&
6782
	 { ac_try='test -s conftest.$ac_objext'
6783
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6784
  (eval $ac_try) 2>&5
6785
  ac_status=$?
6786
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6787
  (exit $ac_status); }; }; then
6788
  ac_lo=$ac_mid; break
6789
else
6790
  echo "$as_me: failed program was:" >&5
6791
sed 's/^/| /' conftest.$ac_ext >&5
6792
6793
ac_hi=`expr '(' $ac_mid ')' - 1`
6794
		       if test $ac_mid -le $ac_hi; then
6795
			 ac_lo= ac_hi=
6796
			 break
6797
		       fi
6798
		       ac_mid=`expr 2 '*' $ac_mid`
6799
fi
6800
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6801
  done
6802
else
6803
  echo "$as_me: failed program was:" >&5
6804
sed 's/^/| /' conftest.$ac_ext >&5
6805
6806
ac_lo= ac_hi=
6807
fi
6808
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6809
fi
6810
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6811
# Binary search between lo and hi bounds.
6812
while test "x$ac_lo" != "x$ac_hi"; do
6813
  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
6814
  cat >conftest.$ac_ext <<_ACEOF
6815
/* confdefs.h.  */
6816
_ACEOF
6817
cat confdefs.h >>conftest.$ac_ext
6818
cat >>conftest.$ac_ext <<_ACEOF
6819
/* end confdefs.h.  */
6820
#include <stddef.h>
6821
int
6822
main ()
6823
{
6824
static int test_array [1 - 2 * !((~(size_t)0 % 10) <= $ac_mid)];
6825
test_array [0] = 0
6826
6827
  ;
6828
  return 0;
6829
}
6830
_ACEOF
6831
rm -f conftest.$ac_objext
6832
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6833
  (eval $ac_compile) 2>conftest.er1
6834
  ac_status=$?
6835
  grep -v '^ *+' conftest.er1 >conftest.err
6836
  rm -f conftest.er1
6837
  cat conftest.err >&5
6838
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6839
  (exit $ac_status); } &&
6840
	 { ac_try='test -z "$ac_c_werror_flag"
6841
			 || test ! -s conftest.err'
6842
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6843
  (eval $ac_try) 2>&5
6844
  ac_status=$?
6845
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6846
  (exit $ac_status); }; } &&
6847
	 { ac_try='test -s conftest.$ac_objext'
6848
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6849
  (eval $ac_try) 2>&5
6850
  ac_status=$?
6851
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6852
  (exit $ac_status); }; }; then
6853
  ac_hi=$ac_mid
6854
else
6855
  echo "$as_me: failed program was:" >&5
6856
sed 's/^/| /' conftest.$ac_ext >&5
6857
6858
ac_lo=`expr '(' $ac_mid ')' + 1`
6859
fi
6860
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
6861
done
6862
case $ac_lo in
6863
?*) res_lo=$ac_lo;;
6864
'') result=? ;;
6865
esac
6866
else
6867
  if test "$cross_compiling" = yes; then
6868
  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
6869
See \`config.log' for more details." >&5
6870
echo "$as_me: error: cannot run test program while cross compiling
6871
See \`config.log' for more details." >&2;}
6872
   { (exit 1); exit 1; }; }
6873
else
6874
  cat >conftest.$ac_ext <<_ACEOF
6875
/* confdefs.h.  */
6876
_ACEOF
6877
cat confdefs.h >>conftest.$ac_ext
6878
cat >>conftest.$ac_ext <<_ACEOF
6879
/* end confdefs.h.  */
6880
#include <stddef.h>
6881
long longval () { return ~(size_t)0 % 10; }
6882
unsigned long ulongval () { return ~(size_t)0 % 10; }
6883
#include <stdio.h>
6884
#include <stdlib.h>
6885
int
6886
main ()
6887
{
6888
6889
  FILE *f = fopen ("conftest.val", "w");
6890
  if (! f)
6891
    exit (1);
6892
  if ((~(size_t)0 % 10) < 0)
6893
    {
6894
      long i = longval ();
6895
      if (i != (~(size_t)0 % 10))
6896
	exit (1);
6897
      fprintf (f, "%ld\n", i);
6898
    }
6899
  else
6900
    {
6901
      unsigned long i = ulongval ();
6902
      if (i != (~(size_t)0 % 10))
6903
	exit (1);
6904
      fprintf (f, "%lu\n", i);
6905
    }
6906
  exit (ferror (f) || fclose (f) != 0);
6907
6908
  ;
6909
  return 0;
6910
}
6911
_ACEOF
6912
rm -f conftest$ac_exeext
6913
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
6914
  (eval $ac_link) 2>&5
6915
  ac_status=$?
6916
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6917
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
6918
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6919
  (eval $ac_try) 2>&5
6920
  ac_status=$?
6921
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6922
  (exit $ac_status); }; }; then
6923
  res_lo=`cat conftest.val`
6924
else
6925
  echo "$as_me: program exited with status $ac_status" >&5
6926
echo "$as_me: failed program was:" >&5
6927
sed 's/^/| /' conftest.$ac_ext >&5
6928
6929
( exit $ac_status )
6930
result=?
6931
fi
6932
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
6933
fi
6934
fi
6935
rm -f conftest.val
6936
    if test "$cross_compiling" = yes; then
6937
  # Depending upon the size, compute the lo and hi bounds.
6938
cat >conftest.$ac_ext <<_ACEOF
6939
/* confdefs.h.  */
6940
_ACEOF
6941
cat confdefs.h >>conftest.$ac_ext
6942
cat >>conftest.$ac_ext <<_ACEOF
6943
/* end confdefs.h.  */
6944
#include <stddef.h>
6945
int
6946
main ()
6947
{
6948
static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)];
6949
test_array [0] = 0
6950
6951
  ;
6952
  return 0;
6953
}
6954
_ACEOF
6955
rm -f conftest.$ac_objext
6956
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6957
  (eval $ac_compile) 2>conftest.er1
6958
  ac_status=$?
6959
  grep -v '^ *+' conftest.er1 >conftest.err
6960
  rm -f conftest.er1
6961
  cat conftest.err >&5
6962
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6963
  (exit $ac_status); } &&
6964
	 { ac_try='test -z "$ac_c_werror_flag"
6965
			 || test ! -s conftest.err'
6966
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6967
  (eval $ac_try) 2>&5
6968
  ac_status=$?
6969
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6970
  (exit $ac_status); }; } &&
6971
	 { ac_try='test -s conftest.$ac_objext'
6972
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
6973
  (eval $ac_try) 2>&5
6974
  ac_status=$?
6975
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
6976
  (exit $ac_status); }; }; then
6977
  ac_lo=0 ac_mid=0
6978
  while :; do
6979
    cat >conftest.$ac_ext <<_ACEOF
6980
/* confdefs.h.  */
6981
_ACEOF
6982
cat confdefs.h >>conftest.$ac_ext
6983
cat >>conftest.$ac_ext <<_ACEOF
6984
/* end confdefs.h.  */
6985
#include <stddef.h>
6986
int
6987
main ()
6988
{
6989
static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)];
6990
test_array [0] = 0
6991
6992
  ;
6993
  return 0;
6994
}
6995
_ACEOF
6996
rm -f conftest.$ac_objext
6997
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6998
  (eval $ac_compile) 2>conftest.er1
6999
  ac_status=$?
7000
  grep -v '^ *+' conftest.er1 >conftest.err
7001
  rm -f conftest.er1
7002
  cat conftest.err >&5
7003
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7004
  (exit $ac_status); } &&
7005
	 { ac_try='test -z "$ac_c_werror_flag"
7006
			 || test ! -s conftest.err'
7007
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7008
  (eval $ac_try) 2>&5
7009
  ac_status=$?
7010
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7011
  (exit $ac_status); }; } &&
7012
	 { ac_try='test -s conftest.$ac_objext'
7013
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7014
  (eval $ac_try) 2>&5
7015
  ac_status=$?
7016
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7017
  (exit $ac_status); }; }; then
7018
  ac_hi=$ac_mid; break
7019
else
7020
  echo "$as_me: failed program was:" >&5
7021
sed 's/^/| /' conftest.$ac_ext >&5
7022
7023
ac_lo=`expr $ac_mid + 1`
7024
		    if test $ac_lo -le $ac_mid; then
7025
		      ac_lo= ac_hi=
7026
		      break
7027
		    fi
7028
		    ac_mid=`expr 2 '*' $ac_mid + 1`
7029
fi
7030
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7031
  done
7032
else
7033
  echo "$as_me: failed program was:" >&5
7034
sed 's/^/| /' conftest.$ac_ext >&5
7035
7036
cat >conftest.$ac_ext <<_ACEOF
7037
/* confdefs.h.  */
7038
_ACEOF
7039
cat confdefs.h >>conftest.$ac_ext
7040
cat >>conftest.$ac_ext <<_ACEOF
7041
/* end confdefs.h.  */
7042
#include <stddef.h>
7043
int
7044
main ()
7045
{
7046
static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)];
7047
test_array [0] = 0
7048
7049
  ;
7050
  return 0;
7051
}
7052
_ACEOF
7053
rm -f conftest.$ac_objext
7054
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7055
  (eval $ac_compile) 2>conftest.er1
7056
  ac_status=$?
7057
  grep -v '^ *+' conftest.er1 >conftest.err
7058
  rm -f conftest.er1
7059
  cat conftest.err >&5
7060
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7061
  (exit $ac_status); } &&
7062
	 { ac_try='test -z "$ac_c_werror_flag"
7063
			 || test ! -s conftest.err'
7064
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7065
  (eval $ac_try) 2>&5
7066
  ac_status=$?
7067
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7068
  (exit $ac_status); }; } &&
7069
	 { ac_try='test -s conftest.$ac_objext'
7070
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7071
  (eval $ac_try) 2>&5
7072
  ac_status=$?
7073
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7074
  (exit $ac_status); }; }; then
7075
  ac_hi=-1 ac_mid=-1
7076
  while :; do
7077
    cat >conftest.$ac_ext <<_ACEOF
7078
/* confdefs.h.  */
7079
_ACEOF
7080
cat confdefs.h >>conftest.$ac_ext
7081
cat >>conftest.$ac_ext <<_ACEOF
7082
/* end confdefs.h.  */
7083
#include <stddef.h>
7084
int
7085
main ()
7086
{
7087
static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)];
7088
test_array [0] = 0
7089
7090
  ;
7091
  return 0;
7092
}
7093
_ACEOF
7094
rm -f conftest.$ac_objext
7095
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7096
  (eval $ac_compile) 2>conftest.er1
7097
  ac_status=$?
7098
  grep -v '^ *+' conftest.er1 >conftest.err
7099
  rm -f conftest.er1
7100
  cat conftest.err >&5
7101
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7102
  (exit $ac_status); } &&
7103
	 { ac_try='test -z "$ac_c_werror_flag"
7104
			 || test ! -s conftest.err'
7105
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7106
  (eval $ac_try) 2>&5
7107
  ac_status=$?
7108
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7109
  (exit $ac_status); }; } &&
7110
	 { ac_try='test -s conftest.$ac_objext'
7111
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7112
  (eval $ac_try) 2>&5
7113
  ac_status=$?
7114
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7115
  (exit $ac_status); }; }; then
7116
  ac_lo=$ac_mid; break
7117
else
7118
  echo "$as_me: failed program was:" >&5
7119
sed 's/^/| /' conftest.$ac_ext >&5
7120
7121
ac_hi=`expr '(' $ac_mid ')' - 1`
7122
		       if test $ac_mid -le $ac_hi; then
7123
			 ac_lo= ac_hi=
7124
			 break
7125
		       fi
7126
		       ac_mid=`expr 2 '*' $ac_mid`
7127
fi
7128
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7129
  done
7130
else
7131
  echo "$as_me: failed program was:" >&5
7132
sed 's/^/| /' conftest.$ac_ext >&5
7133
7134
ac_lo= ac_hi=
7135
fi
7136
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7137
fi
7138
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7139
# Binary search between lo and hi bounds.
7140
while test "x$ac_lo" != "x$ac_hi"; do
7141
  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
7142
  cat >conftest.$ac_ext <<_ACEOF
7143
/* confdefs.h.  */
7144
_ACEOF
7145
cat confdefs.h >>conftest.$ac_ext
7146
cat >>conftest.$ac_ext <<_ACEOF
7147
/* end confdefs.h.  */
7148
#include <stddef.h>
7149
int
7150
main ()
7151
{
7152
static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)];
7153
test_array [0] = 0
7154
7155
  ;
7156
  return 0;
7157
}
7158
_ACEOF
7159
rm -f conftest.$ac_objext
7160
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7161
  (eval $ac_compile) 2>conftest.er1
7162
  ac_status=$?
7163
  grep -v '^ *+' conftest.er1 >conftest.err
7164
  rm -f conftest.er1
7165
  cat conftest.err >&5
7166
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7167
  (exit $ac_status); } &&
7168
	 { ac_try='test -z "$ac_c_werror_flag"
7169
			 || test ! -s conftest.err'
7170
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7171
  (eval $ac_try) 2>&5
7172
  ac_status=$?
7173
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7174
  (exit $ac_status); }; } &&
7175
	 { ac_try='test -s conftest.$ac_objext'
7176
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7177
  (eval $ac_try) 2>&5
7178
  ac_status=$?
7179
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7180
  (exit $ac_status); }; }; then
7181
  ac_hi=$ac_mid
7182
else
7183
  echo "$as_me: failed program was:" >&5
7184
sed 's/^/| /' conftest.$ac_ext >&5
7185
7186
ac_lo=`expr '(' $ac_mid ')' + 1`
7187
fi
7188
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7189
done
7190
case $ac_lo in
7191
?*) fits_in_uint=$ac_lo;;
7192
'') result=? ;;
7193
esac
7194
else
7195
  if test "$cross_compiling" = yes; then
7196
  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
7197
See \`config.log' for more details." >&5
7198
echo "$as_me: error: cannot run test program while cross compiling
7199
See \`config.log' for more details." >&2;}
7200
   { (exit 1); exit 1; }; }
7201
else
7202
  cat >conftest.$ac_ext <<_ACEOF
7203
/* confdefs.h.  */
7204
_ACEOF
7205
cat confdefs.h >>conftest.$ac_ext
7206
cat >>conftest.$ac_ext <<_ACEOF
7207
/* end confdefs.h.  */
7208
#include <stddef.h>
7209
long longval () { return sizeof (size_t) <= sizeof (unsigned int); }
7210
unsigned long ulongval () { return sizeof (size_t) <= sizeof (unsigned int); }
7211
#include <stdio.h>
7212
#include <stdlib.h>
7213
int
7214
main ()
7215
{
7216
7217
  FILE *f = fopen ("conftest.val", "w");
7218
  if (! f)
7219
    exit (1);
7220
  if ((sizeof (size_t) <= sizeof (unsigned int)) < 0)
7221
    {
7222
      long i = longval ();
7223
      if (i != (sizeof (size_t) <= sizeof (unsigned int)))
7224
	exit (1);
7225
      fprintf (f, "%ld\n", i);
7226
    }
7227
  else
7228
    {
7229
      unsigned long i = ulongval ();
7230
      if (i != (sizeof (size_t) <= sizeof (unsigned int)))
7231
	exit (1);
7232
      fprintf (f, "%lu\n", i);
7233
    }
7234
  exit (ferror (f) || fclose (f) != 0);
7235
7236
  ;
7237
  return 0;
7238
}
7239
_ACEOF
7240
rm -f conftest$ac_exeext
7241
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
7242
  (eval $ac_link) 2>&5
7243
  ac_status=$?
7244
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7245
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
7246
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7247
  (eval $ac_try) 2>&5
7248
  ac_status=$?
7249
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7250
  (exit $ac_status); }; }; then
7251
  fits_in_uint=`cat conftest.val`
7252
else
7253
  echo "$as_me: program exited with status $ac_status" >&5
7254
echo "$as_me: failed program was:" >&5
7255
sed 's/^/| /' conftest.$ac_ext >&5
7256
7257
( exit $ac_status )
7258
result=?
7259
fi
7260
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
7261
fi
7262
fi
7263
rm -f conftest.val
7264
    if test "$fits_in_uint" = 1; then
7265
                  cat >conftest.$ac_ext <<_ACEOF
7266
/* confdefs.h.  */
7267
_ACEOF
7268
cat confdefs.h >>conftest.$ac_ext
7269
cat >>conftest.$ac_ext <<_ACEOF
7270
/* end confdefs.h.  */
7271
#include <stddef.h>
7272
        extern size_t foo;
7273
        extern unsigned long foo;
7274
7275
int
7276
main ()
7277
{
7278
7279
  ;
7280
  return 0;
7281
}
7282
_ACEOF
7283
rm -f conftest.$ac_objext
7284
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7285
  (eval $ac_compile) 2>conftest.er1
7286
  ac_status=$?
7287
  grep -v '^ *+' conftest.er1 >conftest.err
7288
  rm -f conftest.er1
7289
  cat conftest.err >&5
7290
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7291
  (exit $ac_status); } &&
7292
	 { ac_try='test -z "$ac_c_werror_flag"
7293
			 || test ! -s conftest.err'
7294
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7295
  (eval $ac_try) 2>&5
7296
  ac_status=$?
7297
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7298
  (exit $ac_status); }; } &&
7299
	 { ac_try='test -s conftest.$ac_objext'
7300
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7301
  (eval $ac_try) 2>&5
7302
  ac_status=$?
7303
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7304
  (exit $ac_status); }; }; then
7305
  fits_in_uint=0
7306
else
7307
  echo "$as_me: failed program was:" >&5
7308
sed 's/^/| /' conftest.$ac_ext >&5
7309
7310
fi
7311
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7312
    fi
7313
    if test -z "$result"; then
7314
      if test "$fits_in_uint" = 1; then
7315
        result="$res_hi$res_lo"U
7316
      else
7317
        result="$res_hi$res_lo"UL
7318
      fi
7319
    else
7320
            result='~(size_t)0'
7321
    fi
7322
  fi
7323
  echo "$as_me:$LINENO: result: $result" >&5
7324
echo "${ECHO_T}$result" >&6
7325
  if test "$result" != yes; then
7326
7327
cat >>confdefs.h <<_ACEOF
7328
#define SIZE_MAX $result
7329
_ACEOF
7330
7331
  fi
7332
7333
echo "$as_me:$LINENO: checking for inline" >&5
7334
echo $ECHO_N "checking for inline... $ECHO_C" >&6
7335
if test "${ac_cv_c_inline+set}" = set; then
7336
  echo $ECHO_N "(cached) $ECHO_C" >&6
7337
else
7338
  ac_cv_c_inline=no
7339
for ac_kw in inline __inline__ __inline; do
7340
  cat >conftest.$ac_ext <<_ACEOF
7341
/* confdefs.h.  */
7342
_ACEOF
7343
cat confdefs.h >>conftest.$ac_ext
7344
cat >>conftest.$ac_ext <<_ACEOF
7345
/* end confdefs.h.  */
7346
#ifndef __cplusplus
7347
typedef int foo_t;
7348
static $ac_kw foo_t static_foo () {return 0; }
7349
$ac_kw foo_t foo () {return 0; }
7350
#endif
7351
7352
_ACEOF
7353
rm -f conftest.$ac_objext
7354
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7355
  (eval $ac_compile) 2>conftest.er1
7356
  ac_status=$?
7357
  grep -v '^ *+' conftest.er1 >conftest.err
7358
  rm -f conftest.er1
7359
  cat conftest.err >&5
7360
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7361
  (exit $ac_status); } &&
7362
	 { ac_try='test -z "$ac_c_werror_flag"
7363
			 || test ! -s conftest.err'
7364
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7365
  (eval $ac_try) 2>&5
7366
  ac_status=$?
7367
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7368
  (exit $ac_status); }; } &&
7369
	 { ac_try='test -s conftest.$ac_objext'
7370
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7371
  (eval $ac_try) 2>&5
7372
  ac_status=$?
7373
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7374
  (exit $ac_status); }; }; then
7375
  ac_cv_c_inline=$ac_kw; break
7376
else
7377
  echo "$as_me: failed program was:" >&5
7378
sed 's/^/| /' conftest.$ac_ext >&5
7379
7380
fi
7381
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7382
done
7383
7384
fi
7385
echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
7386
echo "${ECHO_T}$ac_cv_c_inline" >&6
7387
7388
7389
case $ac_cv_c_inline in
7390
  inline | yes) ;;
7391
  *)
7392
    case $ac_cv_c_inline in
7393
      no) ac_val=;;
7394
      *) ac_val=$ac_cv_c_inline;;
7395
    esac
7396
    cat >>confdefs.h <<_ACEOF
7397
#ifndef __cplusplus
7398
#define inline $ac_val
7399
#endif
7400
_ACEOF
7401
    ;;
7402
esac
7403
7404
7405
7406
7407
7408
for ac_header in stdint.h
7409
do
7410
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7411
if eval "test \"\${$as_ac_Header+set}\" = set"; then
7412
  echo "$as_me:$LINENO: checking for $ac_header" >&5
7413
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
7414
if eval "test \"\${$as_ac_Header+set}\" = set"; then
7415
  echo $ECHO_N "(cached) $ECHO_C" >&6
7416
fi
7417
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
7418
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
7419
else
7420
  # Is the header compilable?
7421
echo "$as_me:$LINENO: checking $ac_header usability" >&5
7422
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
7423
cat >conftest.$ac_ext <<_ACEOF
7424
/* confdefs.h.  */
7425
_ACEOF
7426
cat confdefs.h >>conftest.$ac_ext
7427
cat >>conftest.$ac_ext <<_ACEOF
7428
/* end confdefs.h.  */
7429
$ac_includes_default
7430
#include <$ac_header>
7431
_ACEOF
7432
rm -f conftest.$ac_objext
7433
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
7434
  (eval $ac_compile) 2>conftest.er1
7435
  ac_status=$?
7436
  grep -v '^ *+' conftest.er1 >conftest.err
7437
  rm -f conftest.er1
7438
  cat conftest.err >&5
7439
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7440
  (exit $ac_status); } &&
7441
	 { ac_try='test -z "$ac_c_werror_flag"
7442
			 || test ! -s conftest.err'
7443
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7444
  (eval $ac_try) 2>&5
7445
  ac_status=$?
7446
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7447
  (exit $ac_status); }; } &&
7448
	 { ac_try='test -s conftest.$ac_objext'
7449
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
7450
  (eval $ac_try) 2>&5
7451
  ac_status=$?
7452
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7453
  (exit $ac_status); }; }; then
7454
  ac_header_compiler=yes
7455
else
7456
  echo "$as_me: failed program was:" >&5
7457
sed 's/^/| /' conftest.$ac_ext >&5
7458
7459
ac_header_compiler=no
7460
fi
7461
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
7462
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
7463
echo "${ECHO_T}$ac_header_compiler" >&6
7464
7465
# Is the header present?
7466
echo "$as_me:$LINENO: checking $ac_header presence" >&5
7467
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
7468
cat >conftest.$ac_ext <<_ACEOF
7469
/* confdefs.h.  */
7470
_ACEOF
7471
cat confdefs.h >>conftest.$ac_ext
7472
cat >>conftest.$ac_ext <<_ACEOF
7473
/* end confdefs.h.  */
7474
#include <$ac_header>
7475
_ACEOF
7476
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
7477
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
7478
  ac_status=$?
7479
  grep -v '^ *+' conftest.er1 >conftest.err
7480
  rm -f conftest.er1
7481
  cat conftest.err >&5
7482
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
7483
  (exit $ac_status); } >/dev/null; then
7484
  if test -s conftest.err; then
7485
    ac_cpp_err=$ac_c_preproc_warn_flag
7486
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
7487
  else
7488
    ac_cpp_err=
7489
  fi
7490
else
7491
  ac_cpp_err=yes
7492
fi
7493
if test -z "$ac_cpp_err"; then
7494
  ac_header_preproc=yes
7495
else
7496
  echo "$as_me: failed program was:" >&5
7497
sed 's/^/| /' conftest.$ac_ext >&5
7498
7499
  ac_header_preproc=no
7500
fi
7501
rm -f conftest.err conftest.$ac_ext
7502
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
7503
echo "${ECHO_T}$ac_header_preproc" >&6
7504
7505
# So?  What about this header?
7506
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
7507
  yes:no: )
7508
    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
7509
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
7510
    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
7511
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
7512
    ac_header_preproc=yes
7513
    ;;
7514
  no:yes:* )
7515
    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
7516
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
7517
    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
7518
echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
7519
    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
7520
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
7521
    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
7522
echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
7523
    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
7524
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
7525
    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
7526
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
7527
    (
7528
      cat <<\_ASBOX
7529
## ------------------------------ ##
7530
## Report this to bug-cvs@gnu.org ##
7531
## ------------------------------ ##
7532
_ASBOX
7533
    ) |
7534
      sed "s/^/$as_me: WARNING:     /" >&2
7535
    ;;
7536
esac
7537
echo "$as_me:$LINENO: checking for $ac_header" >&5
7538
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
7539
if eval "test \"\${$as_ac_Header+set}\" = set"; then
7540
  echo $ECHO_N "(cached) $ECHO_C" >&6
7541
else
7542
  eval "$as_ac_Header=\$ac_header_preproc"
7543
fi
7544
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
7545
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
7546
7547
fi
7548
if test `eval echo '${'$as_ac_Header'}'` = yes; then
7549
  cat >>confdefs.h <<_ACEOF
7550
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7551
_ACEOF
7552
7553
fi
7554
7555
done
7556
7557
7558
7559
6105
cat >>confdefs.h <<\_ACEOF
7560
cat >>confdefs.h <<\_ACEOF
6106
#define getpass cvs_getpass
7561
#define getpass cvs_getpass
6107
_ACEOF
7562
_ACEOF
(-)configure.in (+1 lines)
Lines 191-196 AC_REPLACE_FUNCS(\ Link Here
191
dnl
191
dnl
192
dnl Begin GNULIB stuff.
192
dnl Begin GNULIB stuff.
193
dnl
193
dnl
194
gl_XSIZE
194
195
195
dnl We always want to use the GNULIB getpass, so define its name to something
196
dnl We always want to use the GNULIB getpass, so define its name to something
196
dnl that won't conflict with system declarations.
197
dnl that won't conflict with system declarations.
(-)lib/ChangeLog (+5 lines)
Lines 1-3 Link Here
1
2004-05-28  Derek Price  <derek@ximbiot.com>
2
3
	* xsize.h: New file from GNULIB.
4
	* Makefile.am (libcvs_a_SOURCES): Add xsize.h.
5
1
2004-05-15  Derek Price  <derek@ximbiot.com>
6
2004-05-15  Derek Price  <derek@ximbiot.com>
2
7
3
	* libcvs.dsp: Header file list updated.
8
	* libcvs.dsp: Header file list updated.
(-)lib/Makefile.am (+3 lines)
Lines 88-93 EXTRA_DIST = \ Link Here
88
	libcvs.dep libcvs.dsp libcvs.mak \
88
	libcvs.dep libcvs.dsp libcvs.mak \
89
	xgssapi.h
89
	xgssapi.h
90
90
91
# For the xsize module from GNULIB.
92
libcvs_a_SOURCES += xsize.h
93
91
# Until Automake gets its act together
94
# Until Automake gets its act together
92
distclean-local:
95
distclean-local:
93
	rm -f fnmatch.h
96
	rm -f fnmatch.h
(-)lib/Makefile.in (-2 / +4 lines)
Lines 166-171 noinst_LIBRARIES = libcvs.a Link Here
166
# Also should look into unifying regular expression matching in CVS
166
# Also should look into unifying regular expression matching in CVS
167
# with the diff library (perhaps to have the caller, CVS, do the
167
# with the diff library (perhaps to have the caller, CVS, do the
168
# matching?)
168
# matching?)
169
170
# For the xsize module from GNULIB.
169
libcvs_a_SOURCES = \
171
libcvs_a_SOURCES = \
170
	argmatch.c \
172
	argmatch.c \
171
	getdate.y \
173
	getdate.y \
Lines 189-196 libcvs_a_SOURCES = \ Link Here
189
	system.h \
191
	system.h \
190
	wait.h \
192
	wait.h \
191
	xselect.h \
193
	xselect.h \
192
	xtime.h
194
	xtime.h\
193
195
xsize.h
194
libcvs_a_LIBADD = @LIBOBJS@
196
libcvs_a_LIBADD = @LIBOBJS@
195
197
196
EXTRA_DIST = \
198
EXTRA_DIST = \
(-)lib/xsize.h (+108 lines)
Added Link Here
1
/* xsize.h -- Checked size_t computations.
2
3
   Copyright (C) 2003 Free Software Foundation, Inc.
4
5
   This program is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 2, or (at your option)
8
   any later version.
9
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
   You should have received a copy of the GNU General Public License
16
   along with this program; if not, write to the Free Software Foundation,
17
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18
19
#ifndef _XSIZE_H
20
#define _XSIZE_H
21
22
/* Get size_t.  */
23
#include <stddef.h>
24
25
/* Get SIZE_MAX.  */
26
#include <limits.h>
27
#if HAVE_STDINT_H
28
# include <stdint.h>
29
#endif
30
31
/* The size of memory objects is often computed through expressions of
32
   type size_t. Example:
33
      void* p = malloc (header_size + n * element_size).
34
   These computations can lead to overflow.  When this happens, malloc()
35
   returns a piece of memory that is way too small, and the program then
36
   crashes while attempting to fill the memory.
37
   To avoid this, the functions and macros in this file check for overflow.
38
   The convention is that SIZE_MAX represents overflow.
39
   malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
40
   implementation that uses mmap --, it's recommended to use size_overflow_p()
41
   or size_in_bounds_p() before invoking malloc().
42
   The example thus becomes:
43
      size_t size = xsum (header_size, xtimes (n, element_size));
44
      void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
45
*/
46
47
/* Convert an arbitrary value >= 0 to type size_t.  */
48
#define xcast_size_t(N) \
49
  ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
50
51
/* Sum of two sizes, with overflow check.  */
52
static inline size_t
53
#if __GNUC__ >= 3
54
__attribute__ ((__pure__))
55
#endif
56
xsum (size_t size1, size_t size2)
57
{
58
  size_t sum = size1 + size2;
59
  return (sum >= size1 ? sum : SIZE_MAX);
60
}
61
62
/* Sum of three sizes, with overflow check.  */
63
static inline size_t
64
#if __GNUC__ >= 3
65
__attribute__ ((__pure__))
66
#endif
67
xsum3 (size_t size1, size_t size2, size_t size3)
68
{
69
  return xsum (xsum (size1, size2), size3);
70
}
71
72
/* Sum of four sizes, with overflow check.  */
73
static inline size_t
74
#if __GNUC__ >= 3
75
__attribute__ ((__pure__))
76
#endif
77
xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
78
{
79
  return xsum (xsum (xsum (size1, size2), size3), size4);
80
}
81
82
/* Maximum of two sizes, with overflow check.  */
83
static inline size_t
84
#if __GNUC__ >= 3
85
__attribute__ ((__pure__))
86
#endif
87
xmax (size_t size1, size_t size2)
88
{
89
  /* No explicit check is needed here, because for any n:
90
     max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX.  */
91
  return (size1 >= size2 ? size1 : size2);
92
}
93
94
/* Multiplication of a count with an element size, with overflow check.
95
   The count must be >= 0 and the element size must be > 0.
96
   This is a macro, not an inline function, so that it works correctly even
97
   when N is of a wider tupe and N > SIZE_MAX.  */
98
#define xtimes(N, ELSIZE) \
99
  ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
100
101
/* Check for overflow.  */
102
#define size_overflow_p(SIZE) \
103
  ((SIZE) == SIZE_MAX)
104
/* Check against overflow.  */
105
#define size_in_bounds_p(SIZE) \
106
  ((SIZE) != SIZE_MAX)
107
108
#endif /* _XSIZE_H */
(-)src/ChangeLog (+9 lines)
Lines 1-3 Link Here
1
2004-05-28  Derek Price  <derek@ximbiot.com>
2
3
	* commit.c, filesubr.c, history.c, server.c, wrapper.c: Various
4
	security fixes.
5
	(Original patch from Stefan Essler <s.esser@e-matters.de> & Sebastian
6
	Krahmer <krahmer@suse.de>.)
7
8
	* cvs.h: Include xsize.h.
9
1
2004-05-19  Derek Price  <derek@ximbiot.com>
10
2004-05-19  Derek Price  <derek@ximbiot.com>
2
11
3
	* server.c (serve_unchanged, serve_is_modified): Overwrite existing
12
	* server.c (serve_unchanged, serve_is_modified): Overwrite existing
(-)src/commit.c (-1 / +6 lines)
Lines 523-529 commit (argc, argv) Link Here
523
	   operate on, and only work with those files in the future.
523
	   operate on, and only work with those files in the future.
524
	   This saves time--we don't want to search the file system
524
	   This saves time--we don't want to search the file system
525
	   of the working directory twice.  */
525
	   of the working directory twice.  */
526
	find_args.argv = (char **) xmalloc (find_args.argc * sizeof (char **));
526
	if (size_overflow_p (xtimes (find_args.argc, sizeof (char **))))
527
	{
528
	    find_args.argc = 0;
529
	    return 0;
530
	}
531
	find_args.argv = xmalloc (xtimes (find_args.argc, sizeof (char **)));
527
	find_args.argc = 0;
532
	find_args.argc = 0;
528
	walklist (find_args.ulist, copy_ulist, &find_args);
533
	walklist (find_args.ulist, copy_ulist, &find_args);
529
534
(-)src/cvs.h (+4 lines)
Lines 40-45 Link Here
40
#include "popen.h"
40
#include "popen.h"
41
#endif
41
#endif
42
42
43
/* Begin GNULIB headers.  */
44
#include "xsize.h"
45
/* End GNULIB headers.  */
46
43
#ifdef STDC_HEADERS
47
#ifdef STDC_HEADERS
44
#include <stdlib.h>
48
#include <stdlib.h>
45
#else
49
#else
(-)src/filesubr.c (-1 / +7 lines)
Lines 1029-1036 expand_wild (argc, argv, pargc, pargv) Link Here
1029
    char ***pargv;
1029
    char ***pargv;
1030
{
1030
{
1031
    int i;
1031
    int i;
1032
    if (size_overflow_p (xtimes (argc, sizeof (char *)))) {
1033
	*pargc = 0;
1034
	*pargv = NULL;
1035
	error (0, 0, "expand_wild: too many arguments");
1036
	return;
1037
    }
1032
    *pargc = argc;
1038
    *pargc = argc;
1033
    *pargv = (char **) xmalloc (argc * sizeof (char *));
1039
    *pargv = xmalloc (xtimes (argc, sizeof (char *)));
1034
    for (i = 0; i < argc; ++i)
1040
    for (i = 0; i < argc; ++i)
1035
	(*pargv)[i] = xstrdup (argv[i]);
1041
	(*pargv)[i] = xstrdup (argv[i]);
1036
}
1042
}
(-)src/history.c (-9 / +24 lines)
Lines 416-423 history (argc, argv) Link Here
416
		working = 1;
416
		working = 1;
417
		break;
417
		break;
418
	    case 'X':			/* Undocumented debugging flag */
418
	    case 'X':			/* Undocumented debugging flag */
419
#ifdef DEBUG
419
		histfile = optarg;
420
		histfile = optarg;
421
#endif
420
		break;
422
		break;
423
421
	    case 'D':			/* Since specified date */
424
	    case 'D':			/* Since specified date */
422
		if (*since_rev || *since_tag || *backto)
425
		if (*since_rev || *since_tag || *backto)
423
		{
426
		{
Lines 906-914 save_user (name) Link Here
906
{
909
{
907
    if (user_count == user_max)
910
    if (user_count == user_max)
908
    {
911
    {
909
	user_max += USER_INCREMENT;
912
	user_max = xsum (user_max, USER_INCREMENT);
910
	user_list = (char **) xrealloc ((char *) user_list,
913
	if (size_overflow_p (xtimes (user_max, sizeof (char *))))
911
					(int) user_max * sizeof (char *));
914
	{
915
	    error (0, 0, "save_user: too many users");
916
	    return;
917
	}
918
	user_list = xrealloc (user_list, xtimes (user_max, sizeof (char *)));
912
    }
919
    }
913
    user_list[user_count++] = xstrdup (name);
920
    user_list[user_count++] = xstrdup (name);
914
}
921
}
Lines 936-944 save_file (dir, name, module) Link Here
936
943
937
    if (file_count == file_max)
944
    if (file_count == file_max)
938
    {
945
    {
939
	file_max += FILE_INCREMENT;
946
	file_max = xsum (file_max, FILE_INCREMENT);
940
	file_list = (struct file_list_str *) xrealloc ((char *) file_list,
947
	if (size_overflow_p (xtimes (file_max, sizeof (*fl))))
941
						   file_max * sizeof (*fl));
948
	{
949
	    error (0, 0, "save_file: too many files");
950
	    return;
951
	}
952
	file_list = xrealloc (file_list, xtimes (file_max, sizeof (*fl)));
942
    }
953
    }
943
    fl = &file_list[file_count++];
954
    fl = &file_list[file_count++];
944
    fl->l_file = cp = xmalloc (strlen (dir) + strlen (name) + 2);
955
    fl->l_file = cp = xmalloc (strlen (dir) + strlen (name) + 2);
Lines 977-985 save_module (module) Link Here
977
{
988
{
978
    if (mod_count == mod_max)
989
    if (mod_count == mod_max)
979
    {
990
    {
980
	mod_max += MODULE_INCREMENT;
991
	mod_max = xsum (mod_max, MODULE_INCREMENT);
981
	mod_list = (char **) xrealloc ((char *) mod_list,
992
	if (size_overflow_p (xtimes (mod_max, sizeof (char *))))
982
				       mod_max * sizeof (char *));
993
	{
994
	    error (0, 0, "save_module: too many modules");
995
	    return;
996
	}
997
	mod_list = xrealloc (mod_list, xtimes (mod_max, sizeof (char *)));
983
    }
998
    }
984
    mod_list[mod_count++] = xstrdup (module);
999
    mod_list[mod_count++] = xstrdup (module);
985
}
1000
}
(-)src/server.c (-3 / +22 lines)
Lines 917-923 serve_max_dotdot (arg) Link Here
917
    int i;
917
    int i;
918
    char *p;
918
    char *p;
919
919
920
    if (lim < 0)
920
    if (lim < 0 || lim > 10000)
921
	return;
921
	return;
922
    p = xmalloc (strlen (server_temp_dir) + 2 * lim + 10);
922
    p = xmalloc (strlen (server_temp_dir) + 2 * lim + 10);
923
    if (p == NULL)
923
    if (p == NULL)
Lines 2018-2023 serve_notify (arg) Link Here
2018
    {
2018
    {
2019
	char *cp;
2019
	char *cp;
2020
2020
2021
	if (!data[0])
2022
	    goto error;
2023
2021
	if (strchr (data, '+'))
2024
	if (strchr (data, '+'))
2022
	    goto error;
2025
	    goto error;
2023
2026
Lines 2149-2154 serve_argument (arg) Link Here
2149
    char *p;
2152
    char *p;
2150
2153
2151
    if (error_pending()) return;
2154
    if (error_pending()) return;
2155
    
2156
    if (argument_count >= 10000)
2157
    {
2158
	if (alloc_pending (80))
2159
	    sprintf (pending_error_text, 
2160
		     "E Protocol error: too many arguments");
2161
	return;
2162
    }
2152
2163
2153
    if (argument_vector_size <= argument_count)
2164
    if (argument_vector_size <= argument_count)
2154
    {
2165
    {
Lines 2179-2184 serve_argumentx (arg) Link Here
2179
    char *p;
2190
    char *p;
2180
2191
2181
    if (error_pending()) return;
2192
    if (error_pending()) return;
2193
    
2194
    if (argument_count <= 1) 
2195
    {
2196
	if (alloc_pending (80))
2197
	    sprintf (pending_error_text,
2198
		     "E Protocol error: called argumentx without prior call to argument");
2199
	return;
2200
    }
2182
2201
2183
    p = argument_vector[argument_count - 1];
2202
    p = argument_vector[argument_count - 1];
2184
    p = xrealloc (p, strlen (p) + 1 + strlen (arg) + 1);
2203
    p = xrealloc (p, strlen (p) + 1 + strlen (arg) + 1);
Lines 2512-2518 check_command_legal_p (cmd_name) Link Here
2512
		    save some code here...  -kff */
2531
		    save some code here...  -kff */
2513
2532
2514
		 /* Chop newline by hand, for strcmp()'s sake. */
2533
		 /* Chop newline by hand, for strcmp()'s sake. */
2515
		 if (linebuf[num_red - 1] == '\n')
2534
                 if (num_red > 0 && linebuf[num_red - 1] == '\n')
2516
		     linebuf[num_red - 1] = '\0';
2535
		     linebuf[num_red - 1] = '\0';
2517
2536
2518
		 if (strcmp (linebuf, CVS_Username) == 0)
2537
		 if (strcmp (linebuf, CVS_Username) == 0)
Lines 2567-2573 check_command_legal_p (cmd_name) Link Here
2567
	 while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
2586
	 while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
2568
	 {
2587
	 {
2569
	     /* Chop newline by hand, for strcmp()'s sake. */
2588
	     /* Chop newline by hand, for strcmp()'s sake. */
2570
	     if (linebuf[num_red - 1] == '\n')
2589
	     if (num_red > 0 && linebuf[num_red - 1] == '\n')
2571
		 linebuf[num_red - 1] = '\0';
2590
		 linebuf[num_red - 1] = '\0';
2572
2591
2573
	     if (strcmp (linebuf, CVS_Username) == 0)
2592
	     if (strcmp (linebuf, CVS_Username) == 0)
(-)src/wrapper.c (-6 / +28 lines)
Lines 237-242 wrap_unparse_rcs_options (line, first_ca Link Here
237
#endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
237
#endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
238
238
239
/*
239
/*
240
 * Remove fmt str specifier other than %% or %s. And allow
241
 * only max_s %s specifiers
242
 */
243
wrap_clean_fmt_str(char *fmt, int max_s)
244
{
245
    while (*fmt) {
246
	if (fmt[0] == '%' && fmt[1])
247
	{
248
	    if (fmt[1] == '%') 
249
		fmt++;
250
	    else
251
		if (fmt[1] == 's' && max_s > 0)
252
		{
253
		    max_s--;
254
		    fmt++;
255
		} else 
256
		    *fmt = ' ';
257
	}
258
	fmt++;
259
    }
260
    return;
261
}
262
263
/*
240
 * Open a file and read lines, feeding each line to a line parser. Arrange
264
 * Open a file and read lines, feeding each line to a line parser. Arrange
241
 * for keeping a temporary list of wrappers at the end, if the "temp"
265
 * for keeping a temporary list of wrappers at the end, if the "temp"
242
 * argument is set.
266
 * argument is set.
Lines 556-564 wrap_tocvs_process_file(fileName) Link Here
556
    args = xmalloc (strlen (e->tocvsFilter)
580
    args = xmalloc (strlen (e->tocvsFilter)
557
		    + strlen (fileName)
581
		    + strlen (fileName)
558
		    + strlen (buf));
582
		    + strlen (buf));
559
    /* FIXME: sprintf will blow up if the format string contains items other
583
560
       than %s, or contains too many %s's.  We should instead be parsing
584
    wrap_clean_fmt_str(e->tocvsFilter, 2);
561
       e->tocvsFilter ourselves and giving a real error.  */
562
    sprintf (args, e->tocvsFilter, fileName, buf);
585
    sprintf (args, e->tocvsFilter, fileName, buf);
563
    run_setup (args);
586
    run_setup (args);
564
    run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY );
587
    run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY );
Lines 590-598 wrap_fromcvs_process_file(fileName) Link Here
590
613
591
    args = xmalloc (strlen (e->fromcvsFilter)
614
    args = xmalloc (strlen (e->fromcvsFilter)
592
		    + strlen (fileName));
615
		    + strlen (fileName));
593
    /* FIXME: sprintf will blow up if the format string contains items other
616
594
       than %s, or contains too many %s's.  We should instead be parsing
617
    wrap_clean_fmt_str(e->fromcvsFilter, 1);
595
       e->fromcvsFilter ourselves and giving a real error.  */
596
    sprintf (args, e->fromcvsFilter, fileName);
618
    sprintf (args, e->fromcvsFilter, fileName);
597
    run_setup (args);
619
    run_setup (args);
598
    run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL );
620
    run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL );

Return to bug 54773