Rejigger header generation for default uname implementation.

This commit is contained in:
Roland McGrath 2010-08-24 11:55:53 -07:00
parent f2ac4868b7
commit 090555538d
6 changed files with 69 additions and 165 deletions

View File

@ -1,5 +1,12 @@
2010-08-24 Roland McGrath <roland@redhat.com>
* configure.in: Remove config-name.h generation.
* configure: Regenerated.
* config-name.in: File removed.
* scripts/config-uname.sh: New file.
* posix/Makefile (uname.c): Depend on $(objdir)config-name.h.
($(objdir)config-name.h): New target.
* sunrpc/rpc_parse.h: Avoid nested comment.
2010-08-24 Richard Henderson <rth@redhat.com>

View File

@ -1,9 +0,0 @@
/* @configure_input@ -*- C -*-
This is used only by the generic `uname' function for systems with no real
`uname' call. If this data is not correct, it does not matter much. */
#define UNAME_SYSNAME "@uname_sysname@"
#define UNAME_RELEASE "@uname_release@"
#define UNAME_VERSION "@uname_version@"
#define UNAME_MACHINE "@host_cpu@-@host_vendor@"

87
configure vendored
View File

@ -623,9 +623,6 @@ libc_cv_sysconfdir
libc_cv_localedir
libc_cv_slibdir
old_glibc_headers
uname_version
uname_release
uname_sysname
libc_cv_gcc_unwind_find_fde
sizeof_long_double
EGREP
@ -7746,8 +7743,7 @@ libc_cv_gcc_unwind_find_fde=no
libc_cv_idn=no
# Iterate over all the sysdep directories we will use, running their
# configure fragments, and looking for a uname implementation.
uname=
# configure fragments.
for dir in $sysnames; do
case $dir in
/*) dest=$dir ;;
@ -7758,15 +7754,6 @@ for dir in $sysnames; do
$as_echo "running configure fragment for $dir" >&6; }
. $dest/configure
fi
if test -z "$uname"; then
if test -r $dest/uname.c ||
test -r $dest/uname.S ||
{ test -r $dest/syscalls.list &&
grep '^uname[ ]' $dest/syscalls.list >/dev/null; }; then
uname=$dir
fi
fi
done
if test x$libc_cv_gcc_unwind_find_fde = xyes; then
@ -7775,75 +7762,6 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then
fi
# If we will use the generic uname implementation, we must figure out what
# it will say by examining the system, and write the results in config-name.h.
if test "$uname" = "sysdeps/generic"; then
uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
if test $uname_sysname != $config_os; then
config_release=`echo $config_os | sed s/$uname_sysname//`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OS release for uname" >&5
$as_echo_n "checking OS release for uname... " >&6; }
if test "${libc_cv_uname_release+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -r /vmunix; then
kernel_id=`strings /vmunix | grep UNIX`
elif test -r /dynix; then
kernel_id=`strings /dynix | grep DYNIX`
else
kernel_id=
fi
kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
!= x$config_release; then
# The configuration release is a substring of the kernel release.
libc_cv_uname_release=$kernel_release
elif test x$config_release != x; then
libc_cv_uname_release=$config_release
elif test x$kernel_release != x; then
libc_cv_uname_release=$kernel_release
else
libc_cv_uname_release=unknown
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_uname_release" >&5
$as_echo "$libc_cv_uname_release" >&6; }
uname_release="$libc_cv_uname_release"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OS version for uname" >&5
$as_echo_n "checking OS version for uname... " >&6; }
if test "${libc_cv_uname_version+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -r /vmunix; then
kernel_id=`strings /vmunix | grep UNIX`
elif test -r /dynix; then
kernel_id=`strings /dynix | grep DYNIX`
else
kernel_id=
fi
kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
if test -n "$kernel_version"; then
libc_cv_uname_version="$kernel_version"
else
libc_cv_uname_version=unknown
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_uname_version" >&5
$as_echo "$libc_cv_uname_version" >&6; }
uname_version="$libc_cv_uname_version"
config_uname=config-name.h:config-name.in
else
# For non-generic uname, we don't need to create config-name.h at all.
config_uname=
fi
$as_echo "#define USE_IN_LIBIO 1" >>confdefs.h
@ -7938,7 +7856,7 @@ RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
ac_config_files="$ac_config_files config.make ${config_makefile} ${config_uname}"
ac_config_files="$ac_config_files config.make ${config_makefile}"
ac_config_commands="$ac_config_commands default"
@ -8640,7 +8558,6 @@ do
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"config.make") CONFIG_FILES="$CONFIG_FILES config.make" ;;
"${config_makefile}") CONFIG_FILES="$CONFIG_FILES ${config_makefile}" ;;
"${config_uname}") CONFIG_FILES="$CONFIG_FILES ${config_uname}" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;

View File

@ -2192,8 +2192,7 @@ libc_cv_gcc_unwind_find_fde=no
libc_cv_idn=no
# Iterate over all the sysdep directories we will use, running their
# configure fragments, and looking for a uname implementation.
uname=
# configure fragments.
for dir in $sysnames; do
case $dir in
/*) dest=$dir ;;
@ -2203,16 +2202,6 @@ for dir in $sysnames; do
AC_MSG_RESULT(running configure fragment for $dir)
. $dest/configure
fi
[
if test -z "$uname"; then
if test -r $dest/uname.c ||
test -r $dest/uname.S ||
{ test -r $dest/syscalls.list &&
grep '^uname[ ]' $dest/syscalls.list >/dev/null; }; then
uname=$dir
fi
fi
]dnl
done
if test x$libc_cv_gcc_unwind_find_fde = xyes; then
@ -2220,64 +2209,6 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then
fi
AC_SUBST(libc_cv_gcc_unwind_find_fde)
# If we will use the generic uname implementation, we must figure out what
# it will say by examining the system, and write the results in config-name.h.
if test "$uname" = "sysdeps/generic"; then
changequote(,)dnl
uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
changequote([,])dnl
if test $uname_sysname != $config_os; then
config_release=`echo $config_os | sed s/$uname_sysname//`
fi
dnl
AC_DEFUN(LIBC_KERNEL_ID, [dnl
if test -r /vmunix; then
kernel_id=`strings /vmunix | grep UNIX`
elif test -r /dynix; then
kernel_id=`strings /dynix | grep DYNIX`
else
kernel_id=
fi
])dnl
AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
LIBC_KERNEL_ID
changequote(,)dnl
kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
changequote([,])dnl
if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
!= x$config_release; then
# The configuration release is a substring of the kernel release.
libc_cv_uname_release=$kernel_release
elif test x$config_release != x; then
libc_cv_uname_release=$config_release
elif test x$kernel_release != x; then
libc_cv_uname_release=$kernel_release
else
libc_cv_uname_release=unknown
fi])
uname_release="$libc_cv_uname_release"
AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
LIBC_KERNEL_ID
changequote(,)dnl
kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
changequote([,])dnl
if test -n "$kernel_version"; then
libc_cv_uname_version="$kernel_version"
else
libc_cv_uname_version=unknown
fi])
uname_version="$libc_cv_uname_version"
AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
config_uname=config-name.h:config-name.in
else
# For non-generic uname, we don't need to create config-name.h at all.
config_uname=
fi
dnl This is tested by existing code and it's simpler to avoid changing it.
AC_DEFINE(USE_IN_LIBIO)
@ -2361,7 +2292,7 @@ RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
AC_SUBST(VERSION)
AC_SUBST(RELEASE)
AC_CONFIG_FILES([config.make ${config_makefile} ${config_uname}])
AC_CONFIG_FILES([config.make ${config_makefile}])
AC_CONFIG_COMMANDS([default],[[
case $CONFIG_FILES in *config.make*)
echo "$config_vars" >> config.make;;

View File

@ -139,6 +139,14 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
endif
endif
# If we will use the generic uname implementation, we must figure out what
# it will say by examining the system, and write the results in config-name.h.
uname.c: $(objpfx)config-name.h
$(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
$< '$(config-os)' '$(config-release)' \
'$(config-machine)-$(config-vendor)' > $@.new
mv -f $@.new $@
CFLAGS-regex.c = -Wno-strict-prototypes
CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD
CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables

50
scripts/config-uname.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
config_os=$1
config_release=$2
uname_machine=$3
uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
if test $uname_sysname != $config_os; then
config_release=`echo $config_os | sed s/$uname_sysname//`
fi
if test -r /vmunix; then
kernel_id=`strings /vmunix | grep UNIX`
elif test -r /dynix; then
kernel_id=`strings /dynix | grep DYNIX`
else
kernel_id=
fi
kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
!= x$config_release; then
# The configuration release is a substring of the kernel release.
uname_release=$kernel_release
elif test x$config_release != x; then
uname_release=$config_release
elif test x$kernel_release != x; then
uname_release=$kernel_release
else
uname_release=unknown
fi
kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
if test -n "$kernel_version"; then
uname_version="$kernel_version"
else
uname_version=unknown
fi
cat <<EOF
/* This file is generated by $0. DO NOT EDIT.
This is used only by the generic uname function for systems with no real
uname call. If this data is not correct, it does not matter much. */
#define UNAME_SYSNAME "$uname_sysname"
#define UNAME_RELEASE "$uname_release"
#define UNAME_VERSION "$uname_version"
#define UNAME_MACHINE "$uname_machine"
EOF