From 22a1292a42facff7597f3336a91eea57db9709e6 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 25 Feb 1995 01:23:32 +0000 Subject: * io/Makefile (routines): Add euidaccess. * sysdeps/mach/hurd/euidaccess.c: New file. * sysdeps/stub/euidaccess.c: New file. * posix/unistd.h [__USE_GNU] (euidaccess): Declare it. * dirent/Makefile (routines): Add dirfd. * sysdeps/stub/dirfd.c: New file. * sysdeps/unix/dirfd.c: New file. * sysdeps/unix/dirstream.h (_DIR_dirfd): New macro. * dirent/dirent.h (dirfd): Declare new function. Define as macro _DIR_dirfd if that is defined. * sysdeps/mach/hurd/dirstream.h (DIR): Replace `__port' member with `void *__fd'. * sysdeps/mach/hurd/opendir.c: Use DIRP->__fd instead of DIRP->__port. Open the file with `open'; set FD_CLOEXEC on the fd. * sysdeps/mach/hurd/closedir.c: Likewise. * sysdeps/mach/hurd/readdir.c: Likewise. * sysdeps/mach/hurd/dirfd.c: New file. * posix/Makefile (glob/configure): Do cvs commit if there is a CVS directory. (glob/ChangeLog): Likewise. * locale/locale.h (LC_*): Use small integers instead of bit masks. --- ChangeLog | 25 + NEWS | 5 +- dirent/Makefile | 2 +- dirent/dirent.h | 9 +- io/Makefile | 2 +- locale/locale.h | 20 +- manual/memory.texi | 4 +- posix/Makefile | 2 + posix/glob/configure | 1562 +++++++++++++++++++++++++--------------- posix/unistd.h | 8 +- sysdeps/mach/hurd/closedir.c | 16 +- sysdeps/mach/hurd/dirfd.c | 39 + sysdeps/mach/hurd/dirstream.h | 5 +- sysdeps/mach/hurd/euidaccess.c | 58 ++ sysdeps/mach/hurd/opendir.c | 22 +- sysdeps/mach/hurd/readdir.c | 9 +- sysdeps/stub/dirfd.c | 30 + sysdeps/stub/euidaccess.c | 38 + sysdeps/unix/dirfd.c | 28 + sysdeps/unix/dirstream.h | 4 +- 20 files changed, 1279 insertions(+), 609 deletions(-) create mode 100644 sysdeps/mach/hurd/dirfd.c create mode 100644 sysdeps/mach/hurd/euidaccess.c create mode 100644 sysdeps/stub/dirfd.c create mode 100644 sysdeps/stub/euidaccess.c create mode 100644 sysdeps/unix/dirfd.c diff --git a/ChangeLog b/ChangeLog index de130af..a9668d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,30 @@ Fri Feb 24 14:40:48 1995 Roland McGrath + * io/Makefile (routines): Add euidaccess. + * sysdeps/mach/hurd/euidaccess.c: New file. + * sysdeps/stub/euidaccess.c: New file. + * posix/unistd.h [__USE_GNU] (euidaccess): Declare it. + + * dirent/Makefile (routines): Add dirfd. + * sysdeps/stub/dirfd.c: New file. + * sysdeps/unix/dirfd.c: New file. + * sysdeps/unix/dirstream.h (_DIR_dirfd): New macro. + * dirent/dirent.h (dirfd): Declare new function. Define as macro + _DIR_dirfd if that is defined. + * sysdeps/mach/hurd/dirstream.h (DIR): Replace `__port' member + with `void *__fd'. + * sysdeps/mach/hurd/opendir.c: Use DIRP->__fd instead of DIRP->__port. + Open the file with `open'; set FD_CLOEXEC on the fd. + * sysdeps/mach/hurd/closedir.c: Likewise. + * sysdeps/mach/hurd/readdir.c: Likewise. + * sysdeps/mach/hurd/dirfd.c: New file. + + * posix/Makefile (glob/configure): Do cvs commit if there is a CVS + directory. + (glob/ChangeLog): Likewise. + + * locale/locale.h (LC_*): Use small integers instead of bit masks. + * stdio/bug4.c: Put temporary files in /tmp. * stdio/bug3.c: Likewise. * stdio/bug5.c: Likewise. diff --git a/NEWS b/NEWS index dfc213c..cc2b89f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 17 February 1995 +GNU C Library NEWS -- history of user-visible changes. 24 February 1995 Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. See the end for copying conditions. @@ -63,6 +63,9 @@ Version 1.10 numbers as indicated by the locale. In the default "C" locale, numbers are not grouped; but locales for specific countries will define the usual conventions (i.e. separate thousands with `,' in the US locale). + +* New function `euidaccess' checks allowed access to a file like `access', + but using the effective IDs instead of the real IDs. Version 1.09 diff --git a/dirent/Makefile b/dirent/Makefile index ed3335c..0235276 100644 --- a/dirent/Makefile +++ b/dirent/Makefile @@ -24,7 +24,7 @@ subdir := dirent headers := dirent.h dirstream.h routines := opendir closedir readdir rewinddir \ seekdir telldir scandir alphasort \ - getdents + getdents dirfd distribute := direct.h tests := list tst-seekdir diff --git a/dirent/dirent.h b/dirent/dirent.h index b102a47..88a6fc8 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -96,6 +96,13 @@ extern void rewinddir __P ((DIR * __dirp)); #if defined(__USE_BSD) || defined(__USE_MISC) +/* Return the file descriptor used by DIRP. */ +extern int dirfd __P ((DIR *__dirp)); + +#if defined (__OPTIMIZE__) && defined (_DIR_dirfd) +#define dirfd(dirp) _DIR_dirfd (dirp) +#endif + #ifndef MAXNAMLEN /* Get the definitions of the POSIX.1 limits. */ #include diff --git a/io/Makefile b/io/Makefile index 639f6b7..c484e40 100644 --- a/io/Makefile +++ b/io/Makefile @@ -31,7 +31,7 @@ routines := \ mkfifo \ stat fstat lstat \ umask chmod fchmod mkdir \ - open close read write lseek access \ + open close read write lseek access euidaccess \ fcntl flock lockf \ dup dup2 pipe \ creat \ diff --git a/locale/locale.h b/locale/locale.h index 80f9f90..1fc867a 100644 --- a/locale/locale.h +++ b/locale/locale.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,16 +28,14 @@ Cambridge, MA 02139, USA. */ __BEGIN_DECLS /* These are the possibilities for the first argument to setlocale. - Note that although they are bit masks, they cannot be OR'd together - to form a new argument to pass. They must be used one at a time. */ -#define LC_COLLATE (1 << 0) -#define LC_CTYPE (1 << 1) -#define LC_MONETARY (1 << 2) -#define LC_NUMERIC (1 << 3) -#define LC_TIME (1 << 4) -#define LC_RESPONSE (1 << 5) -#define LC_ALL (LC_COLLATE|LC_CTYPE|LC_MONETARY|LC_NUMERIC|LC_TIME|\ - LC_RESPONSE) + The code assumes that LC_ALL is the highest value, and zero the lowest. */ +#define LC_COLLATE 0 +#define LC_CTYPE 1 +#define LC_MONETARY 2 +#define LC_NUMERIC 3 +#define LC_TIME 4 +#define LC_MESSAGES 5 +#define LC_ALL 6 /* Structure giving information about numeric and monetary notation. */ diff --git a/manual/memory.texi b/manual/memory.texi index 9269380..de543ec 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -451,7 +451,7 @@ however---BSD does not provide any way to free such blocks. @comment malloc.h stdlib.h @comment BSD -@deftypefun {void *} memalign (size_t @var{size}, size_t @var{boundary}) +@deftypefun {void *} memalign (size_t @var{boundary}, size_t @var{size}) The @code{memalign} function allocates a block of @var{size} bytes whose address is a multiple of @var{boundary}. The @var{boundary} must be a power of two! The function @code{memalign} works by calling @@ -469,7 +469,7 @@ as the value of the second argument. It is implemented like this: void * valloc (size_t size) @{ - return memalign (size, getpagesize ()); + return memalign (getpagesize (), size); @} @end smallexample @c !!! xref getpagesize diff --git a/posix/Makefile b/posix/Makefile index ae4c1a5..34fe4bb 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -70,11 +70,13 @@ glob/%.h: %.h glob/configure: glob/configure.in cd glob; autoconf $(ACFLAGS) + test -d CVS && cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@ glob/ChangeLog: ../ChangeLog changelog-extract --regexp 'posix/(glob|fnmatch).*' < $< > $@.new chmod a-w $@.new mv -f $@.new $@ + test -d CVS && cvs commit -mRegenerated $@ %.Z: % compress -c $< > $@-tmp diff --git a/posix/glob/configure b/posix/glob/configure index 3831522..d82e6dd 100755 --- a/posix/glob/configure +++ b/posix/glob/configure @@ -1,64 +1,41 @@ -#!/bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 1.11 -# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. - -# This configure script is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as published -# by the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This script is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#! /bin/sh -# Save the original args to write them into config.status later. -configure_args="$*" +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.1.2 +# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. -# Only options that might do something get documented. -ac_usage="Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] ---build=BUILD configure for building on BUILD [BUILD=HOST] ---disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) ---enable-FEATURE[=ARG] include FEATURE [ARG=yes] ---exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local] ---help print this message ---host=HOST configure for HOST [guessed] ---prefix=PREFIX install host independent files in PREFIX [/usr/local] ---quiet, --silent do not print \`checking for...' messages ---srcdir=DIR find the sources in DIR [configure dir or ..] ---target=TARGET configure for TARGET [TARGET=HOST] ---verbose print results of checks ---version print the version of autoconf that created configure ---with-PACKAGE[=ARG] use PACKAGE [ARG=yes] ---without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) ---x-includes=DIR X include files are in DIR ---x-libraries=DIR X library files are in DIR" +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE -exec_prefix= +cache_file=./config.cache +exec_prefix=NONE host=NONE no_create= nonopt=NONE -norecursion= -prefix= -program_prefix= -program_suffix= -program_transform_name= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, silent= +site= srcdir= target=NONE verbose= -x_includes= -x_libraries= +x_includes=NONE +x_libraries=NONE + +# Initialize some other variables. +subdirs= ac_prev= for ac_option @@ -71,14 +48,13 @@ do continue fi - # Accept (but ignore some of) the important Cygnus configure - # options, so we can diagnose typos. - case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac + # Accept the important Cygnus configure options, so we can diagnose typos. + case "$ac_option" in -build | --build | --buil | --bui | --bu | --b) @@ -86,20 +62,27 @@ do -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) build="$ac_optarg" ;; + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - echo "configure: $ac_feature: invalid feature name" >&2; exit 1 + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - echo "configure: $ac_feature: invalid feature name" >&2; exit 1 + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in @@ -108,7 +91,6 @@ do esac eval "enable_${ac_feature}='$ac_optarg'" ;; - # For backward compatibility, recognize -exec-prefix and --exec_prefix. -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) @@ -119,11 +101,42 @@ do exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) - with_gas=yes ;; # Obsolete; use --with-gas. + # Obsolete; use --with-gas. + with_gas=yes ;; -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF -$ac_usage +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=PREFIX install architecture-dependent files in PREFIX + [same as prefix] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +--enable and --with options recognized:$ac_help EOF exit 0 ;; @@ -133,15 +146,16 @@ EOF host="$ac_optarg" ;; -nfp | --nfp | --nf) - with_fp=no ;; # Obsolete; use --without-fp. + # Obsolete; use --without-fp. + with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; - -norecursion | --norecursion | --norecursio | --norecursi \ - | --norecurs | --norecur | --norecu | --norec | --nore | --nor) - norecursion=yes ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; @@ -183,6 +197,11 @@ EOF | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -197,14 +216,14 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 1.11" + echo "configure generated by autoconf version 2.1.2" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - echo "configure: $ac_package: invalid package name" >&2; exit 1 + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in @@ -215,14 +234,16 @@ EOF -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - echo "configure: $ac_package: invalid package name" >&2; exit 1 + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; - --x) with_x=yes ;; # Obsolete; use --with-x. + --x) + # Obsolete; use --with-x. + with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) @@ -238,15 +259,15 @@ EOF | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; - -*) echo "configure: $ac_option: invalid option; use --help to show usage" >&2; exit 1 + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" >&2 + echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then - echo "configure: can only configure for one host and one target at a time" >&2; exit 1 + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; @@ -255,31 +276,53 @@ EOF done if test -n "$ac_prev"; then - echo "configure: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" >&2; exit 1 + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 fi +exec 5>./config.log -trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15 -trap 'rm -fr confdefs* $ac_clean_files' 0 +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 -# Save the original args if we used an alternate arg parser. -ac_configure_temp="${configure_args-$*}" -# Strip out --no-create and --norecursion so they don't pile up. -configure_args= -for ac_arg in $ac_configure_temp; do +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; - -norecursion | --norecursion | --norecursio | --norecursi \ - | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;; - *) configure_args="$configure_args $ac_arg" ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. +# Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = 'set'; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = 'set'; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -293,7 +336,7 @@ ac_unique_file=fnmatch.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then `..'. + # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. @@ -301,581 +344,961 @@ if test -z "$srcdir"; then if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi +else + ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then - if test x$ac_srcdir_defaulted = xyes; then - echo "configure: can not find sources in ${ac_confdir} or .." >&2; exit 1 + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else - echo "configure: can not find sources in ${srcdir}" >&2; exit 1 + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='${CPP}' -ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS >/dev/null 2>&1' +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5' +ac_link='${CC-cc} conftest.$ac_ext $CFLAGS $CPPFLAGS $LDFLAGS -o conftest $LIBS 1>&5 2>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi - if test -z "$RANLIB"; then - # Extract the first word of `ranlib', so it can be a program name with args. - set ac_dummy ranlib; ac_word=$2 - test -n "$silent" || echo "checking for $ac_word" + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - RANLIB="ranlib" + ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" + test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5 | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi fi -test -z "$RANLIB" && RANLIB=":" -test -n "$RANLIB" && test -n "$verbose" && echo " setting RANLIB to $RANLIB" +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* -test -n "$silent" || echo "checking how to run the C preprocessor" +fi + echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi if test -z "$CPP"; then - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and ``${CC-cc}'' will simply confuse - # make. It must be expanded now. +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" - cat > conftest.${ac_ext} < conftest.$ac_ext < +#include Syntax Error EOF -# Some shells (Coherent) do redirections in the wrong order, so need -# the parens. -ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"` +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else + echo "$ac_err" >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.${ac_ext} < conftest.$ac_ext < +#include Syntax Error EOF -# Some shells (Coherent) do redirections in the wrong order, so need -# the parens. -ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"` +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else + echo "$ac_err" >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* + ac_cv_prog_CPP="$CPP" fi -test -n "$verbose" && echo " setting CPP to $CPP" - test -n "$silent" || echo "checking for AIX" -cat > conftest.${ac_ext} <&6 + echo $ac_n "checking for AIX""... $ac_c" 1>&6 +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining _ALL_SOURCE" -echo "#define" _ALL_SOURCE "1" >> confdefs.h -DEFS="$DEFS -D_ALL_SOURCE=1" -} + echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF +#define _ALL_SOURCE 1 +EOF + +else + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +ac_safe=`echo "minix/config.h" | tr './\055' '___'` +echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MINIX=yes +else + echo "$ac_t""no" 1>&6 +MINIX= +fi + +if test "$MINIX" = yes; then + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define _POSIX_1_SOURCE 2 +EOF + + cat >> confdefs.h <<\EOF +#define _MINIX 1 +EOF +fi -test -n "$silent" || echo "checking for POSIXized ISC" +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then - ISC=1 # If later tests want to check for ISC. - -{ -test -n "$verbose" && \ -echo " defining _POSIX_SOURCE" -echo "#define" _POSIX_SOURCE "1" >> confdefs.h -DEFS="$DEFS -D_POSIX_SOURCE=1" -} + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF - if test -n "$GCC"; then + if test "$GCC" = yes; then CC="$CC -posix" else CC="$CC -Xp" fi +else + echo "$ac_t""no" 1>&6 + ISC= fi -test -n "$silent" || echo "checking for minix/config.h" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < + +int main() { return 0; } +int t() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } EOF -# Some shells (Coherent) do redirections in the wrong order, so need -# the parens. -ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"` -if test -z "$ac_err"; then +if eval $ac_compile; then rm -rf conftest* - MINIX=1 - + ac_cv_c_const=yes +else + rm -rf conftest* + ac_cv_c_const=no fi rm -f conftest* -# The Minix shell can't assign to the same variable on the same line! -if test -n "$MINIX"; then - -{ -test -n "$verbose" && \ -echo " defining _POSIX_SOURCE" -echo "#define" _POSIX_SOURCE "1" >> confdefs.h -DEFS="$DEFS -D_POSIX_SOURCE=1" -} - - -{ -test -n "$verbose" && \ -echo " defining" _POSIX_1_SOURCE to be "2" -echo "#define" _POSIX_1_SOURCE "2" >> confdefs.h -DEFS="$DEFS -D_POSIX_1_SOURCE=2" -} +fi +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF - -{ -test -n "$verbose" && \ -echo " defining _MINIX" -echo "#define" _MINIX "1" >> confdefs.h -DEFS="$DEFS -D_MINIX=1" -} +fi +# If we cannot run a trivial program, we must be cross compiling. +echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_cross=yes +else +cat > conftest.$ac_ext </dev/null; then + ac_cv_c_cross=no +else + ac_cv_c_cross=yes +fi +fi +rm -fr conftest* fi +cross_compiling=$ac_cv_c_cross +echo "$ac_t""$ac_cv_c_cross" 1>&6 -test -n "$silent" || echo "checking for ANSI C header files" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < #include #include #include EOF -# Some shells (Coherent) do redirections in the wrong order, so need -# the parens. -ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"` +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -echo '#include "confdefs.h" -#include ' > conftest.${ac_ext} -eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1" -if egrep "memchr" conftest.out >/dev/null 2>&1; then +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else rm -rf conftest* - # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -cat > conftest.${ac_ext} < conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + ac_cv_header_stdc=no +else +cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e,f) (((e) && !(f)) || (!(e) && (f))) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -eval $ac_compile +eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -echo '#include "confdefs.h" -#include ' > conftest.${ac_ext} -eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1" -if egrep "free" conftest.out >/dev/null 2>&1; then - rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining STDC_HEADERS" -echo "#define" STDC_HEADERS "1" >> confdefs.h -DEFS="$DEFS -DSTDC_HEADERS=1" -} - - + : +else + ac_cv_header_stdc=no fi -rm -f conftest* - - fi rm -fr conftest* - fi -rm -f conftest* - +fi +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF fi -rm -f conftest* for ac_hdr in memory.h unistd.h string.h do -ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'` -test -n "$silent" || echo "checking for ${ac_hdr}" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include <$ac_hdr> EOF -# Some shells (Coherent) do redirections in the wrong order, so need -# the parens. -ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"` +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining ${ac_tr_hdr}" -echo "#define" ${ac_tr_hdr} "1" >> confdefs.h -DEFS="$DEFS -D${ac_tr_hdr}=1" -} - - + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'` + cat >> confdefs.h <&6 +fi done -test -n "$silent" || echo "checking for directory library header" -ac_dir_header= -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for dirent.h" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < -#include +#include <$ac_hdr> int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } +int t() { +DIR *dirp = 0; +; return 0; } EOF if eval $ac_compile; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining DIRENT" -echo "#define" DIRENT "1" >> confdefs.h -DEFS="$DEFS -DDIRENT=1" -} - ac_dir_header=dirent.h - + eval "ac_cv_header_dirent_$ac_safe=yes" +else + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* -fi -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for sys/ndir.h" -cat > conftest.${ac_ext} < -#include -int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } -EOF -if eval $ac_compile; then - rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining SYSNDIR" -echo "#define" SYSNDIR "1" >> confdefs.h -DEFS="$DEFS -DSYSNDIR=1" -} - ac_dir_header=sys/ndir.h fi -rm -f conftest* +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'` + cat >> confdefs.h <&6 fi -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for sys/dir.h" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_lib_dir'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext < -#include + int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } +int t() { +opendir() +; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining SYSDIR" -echo "#define" SYSDIR "1" >> confdefs.h -DEFS="$DEFS -DSYSDIR=1" -} - ac_dir_header=sys/dir.h - + eval "ac_cv_lib_dir=yes" +else + rm -rf conftest* + eval "ac_cv_lib_dir=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'dir`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 fi -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for ndir.h" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_lib_x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext < -#include + int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } +int t() { +opendir() +; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining NDIR" -echo "#define" NDIR "1" >> confdefs.h -DEFS="$DEFS -DNDIR=1" -} - ac_dir_header=ndir.h - + eval "ac_cv_lib_x=yes" +else + rm -rf conftest* + eval "ac_cv_lib_x=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'x`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 fi -test -n "$silent" || echo "checking for closedir return value" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else +cat > conftest.$ac_ext < -#include <$ac_dir_header> +#include <$ac_header_dirent> int closedir(); main() { exit(closedir(opendir(".")) != 0); } EOF -eval $ac_compile +eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - : + ac_cv_func_closedir_void=no else - -{ -test -n "$verbose" && \ -echo " defining VOID_CLOSEDIR" -echo "#define" VOID_CLOSEDIR "1" >> confdefs.h -DEFS="$DEFS -DVOID_CLOSEDIR=1" -} - + ac_cv_func_closedir_void=yes +fi fi rm -fr conftest* +fi +echo "$ac_t""$ac_cv_func_closedir_void" 1>&6 +if test $ac_cv_func_closedir_void = yes; then + cat >> confdefs.h <<\EOF +#define CLOSEDIR_VOID 1 +EOF + +fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -test -n "$silent" || echo "checking for working alloca.h" -cat > conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < int main() { return 0; } -int t() { char *p = alloca(2 * sizeof(int));; return 0; } +int t() { +char *p = alloca(2 * sizeof(int)); +; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining HAVE_ALLOCA_H" -echo "#define" HAVE_ALLOCA_H "1" >> confdefs.h -DEFS="$DEFS -DHAVE_ALLOCA_H=1" -} + ac_cv_header_alloca_h=yes +else + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF fi -rm -f conftest* -ac_decl="#ifdef __GNUC__ -#define alloca __builtin_alloca -#else -#if HAVE_ALLOCA_H -#include +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_alloca'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# else +# ifdef _AIX #pragma alloca -#else +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); +# endif +# endif +# endif #endif -#endif -#endif -" -test -n "$silent" || echo "checking for alloca" -cat > conftest.${ac_ext} <> confdefs.h -DEFS="$DEFS -DHAVE_ALLOCA=1" -} + ac_cv_func_alloca=yes +else + rm -rf conftest* + ac_cv_func_alloca=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_func_alloca" 1>&6 +if test $ac_cv_func_alloca = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - rm -rf conftest* - ac_alloca_missing=1 -cat > conftest.${ac_ext} < conftest.$ac_ext < conftest.out 2>&1" -if egrep "winnitude" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else rm -rf conftest* - test -n "$silent" || echo "checking for _getb67" -cat > conftest.${ac_ext} <&6 +if test $ac_cv_os_cray = yes; then +echo $ac_n "checking for _getb67""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func__getb67'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include /* Arbitrary system header to define __stub macros. */ +/* Override any gcc2 internal prototype to avoid an error. */ +char _getb67(); + int main() { return 0; } -int t() { +int t() { + /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub__getb67) || defined (__stub____getb67) choke me #else -/* Override any gcc2 internal prototype to avoid an error. */ -extern char _getb67(); _getb67(); +_getb67(); #endif + ; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then rm -rf conftest* - { -test -n "$verbose" && \ -echo " defining" CRAY_STACKSEG_END to be "_getb67" -echo "#define" CRAY_STACKSEG_END "_getb67" >> confdefs.h -DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67" -} + eval "ac_cv_func__getb67=yes" +else + rm -rf conftest* + eval "ac_cv_func__getb67=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'_getb67`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define CRAY_STACKSEG_END _getb67 +EOF else - rm -rf conftest* - test -n "$silent" || echo "checking for GETB67" -cat > conftest.${ac_ext} <&6 +echo $ac_n "checking for GETB67""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_GETB67'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include /* Arbitrary system header to define __stub macros. */ +/* Override any gcc2 internal prototype to avoid an error. */ +char GETB67(); + int main() { return 0; } -int t() { +int t() { + /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_GETB67) || defined (__stub___GETB67) choke me #else -/* Override any gcc2 internal prototype to avoid an error. */ -extern char GETB67(); GETB67(); +GETB67(); #endif + ; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then rm -rf conftest* - { -test -n "$verbose" && \ -echo " defining" CRAY_STACKSEG_END to be "GETB67" -echo "#define" CRAY_STACKSEG_END "GETB67" >> confdefs.h -DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67" -} + eval "ac_cv_func_GETB67=yes" +else + rm -rf conftest* + eval "ac_cv_func_GETB67=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'GETB67`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define CRAY_STACKSEG_END GETB67 +EOF else - rm -rf conftest* - test -n "$silent" || echo "checking for getb67" -cat > conftest.${ac_ext} <&6 +echo $ac_n "checking for getb67""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_getb67'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include /* Arbitrary system header to define __stub macros. */ +/* Override any gcc2 internal prototype to avoid an error. */ +char getb67(); + int main() { return 0; } -int t() { +int t() { + /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getb67) || defined (__stub___getb67) choke me #else -/* Override any gcc2 internal prototype to avoid an error. */ -extern char getb67(); getb67(); +getb67(); #endif + ; return 0; } EOF -if eval $ac_compile; then +if eval $ac_link; then rm -rf conftest* - { -test -n "$verbose" && \ -echo " defining" CRAY_STACKSEG_END to be "getb67" -echo "#define" CRAY_STACKSEG_END "getb67" >> confdefs.h -DEFS="$DEFS -DCRAY_STACKSEG_END=getb67" -} - - + eval "ac_cv_func_getb67=yes" +else + rm -rf conftest* + eval "ac_cv_func_getb67=no" fi rm -f conftest* fi -rm -f conftest* +if eval "test \"`echo '$ac_cv_func_'getb67`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define CRAY_STACKSEG_END getb67 +EOF +else + echo "$ac_t""no" 1>&6 fi -rm -f conftest* - fi -rm -f conftest* - fi -rm -f conftest* - -if test -n "$ac_alloca_missing"; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.o - -{ -test -n "$verbose" && \ -echo " defining C_ALLOCA" -echo "#define" C_ALLOCA "1" >> confdefs.h -DEFS="$DEFS -DC_ALLOCA=1" -} - - test -n "$silent" || echo "checking stack direction for C alloca" - test -n "$silent" || echo "checking whether cross-compiling" -# If we cannot run a trivial program, we must be cross compiling. -cat > conftest.${ac_ext} </dev/null; then - : -else - cross_compiling=1 fi -rm -fr conftest* - -if test -n "$cross_compiling" -then - -{ -test -n "$verbose" && \ -echo " defining" STACK_DIRECTION to be "0" -echo "#define" STACK_DIRECTION "0" >> confdefs.h -DEFS="$DEFS -DSTACK_DIRECTION=0" -} +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 else -cat > conftest.${ac_ext} < conftest.$ac_ext </dev/null; then - -{ -test -n "$verbose" && \ -echo " defining" STACK_DIRECTION to be "1" -echo "#define" STACK_DIRECTION "1" >> confdefs.h -DEFS="$DEFS -DSTACK_DIRECTION=1" -} - - + ac_cv_c_stack_direction=1 else - -{ -test -n "$verbose" && \ -echo " defining" STACK_DIRECTION to be "-1" -echo "#define" STACK_DIRECTION "-1" >> confdefs.h -DEFS="$DEFS -DSTACK_DIRECTION=-1" -} - + ac_cv_c_stack_direction=-1 fi fi rm -fr conftest* fi +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h < conftest.${ac_ext} <&6 +if eval "test \"`echo '$''{'ac_cv_func_strcoll'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_strcoll=no +else +cat > conftest.$ac_ext < main () @@ -930,80 +1351,56 @@ main () strcoll ("123", "456") >= 0); } EOF -eval $ac_compile +eval $ac_link if test -s conftest && (./conftest; exit) 2>/dev/null; then - -{ -test -n "$verbose" && \ -echo " defining HAVE_STRCOLL" -echo "#define" HAVE_STRCOLL "1" >> confdefs.h -DEFS="$DEFS -DHAVE_STRCOLL=1" -} - - + ac_cv_func_strcoll=yes +else + ac_cv_func_strcoll=no fi -rm -fr conftest* -ac_save_LIBS="${LIBS}" -LIBS="${LIBS} -lseq" -ac_have_lib="" -test -n "$silent" || echo "checking for -lseq" -cat > conftest.${ac_ext} < conftest.${ac_ext} <&6 +if test $ac_cv_func_strcoll = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_STRCOLL 1 EOF -eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then - rm -rf conftest* - XENIX=1 fi -rm -f conftest* -if test -n "$XENIX"; then - LIBS="$LIBS -lx" - case "$DEFS" in - *SYSNDIR*) ;; - *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx. - esac +trap '' 1 2 15 +if test -w $cache_file; then +echo "updating cache $cache_file" +cat > $cache_file <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> $cache_file +else +echo "not updating unwritable cache $cache_file" fi +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 -# The preferred way to propogate these variables is regular @ substitutions. -if test -n "$prefix"; then - ac_prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" -else - prefix=/usr/local -fi -if test -n "$exec_prefix"; then - ac_prsub="$ac_prsub -s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" -else - exec_prefix='${prefix}' # Let make expand it. -fi +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. @@ -1012,36 +1409,48 @@ if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi -# Quote sed substitution magic chars in DEFS. -cat >conftest.def < conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g EOF -ac_escape_ampersand_and_backslash='s%[&\\]%\\&%g' -DEFS=`sed "$ac_escape_ampersand_and_backslash" config.status < $CONFIG_STATUS </dev/null | sed 1q`: # -# $0 $configure_args +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. -ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]" +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create - exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create ;; + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "config.status generated by autoconf version 1.11" + echo "$CONFIG_STATUS generated by autoconf version 2.1.2" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1049,41 +1458,62 @@ do esac done +ac_given_srcdir=$srcdir + trap 'rm -f Makefile; exit 1' 1 2 15 -RANLIB='$RANLIB' -CPP='$CPP' -ALLOCA='$ALLOCA' -LIBS='$LIBS' -srcdir='$srcdir' -top_srcdir='$top_srcdir' -prefix='$prefix' -exec_prefix='$exec_prefix' -DEFS='$DEFS' -ac_prsub='$ac_prsub' -ac_vpsub='$ac_vpsub' -extrasub='$extrasub' + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@CC@%$CC%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@CPP@%$CPP%g +s%@ALLOCA@%$ALLOCA%g + +CEOF EOF -cat >> config.status <<\EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. -CONFIG_FILES=${CONFIG_FILES-"Makefile"} -for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else - ac_dir_suffix= + ac_dir_suffix= ac_dots= fi - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` case "$ac_given_srcdir" in .) srcdir=. - if test -z "$ac_dir_suffix"; then top_srcdir=. + if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. @@ -1093,31 +1523,25 @@ for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then echo creating "$ac_file" rm -f "$ac_file" - comment_str="Generated automatically from `echo $ac_file|sed 's|.*/||'`.in by configure." + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in - *.c | *.h | *.C | *.cc | *.m ) echo "/* $comment_str */" > "$ac_file" ;; - * ) echo "# $comment_str" > "$ac_file" ;; + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; esac - sed -e " -$ac_prsub -$ac_vpsub -$extrasub -s%@RANLIB@%$RANLIB%g -s%@CPP@%$CPP%g -s%@ALLOCA@%$ALLOCA%g -s%@LIBS@%$LIBS%g + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g -s%@prefix@%$prefix%g -s%@exec_prefix@%$exec_prefix%g -s%@DEFS@%$DEFS% -" $ac_given_srcdir/${ac_file}.in >> $ac_file +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file fi; done +rm -f conftest.subs + exit 0 EOF -chmod +x config.status -# Some shells look in PATH for config.status without the "./". -test -n "$no_create" || ${CONFIG_SHELL-/bin/sh} ./config.status +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/posix/unistd.h b/posix/unistd.h index 7143fe1..f0254b4 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -107,10 +107,16 @@ __BEGIN_DECLS #define X_OK 1 /* Test for execute permission. */ #define F_OK 0 /* Test for existence. */ -/* Test for access to NAME. */ +/* Test for access to NAME using the real UID and real GID. */ extern int __access __P ((__const char *__name, int __type)); extern int access __P ((__const char *__name, int __type)); +#ifdef __USE_GNU +/* Test for access to NAME using the effective UID and GID + (as normal file operations use). */ +extern int euidaccess __P ((__const char *__name, int __type)); +#endif + /* Values for the WHENCE argument to lseek. */ #ifndef _STDIO_H /* has the same definitions. */ diff --git a/sysdeps/mach/hurd/closedir.c b/sysdeps/mach/hurd/closedir.c index 9d20621..bb970ae 100644 --- a/sysdeps/mach/hurd/closedir.c +++ b/sysdeps/mach/hurd/closedir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,13 +37,13 @@ DEFUN(closedir, (dirp), DIR *dirp) return -1; } - if ((err = __vm_deallocate (__mach_task_self (), - (vm_address_t) dirp->__data, dirp->__allocation)) - || (err = __mach_port_deallocate (__mach_task_self (), dirp->__port))) - { - errno = err; - return -1; - } + if (err = __vm_deallocate (__mach_task_self (), + (vm_address_t) dirp->__data, dirp->__allocation)) + return __hurd_fail (err); + dirp->__data = NULL; + + if (err = _hurd_fd_close (dirp->__fd)) + return __hurd_fail (err); free (dirp); diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c new file mode 100644 index 0000000..366a340 --- /dev/null +++ b/sysdeps/mach/hurd/dirfd.c @@ -0,0 +1,39 @@ +/* dirfd -- Return the file desciptor used by a DIR stream. Hurd version. +Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +int +dirfd (DIR *dirp) +{ + int fd; + __mutex_lock (&_hurd_dtable_lock); + for (fd = 0; fd < _hurd_dtablesize; ++fd) + if (_hurd_dtable[fd] == dirp->__fd) + break; + if (fd == _hurd_dtablesize) + { + errno = EINVAL + fd = -1; + } + __mutex_unlock (&_hurd_dtable_lock); + + return fd; +} diff --git a/sysdeps/mach/hurd/dirstream.h b/sysdeps/mach/hurd/dirstream.h index 0bcec36..42bbd07 100644 --- a/sysdeps/mach/hurd/dirstream.h +++ b/sysdeps/mach/hurd/dirstream.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,8 +27,7 @@ Cambridge, MA 02139, USA. */ typedef struct { - /* XXX we need a namespace-clean name for mach_port_t! */ - unsigned int __port; /* Port to the directory. */ + void *__fd; /* `struct hurd_fd' pointer for descriptor. */ char *__data; /* Directory block. */ int __entry_data; /* Entry number `__data' corresponds to. */ char *__ptr; /* Current pointer into the block. */ diff --git a/sysdeps/mach/hurd/euidaccess.c b/sysdeps/mach/hurd/euidaccess.c new file mode 100644 index 0000000..5ba2af4 --- /dev/null +++ b/sysdeps/mach/hurd/euidaccess.c @@ -0,0 +1,58 @@ +/* Test for access to FILE using effective UID and GID. Hurd version. +Copyright (C) 1991, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include + +int +euidaccess (file, type) + const char *file; + int type; +{ + file_t port; + int allowed, flags; + + port = __file_name_lookup (file, 0, 0); + if (port == MACH_PORT_NULL) + return -1; + + /* Find out what types of access we are allowed to this file. */ + err = __file_check_access (file, &allowed); + __mach_port_deallocate (__mach_task_self (), file); + if (err) + return __hurd_fail (err); + + flags = 0; + if (type & R_OK) + flags |= O_READ; + if (type & W_OK) + flags |= O_WRITE; + if (type & X_OK) + flags |= O_EXEC; + + if (flags & ~allowed) + /* We are not allowed all the requested types of access. */ + return __hurd_fail (EACCES); + + return 0; +} + +weak_alias (__access, access) diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c index d843da8..001016d 100644 --- a/sysdeps/mach/hurd/opendir.c +++ b/sysdeps/mach/hurd/opendir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,21 +36,29 @@ DEFUN(opendir, (name), CONST char *name) { DIR *dirp; file_t port; + int fd; - port = __file_name_lookup (name, O_RDONLY, 0); - if (port == MACH_PORT_NULL) + fd = __open (name, O_RDONLY); + if (fd < 0) return NULL; - /* XXX this port should be deallocated on exec */ - dirp = (DIR *) malloc (sizeof (DIR)); if (dirp == NULL) { - __mach_port_deallocate (__mach_task_self (), port); + __close (fd); return NULL; } - dirp->__port = port; + /* Extract the pointer to the descriptor structure. */ + __mutex_lock (&_hurd_dtable_lock); + dirp->__fd = _hurd_dtable[fd]; + __mutex_unlock (&_hurd_dtable_lock); + + /* Set the descriptor to close on exec. */ + __spin_lock (&dirp->__fd->port.lock); + dirp->__fd->flags |= FD_CLOEXEC; + __spin_unlock (&dirp->__fd->port.lock); + dirp->__data = dirp->__ptr = NULL; dirp->__entry_data = dirp->__entry_ptr = 0; dirp->__allocation = 0; diff --git a/sysdeps/mach/hurd/readdir.c b/sysdeps/mach/hurd/readdir.c index 185aeee..9e9f1ae 100644 --- a/sysdeps/mach/hurd/readdir.c +++ b/sysdeps/mach/hurd/readdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -49,8 +49,11 @@ DEFUN(readdir, (dirp), DIR *dirp) int nentries; error_t err; - if (err = __dir_readdir (dirp->__port, &data, &dirp->__size, - dirp->__entry_ptr, -1, 0, &nentries)) + if (err = HURD_FD_PORT_USE (dirp->__fd, + __dir_readdir (dirp->__port, + &data, &dirp->__size, + dirp->__entry_ptr, + -1, 0, &nentries))) return __hurd_fail (err), NULL; /* DATA now corresponds to entry index DIRP->__entry_ptr. */ diff --git a/sysdeps/stub/dirfd.c b/sysdeps/stub/dirfd.c new file mode 100644 index 0000000..f6ebd04 --- /dev/null +++ b/sysdeps/stub/dirfd.c @@ -0,0 +1,30 @@ +/* dirfd -- Return the file desciptor used by a DIR stream. Stub version. +Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +int +dirfd (dirp) + FILE *dirp; +{ + errno = ENOSYS; + return -1; +} diff --git a/sysdeps/stub/euidaccess.c b/sysdeps/stub/euidaccess.c new file mode 100644 index 0000000..1769e0d --- /dev/null +++ b/sysdeps/stub/euidaccess.c @@ -0,0 +1,38 @@ +/* Test for access to FILE using effective UID and GID. Stub version. +Copyright (C) 1991, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +int +euidaccess (file, type) + const char *file; + int type; +{ + if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0) + { + errno = EINVAL; + return -1; + } + + errno = ENOSYS; + return -1; +} +stub_warning (euidaccess) diff --git a/sysdeps/unix/dirfd.c b/sysdeps/unix/dirfd.c new file mode 100644 index 0000000..6b6f980 --- /dev/null +++ b/sysdeps/unix/dirfd.c @@ -0,0 +1,28 @@ +/* dirfd -- Return the file desciptor used by a DIR stream. Unix version. +Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +int +dirfd (dirp) + FILE *dirp; +{ + return dirp->__fd; +} diff --git a/sysdeps/unix/dirstream.h b/sysdeps/unix/dirstream.h index 20c4922..d8c2395 100644 --- a/sysdeps/unix/dirstream.h +++ b/sysdeps/unix/dirstream.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,4 +40,6 @@ typedef struct struct dirent __entry; /* Returned by `readdir'. */ } DIR; +#define _DIR_dirfd(dirp) ((dirp)->__fd) + #endif /* dirstream.h */ -- cgit v1.1