Commit 23a403db authored by Peter Renström's avatar Peter Renström

Update libev to 4.20.

This most importantly fixes build issues related to C11 which is used in
for example OS X 10.11 ("El Capitan"):

    libev/ev.c:1029:42: error: '_Noreturn' keyword must precede function declarator
      ecb_inline void ecb_unreachable (void) ecb_noreturn;
                                             ^~~~~~~~~~~~
parent 0a92b17e
...@@ -33,6 +33,7 @@ Unreleased ...@@ -33,6 +33,7 @@ Unreleased
raised exceptions now usually raises the original traceback. This raised exceptions now usually raises the original traceback. This
should assist things like Sentry to track the original problem. PRs should assist things like Sentry to track the original problem. PRs
#450 and #528 by Rodolfo and Eddi Linder. #450 and #528 by Rodolfo and Eddi Linder.
- Upgrade to libev 4.20.
Release 1.0.2 Release 1.0.2
------------- -------------
......
...@@ -12,9 +12,14 @@ TODO: document file descriptor usage per loop ...@@ -12,9 +12,14 @@ TODO: document file descriptor usage per loop
TODO: store loop pid_t and compare isndie signal handler,store 1 for same, 2 for differign pid, clean up in loop_fork TODO: store loop pid_t and compare isndie signal handler,store 1 for same, 2 for differign pid, clean up in loop_fork
TODO: embed watchers need updating when fd changes TODO: embed watchers need updating when fd changes
TODO: document portability requirements for atomic pointer access TODO: document portability requirements for atomic pointer access
TODO: possible cb aliasing?
TODO: document requirements for function pointers and calling conventions. TODO: document requirements for function pointers and calling conventions.
4.20 Sat Jun 20 13:01:43 CEST 2015
- prefer noexcept over throw () with C++ 11.
- update ecb.h due to incompatibilities with c11.
- fix a potential aliasing issue when reading and writing
watcher callbacks.
4.19 Thu Sep 25 08:18:25 CEST 2014 4.19 Thu Sep 25 08:18:25 CEST 2014
- ev.h wasn't valid C++ anymore, which tripped compilers other than - ev.h wasn't valid C++ anymore, which tripped compilers other than
clang, msvc or gcc (analyzed by Raphael 'kena' Poss). Unfortunately, clang, msvc or gcc (analyzed by Raphael 'kena' Poss). Unfortunately,
......
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2015 Free Software Foundation, Inc. # Copyright 1992-2014 Free Software Foundation, Inc.
timestamp='2015-03-04' timestamp='2014-03-23'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -24,12 +24,12 @@ timestamp='2015-03-04' ...@@ -24,12 +24,12 @@ timestamp='2015-03-04'
# program. This Exception is an additional permission under section 7 # program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3"). # of the GNU General Public License, version 3 ("GPLv3").
# #
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # Originally written by Per Bothner.
# #
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
# #
# Please send patches to <config-patches@gnu.org>. # Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
...@@ -50,7 +50,7 @@ version="\ ...@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright 1992-2015 Free Software Foundation, Inc. Copyright 1992-2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -168,27 +168,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -168,27 +168,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor # Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown". # portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch" sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;; armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;; sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
# to ELF recently, or will in the future. # to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__ | grep -q __ELF__
...@@ -204,13 +197,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -204,13 +197,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd os=netbsd
;; ;;
esac esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release # The OS release
# Debian GNU/NetBSD machines have a different userland, and # Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need # thus, need a distinct triplet. However, they do not need
...@@ -227,7 +213,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -227,7 +213,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}${abi}" echo "${machine}-${os}${release}"
exit ;; exit ;;
*:Bitrig:*:*) *:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
...@@ -593,9 +579,8 @@ EOF ...@@ -593,9 +579,8 @@ EOF
else else
IBM_ARCH=powerpc IBM_ARCH=powerpc
fi fi
if [ -x /usr/bin/lslpp ] ; then if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | IBM_REV=`/usr/bin/oslevel`
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi fi
...@@ -947,9 +932,6 @@ EOF ...@@ -947,9 +932,6 @@ EOF
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC} echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;; exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*) frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
......
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2015 Free Software Foundation, Inc. # Copyright 1992-2014 Free Software Foundation, Inc.
timestamp='2015-03-08' timestamp='2014-09-11'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -25,7 +25,7 @@ timestamp='2015-03-08' ...@@ -25,7 +25,7 @@ timestamp='2015-03-08'
# of the GNU General Public License, version 3 ("GPLv3"). # of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. # Please send patches with a ChangeLog entry to config-patches@gnu.org.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
...@@ -68,7 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." ...@@ -68,7 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright 1992-2015 Free Software Foundation, Inc. Copyright 1992-2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` ...@@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
...@@ -259,8 +259,8 @@ case $basic_machine in ...@@ -259,8 +259,8 @@ case $basic_machine in
| bfin \ | bfin \
| c4x | c8051 | clipper \ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| e2k | epiphany \ | epiphany \
| fido | fr30 | frv | ft32 \ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \ | hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
...@@ -313,7 +313,6 @@ case $basic_machine in ...@@ -313,7 +313,6 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \ | ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \ | we32k \
| x86 | xc16x | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
...@@ -328,9 +327,6 @@ case $basic_machine in ...@@ -328,9 +327,6 @@ case $basic_machine in
c6x) c6x)
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
;; ;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
...@@ -381,7 +377,7 @@ case $basic_machine in ...@@ -381,7 +377,7 @@ case $basic_machine in
| c[123]* | c30-* | [cjt]90-* | c4x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| e2k-* | elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
...@@ -441,7 +437,6 @@ case $basic_machine in ...@@ -441,7 +437,6 @@ case $basic_machine in
| ubicom32-* \ | ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \ | vax-* \
| visium-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
...@@ -518,9 +513,6 @@ case $basic_machine in ...@@ -518,9 +513,6 @@ case $basic_machine in
basic_machine=i386-pc basic_machine=i386-pc
os=-aros os=-aros
;; ;;
asmjs)
basic_machine=asmjs-unknown
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
...@@ -782,9 +774,6 @@ case $basic_machine in ...@@ -782,9 +774,6 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu) m68knommu)
basic_machine=m68k-unknown basic_machine=m68k-unknown
os=-linux os=-linux
...@@ -1376,7 +1365,7 @@ case $os in ...@@ -1376,7 +1365,7 @@ case $os in
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* | -cloudabi* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
......
...@@ -2406,8 +2406,8 @@ test "$program_suffix" != NONE && ...@@ -2406,8 +2406,8 @@ test "$program_suffix" != NONE &&
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# expand $ac_aux_dir to an absolute path # Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd $ac_aux_dir && pwd` am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then if test x"${MISSING+set}" != xset; then
case $am_aux_dir in case $am_aux_dir in
...@@ -2721,7 +2721,7 @@ fi ...@@ -2721,7 +2721,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE=libev PACKAGE=libev
VERSION=4.19 VERSION=4.20
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -2813,7 +2813,8 @@ END ...@@ -2813,7 +2813,8 @@ END
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
fi fi
fi fi
ac_config_headers="$ac_config_headers config.h"
ac_config_headers="$ac_config_headers config.h"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
...@@ -4771,7 +4772,8 @@ else ...@@ -4771,7 +4772,8 @@ else
;; ;;
*) *)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len"; then if test -n "$lt_cv_sys_max_cmd_len" && \
test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else else
...@@ -6292,7 +6294,7 @@ ia64-*-hpux*) ...@@ -6292,7 +6294,7 @@ ia64-*-hpux*)
rm -rf conftest* rm -rf conftest*
;; ;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*) s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext echo 'int i;' > conftest.$ac_ext
...@@ -6308,9 +6310,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ...@@ -6308,9 +6310,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd" LD="${LD-ld} -m elf_i386_fbsd"
;; ;;
x86_64-*linux*) x86_64-*linux*)
LD="${LD-ld} -m elf_i386" case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
;;
*)
LD="${LD-ld} -m elf_i386"
;;
esac
;; ;;
ppc64-*linux*|powerpc64-*linux*) powerpc64le-*)
LD="${LD-ld} -m elf32lppclinux"
;;
powerpc64-*)
LD="${LD-ld} -m elf32ppclinux" LD="${LD-ld} -m elf32ppclinux"
;; ;;
s390x-*linux*) s390x-*linux*)
...@@ -6329,7 +6341,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ...@@ -6329,7 +6341,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*) x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64" LD="${LD-ld} -m elf_x86_64"
;; ;;
ppc*-*linux*|powerpc*-*linux*) powerpcle-*)
LD="${LD-ld} -m elf64lppc"
;;
powerpc-*)
LD="${LD-ld} -m elf64ppc" LD="${LD-ld} -m elf64ppc"
;; ;;
s390*-*linux*|s390*-*tpf*) s390*-*linux*|s390*-*tpf*)
......
...@@ -493,7 +493,7 @@ struct signalfd_siginfo ...@@ -493,7 +493,7 @@ struct signalfd_siginfo
/* /*
* libecb - http://software.schmorp.de/pkg/libecb * libecb - http://software.schmorp.de/pkg/libecb
* *
* Copyright (©) 2009-2014 Marc Alexander Lehmann <libecb@schmorp.de> * Copyright (©) 2009-2015 Marc Alexander Lehmann <libecb@schmorp.de>
* Copyright (©) 2011 Emanuele Giaquinta * Copyright (©) 2011 Emanuele Giaquinta
* All rights reserved. * All rights reserved.
* *
...@@ -534,7 +534,7 @@ struct signalfd_siginfo ...@@ -534,7 +534,7 @@ struct signalfd_siginfo
#define ECB_H #define ECB_H
/* 16 bits major, 16 bits minor */ /* 16 bits major, 16 bits minor */
#define ECB_VERSION 0x00010003 #define ECB_VERSION 0x00010004
#ifdef _WIN32 #ifdef _WIN32
typedef signed char int8_t; typedef signed char int8_t;
...@@ -568,8 +568,11 @@ struct signalfd_siginfo ...@@ -568,8 +568,11 @@ struct signalfd_siginfo
#endif #endif
#endif #endif
#define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__)
#define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64)
/* work around x32 idiocy by defining proper macros */ /* work around x32 idiocy by defining proper macros */
#if __amd64 || __x86_64 || _M_AMD64 || _M_X64 #if ECB_GCC_AMD64 || ECB_MSVC_AMD64
#if _ILP32 #if _ILP32
#define ECB_AMD64_X32 1 #define ECB_AMD64_X32 1
#else #else
...@@ -584,12 +587,24 @@ struct signalfd_siginfo ...@@ -584,12 +587,24 @@ struct signalfd_siginfo
* we try to detect these and simply assume they are not gcc - if they have * we try to detect these and simply assume they are not gcc - if they have
* an issue with that they should have done it right in the first place. * an issue with that they should have done it right in the first place.
*/ */
#ifndef ECB_GCC_VERSION #if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__
#if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__ #define ECB_GCC_VERSION(major,minor) 0
#define ECB_GCC_VERSION(major,minor) 0 #else
#else #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
#define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) #endif
#endif
#define ECB_CLANG_VERSION(major,minor) (__clang_major__ > (major) || (__clang_major__ == (major) && __clang_minor__ >= (minor)))
#if __clang__ && defined __has_builtin
#define ECB_CLANG_BUILTIN(x) __has_builtin (x)
#else
#define ECB_CLANG_BUILTIN(x) 0
#endif
#if __clang__ && defined __has_extension
#define ECB_CLANG_EXTENSION(x) __has_extension (x)
#else
#define ECB_CLANG_EXTENSION(x) 0
#endif #endif
#define ECB_CPP (__cplusplus+0) #define ECB_CPP (__cplusplus+0)
...@@ -629,13 +644,18 @@ struct signalfd_siginfo ...@@ -629,13 +644,18 @@ struct signalfd_siginfo
#define ECB_MEMORY_FENCE do { } while (0) #define ECB_MEMORY_FENCE do { } while (0)
#endif #endif
/* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/compiler_builtins.html */
#if __xlC__ && ECB_CPP
#include <builtins.h>
#endif
#ifndef ECB_MEMORY_FENCE #ifndef ECB_MEMORY_FENCE
#if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
#if __i386 || __i386__ #if __i386 || __i386__
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
#elif __amd64 || __amd64__ || __x86_64 || __x86_64__ #elif ECB_GCC_AMD64
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
...@@ -683,16 +703,11 @@ struct signalfd_siginfo ...@@ -683,16 +703,11 @@ struct signalfd_siginfo
#define ECB_MEMORY_FENCE_ACQUIRE __atomic_thread_fence (__ATOMIC_ACQUIRE) #define ECB_MEMORY_FENCE_ACQUIRE __atomic_thread_fence (__ATOMIC_ACQUIRE)
#define ECB_MEMORY_FENCE_RELEASE __atomic_thread_fence (__ATOMIC_RELEASE) #define ECB_MEMORY_FENCE_RELEASE __atomic_thread_fence (__ATOMIC_RELEASE)
/* The __has_feature syntax from clang is so misdesigned that we cannot use it #elif ECB_CLANG_EXTENSION(c_atomic)
* without risking compile time errors with other compilers. We *could* /* see comment below (stdatomic.h) about the C11 memory model. */
* define our own ecb_clang_has_feature, but I just can't be bothered to work #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
* around this shit time and again. #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
* #elif defined __clang && __has_feature (cxx_atomic) #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
* // see comment below (stdatomic.h) about the C11 memory model.
* #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
* #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
* #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
*/
#elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__ #elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__
#define ECB_MEMORY_FENCE __sync_synchronize () #define ECB_MEMORY_FENCE __sync_synchronize ()
...@@ -765,7 +780,7 @@ struct signalfd_siginfo ...@@ -765,7 +780,7 @@ struct signalfd_siginfo
/*****************************************************************************/ /*****************************************************************************/
#if __cplusplus #if ECB_CPP
#define ecb_inline static inline #define ecb_inline static inline
#elif ECB_GCC_VERSION(2,5) #elif ECB_GCC_VERSION(2,5)
#define ecb_inline static __inline__ #define ecb_inline static __inline__
...@@ -789,47 +804,79 @@ typedef int ecb_bool; ...@@ -789,47 +804,79 @@ typedef int ecb_bool;
#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) #define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
#define ECB_STRINGIFY_(a) # a #define ECB_STRINGIFY_(a) # a
#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
#define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr))
#define ecb_function_ ecb_inline #define ecb_function_ ecb_inline
#if ECB_GCC_VERSION(3,1) #if ECB_GCC_VERSION(3,1) || ECB_CLANG_VERSION(2,8)
#define ecb_attribute(attrlist) __attribute__(attrlist) #define ecb_attribute(attrlist) __attribute__ (attrlist)
#define ecb_is_constant(expr) __builtin_constant_p (expr)
#define ecb_expect(expr,value) __builtin_expect ((expr),(value))
#define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
#else #else
#define ecb_attribute(attrlist) #define ecb_attribute(attrlist)
#endif
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_constant_p)
#define ecb_is_constant(expr) __builtin_constant_p (expr)
#else
/* possible C11 impl for integral types /* possible C11 impl for integral types
typedef struct ecb_is_constant_struct ecb_is_constant_struct; typedef struct ecb_is_constant_struct ecb_is_constant_struct;
#define ecb_is_constant(expr) _Generic ((1 ? (struct ecb_is_constant_struct *)0 : (void *)((expr) - (expr)), ecb_is_constant_struct *: 0, default: 1)) */ #define ecb_is_constant(expr) _Generic ((1 ? (struct ecb_is_constant_struct *)0 : (void *)((expr) - (expr)), ecb_is_constant_struct *: 0, default: 1)) */
#define ecb_is_constant(expr) 0 #define ecb_is_constant(expr) 0
#endif
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_expect)
#define ecb_expect(expr,value) __builtin_expect ((expr),(value))
#else
#define ecb_expect(expr,value) (expr) #define ecb_expect(expr,value) (expr)
#endif
#if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_prefetch)
#define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
#else
#define ecb_prefetch(addr,rw,locality) #define ecb_prefetch(addr,rw,locality)
#endif #endif
/* no emulation for ecb_decltype */ /* no emulation for ecb_decltype */
#if ECB_GCC_VERSION(4,5) #if ECB_CPP11
#define ecb_decltype(x) __decltype(x) // older implementations might have problems with decltype(x)::type, work around it
#elif ECB_GCC_VERSION(3,0) template<class T> struct ecb_decltype_t { typedef T type; };
#define ecb_decltype(x) __typeof(x) #define ecb_decltype(x) ecb_decltype_t<decltype (x)>::type
#elif ECB_GCC_VERSION(3,0) || ECB_CLANG_VERSION(2,8)
#define ecb_decltype(x) __typeof__ (x)
#endif #endif
#if _MSC_VER >= 1300 #if _MSC_VER >= 1300
#define ecb_deprecated __declspec(deprecated) #define ecb_deprecated __declspec (deprecated)
#else #else
#define ecb_deprecated ecb_attribute ((__deprecated__)) #define ecb_deprecated ecb_attribute ((__deprecated__))
#endif #endif
#define ecb_noinline ecb_attribute ((__noinline__)) #if _MSC_VER >= 1500
#define ecb_deprecated_message(msg) __declspec (deprecated (msg))
#elif ECB_GCC_VERSION(4,5)
#define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg))
#else
#define ecb_deprecated_message(msg) ecb_deprecated
#endif
#if _MSC_VER >= 1400
#define ecb_noinline __declspec (noinline)
#else
#define ecb_noinline ecb_attribute ((__noinline__))
#endif
#define ecb_unused ecb_attribute ((__unused__)) #define ecb_unused ecb_attribute ((__unused__))
#define ecb_const ecb_attribute ((__const__)) #define ecb_const ecb_attribute ((__const__))
#define ecb_pure ecb_attribute ((__pure__)) #define ecb_pure ecb_attribute ((__pure__))
/* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */ #if ECB_C11 || __IBMC_NORETURN
#if ECB_C11 /* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/language_ref/noreturn.html */
#define ecb_noreturn _Noreturn #define ecb_noreturn _Noreturn
#elif ECB_CPP11
#define ecb_noreturn [[noreturn]]
#elif _MSC_VER >= 1200
/* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */
#define ecb_noreturn __declspec (noreturn)
#else #else
#define ecb_noreturn ecb_attribute ((__noreturn__)) #define ecb_noreturn ecb_attribute ((__noreturn__))
#endif #endif
...@@ -854,7 +901,10 @@ typedef int ecb_bool; ...@@ -854,7 +901,10 @@ typedef int ecb_bool;
#define ecb_unlikely(expr) ecb_expect_false (expr) #define ecb_unlikely(expr) ecb_expect_false (expr)
/* count trailing zero bits and count # of one bits */ /* count trailing zero bits and count # of one bits */
#if ECB_GCC_VERSION(3,4) #if ECB_GCC_VERSION(3,4) \
|| (ECB_CLANG_BUILTIN(__builtin_clz) && ECB_CLANG_BUILTIN(__builtin_clzll) \
&& ECB_CLANG_BUILTIN(__builtin_ctz) && ECB_CLANG_BUILTIN(__builtin_ctzll) \
&& ECB_CLANG_BUILTIN(__builtin_popcount))
/* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */ /* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */
#define ecb_ld32(x) (__builtin_clz (x) ^ 31) #define ecb_ld32(x) (__builtin_clz (x) ^ 31)
#define ecb_ld64(x) (__builtin_clzll (x) ^ 63) #define ecb_ld64(x) (__builtin_clzll (x) ^ 63)
...@@ -863,8 +913,8 @@ typedef int ecb_bool; ...@@ -863,8 +913,8 @@ typedef int ecb_bool;
#define ecb_popcount32(x) __builtin_popcount (x) #define ecb_popcount32(x) __builtin_popcount (x)
/* no popcountll */ /* no popcountll */
#else #else
ecb_function_ int ecb_ctz32 (uint32_t x) ecb_const; ecb_function_ ecb_const int ecb_ctz32 (uint32_t x);
ecb_function_ int ecb_function_ ecb_const int
ecb_ctz32 (uint32_t x) ecb_ctz32 (uint32_t x)
{ {
int r = 0; int r = 0;
...@@ -888,16 +938,16 @@ typedef int ecb_bool; ...@@ -888,16 +938,16 @@ typedef int ecb_bool;
return r; return r;
} }
ecb_function_ int ecb_ctz64 (uint64_t x) ecb_const; ecb_function_ ecb_const int ecb_ctz64 (uint64_t x);
ecb_function_ int ecb_function_ ecb_const int
ecb_ctz64 (uint64_t x) ecb_ctz64 (uint64_t x)
{ {
int shift = x & 0xffffffffU ? 0 : 32; int shift = x & 0xffffffffU ? 0 : 32;
return ecb_ctz32 (x >> shift) + shift; return ecb_ctz32 (x >> shift) + shift;
} }
ecb_function_ int ecb_popcount32 (uint32_t x) ecb_const; ecb_function_ ecb_const int ecb_popcount32 (uint32_t x);
ecb_function_ int ecb_function_ ecb_const int
ecb_popcount32 (uint32_t x) ecb_popcount32 (uint32_t x)
{ {
x -= (x >> 1) & 0x55555555; x -= (x >> 1) & 0x55555555;
...@@ -908,8 +958,8 @@ typedef int ecb_bool; ...@@ -908,8 +958,8 @@ typedef int ecb_bool;
return x >> 24; return x >> 24;
} }
ecb_function_ int ecb_ld32 (uint32_t x) ecb_const; ecb_function_ ecb_const int ecb_ld32 (uint32_t x);
ecb_function_ int ecb_ld32 (uint32_t x) ecb_function_ ecb_const int ecb_ld32 (uint32_t x)
{ {
int r = 0; int r = 0;
...@@ -922,8 +972,8 @@ typedef int ecb_bool; ...@@ -922,8 +972,8 @@ typedef int ecb_bool;
return r; return r;
} }
ecb_function_ int ecb_ld64 (uint64_t x) ecb_const; ecb_function_ ecb_const int ecb_ld64 (uint64_t x);
ecb_function_ int ecb_ld64 (uint64_t x) ecb_function_ ecb_const int ecb_ld64 (uint64_t x)
{ {
int r = 0; int r = 0;
...@@ -933,20 +983,20 @@ typedef int ecb_bool; ...@@ -933,20 +983,20 @@ typedef int ecb_bool;
} }
#endif #endif
ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) ecb_const; ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x);
ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); } ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); }
ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) ecb_const; ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x);
ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); } ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); }
ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) ecb_const; ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x);
ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x)
{ {
return ( (x * 0x0802U & 0x22110U) return ( (x * 0x0802U & 0x22110U)
| (x * 0x8020U & 0x88440U)) * 0x10101U >> 16; | (x * 0x8020U & 0x88440U)) * 0x10101U >> 16;
} }
ecb_function_ uint16_t ecb_bitrev16 (uint16_t x) ecb_const; ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x);
ecb_function_ uint16_t ecb_bitrev16 (uint16_t x) ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x)
{ {
x = ((x >> 1) & 0x5555) | ((x & 0x5555) << 1); x = ((x >> 1) & 0x5555) | ((x & 0x5555) << 1);
x = ((x >> 2) & 0x3333) | ((x & 0x3333) << 2); x = ((x >> 2) & 0x3333) | ((x & 0x3333) << 2);
...@@ -956,8 +1006,8 @@ ecb_function_ uint16_t ecb_bitrev16 (uint16_t x) ...@@ -956,8 +1006,8 @@ ecb_function_ uint16_t ecb_bitrev16 (uint16_t x)
return x; return x;
} }
ecb_function_ uint32_t ecb_bitrev32 (uint32_t x) ecb_const; ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x);
ecb_function_ uint32_t ecb_bitrev32 (uint32_t x) ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x)
{ {
x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1); x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2); x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
...@@ -970,71 +1020,80 @@ ecb_function_ uint32_t ecb_bitrev32 (uint32_t x) ...@@ -970,71 +1020,80 @@ ecb_function_ uint32_t ecb_bitrev32 (uint32_t x)
/* popcount64 is only available on 64 bit cpus as gcc builtin */ /* popcount64 is only available on 64 bit cpus as gcc builtin */
/* so for this version we are lazy */ /* so for this version we are lazy */
ecb_function_ int ecb_popcount64 (uint64_t x) ecb_const; ecb_function_ ecb_const int ecb_popcount64 (uint64_t x);
ecb_function_ int ecb_function_ ecb_const int
ecb_popcount64 (uint64_t x) ecb_popcount64 (uint64_t x)
{ {
return ecb_popcount32 (x) + ecb_popcount32 (x >> 32); return ecb_popcount32 (x) + ecb_popcount32 (x >> 32);
} }
ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count);
ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count);
ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count);
ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count);
ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count);
ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count);
ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count);
ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) ecb_const; ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count);
ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); } ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); }
ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); } ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); }
ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); } ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); }
ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); } ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); }
ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); } ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); }
ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); } ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); }
ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); } ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); } ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
#if ECB_GCC_VERSION(4,3) #if ECB_GCC_VERSION(4,3) || (ECB_CLANG_BUILTIN(__builtin_bswap32) && ECB_CLANG_BUILTIN(__builtin_bswap64))
#if ECB_GCC_VERSION(4,8) || ECB_CLANG_BUILTIN(__builtin_bswap16)
#define ecb_bswap16(x) __builtin_bswap16 (x)
#else
#define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16) #define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16)
#endif
#define ecb_bswap32(x) __builtin_bswap32 (x) #define ecb_bswap32(x) __builtin_bswap32 (x)
#define ecb_bswap64(x) __builtin_bswap64 (x) #define ecb_bswap64(x) __builtin_bswap64 (x)
#elif _MSC_VER
#include <stdlib.h>
#define ecb_bswap16(x) ((uint16_t)_byteswap_ushort ((uint16_t)(x)))
#define ecb_bswap32(x) ((uint32_t)_byteswap_ulong ((uint32_t)(x)))
#define ecb_bswap64(x) ((uint64_t)_byteswap_uint64 ((uint64_t)(x)))
#else #else
ecb_function_ uint16_t ecb_bswap16 (uint16_t x) ecb_const; ecb_function_ ecb_const uint16_t ecb_bswap16 (uint16_t x);
ecb_function_ uint16_t ecb_function_ ecb_const uint16_t
ecb_bswap16 (uint16_t x) ecb_bswap16 (uint16_t x)
{ {
return ecb_rotl16 (x, 8); return ecb_rotl16 (x, 8);
} }
ecb_function_ uint32_t ecb_bswap32 (uint32_t x) ecb_const; ecb_function_ ecb_const uint32_t ecb_bswap32 (uint32_t x);
ecb_function_ uint32_t ecb_function_ ecb_const uint32_t
ecb_bswap32 (uint32_t x) ecb_bswap32 (uint32_t x)
{ {
return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16); return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16);
} }
ecb_function_ uint64_t ecb_bswap64 (uint64_t x) ecb_const; ecb_function_ ecb_const uint64_t ecb_bswap64 (uint64_t x);
ecb_function_ uint64_t ecb_function_ ecb_const uint64_t
ecb_bswap64 (uint64_t x) ecb_bswap64 (uint64_t x)
{ {
return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32); return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32);
} }
#endif #endif
#if ECB_GCC_VERSION(4,5) #if ECB_GCC_VERSION(4,5) || ECB_CLANG_BUILTIN(__builtin_unreachable)
#define ecb_unreachable() __builtin_unreachable () #define ecb_unreachable() __builtin_unreachable ()
#else #else
/* this seems to work fine, but gcc always emits a warning for it :/ */ /* this seems to work fine, but gcc always emits a warning for it :/ */
ecb_inline void ecb_unreachable (void) ecb_noreturn; ecb_inline ecb_noreturn void ecb_unreachable (void);
ecb_inline void ecb_unreachable (void) { } ecb_inline ecb_noreturn void ecb_unreachable (void) { }
#endif #endif
/* try to tell the compiler that some condition is definitely true */ /* try to tell the compiler that some condition is definitely true */
#define ecb_assume(cond) if (!(cond)) ecb_unreachable (); else 0 #define ecb_assume(cond) if (!(cond)) ecb_unreachable (); else 0
ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const; ecb_inline ecb_const unsigned char ecb_byteorder_helper (void);
ecb_inline unsigned char ecb_inline ecb_const unsigned char
ecb_byteorder_helper (void) ecb_byteorder_helper (void)
{ {
/* the union code still generates code under pressure in gcc, */ /* the union code still generates code under pressure in gcc, */
...@@ -1043,7 +1102,7 @@ ecb_byteorder_helper (void) ...@@ -1043,7 +1102,7 @@ ecb_byteorder_helper (void)
/* the reason why we have this horrible preprocessor mess */ /* the reason why we have this horrible preprocessor mess */
/* is to avoid it in all cases, at least on common architectures */ /* is to avoid it in all cases, at least on common architectures */
/* or when using a recent enough gcc version (>= 4.6) */ /* or when using a recent enough gcc version (>= 4.6) */
#if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64 #if ((__i386 || __i386__) && !__VOS__) || _M_IX86 || ECB_GCC_AMD64 || ECB_MSVC_AMD64
return 0x44; return 0x44;
#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
return 0x44; return 0x44;
...@@ -1059,10 +1118,10 @@ ecb_byteorder_helper (void) ...@@ -1059,10 +1118,10 @@ ecb_byteorder_helper (void)
#endif #endif
} }
ecb_inline ecb_bool ecb_big_endian (void) ecb_const; ecb_inline ecb_const ecb_bool ecb_big_endian (void);
ecb_inline ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; } ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
ecb_inline ecb_bool ecb_little_endian (void) ecb_const; ecb_inline ecb_const ecb_bool ecb_little_endian (void);
ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; } ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
#if ECB_GCC_VERSION(3,0) || ECB_C99 #if ECB_GCC_VERSION(3,0) || ECB_C99
#define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0)) #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0))
...@@ -1070,7 +1129,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1070,7 +1129,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
#define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n))) #define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n)))
#endif #endif
#if __cplusplus #if ECB_CPP
template<typename T> template<typename T>
static inline T ecb_div_rd (T val, T div) static inline T ecb_div_rd (T val, T div)
{ {
...@@ -1104,7 +1163,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1104,7 +1163,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
/* the only noteworthy exception is ancient armle, which uses order 43218765 */ /* the only noteworthy exception is ancient armle, which uses order 43218765 */
#if 0 \ #if 0 \
|| __i386 || __i386__ \ || __i386 || __i386__ \
|| __amd64 || __amd64__ || __x86_64 || __x86_64__ \ || ECB_GCC_AMD64 \
|| __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \ || __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \
|| defined __s390__ || defined __s390x__ \ || defined __s390__ || defined __s390x__ \
|| defined __mips__ \ || defined __mips__ \
...@@ -1114,7 +1173,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1114,7 +1173,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
|| defined __m68k__ \ || defined __m68k__ \
|| defined __m88k__ \ || defined __m88k__ \
|| defined __sh__ \ || defined __sh__ \
|| defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 \ || defined _M_IX86 || defined ECB_MSVC_AMD64 || defined _M_IA64 \
|| (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \ || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \
|| defined __aarch64__ || defined __aarch64__
#define ECB_STDFP 1 #define ECB_STDFP 1
...@@ -1140,17 +1199,25 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1140,17 +1199,25 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
#define ECB_NAN ECB_INFINITY #define ECB_NAN ECB_INFINITY
#endif #endif
#if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L
#define ecb_ldexpf(x,e) ldexpf ((x), (e))
#define ecb_frexpf(x,e) frexpf ((x), (e))
#else
#define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e))
#define ecb_frexpf(x,e) (float) frexp ((double) (x), (e))
#endif
/* converts an ieee half/binary16 to a float */ /* converts an ieee half/binary16 to a float */
ecb_function_ float ecb_binary16_to_float (uint16_t x) ecb_const; ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x);
ecb_function_ float ecb_function_ ecb_const float
ecb_binary16_to_float (uint16_t x) ecb_binary16_to_float (uint16_t x)
{ {
int e = (x >> 10) & 0x1f; int e = (x >> 10) & 0x1f;
int m = x & 0x3ff; int m = x & 0x3ff;
float r; float r;
if (!e ) r = ldexpf (m , -24); if (!e ) r = ecb_ldexpf (m , -24);
else if (e != 31) r = ldexpf (m + 0x400, e - 25); else if (e != 31) r = ecb_ldexpf (m + 0x400, e - 25);
else if (m ) r = ECB_NAN; else if (m ) r = ECB_NAN;
else r = ECB_INFINITY; else r = ECB_INFINITY;
...@@ -1158,8 +1225,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1158,8 +1225,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
} }
/* convert a float to ieee single/binary32 */ /* convert a float to ieee single/binary32 */
ecb_function_ uint32_t ecb_float_to_binary32 (float x) ecb_const; ecb_function_ ecb_const uint32_t ecb_float_to_binary32 (float x);
ecb_function_ uint32_t ecb_function_ ecb_const uint32_t
ecb_float_to_binary32 (float x) ecb_float_to_binary32 (float x)
{ {
uint32_t r; uint32_t r;
...@@ -1176,7 +1243,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1176,7 +1243,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
if (x < -3.40282346638528860e+38f) return 0xff800000U; if (x < -3.40282346638528860e+38f) return 0xff800000U;
if (x != x ) return 0x7fbfffffU; if (x != x ) return 0x7fbfffffU;
m = frexpf (x, &e) * 0x1000000U; m = ecb_frexpf (x, &e) * 0x1000000U;
r = m & 0x80000000U; r = m & 0x80000000U;
...@@ -1198,8 +1265,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1198,8 +1265,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
} }
/* converts an ieee single/binary32 to a float */ /* converts an ieee single/binary32 to a float */
ecb_function_ float ecb_binary32_to_float (uint32_t x) ecb_const; ecb_function_ ecb_const float ecb_binary32_to_float (uint32_t x);
ecb_function_ float ecb_function_ ecb_const float
ecb_binary32_to_float (uint32_t x) ecb_binary32_to_float (uint32_t x)
{ {
float r; float r;
...@@ -1219,7 +1286,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1219,7 +1286,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
e = 1; e = 1;
/* we distrust ldexpf a bit and do the 2**-24 scaling by an extra multiply */ /* we distrust ldexpf a bit and do the 2**-24 scaling by an extra multiply */
r = ldexpf (x * (0.5f / 0x800000U), e - 126); r = ecb_ldexpf (x * (0.5f / 0x800000U), e - 126);
r = neg ? -r : r; r = neg ? -r : r;
#endif #endif
...@@ -1228,8 +1295,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1228,8 +1295,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
} }
/* convert a double to ieee double/binary64 */ /* convert a double to ieee double/binary64 */
ecb_function_ uint64_t ecb_double_to_binary64 (double x) ecb_const; ecb_function_ ecb_const uint64_t ecb_double_to_binary64 (double x);
ecb_function_ uint64_t ecb_function_ ecb_const uint64_t
ecb_double_to_binary64 (double x) ecb_double_to_binary64 (double x)
{ {
uint64_t r; uint64_t r;
...@@ -1268,8 +1335,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == ...@@ -1268,8 +1335,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
} }
/* converts an ieee double/binary64 to a double */ /* converts an ieee double/binary64 to a double */
ecb_function_ double ecb_binary64_to_double (uint64_t x) ecb_const; ecb_function_ ecb_const double ecb_binary64_to_double (uint64_t x);
ecb_function_ double ecb_function_ ecb_const double
ecb_binary64_to_double (uint64_t x) ecb_binary64_to_double (uint64_t x)
{ {
double r; double r;
......
/* /*
* libev native API header * libev native API header
* *
* Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libev@schmorp.de> * Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
...@@ -42,12 +42,16 @@ ...@@ -42,12 +42,16 @@
#ifdef __cplusplus #ifdef __cplusplus
# define EV_CPP(x) x # define EV_CPP(x) x
# if __cplusplus >= 201103L
# define EV_THROW noexcept
# else
# define EV_THROW throw ()
# endif
#else #else
# define EV_CPP(x) # define EV_CPP(x)
# define EV_THROW
#endif #endif
#define EV_THROW EV_CPP(throw())
EV_CPP(extern "C" {) EV_CPP(extern "C" {)
/*****************************************************************************/ /*****************************************************************************/
...@@ -148,6 +152,8 @@ EV_CPP(extern "C" {) ...@@ -148,6 +152,8 @@ EV_CPP(extern "C" {)
typedef double ev_tstamp; typedef double ev_tstamp;
#include <string.h> /* for memmove */
#ifndef EV_ATOMIC_T #ifndef EV_ATOMIC_T
# include <signal.h> # include <signal.h>
# define EV_ATOMIC_T sig_atomic_t volatile # define EV_ATOMIC_T sig_atomic_t volatile
...@@ -205,7 +211,7 @@ struct ev_loop; ...@@ -205,7 +211,7 @@ struct ev_loop;
/*****************************************************************************/ /*****************************************************************************/
#define EV_VERSION_MAJOR 4 #define EV_VERSION_MAJOR 4
#define EV_VERSION_MINOR 19 #define EV_VERSION_MINOR 20
/* eventmask, revents, events... */ /* eventmask, revents, events... */
enum { enum {
...@@ -660,7 +666,7 @@ EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW; ...@@ -660,7 +666,7 @@ EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW;
EV_API_DECL void *ev_userdata (EV_P) EV_THROW; EV_API_DECL void *ev_userdata (EV_P) EV_THROW;
typedef void (*ev_loop_callback)(EV_P); typedef void (*ev_loop_callback)(EV_P);
EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW; EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW;
/* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out*/ /* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out */
EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW; EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW;
EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */ EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */
...@@ -715,7 +721,8 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW; ...@@ -715,7 +721,8 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */ #define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
#define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */ #define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
#define ev_cb(ev) (ev)->cb /* rw */ #define ev_cb_(ev) (ev)->cb /* rw */
#define ev_cb(ev) (memmove (&ev_cb_ (ev), &((ev_watcher *)(ev))->cb, sizeof (ev_cb_ (ev))), (ev)->cb)
#if EV_MINPRI == EV_MAXPRI #if EV_MINPRI == EV_MAXPRI
# define ev_priority(ev) ((ev), EV_MINPRI) # define ev_priority(ev) ((ev), EV_MINPRI)
...@@ -728,7 +735,7 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW; ...@@ -728,7 +735,7 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
#define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at) #define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at)
#ifndef ev_set_cb #ifndef ev_set_cb
# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_) # define ev_set_cb(ev,cb_) (ev_cb_ (ev) = (cb_), memmove (&((ev_watcher *)(ev))->cb, &ev_cb_ (ev), sizeof (ev_cb_ (ev))))
#endif #endif
/* stopping (enabling, adding) a watcher does nothing if it is already running */ /* stopping (enabling, adding) a watcher does nothing if it is already running */
......
#!/bin/sh #!/bin/sh
#
# install - install a program, script, or datafile # install - install a program, script, or datafile
#
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license. # following copyright and license.
...@@ -34,261 +35,493 @@ ...@@ -34,261 +35,493 @@
# FSF changes to this file are in the public domain. # FSF changes to this file are in the public domain.
# #
# Calling this script install-sh is preferred over install.sh, to prevent # Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it # 'make' implicit rules from creating a file called install from it
# when there is no Makefile. # when there is no Makefile.
# #
# This script is compatible with the BSD install script, but was written # This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction # from scratch.
# shared with many OS's install programs.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script # set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it. # Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}" doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else else
: doit_exec=$doit
fi fi
if [ x"$dir_arg" != x ]; then # Put in absolute file names if you don't have them in your path;
dst=$src # or use environment vars.
src=""
chgrpprog=${CHGRPPROG-chgrp}
if [ -d "$dst" ]; then chmodprog=${CHMODPROG-chmod}
instcmd=: chownprog=${CHOWNPROG-chown}
chmodcmd="" cmpprog=${CMPPROG-cmp}
else cpprog=${CPPROG-cp}
instcmd=$mkdirprog mkdirprog=${MKDIRPROG-mkdir}
fi mvprog=${MVPROG-mv}
else rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad posix_glob='?'
# if $src (and thus $dsttmp) contains '*'. initialize_posix_glob='
test "$posix_glob" != "?" || {
if [ -f "$src" ] || [ -d "$src" ] if (set -f) 2>/dev/null; then
then posix_glob=
: else
else posix_glob=:
echo "$0: $src does not exist" >&2 fi
exit 1 }
fi '
if [ x"$dst" = x ] posix_mkdir=
then
echo "$0: no destination specified" >&2 # Desired mode of installed file.
exit 1 mode=0755
else
: chgrpcmd=
fi chmodcmd=$chmodprog
chowncmd=
# If destination is a directory, append the input filename; if your system mvcmd=$mvprog
# does not like double slashes in filenames, you may need to add some logic rmcmd="$rmprog -f"
stripcmd=
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command src=
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` dst=
dir_arg=
dst_arg=
# Make sure that the destination directory exists. copy_on_change=false
# this part is taken from Noah Friedman's mkinstalldirs script no_target_directory=
# Skip lots of stat calls in the usual case. usage="\
if [ ! -d "$dstdir" ]; then Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
defaultIFS=' or: $0 [OPTION]... SRCFILES... DIRECTORY
' or: $0 [OPTION]... -t DIRECTORY SRCFILES...
IFS="${IFS-$defaultIFS}" or: $0 [OPTION]... -d DIRECTORIES...
oIFS=$IFS In the 1st form, copy SRCFILE to DSTFILE.
# Some sh's can't handle IFS=/ for some reason. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
IFS='%' In the 4th, create DIRECTORIES.
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp='' Options:
--help display this help and exit.
--version display version info and exit.
while [ $# -ne 0 ] ; do -c (ignored)
pathcomp=$pathcomp$1 -C install only if different (preserve the last data modification time)
shift -d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
if [ ! -d "$pathcomp" ] ; Environment variables override the default commands:
then CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
$mkdirprog "$pathcomp" RMPROG STRIPPROG
else "
:
fi
pathcomp=$pathcomp/ while test $# -ne 0; do
done case $1 in
fi -c) ;;
if [ x"$dir_arg" != x ] -C) copy_on_change=true;;
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && -d) dir_arg=true;;
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now. -g) chgrpcmd="$chgrpprog $2"
shift;;
if [ x"$transformarg" = x ] --help) echo "$usage"; exit $?;;
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename -m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
if [ x"$dstfile" = x ] -o) chowncmd="$chownprog $2"
then shift;;
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory. -s) stripcmd=$stripprog;;
dsttmp=$dstdir/_inst.$$_ -t) dst_arg=$2
rmtmp=$dstdir/_rm.$$_ # Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
# Trap to clean up temp files at exit. -T) no_target_directory=true;;
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 --version) echo "$0 $scriptversion"; exit $?;;
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name --) shift
break;;
$doit $instcmd "$src" "$dsttmp" && -*) echo "$0: invalid option: $1" >&2
exit 1;;
# and set any options; do chmod last to preserve setuid bits *) break;;
esac
shift
done
# If any of these fail, we abort the whole thing. If we want to if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# ignore errors from any of these, just make sure not to ignore # When -d is used, all remaining arguments are directories to create.
# errors from the above "$doit $instcmd $src $dsttmp" command. # When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && if test $# -eq 0; then
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if test -z "$dir_arg"; then
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && echo "$0: no input file specified." >&2
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
# Now remove or move aside any old file at destination location. We try this if test -z "$dir_arg"; then
# two ways since rm can't unlink itself on some systems and the destination do_exit='(exit $ret); exit $ret'
# file might be busy for other reasons. In this case, the final cleanup trap "ret=129; $do_exit" 1
# might fail but the new file should still install successfully. trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
{ for src
if [ -f "$dstdir/$dstfile" ] do
then # Protect names problematic for 'test' and other utilities.
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || case $src in
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || -* | [=\(\)!]) src=./$src;;
{ esac
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit if test -n "$dir_arg"; then
} dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else else
: mkdir_mode=
fi fi
} &&
# Now rename the file to the real destination. posix_mkdir=false
case $umask in
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile" *[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
fi && # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
# The final little trick to "correctly" pass the exit status to the exit trap. if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
{ # Local variables:
(exit 0); exit # eval: (add-hook 'write-file-hooks 'time-stamp)
} # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# GNU Libtool is free software; you can redistribute it and/or modify # GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# As a special exception to the GNU General Public License, # As a special exception to the GNU General Public License,
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
# compiler: $LTCC # compiler: $LTCC
# compiler flags: $LTCFLAGS # compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld) # linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.1 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.11
# automake: $automake_version # automake: $automake_version
# autoconf: $autoconf_version # autoconf: $autoconf_version
# #
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
PROGRAM=libtool PROGRAM=libtool
PACKAGE=libtool PACKAGE=libtool
VERSION="2.4.2 Debian-2.4.2-1.1" VERSION="2.4.2 Debian-2.4.2-1.11"
TIMESTAMP="" TIMESTAMP=""
package_revision=1.3337 package_revision=1.3337
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment