- Revert last commit, restore the regenerated files aclocal.m4 and configure
From-SVN: r242438
This commit is contained in:
parent
7b277e8b46
commit
2b60167833
188
libiberty/aclocal.m4
vendored
188
libiberty/aclocal.m4
vendored
@ -1,19 +1,175 @@
|
||||
# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
|
||||
sinclude(../config/acx.m4)
|
||||
sinclude(../config/no-executables.m4)
|
||||
sinclude(../config/override.m4)
|
||||
sinclude(../config/picflag.m4)
|
||||
sinclude(../config/warnings.m4)
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
|
||||
# Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
dnl See whether strncmp reads past the end of its string parameters.
|
||||
dnl On some versions of SunOS4 at least, strncmp reads a word at a time
|
||||
dnl but erroneously reads past the end of strings. This can cause
|
||||
dnl a SEGV in some cases.
|
||||
AC_DEFUN(libiberty_AC_FUNC_STRNCMP,
|
||||
[AC_REQUIRE([AC_FUNC_MMAP])
|
||||
AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
|
||||
[AC_TRY_RUN([
|
||||
/* Test by Jim Wilson and Kaveh Ghazi.
|
||||
Check whether strncmp reads past the end of its string parameters. */
|
||||
#include <sys/types.h>
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
m4_include([../config/acx.m4])
|
||||
m4_include([../config/no-executables.m4])
|
||||
m4_include([../config/override.m4])
|
||||
m4_include([../config/picflag.m4])
|
||||
m4_include([../config/warnings.m4])
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAP_ANON
|
||||
#ifdef MAP_ANONYMOUS
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
#else
|
||||
#define MAP_ANON MAP_FILE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
#ifndef O_RDONLY
|
||||
#define O_RDONLY 0
|
||||
#endif
|
||||
|
||||
#define MAP_LEN 0x10000
|
||||
|
||||
main ()
|
||||
{
|
||||
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
|
||||
char *p;
|
||||
int dev_zero;
|
||||
|
||||
dev_zero = open ("/dev/zero", O_RDONLY);
|
||||
if (dev_zero < 0)
|
||||
exit (1);
|
||||
|
||||
p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|
||||
MAP_ANON|MAP_PRIVATE, dev_zero, 0);
|
||||
if (p == (char *)-1)
|
||||
p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|
||||
MAP_ANON|MAP_PRIVATE, -1, 0);
|
||||
if (p == (char *)-1)
|
||||
exit (2);
|
||||
else
|
||||
{
|
||||
char *string = "__si_type_info";
|
||||
char *q = (char *) p + MAP_LEN - strlen (string) - 2;
|
||||
char *r = (char *) p + 0xe;
|
||||
|
||||
strcpy (q, string);
|
||||
strcpy (r, string);
|
||||
strncmp (r, q, 14);
|
||||
}
|
||||
#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
|
||||
exit (0);
|
||||
}
|
||||
], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no,
|
||||
ac_cv_func_strncmp_works=yes)
|
||||
rm -f core core.* *.core])
|
||||
if test $ac_cv_func_strncmp_works = no ; then
|
||||
AC_LIBOBJ([strncmp])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if errno must be declared even when <errno.h> is included.
|
||||
AC_DEFUN(libiberty_AC_DECLARE_ERRNO,
|
||||
[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno,
|
||||
[AC_TRY_COMPILE(
|
||||
[#include <errno.h>],
|
||||
[int x = errno;],
|
||||
libiberty_cv_declare_errno=no,
|
||||
libiberty_cv_declare_errno=yes)])
|
||||
if test $libiberty_cv_declare_errno = yes
|
||||
then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
|
||||
[Define if errno must be declared even when <errno.h> is included.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See whether we need a declaration for a function.
|
||||
AC_DEFUN(libiberty_NEED_DECLARATION,
|
||||
[AC_MSG_CHECKING([whether $1 must be declared])
|
||||
AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
|
||||
[AC_TRY_COMPILE([
|
||||
#include "confdefs.h"
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif],
|
||||
[char *(*pfn) = (char *(*)) $1],
|
||||
libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
|
||||
AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
|
||||
if test $libiberty_cv_decl_needed_$1 = yes; then
|
||||
AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if $1 is not declared in system header files.])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
# We always want a C version of alloca() compiled into libiberty,
|
||||
# because native-compiler support for the real alloca is so !@#$%
|
||||
# unreliable that GCC has decided to use it only when being compiled
|
||||
# by GCC. This is the part of AC_FUNC_ALLOCA that calculates the
|
||||
# information alloca.c needs.
|
||||
AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA,
|
||||
[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
|
||||
[AC_EGREP_CPP(webecray,
|
||||
[#if defined(CRAY) && ! defined(CRAY2)
|
||||
webecray
|
||||
#else
|
||||
wenotbecray
|
||||
#endif
|
||||
], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
|
||||
if test $ac_cv_os_cray = yes; then
|
||||
for ac_func in _getb67 GETB67 getb67; do
|
||||
AC_CHECK_FUNC($ac_func,
|
||||
[AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
|
||||
[Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
|
||||
systems. This function is required for alloca.c support on those
|
||||
systems.]) break])
|
||||
done
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
|
||||
[AC_TRY_RUN([find_stack_direction ()
|
||||
{
|
||||
static char *addr = 0;
|
||||
auto char dummy;
|
||||
if (addr == 0)
|
||||
{
|
||||
addr = &dummy;
|
||||
return find_stack_direction ();
|
||||
}
|
||||
else
|
||||
return (&dummy > addr) ? 1 : -1;
|
||||
}
|
||||
main ()
|
||||
{
|
||||
exit (find_stack_direction() < 0);
|
||||
}],
|
||||
ac_cv_c_stack_direction=1,
|
||||
ac_cv_c_stack_direction=-1,
|
||||
ac_cv_c_stack_direction=0)])
|
||||
AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
|
||||
[Define if you know the direction of stack growth for your system;
|
||||
otherwise it will be automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown])
|
||||
])
|
||||
|
454
libiberty/configure
vendored
454
libiberty/configure
vendored
@ -5112,6 +5112,10 @@ case "${host}" in
|
||||
;;
|
||||
i[34567]86-*-mingw* | x86_64-*-mingw*)
|
||||
;;
|
||||
i[34567]86-*-interix[3-9]*)
|
||||
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
|
||||
# Instead, we relocate shared libraries at runtime.
|
||||
;;
|
||||
i[34567]86-*-nto-qnx*)
|
||||
# QNX uses GNU C++, but need to define -shared option too, otherwise
|
||||
# it will coredump.
|
||||
@ -5300,7 +5304,37 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
|
||||
fi
|
||||
|
||||
|
||||
libiberty_AC_DECLARE_ERRNO
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether errno must be declared" >&5
|
||||
$as_echo_n "checking whether errno must be declared... " >&6; }
|
||||
if test "${libiberty_cv_declare_errno+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <errno.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int x = errno;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
libiberty_cv_declare_errno=no
|
||||
else
|
||||
libiberty_cv_declare_errno=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libiberty_cv_declare_errno" >&5
|
||||
$as_echo "$libiberty_cv_declare_errno" >&6; }
|
||||
if test $libiberty_cv_declare_errno = yes
|
||||
then
|
||||
$as_echo "#define NEED_DECLARATION_ERRNO 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Determine sizes of some types.
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
@ -6369,7 +6403,92 @@ fi
|
||||
done
|
||||
|
||||
|
||||
libiberty_AC_FUNC_C_ALLOCA
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether alloca needs Cray hooks" >&5
|
||||
$as_echo_n "checking whether alloca needs Cray hooks... " >&6; }
|
||||
if test "${ac_cv_os_cray+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#if defined(CRAY) && ! defined(CRAY2)
|
||||
webecray
|
||||
#else
|
||||
wenotbecray
|
||||
#endif
|
||||
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "webecray" >/dev/null 2>&1; then :
|
||||
ac_cv_os_cray=yes
|
||||
else
|
||||
ac_cv_os_cray=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
|
||||
$as_echo "$ac_cv_os_cray" >&6; }
|
||||
if test $ac_cv_os_cray = yes; then
|
||||
for ac_func in _getb67 GETB67 getb67; do
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
eval as_val=\$$as_ac_var
|
||||
if test "x$as_val" = x""yes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define CRAY_STACKSEG_END $ac_func
|
||||
_ACEOF
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
|
||||
$as_echo_n "checking stack direction for C alloca... " >&6; }
|
||||
if test "${ac_cv_c_stack_direction+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
ac_cv_c_stack_direction=0
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = 0;
|
||||
auto char dummy;
|
||||
if (addr == 0)
|
||||
{
|
||||
addr = &dummy;
|
||||
return find_stack_direction ();
|
||||
}
|
||||
else
|
||||
return (&dummy > addr) ? 1 : -1;
|
||||
}
|
||||
main ()
|
||||
{
|
||||
exit (find_stack_direction() < 0);
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
ac_cv_c_stack_direction=1
|
||||
else
|
||||
ac_cv_c_stack_direction=-1
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
|
||||
$as_echo "$ac_cv_c_stack_direction" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define STACK_DIRECTION $ac_cv_c_stack_direction
|
||||
_ACEOF
|
||||
|
||||
|
||||
for ac_header in vfork.h
|
||||
do :
|
||||
ac_fn_c_check_header_preproc "$LINENO" "vfork.h" "ac_cv_header_vfork_h"
|
||||
@ -6885,7 +7004,53 @@ cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_STRVERSCMP $ac_have_decl
|
||||
_ACEOF
|
||||
|
||||
libiberty_NEED_DECLARATION(canonicalize_file_name)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether canonicalize_file_name must be declared" >&5
|
||||
$as_echo_n "checking whether canonicalize_file_name must be declared... " >&6; }
|
||||
if test "${libiberty_cv_decl_needed_canonicalize_file_name+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include "confdefs.h"
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char *(*pfn) = (char *(*)) canonicalize_file_name
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
libiberty_cv_decl_needed_canonicalize_file_name=no
|
||||
else
|
||||
libiberty_cv_decl_needed_canonicalize_file_name=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libiberty_cv_decl_needed_canonicalize_file_name" >&5
|
||||
$as_echo "$libiberty_cv_decl_needed_canonicalize_file_name" >&6; }
|
||||
if test $libiberty_cv_decl_needed_canonicalize_file_name = yes; then
|
||||
|
||||
$as_echo "#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Figure out which version of pexecute to use.
|
||||
@ -6897,7 +7062,288 @@ case "${host}" in
|
||||
esac
|
||||
|
||||
|
||||
libiberty_AC_FUNC_STRNCMP
|
||||
if test x$gcc_no_link = xyes; then
|
||||
if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
|
||||
ac_cv_func_mmap_fixed_mapped=no
|
||||
fi
|
||||
fi
|
||||
if test "x${ac_cv_func_mmap_fixed_mapped}" != xno; then
|
||||
for ac_header in stdlib.h unistd.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_preproc "$LINENO" "$ac_header" "$as_ac_Header"
|
||||
eval as_val=\$$as_ac_Header
|
||||
if test "x$as_val" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in getpagesize
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
|
||||
if test "x$ac_cv_func_getpagesize" = x""yes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
|
||||
$as_echo_n "checking for working mmap... " >&6; }
|
||||
if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
ac_cv_func_mmap_fixed_mapped=no
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
/* malloc might have been renamed as rpl_malloc. */
|
||||
#undef malloc
|
||||
|
||||
/* Thanks to Mike Haertel and Jim Avera for this test.
|
||||
Here is a matrix of mmap possibilities:
|
||||
mmap private not fixed
|
||||
mmap private fixed at somewhere currently unmapped
|
||||
mmap private fixed at somewhere already mapped
|
||||
mmap shared not fixed
|
||||
mmap shared fixed at somewhere currently unmapped
|
||||
mmap shared fixed at somewhere already mapped
|
||||
For private mappings, we should verify that changes cannot be read()
|
||||
back from the file, nor mmap's back from the file at a different
|
||||
address. (There have been systems where private was not correctly
|
||||
implemented like the infamous i386 svr4.0, and systems where the
|
||||
VM page cache was not coherent with the file system buffer cache
|
||||
like early versions of FreeBSD and possibly contemporary NetBSD.)
|
||||
For shared mappings, we should conversely verify that changes get
|
||||
propagated back to all the places they're supposed to be.
|
||||
|
||||
Grep wants private fixed already mapped.
|
||||
The main things grep needs to know about mmap are:
|
||||
* does it exist and is it safe to write into the mmap'd area
|
||||
* how to use it (BSD variants) */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
|
||||
char *malloc ();
|
||||
#endif
|
||||
|
||||
/* This mess was copied from the GNU getpagesize.h. */
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
/* Assume that all systems that can run configure have sys/param.h. */
|
||||
# ifndef HAVE_SYS_PARAM_H
|
||||
# define HAVE_SYS_PARAM_H 1
|
||||
# endif
|
||||
|
||||
# ifdef _SC_PAGESIZE
|
||||
# define getpagesize() sysconf(_SC_PAGESIZE)
|
||||
# else /* no _SC_PAGESIZE */
|
||||
# ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# ifdef EXEC_PAGESIZE
|
||||
# define getpagesize() EXEC_PAGESIZE
|
||||
# else /* no EXEC_PAGESIZE */
|
||||
# ifdef NBPG
|
||||
# define getpagesize() NBPG * CLSIZE
|
||||
# ifndef CLSIZE
|
||||
# define CLSIZE 1
|
||||
# endif /* no CLSIZE */
|
||||
# else /* no NBPG */
|
||||
# ifdef NBPC
|
||||
# define getpagesize() NBPC
|
||||
# else /* no NBPC */
|
||||
# ifdef PAGESIZE
|
||||
# define getpagesize() PAGESIZE
|
||||
# endif /* PAGESIZE */
|
||||
# endif /* no NBPC */
|
||||
# endif /* no NBPG */
|
||||
# endif /* no EXEC_PAGESIZE */
|
||||
# else /* no HAVE_SYS_PARAM_H */
|
||||
# define getpagesize() 8192 /* punt totally */
|
||||
# endif /* no HAVE_SYS_PARAM_H */
|
||||
# endif /* no _SC_PAGESIZE */
|
||||
|
||||
#endif /* no HAVE_GETPAGESIZE */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char *data, *data2, *data3;
|
||||
int i, pagesize;
|
||||
int fd;
|
||||
|
||||
pagesize = getpagesize ();
|
||||
|
||||
/* First, make a file with some known garbage in it. */
|
||||
data = (char *) malloc (pagesize);
|
||||
if (!data)
|
||||
return 1;
|
||||
for (i = 0; i < pagesize; ++i)
|
||||
*(data + i) = rand ();
|
||||
umask (0);
|
||||
fd = creat ("conftest.mmap", 0600);
|
||||
if (fd < 0)
|
||||
return 1;
|
||||
if (write (fd, data, pagesize) != pagesize)
|
||||
return 1;
|
||||
close (fd);
|
||||
|
||||
/* Next, try to mmap the file at a fixed address which already has
|
||||
something else allocated at it. If we can, also make sure that
|
||||
we see the same garbage. */
|
||||
fd = open ("conftest.mmap", O_RDWR);
|
||||
if (fd < 0)
|
||||
return 1;
|
||||
data2 = (char *) malloc (2 * pagesize);
|
||||
if (!data2)
|
||||
return 1;
|
||||
data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
|
||||
if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_FIXED, fd, 0L))
|
||||
return 1;
|
||||
for (i = 0; i < pagesize; ++i)
|
||||
if (*(data + i) != *(data2 + i))
|
||||
return 1;
|
||||
|
||||
/* Finally, make sure that changes to the mapped area do not
|
||||
percolate back to the file as seen by read(). (This is a bug on
|
||||
some variants of i386 svr4.0.) */
|
||||
for (i = 0; i < pagesize; ++i)
|
||||
*(data2 + i) = *(data2 + i) + 1;
|
||||
data3 = (char *) malloc (pagesize);
|
||||
if (!data3)
|
||||
return 1;
|
||||
if (read (fd, data3, pagesize) != pagesize)
|
||||
return 1;
|
||||
for (i = 0; i < pagesize; ++i)
|
||||
if (*(data + i) != *(data3 + i))
|
||||
return 1;
|
||||
close (fd);
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
ac_cv_func_mmap_fixed_mapped=yes
|
||||
else
|
||||
ac_cv_func_mmap_fixed_mapped=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
|
||||
$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
|
||||
if test $ac_cv_func_mmap_fixed_mapped = yes; then
|
||||
|
||||
$as_echo "#define HAVE_MMAP 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
rm -f conftest.mmap
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strncmp" >&5
|
||||
$as_echo_n "checking for working strncmp... " >&6; }
|
||||
if test "${ac_cv_func_strncmp_works+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
ac_cv_func_strncmp_works=yes
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Test by Jim Wilson and Kaveh Ghazi.
|
||||
Check whether strncmp reads past the end of its string parameters. */
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAP_ANON
|
||||
#ifdef MAP_ANONYMOUS
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
#else
|
||||
#define MAP_ANON MAP_FILE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
#ifndef O_RDONLY
|
||||
#define O_RDONLY 0
|
||||
#endif
|
||||
|
||||
#define MAP_LEN 0x10000
|
||||
|
||||
main ()
|
||||
{
|
||||
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
|
||||
char *p;
|
||||
int dev_zero;
|
||||
|
||||
dev_zero = open ("/dev/zero", O_RDONLY);
|
||||
if (dev_zero < 0)
|
||||
exit (1);
|
||||
|
||||
p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|
||||
MAP_ANON|MAP_PRIVATE, dev_zero, 0);
|
||||
if (p == (char *)-1)
|
||||
p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
|
||||
MAP_ANON|MAP_PRIVATE, -1, 0);
|
||||
if (p == (char *)-1)
|
||||
exit (2);
|
||||
else
|
||||
{
|
||||
char *string = "__si_type_info";
|
||||
char *q = (char *) p + MAP_LEN - strlen (string) - 2;
|
||||
char *r = (char *) p + 0xe;
|
||||
|
||||
strcpy (q, string);
|
||||
strcpy (r, string);
|
||||
strncmp (r, q, 14);
|
||||
}
|
||||
#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
|
||||
exit (0);
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
ac_cv_func_strncmp_works=yes
|
||||
else
|
||||
ac_cv_func_strncmp_works=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
rm -f core core.* *.core
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strncmp_works" >&5
|
||||
$as_echo "$ac_cv_func_strncmp_works" >&6; }
|
||||
if test $ac_cv_func_strncmp_works = no ; then
|
||||
case " $LIBOBJS " in
|
||||
*" strncmp.$ac_objext "* ) ;;
|
||||
*) LIBOBJS="$LIBOBJS strncmp.$ac_objext"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Install a library built with a cross compiler in $(tooldir) rather
|
||||
# than $(libdir).
|
||||
|
Loading…
Reference in New Issue
Block a user