mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Use the gnulib md5 module.
This commit is contained in:
parent
ffbba2e6b9
commit
58a9721edf
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2010-05-16 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* md5: Remove directory.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add crypto/md5.
|
||||
|
||||
* configure.ac: Remove any check for md5 libraries.
|
||||
|
||||
* Makefile.am (ACLOCAL_AMFLAGS): Remove -I md5/m4.
|
||||
(SUBDIRS): Remove md5.
|
||||
|
||||
2010-05-15 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add "getopt-gnu". Remove "getopt".
|
||||
|
@ -38,10 +38,10 @@ distuninstallcheck_listfiles = find . -type f | \
|
||||
grep -Ev '(/share/info/dir|/etc/wgetrc)$$'
|
||||
|
||||
# Search for macros in the m4 subdirectory:
|
||||
ACLOCAL_AMFLAGS = -I m4 -I md5/m4
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# subdirectories in the distribution
|
||||
SUBDIRS = lib md5 src doc po tests util windows
|
||||
SUBDIRS = lib src doc po tests util windows
|
||||
|
||||
EXTRA_DIST = ChangeLog.README configure.bat MAILING-LIST \
|
||||
msdos/ChangeLog msdos/config.h msdos/Makefile.DJ \
|
||||
|
@ -38,6 +38,7 @@ getsockname
|
||||
gnupload
|
||||
listen
|
||||
maintainer-makefile
|
||||
crypto/md5
|
||||
quote
|
||||
quotearg
|
||||
recv
|
||||
|
69
configure.ac
69
configure.ac
@ -86,13 +86,6 @@ ENABLE_DEBUG=$enableval, ENABLE_DEBUG=yes)
|
||||
test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE([ENABLE_DEBUG], 1,
|
||||
[Define if you want the debug output support compiled in.])
|
||||
|
||||
wget_need_md5=no
|
||||
|
||||
case "${ENABLE_OPIE}${ENABLE_DIGEST}" in
|
||||
*yes*)
|
||||
wget_need_md5=yes
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl Find the compiler
|
||||
dnl
|
||||
@ -106,7 +99,6 @@ AM_PROG_CC_C_O
|
||||
AC_AIX
|
||||
|
||||
gl_EARLY
|
||||
md5_EARLY
|
||||
|
||||
dnl
|
||||
dnl Gettext
|
||||
@ -303,65 +295,6 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Find an MD5 implementation. Since Wget rarely needs MD5, we try
|
||||
dnl to use an existing library implementation to save on code size.
|
||||
dnl
|
||||
|
||||
if test x"$wget_need_md5" = xyes
|
||||
then
|
||||
dnl This should be moved to an AC_DEFUN, but I'm not sure how to
|
||||
dnl manipulate MD5_OBJ from the defun.
|
||||
|
||||
AC_LIBOBJ([gen-md5])
|
||||
found_md5=no
|
||||
|
||||
dnl Check for the system MD5 library on Solaris. We don't check for
|
||||
dnl something simple like "MD5Update" because there are a number of
|
||||
dnl MD5 implementations that use that name, but have an otherwise
|
||||
dnl incompatible interface. md5_calc is, hopefully, specific to the
|
||||
dnl Solaris MD5 library.
|
||||
if test x"$found_md5" = xno; then
|
||||
AC_CHECK_LIB(md5, md5_calc, [
|
||||
dnl Some installations have bogus <md5.h> in the compiler's
|
||||
dnl include path, making the system md5 library useless.
|
||||
AC_MSG_CHECKING([for working md5.h])
|
||||
AC_COMPILE_IFELSE([#include <md5.h>
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_SOLARIS_MD5], 1, [Define when using Solaris MD5.])
|
||||
LIBS="-lmd5 $LIBS"
|
||||
found_md5=yes
|
||||
AC_MSG_NOTICE([using the Solaris MD5 implementation])
|
||||
], [AC_MSG_RESULT(no)])
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Then see if we're linking OpenSSL anyway; if yes, use its md5
|
||||
dnl implementation.
|
||||
if test x"$found_md5" = xno; then
|
||||
if test x"$LIBSSL" != x; then
|
||||
AC_DEFINE([HAVE_OPENSSL_MD5], 1, [Define when using OpenSSL MD5.])
|
||||
found_md5=yes
|
||||
AC_MSG_NOTICE([using the OpenSSL MD5 implementation])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl If none of the above worked, use the one we ship with Wget.
|
||||
if test x"$found_md5" = xno; then
|
||||
AC_DEFINE([HAVE_BUILTIN_MD5], 1, [Define when using built-in MD5.])
|
||||
found_md5=yes
|
||||
AC_MSG_NOTICE([using the built-in (GNU) MD5 implementation])
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_SUBST(MD5_CPPFLAGS, '-I $(top_srcdir)/md5')
|
||||
AC_SUBST(MD5_LDADD, '../md5/libmd5.a')
|
||||
AC_SUBST(MD5_SUBDIR, md5)
|
||||
md5_INIT
|
||||
fi
|
||||
AC_DEFINE([HAVE_MD5], 1, [Define if we're compiling support for MD5.])
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Checks for IPv6
|
||||
dnl **********************************************************************
|
||||
@ -552,6 +485,6 @@ dnl Create output
|
||||
dnl
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile util/Makefile
|
||||
po/Makefile.in tests/Makefile tests/WgetTest.pm
|
||||
lib/Makefile md5/Makefile windows/Makefile])
|
||||
lib/Makefile windows/Makefile])
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
AC_OUTPUT
|
||||
|
@ -1,16 +0,0 @@
|
||||
#
|
||||
# Wget for VMS - MMS (or MMK) Source Dependency File.
|
||||
#
|
||||
|
||||
# This description file is included by other description files. It is
|
||||
# not intended to be used alone. Verify proper inclusion.
|
||||
|
||||
.IFDEF INCL_DESCRIP_DEPS
|
||||
.ELSE
|
||||
$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY.
|
||||
.ENDIF
|
||||
|
||||
[.$(DEST)]MD5.OBJ : [-.MD5]MD5.C
|
||||
[.$(DEST)]MD5.OBJ : [-.SRC.$(DEST)]CONFIG.H
|
||||
[.$(DEST)]MD5.OBJ : [-.MD5]MD5.H
|
||||
[.$(DEST)]MD5.OBJ : [-.VMS]STDINT.H
|
@ -1,18 +0,0 @@
|
||||
# 15 September 2009. SMS.
|
||||
#
|
||||
# Wget 1.12 for VMS - MMS (or MMK) Object Module List File.
|
||||
#
|
||||
|
||||
# This description file is included by other description files. It is
|
||||
# not intended to be used alone. Verify proper inclusion.
|
||||
|
||||
.IFDEF INCL_DESCRIP_SRC
|
||||
.ELSE
|
||||
$$$$ THIS DESCRIPTION FILE IS NOT INTENDED TO BE USED THIS WAY.
|
||||
.ENDIF
|
||||
|
||||
# Object library modules.
|
||||
|
||||
MODS_OBJS_LIB_MD5 = \
|
||||
MD5=[.$(DEST)]MD5.OBJ
|
||||
|
@ -1,34 +0,0 @@
|
||||
# 15 September 2009. SMS.
|
||||
#
|
||||
# Wget 1.12 for VMS - MMS (or MMK) Source Description File.
|
||||
#
|
||||
|
||||
# Default target identifier.
|
||||
|
||||
TARGET_MD5 = 1
|
||||
|
||||
# Common source description file.
|
||||
|
||||
.INCLUDE [-.VMS]DESCRIP_SRC_CMN.MMS
|
||||
|
||||
# C compiler defines.
|
||||
|
||||
CDEFS_SPEC =
|
||||
|
||||
CDEFS = $(CDEFS_CMN) $(CDEFS_SPEC)
|
||||
|
||||
# Other C compiler options.
|
||||
|
||||
CFLAGS_INCL = /include = ([], [.$(DEST)], \
|
||||
[-.$(DIR_SRC)], [-.$(DIR_SRC).$(DEST)], [-.$(DIR_VMS)])
|
||||
|
||||
CFLAGS_SPEC = /prefix_library_entries = all_entries
|
||||
|
||||
# Define CFLAGS and LINKFLAGS.
|
||||
|
||||
.INCLUDE [-.VMS]DESCRIP_SRC_FLAGS.MMS
|
||||
|
||||
# Object library modules.
|
||||
|
||||
.INCLUDE DESCRIP_MODS.MMS
|
||||
|
194
md5/Makefile.am
194
md5/Makefile.am
@ -1,194 +0,0 @@
|
||||
## DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. As a special exception to the GNU General
|
||||
# Public License, this file may be distributed as part of a program
|
||||
# that contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libmd5 --source-base=md5 --m4-base=md5/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=md5 crypto/md5
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||
|
||||
SUBDIRS =
|
||||
noinst_HEADERS =
|
||||
noinst_LIBRARIES =
|
||||
noinst_LTLIBRARIES =
|
||||
EXTRA_DIST =
|
||||
BUILT_SOURCES =
|
||||
SUFFIXES =
|
||||
MOSTLYCLEANFILES = core *.stackdump
|
||||
MOSTLYCLEANDIRS =
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
MAINTAINERCLEANFILES =
|
||||
EXTRA_DIST += m4/gnulib-cache.m4
|
||||
|
||||
AM_CPPFLAGS =
|
||||
AM_CFLAGS =
|
||||
|
||||
noinst_LIBRARIES += libmd5.a
|
||||
|
||||
libmd5_a_SOURCES =
|
||||
libmd5_a_LIBADD = $(md5_LIBOBJS)
|
||||
libmd5_a_DEPENDENCIES = $(md5_LIBOBJS)
|
||||
EXTRA_libmd5_a_SOURCES =
|
||||
|
||||
## begin gnulib module crypto/md5
|
||||
|
||||
|
||||
EXTRA_DIST += md5.c md5.h
|
||||
|
||||
EXTRA_libmd5_a_SOURCES += md5.c
|
||||
|
||||
## end gnulib module crypto/md5
|
||||
|
||||
## begin gnulib module link-warning
|
||||
|
||||
LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
|
||||
|
||||
## end gnulib module link-warning
|
||||
|
||||
## begin gnulib module stddef
|
||||
|
||||
BUILT_SOURCES += $(STDDEF_H)
|
||||
|
||||
# We need the following in order to create <stddef.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stddef.h: stddef.in.h
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
|
||||
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
|
||||
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
|
||||
< $(srcdir)/stddef.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stddef.h stddef.h-t
|
||||
|
||||
EXTRA_DIST += stddef.in.h
|
||||
|
||||
## end gnulib module stddef
|
||||
|
||||
## begin gnulib module stdint
|
||||
|
||||
BUILT_SOURCES += $(STDINT_H)
|
||||
|
||||
# We need the following in order to create <stdint.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stdint.h: stdint.in.h
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
|
||||
-e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
|
||||
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
|
||||
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
|
||||
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
|
||||
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
|
||||
-e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
|
||||
-e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
|
||||
-e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
|
||||
-e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
|
||||
-e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
|
||||
-e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
|
||||
-e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
|
||||
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
|
||||
< $(srcdir)/stdint.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdint.h stdint.h-t
|
||||
|
||||
EXTRA_DIST += stdint.in.h
|
||||
|
||||
## end gnulib module stdint
|
||||
|
||||
## begin gnulib module wchar
|
||||
|
||||
BUILT_SOURCES += $(WCHAR_H)
|
||||
|
||||
# We need the following in order to create <wchar.h> when the system
|
||||
# version does not work standalone.
|
||||
wchar.h: wchar.in.h
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
|
||||
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
|
||||
-e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
|
||||
-e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
|
||||
-e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
|
||||
-e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
|
||||
-e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
|
||||
-e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
|
||||
-e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
|
||||
-e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
|
||||
-e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
|
||||
-e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
|
||||
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
|
||||
-e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
|
||||
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
|
||||
-e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
|
||||
-e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
|
||||
-e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
|
||||
-e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
|
||||
-e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
|
||||
-e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
|
||||
-e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
|
||||
-e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
|
||||
-e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
|
||||
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
|
||||
-e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
|
||||
-e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
|
||||
-e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
|
||||
-e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
|
||||
-e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
|
||||
-e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
|
||||
-e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
|
||||
-e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
|
||||
-e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
|
||||
-e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
|
||||
-e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
|
||||
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
|
||||
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
|
||||
< $(srcdir)/wchar.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += wchar.h wchar.h-t
|
||||
|
||||
EXTRA_DIST += wchar.in.h
|
||||
|
||||
## end gnulib module wchar
|
||||
|
||||
## begin gnulib module dummy
|
||||
|
||||
libmd5_a_SOURCES += dummy.c
|
||||
|
||||
## end gnulib module dummy
|
||||
|
||||
|
||||
mostlyclean-local: mostlyclean-generic
|
||||
@for dir in '' $(MOSTLYCLEANDIRS); do \
|
||||
if test -n "$$dir" && test -d $$dir; then \
|
||||
echo "rmdir $$dir"; rmdir $$dir; \
|
||||
fi; \
|
||||
done; \
|
||||
:
|
42
md5/dummy.c
42
md5/dummy.c
@ -1,42 +0,0 @@
|
||||
/* A dummy file, to prevent empty libraries from breaking builds.
|
||||
Copyright (C) 2004, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
|
||||
libraries without any object files. You might get an error like:
|
||||
|
||||
> ar cru .libs/libgl.a
|
||||
> ar: no archive members specified
|
||||
|
||||
Compiling this file, and adding its object file to the library, will
|
||||
prevent the library from being empty. */
|
||||
|
||||
/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
|
||||
that don't export any symbol. You might get an error like:
|
||||
|
||||
> cc ... libgnu.a
|
||||
> ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
|
||||
|
||||
Compiling this file, and adding its object file to the library, will
|
||||
prevent the library from exporting no symbols. */
|
||||
|
||||
#ifdef __sun
|
||||
/* This declaration ensures that the library will export at least 1 symbol. */
|
||||
int gl_dummy_symbol;
|
||||
#else
|
||||
/* This declaration is solely to ensure that after preprocessing
|
||||
this file is never empty. */
|
||||
typedef int dummy;
|
||||
#endif
|
@ -1,30 +0,0 @@
|
||||
# 00gnulib.m4 serial 2
|
||||
dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This file must be named something that sorts before all other
|
||||
dnl gnulib-provided .m4 files. It is needed until such time as we can
|
||||
dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics.
|
||||
|
||||
# AC_DEFUN_ONCE([NAME], VALUE)
|
||||
# ----------------------------
|
||||
# Define NAME to expand to VALUE on the first use (whether by direct
|
||||
# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
|
||||
# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This
|
||||
# definition is slower than the version in Autoconf 2.64, because it
|
||||
# can only use interfaces that existed since 2.59; but it achieves the
|
||||
# same effect. Quoting is necessary to avoid confusing Automake.
|
||||
m4_version_prereq([2.63.263], [],
|
||||
[m4_define([AC][_DEFUN_ONCE],
|
||||
[AC][_DEFUN([$1],
|
||||
[AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
|
||||
[m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
|
||||
[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
|
||||
|
||||
# gl_00GNULIB
|
||||
# -----------
|
||||
# Witness macro that this file has been included. Needed to force
|
||||
# Automake to include this file prior to all other gnulib .m4 files.
|
||||
AC_DEFUN([gl_00GNULIB])
|
@ -1,35 +0,0 @@
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. As a special exception to the GNU General
|
||||
# Public License, this file may be distributed as part of a program
|
||||
# that contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
#
|
||||
# This file represents the specification of how gnulib-tool is used.
|
||||
# It acts as a cache: It is written and read by gnulib-tool.
|
||||
# In projects using CVS, this file is meant to be stored in CVS,
|
||||
# like the configure.ac and various Makefile.am files.
|
||||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libmd5 --source-base=md5 --m4-base=md5/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=md5 crypto/md5
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
gl_MODULES([
|
||||
crypto/md5
|
||||
])
|
||||
gl_AVOID([])
|
||||
gl_SOURCE_BASE([md5])
|
||||
gl_M4_BASE([md5/m4])
|
||||
gl_PO_BASE([])
|
||||
gl_DOC_BASE([doc])
|
||||
gl_TESTS_BASE([tests])
|
||||
gl_LIB([libmd5])
|
||||
gl_MAKEFILE_NAME([])
|
||||
gl_MACRO_PREFIX([md5])
|
||||
gl_PO_DOMAIN([])
|
@ -1,124 +0,0 @@
|
||||
# gnulib-common.m4 serial 11
|
||||
dnl Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# gl_COMMON
|
||||
# is expanded unconditionally through gnulib-tool magic.
|
||||
AC_DEFUN([gl_COMMON], [
|
||||
dnl Use AC_REQUIRE here, so that the code is expanded once only.
|
||||
AC_REQUIRE([gl_00GNULIB])
|
||||
AC_REQUIRE([gl_COMMON_BODY])
|
||||
])
|
||||
AC_DEFUN([gl_COMMON_BODY], [
|
||||
AH_VERBATIM([isoc99_inline],
|
||||
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
|
||||
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
|
||||
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
|
||||
__APPLE__ && __MACH__ test for MacOS X.
|
||||
__APPLE_CC__ tests for the Apple compiler and its version.
|
||||
__STDC_VERSION__ tests for the C99 mode. */
|
||||
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
|
||||
# define __GNUC_STDC_INLINE__ 1
|
||||
#endif])
|
||||
AH_VERBATIM([unused_parameter],
|
||||
[/* Define as a marker that can be attached to function parameter declarations
|
||||
for parameters that are not used. This helps to reduce warnings, such as
|
||||
from GCC -Wunused-parameter. */
|
||||
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
|
||||
#else
|
||||
# define _UNUSED_PARAMETER_
|
||||
#endif
|
||||
])
|
||||
])
|
||||
|
||||
# gl_MODULE_INDICATOR([modulename])
|
||||
# defines a C macro indicating the presence of the given module.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR],
|
||||
[
|
||||
AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
|
||||
[Define to 1 when using the gnulib module ]$1[.])
|
||||
])
|
||||
|
||||
# m4_foreach_w
|
||||
# is a backport of autoconf-2.59c's m4_foreach_w.
|
||||
# Remove this macro when we can assume autoconf >= 2.60.
|
||||
m4_ifndef([m4_foreach_w],
|
||||
[m4_define([m4_foreach_w],
|
||||
[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
|
||||
|
||||
# AC_PROG_MKDIR_P
|
||||
# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
|
||||
# Remove this macro when we can assume autoconf >= 2.60.
|
||||
m4_ifdef([AC_PROG_MKDIR_P], [], [
|
||||
AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
|
||||
[AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
|
||||
MKDIR_P='$(mkdir_p)'
|
||||
AC_SUBST([MKDIR_P])])])
|
||||
|
||||
# AC_C_RESTRICT
|
||||
# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
|
||||
# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
|
||||
# works.
|
||||
# This definition can be removed once autoconf >= 2.62 can be assumed.
|
||||
AC_DEFUN([AC_C_RESTRICT],
|
||||
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
|
||||
[ac_cv_c_restrict=no
|
||||
# The order here caters to the fact that C++ does not require restrict.
|
||||
for ac_kw in __restrict __restrict__ _Restrict restrict; do
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[typedef int * int_ptr;
|
||||
int foo (int_ptr $ac_kw ip) {
|
||||
return ip[0];
|
||||
}]],
|
||||
[[int s[1];
|
||||
int * $ac_kw t = s;
|
||||
t[0] = 0;
|
||||
return foo(t)]])],
|
||||
[ac_cv_c_restrict=$ac_kw])
|
||||
test "$ac_cv_c_restrict" != no && break
|
||||
done
|
||||
])
|
||||
AH_VERBATIM([restrict],
|
||||
[/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict, even
|
||||
though the corresponding Sun C compiler does, which causes
|
||||
"#define restrict _Restrict" in the previous line. Perhaps some future
|
||||
version of Sun C++ will work with _Restrict; if so, it'll probably
|
||||
define __RESTRICT, just as Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
#endif])
|
||||
case $ac_cv_c_restrict in
|
||||
restrict) ;;
|
||||
no) AC_DEFINE([restrict], []) ;;
|
||||
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# gl_BIGENDIAN
|
||||
# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
|
||||
# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
|
||||
# macros invoke AC_C_BIGENDIAN with arguments.
|
||||
AC_DEFUN([gl_BIGENDIAN],
|
||||
[
|
||||
AC_C_BIGENDIAN
|
||||
])
|
||||
|
||||
# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
|
||||
# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
|
||||
# output a spurious "(cached)" mark in the midst of other configure output.
|
||||
# This macro should be used instead of AC_CACHE_VAL when it is not surrounded
|
||||
# by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
|
||||
AC_DEFUN([gl_CACHE_VAL_SILENT],
|
||||
[
|
||||
saved_as_echo_n="$as_echo_n"
|
||||
as_echo_n=':'
|
||||
AC_CACHE_VAL([$1], [$2])
|
||||
as_echo_n="$saved_as_echo_n"
|
||||
])
|
@ -1,201 +0,0 @@
|
||||
# DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. As a special exception to the GNU General
|
||||
# Public License, this file may be distributed as part of a program
|
||||
# that contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
#
|
||||
# This file represents the compiled summary of the specification in
|
||||
# gnulib-cache.m4. It lists the computed macro invocations that need
|
||||
# to be invoked from configure.ac.
|
||||
# In projects using CVS, this file can be treated like other built files.
|
||||
|
||||
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Checks for programs", right after AC_PROG_CC, and certainly before
|
||||
# any checks for libraries, header files, types and library functions.
|
||||
AC_DEFUN([md5_EARLY],
|
||||
[
|
||||
m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
|
||||
m4_pattern_allow([^gl_ES$])dnl a valid locale name
|
||||
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
|
||||
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
|
||||
AC_REQUIRE([AC_PROG_RANLIB])
|
||||
])
|
||||
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Check for header files, types and library functions".
|
||||
AC_DEFUN([md5_INIT],
|
||||
[
|
||||
AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
|
||||
gl_cond_libtool=false
|
||||
gl_libdeps=
|
||||
gl_ltlibdeps=
|
||||
m4_pushdef([AC_LIBOBJ], m4_defn([md5_LIBOBJ]))
|
||||
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5_REPLACE_FUNCS]))
|
||||
m4_pushdef([AC_LIBSOURCES], m4_defn([md5_LIBSOURCES]))
|
||||
m4_pushdef([md5_LIBSOURCES_LIST], [])
|
||||
m4_pushdef([md5_LIBSOURCES_DIR], [])
|
||||
gl_COMMON
|
||||
gl_source_base='md5'
|
||||
gl_MD5
|
||||
gl_MULTIARCH
|
||||
gl_STDDEF_H
|
||||
gl_STDINT_H
|
||||
gl_WCHAR_H
|
||||
m4_ifval(md5_LIBSOURCES_LIST, [
|
||||
m4_syscmd([test ! -d ]m4_defn([md5_LIBSOURCES_DIR])[ ||
|
||||
for gl_file in ]md5_LIBSOURCES_LIST[ ; do
|
||||
if test ! -r ]m4_defn([md5_LIBSOURCES_DIR])[/$gl_file ; then
|
||||
echo "missing file ]m4_defn([md5_LIBSOURCES_DIR])[/$gl_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done])dnl
|
||||
m4_if(m4_sysval, [0], [],
|
||||
[AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
|
||||
])
|
||||
m4_popdef([md5_LIBSOURCES_DIR])
|
||||
m4_popdef([md5_LIBSOURCES_LIST])
|
||||
m4_popdef([AC_LIBSOURCES])
|
||||
m4_popdef([AC_REPLACE_FUNCS])
|
||||
m4_popdef([AC_LIBOBJ])
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
md5_libobjs=
|
||||
md5_ltlibobjs=
|
||||
if test -n "$md5_LIBOBJS"; then
|
||||
# Remove the extension.
|
||||
sed_drop_objext='s/\.o$//;s/\.obj$//'
|
||||
for i in `for i in $md5_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
|
||||
md5_libobjs="$md5_libobjs $i.$ac_objext"
|
||||
md5_ltlibobjs="$md5_ltlibobjs $i.lo"
|
||||
done
|
||||
fi
|
||||
AC_SUBST([md5_LIBOBJS], [$md5_libobjs])
|
||||
AC_SUBST([md5_LTLIBOBJS], [$md5_ltlibobjs])
|
||||
])
|
||||
gltests_libdeps=
|
||||
gltests_ltlibdeps=
|
||||
m4_pushdef([AC_LIBOBJ], m4_defn([md5tests_LIBOBJ]))
|
||||
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5tests_REPLACE_FUNCS]))
|
||||
m4_pushdef([AC_LIBSOURCES], m4_defn([md5tests_LIBSOURCES]))
|
||||
m4_pushdef([md5tests_LIBSOURCES_LIST], [])
|
||||
m4_pushdef([md5tests_LIBSOURCES_DIR], [])
|
||||
gl_COMMON
|
||||
gl_source_base='tests'
|
||||
m4_ifval(md5tests_LIBSOURCES_LIST, [
|
||||
m4_syscmd([test ! -d ]m4_defn([md5tests_LIBSOURCES_DIR])[ ||
|
||||
for gl_file in ]md5tests_LIBSOURCES_LIST[ ; do
|
||||
if test ! -r ]m4_defn([md5tests_LIBSOURCES_DIR])[/$gl_file ; then
|
||||
echo "missing file ]m4_defn([md5tests_LIBSOURCES_DIR])[/$gl_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done])dnl
|
||||
m4_if(m4_sysval, [0], [],
|
||||
[AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
|
||||
])
|
||||
m4_popdef([md5tests_LIBSOURCES_DIR])
|
||||
m4_popdef([md5tests_LIBSOURCES_LIST])
|
||||
m4_popdef([AC_LIBSOURCES])
|
||||
m4_popdef([AC_REPLACE_FUNCS])
|
||||
m4_popdef([AC_LIBOBJ])
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
md5tests_libobjs=
|
||||
md5tests_ltlibobjs=
|
||||
if test -n "$md5tests_LIBOBJS"; then
|
||||
# Remove the extension.
|
||||
sed_drop_objext='s/\.o$//;s/\.obj$//'
|
||||
for i in `for i in $md5tests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
|
||||
md5tests_libobjs="$md5tests_libobjs $i.$ac_objext"
|
||||
md5tests_ltlibobjs="$md5tests_ltlibobjs $i.lo"
|
||||
done
|
||||
fi
|
||||
AC_SUBST([md5tests_LIBOBJS], [$md5tests_libobjs])
|
||||
AC_SUBST([md5tests_LTLIBOBJS], [$md5tests_ltlibobjs])
|
||||
])
|
||||
LIBMD5_LIBDEPS="$gl_libdeps"
|
||||
AC_SUBST([LIBMD5_LIBDEPS])
|
||||
LIBMD5_LTLIBDEPS="$gl_ltlibdeps"
|
||||
AC_SUBST([LIBMD5_LTLIBDEPS])
|
||||
])
|
||||
|
||||
# Like AC_LIBOBJ, except that the module name goes
|
||||
# into md5_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([md5_LIBOBJ], [
|
||||
AS_LITERAL_IF([$1], [md5_LIBSOURCES([$1.c])])dnl
|
||||
md5_LIBOBJS="$md5_LIBOBJS $1.$ac_objext"
|
||||
])
|
||||
|
||||
# Like AC_REPLACE_FUNCS, except that the module name goes
|
||||
# into md5_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([md5_REPLACE_FUNCS], [
|
||||
m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
|
||||
AC_CHECK_FUNCS([$1], , [md5_LIBOBJ($ac_func)])
|
||||
])
|
||||
|
||||
# Like AC_LIBSOURCES, except the directory where the source file is
|
||||
# expected is derived from the gnulib-tool parameterization,
|
||||
# and alloca is special cased (for the alloca-opt module).
|
||||
# We could also entirely rely on EXTRA_lib..._SOURCES.
|
||||
AC_DEFUN([md5_LIBSOURCES], [
|
||||
m4_foreach([_gl_NAME], [$1], [
|
||||
m4_if(_gl_NAME, [alloca.c], [], [
|
||||
m4_define([md5_LIBSOURCES_DIR], [md5])
|
||||
m4_append([md5_LIBSOURCES_LIST], _gl_NAME, [ ])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
# Like AC_LIBOBJ, except that the module name goes
|
||||
# into md5tests_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([md5tests_LIBOBJ], [
|
||||
AS_LITERAL_IF([$1], [md5tests_LIBSOURCES([$1.c])])dnl
|
||||
md5tests_LIBOBJS="$md5tests_LIBOBJS $1.$ac_objext"
|
||||
])
|
||||
|
||||
# Like AC_REPLACE_FUNCS, except that the module name goes
|
||||
# into md5tests_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([md5tests_REPLACE_FUNCS], [
|
||||
m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
|
||||
AC_CHECK_FUNCS([$1], , [md5tests_LIBOBJ($ac_func)])
|
||||
])
|
||||
|
||||
# Like AC_LIBSOURCES, except the directory where the source file is
|
||||
# expected is derived from the gnulib-tool parameterization,
|
||||
# and alloca is special cased (for the alloca-opt module).
|
||||
# We could also entirely rely on EXTRA_lib..._SOURCES.
|
||||
AC_DEFUN([md5tests_LIBSOURCES], [
|
||||
m4_foreach([_gl_NAME], [$1], [
|
||||
m4_if(_gl_NAME, [alloca.c], [], [
|
||||
m4_define([md5tests_LIBSOURCES_DIR], [tests])
|
||||
m4_append([md5tests_LIBSOURCES_LIST], _gl_NAME, [ ])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
# This macro records the list of files which have been installed by
|
||||
# gnulib-tool and may be removed by future gnulib-tool invocations.
|
||||
AC_DEFUN([md5_FILE_LIST], [
|
||||
build-aux/link-warning.h
|
||||
lib/dummy.c
|
||||
lib/md5.c
|
||||
lib/md5.h
|
||||
lib/stddef.in.h
|
||||
lib/stdint.in.h
|
||||
lib/wchar.in.h
|
||||
m4/00gnulib.m4
|
||||
m4/gnulib-common.m4
|
||||
m4/include_next.m4
|
||||
m4/longlong.m4
|
||||
m4/md5.m4
|
||||
m4/multiarch.m4
|
||||
m4/stddef_h.m4
|
||||
m4/stdint.m4
|
||||
m4/wchar.m4
|
||||
m4/wchar_t.m4
|
||||
m4/wint_t.m4
|
||||
])
|
@ -1,57 +0,0 @@
|
||||
# gnulib-tool.m4 serial 2
|
||||
dnl Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl The following macros need not be invoked explicitly.
|
||||
dnl Invoking them does nothing except to declare default arguments
|
||||
dnl for "gnulib-tool --import".
|
||||
|
||||
dnl Usage: gl_LOCAL_DIR([DIR])
|
||||
AC_DEFUN([gl_LOCAL_DIR], [])
|
||||
|
||||
dnl Usage: gl_MODULES([module1 module2 ...])
|
||||
AC_DEFUN([gl_MODULES], [])
|
||||
|
||||
dnl Usage: gl_AVOID([module1 module2 ...])
|
||||
AC_DEFUN([gl_AVOID], [])
|
||||
|
||||
dnl Usage: gl_SOURCE_BASE([DIR])
|
||||
AC_DEFUN([gl_SOURCE_BASE], [])
|
||||
|
||||
dnl Usage: gl_M4_BASE([DIR])
|
||||
AC_DEFUN([gl_M4_BASE], [])
|
||||
|
||||
dnl Usage: gl_PO_BASE([DIR])
|
||||
AC_DEFUN([gl_PO_BASE], [])
|
||||
|
||||
dnl Usage: gl_DOC_BASE([DIR])
|
||||
AC_DEFUN([gl_DOC_BASE], [])
|
||||
|
||||
dnl Usage: gl_TESTS_BASE([DIR])
|
||||
AC_DEFUN([gl_TESTS_BASE], [])
|
||||
|
||||
dnl Usage: gl_WITH_TESTS
|
||||
AC_DEFUN([gl_WITH_TESTS], [])
|
||||
|
||||
dnl Usage: gl_LIB([LIBNAME])
|
||||
AC_DEFUN([gl_LIB], [])
|
||||
|
||||
dnl Usage: gl_LGPL or gl_LGPL([VERSION])
|
||||
AC_DEFUN([gl_LGPL], [])
|
||||
|
||||
dnl Usage: gl_MAKEFILE_NAME([FILENAME])
|
||||
AC_DEFUN([gl_MAKEFILE_NAME], [])
|
||||
|
||||
dnl Usage: gl_LIBTOOL
|
||||
AC_DEFUN([gl_LIBTOOL], [])
|
||||
|
||||
dnl Usage: gl_MACRO_PREFIX([PREFIX])
|
||||
AC_DEFUN([gl_MACRO_PREFIX], [])
|
||||
|
||||
dnl Usage: gl_PO_DOMAIN([DOMAIN])
|
||||
AC_DEFUN([gl_PO_DOMAIN], [])
|
||||
|
||||
dnl Usage: gl_VC_FILES([BOOLEAN])
|
||||
AC_DEFUN([gl_VC_FILES], [])
|
@ -1,188 +0,0 @@
|
||||
# include_next.m4 serial 14
|
||||
dnl Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert and Derek Price.
|
||||
|
||||
dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
|
||||
dnl
|
||||
dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
|
||||
dnl 'include' otherwise.
|
||||
dnl
|
||||
dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
|
||||
dnl supports it in the special case that it is the first include directive in
|
||||
dnl the given file, or to 'include' otherwise.
|
||||
dnl
|
||||
dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
|
||||
dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
|
||||
dnl '#pragma GCC system_header' has the same effect as if the file was found
|
||||
dnl through the include search path specified with '-isystem' options (as
|
||||
dnl opposed to the search path specified with '-I' options). Namely, gcc
|
||||
dnl does not warn about some things, and on some systems (Solaris and Interix)
|
||||
dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
|
||||
dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
|
||||
dnl of plain '__STDC__'.
|
||||
|
||||
AC_DEFUN([gl_INCLUDE_NEXT],
|
||||
[
|
||||
AC_LANG_PREPROC_REQUIRE()
|
||||
AC_CACHE_CHECK([whether the preprocessor supports include_next],
|
||||
[gl_cv_have_include_next],
|
||||
[rm -rf conftestd1a conftestd1b conftestd2
|
||||
mkdir conftestd1a conftestd1b conftestd2
|
||||
dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on
|
||||
dnl AIX 6.1 support include_next when used as first preprocessor directive
|
||||
dnl in a file, but not when preceded by another include directive. Check
|
||||
dnl for this bug by including <stdio.h>.
|
||||
dnl Additionally, with this same compiler, include_next is a no-op when
|
||||
dnl used in a header file that was included by specifying its absolute
|
||||
dnl file name. Despite these two bugs, include_next is used in the
|
||||
dnl compiler's <math.h>. By virtue of the second bug, we need to use
|
||||
dnl include_next as well in this case.
|
||||
cat <<EOF > conftestd1a/conftest.h
|
||||
#define DEFINED_IN_CONFTESTD1
|
||||
#include_next <conftest.h>
|
||||
#ifdef DEFINED_IN_CONFTESTD2
|
||||
int foo;
|
||||
#else
|
||||
#error "include_next doesn't work"
|
||||
#endif
|
||||
EOF
|
||||
cat <<EOF > conftestd1b/conftest.h
|
||||
#define DEFINED_IN_CONFTESTD1
|
||||
#include <stdio.h>
|
||||
#include_next <conftest.h>
|
||||
#ifdef DEFINED_IN_CONFTESTD2
|
||||
int foo;
|
||||
#else
|
||||
#error "include_next doesn't work"
|
||||
#endif
|
||||
EOF
|
||||
cat <<EOF > conftestd2/conftest.h
|
||||
#ifndef DEFINED_IN_CONFTESTD1
|
||||
#error "include_next test doesn't work"
|
||||
#endif
|
||||
#define DEFINED_IN_CONFTESTD2
|
||||
EOF
|
||||
gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
|
||||
AC_COMPILE_IFELSE([#include <conftest.h>],
|
||||
[gl_cv_have_include_next=yes],
|
||||
[CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
|
||||
AC_COMPILE_IFELSE([#include <conftest.h>],
|
||||
[gl_cv_have_include_next=buggy],
|
||||
[gl_cv_have_include_next=no])
|
||||
])
|
||||
CPPFLAGS="$gl_save_CPPFLAGS"
|
||||
rm -rf conftestd1a conftestd1b conftestd2
|
||||
])
|
||||
PRAGMA_SYSTEM_HEADER=
|
||||
if test $gl_cv_have_include_next = yes; then
|
||||
INCLUDE_NEXT=include_next
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
|
||||
if test -n "$GCC"; then
|
||||
PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
|
||||
fi
|
||||
else
|
||||
if test $gl_cv_have_include_next = buggy; then
|
||||
INCLUDE_NEXT=include
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
|
||||
else
|
||||
INCLUDE_NEXT=include
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([INCLUDE_NEXT])
|
||||
AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
|
||||
AC_SUBST([PRAGMA_SYSTEM_HEADER])
|
||||
])
|
||||
|
||||
# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
|
||||
# ------------------------------------------
|
||||
# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
|
||||
# '<foo.h>'; otherwise define it to be
|
||||
# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
|
||||
# Also, if #include_next works as first preprocessing directive in a file,
|
||||
# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
|
||||
# be
|
||||
# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
|
||||
# That way, a header file with the following line:
|
||||
# #@INCLUDE_NEXT@ @NEXT_FOO_H@
|
||||
# or
|
||||
# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
|
||||
# behaves (after sed substitution) as if it contained
|
||||
# #include_next <foo.h>
|
||||
# even if the compiler does not support include_next.
|
||||
# The three "///" are to pacify Sun C 5.8, which otherwise would say
|
||||
# "warning: #include of /usr/include/... may be non-portable".
|
||||
# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
|
||||
# Note: This macro assumes that the header file is not empty after
|
||||
# preprocessing, i.e. it does not only define preprocessor macros but also
|
||||
# provides some type/enum definitions or function/variable declarations.
|
||||
AC_DEFUN([gl_CHECK_NEXT_HEADERS],
|
||||
[
|
||||
AC_REQUIRE([gl_INCLUDE_NEXT])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_CHECK_HEADERS_ONCE([$1])
|
||||
|
||||
m4_foreach_w([gl_HEADER_NAME], [$1],
|
||||
[AS_VAR_PUSHDEF([gl_next_header],
|
||||
[gl_cv_next_]m4_defn([gl_HEADER_NAME]))
|
||||
if test $gl_cv_have_include_next = yes; then
|
||||
AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
|
||||
else
|
||||
AC_CACHE_CHECK(
|
||||
[absolute name of <]m4_defn([gl_HEADER_NAME])[>],
|
||||
m4_defn([gl_next_header]),
|
||||
[AS_VAR_PUSHDEF([gl_header_exists],
|
||||
[ac_cv_header_]m4_defn([gl_HEADER_NAME]))
|
||||
if test AS_VAR_GET(gl_header_exists) = yes; then
|
||||
AC_LANG_CONFTEST(
|
||||
[AC_LANG_SOURCE(
|
||||
[[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
|
||||
)])
|
||||
dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
|
||||
dnl that contain only a #include of other header files and no
|
||||
dnl non-comment tokens of their own. This leads to a failure to
|
||||
dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
|
||||
dnl and others. The workaround is to force preservation of comments
|
||||
dnl through option -C. This ensures all necessary #line directives
|
||||
dnl are present. GCC supports option -C as well.
|
||||
case "$host_os" in
|
||||
aix*) gl_absname_cpp="$ac_cpp -C" ;;
|
||||
*) gl_absname_cpp="$ac_cpp" ;;
|
||||
esac
|
||||
dnl eval is necessary to expand gl_absname_cpp.
|
||||
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
|
||||
dnl so use subshell.
|
||||
AS_VAR_SET([gl_next_header],
|
||||
['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
|
||||
sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
|
||||
s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
|
||||
s#^/[^/]#//&#
|
||||
p
|
||||
q
|
||||
}'`'"'])
|
||||
else
|
||||
AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
|
||||
fi
|
||||
AS_VAR_POPDEF([gl_header_exists])])
|
||||
fi
|
||||
AC_SUBST(
|
||||
AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
|
||||
[AS_VAR_GET([gl_next_header])])
|
||||
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
|
||||
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
|
||||
gl_next_as_first_directive='<'gl_HEADER_NAME'>'
|
||||
else
|
||||
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
|
||||
gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
|
||||
fi
|
||||
AC_SUBST(
|
||||
AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
|
||||
[$gl_next_as_first_directive])
|
||||
AS_VAR_POPDEF([gl_next_header])])
|
||||
])
|
@ -1,107 +0,0 @@
|
||||
# longlong.m4 serial 14
|
||||
dnl Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
dnl 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
# Define HAVE_LONG_LONG_INT if 'long long int' works.
|
||||
# This fixes a bug in Autoconf 2.61, but can be removed once we
|
||||
# assume 2.62 everywhere.
|
||||
|
||||
# Note: If the type 'long long int' exists but is only 32 bits large
|
||||
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
|
||||
# defined. In this case you can treat 'long long int' like 'long int'.
|
||||
|
||||
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
|
||||
[
|
||||
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
|
||||
[AC_LINK_IFELSE(
|
||||
[_AC_TYPE_LONG_LONG_SNIPPET],
|
||||
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
|
||||
dnl If cross compiling, assume the bug isn't important, since
|
||||
dnl nobody cross compiles for this platform as far as we know.
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[@%:@include <limits.h>
|
||||
@%:@ifndef LLONG_MAX
|
||||
@%:@ define HALF \
|
||||
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
|
||||
@%:@ define LLONG_MAX (HALF - 1 + HALF)
|
||||
@%:@endif]],
|
||||
[[long long int n = 1;
|
||||
int i;
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
long long int m = n << i;
|
||||
if (m >> i != n)
|
||||
return 1;
|
||||
if (LLONG_MAX / 2 < m)
|
||||
break;
|
||||
}
|
||||
return 0;]])],
|
||||
[ac_cv_type_long_long_int=yes],
|
||||
[ac_cv_type_long_long_int=no],
|
||||
[ac_cv_type_long_long_int=yes])],
|
||||
[ac_cv_type_long_long_int=no])])
|
||||
if test $ac_cv_type_long_long_int = yes; then
|
||||
AC_DEFINE([HAVE_LONG_LONG_INT], [1],
|
||||
[Define to 1 if the system has the type `long long int'.])
|
||||
fi
|
||||
])
|
||||
|
||||
# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
|
||||
# This fixes a bug in Autoconf 2.61, but can be removed once we
|
||||
# assume 2.62 everywhere.
|
||||
|
||||
# Note: If the type 'unsigned long long int' exists but is only 32 bits
|
||||
# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
|
||||
# will not be defined. In this case you can treat 'unsigned long long int'
|
||||
# like 'unsigned long int'.
|
||||
|
||||
AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
|
||||
[
|
||||
AC_CACHE_CHECK([for unsigned long long int],
|
||||
[ac_cv_type_unsigned_long_long_int],
|
||||
[AC_LINK_IFELSE(
|
||||
[_AC_TYPE_LONG_LONG_SNIPPET],
|
||||
[ac_cv_type_unsigned_long_long_int=yes],
|
||||
[ac_cv_type_unsigned_long_long_int=no])])
|
||||
if test $ac_cv_type_unsigned_long_long_int = yes; then
|
||||
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
|
||||
[Define to 1 if the system has the type `unsigned long long int'.])
|
||||
fi
|
||||
])
|
||||
|
||||
# Expands to a C program that can be used to test for simultaneous support
|
||||
# of 'long long' and 'unsigned long long'. We don't want to say that
|
||||
# 'long long' is available if 'unsigned long long' is not, or vice versa,
|
||||
# because too many programs rely on the symmetry between signed and unsigned
|
||||
# integer types (excluding 'bool').
|
||||
AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[[/* For now, do not test the preprocessor; as of 2007 there are too many
|
||||
implementations with broken preprocessors. Perhaps this can
|
||||
be revisited in 2012. In the meantime, code should not expect
|
||||
#if to work with literals wider than 32 bits. */
|
||||
/* Test literals. */
|
||||
long long int ll = 9223372036854775807ll;
|
||||
long long int nll = -9223372036854775807LL;
|
||||
unsigned long long int ull = 18446744073709551615ULL;
|
||||
/* Test constant expressions. */
|
||||
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
|
||||
? 1 : -1)];
|
||||
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
|
||||
? 1 : -1)];
|
||||
int i = 63;]],
|
||||
[[/* Test availability of runtime routines for shift and division. */
|
||||
long long int llmax = 9223372036854775807ll;
|
||||
unsigned long long int ullmax = 18446744073709551615ull;
|
||||
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
|
||||
| (llmax / ll) | (llmax % ll)
|
||||
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
|
||||
| (ullmax / ull) | (ullmax % ull));]])
|
||||
])
|
@ -1,16 +0,0 @@
|
||||
# md5.m4 serial 11
|
||||
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free
|
||||
dnl Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_MD5],
|
||||
[
|
||||
AC_LIBOBJ([md5])
|
||||
|
||||
dnl Prerequisites of lib/md5.c.
|
||||
AC_REQUIRE([gl_BIGENDIAN])
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
:
|
||||
])
|
@ -1,65 +0,0 @@
|
||||
# multiarch.m4 serial 5
|
||||
dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Determine whether the compiler is or may be producing universal binaries.
|
||||
#
|
||||
# On MacOS X 10.5 and later systems, the user can create libraries and
|
||||
# executables that work on multiple system types--known as "fat" or
|
||||
# "universal" binaries--by specifying multiple '-arch' options to the
|
||||
# compiler but only a single '-arch' option to the preprocessor. Like
|
||||
# this:
|
||||
#
|
||||
# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
# CPP="gcc -E" CXXCPP="g++ -E"
|
||||
#
|
||||
# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the
|
||||
# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly.
|
||||
|
||||
AC_DEFUN_ONCE([gl_MULTIARCH],
|
||||
[
|
||||
dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
|
||||
gl_cv_c_multiarch=no
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE(
|
||||
[[#ifndef __APPLE_CC__
|
||||
not a universal capable compiler
|
||||
#endif
|
||||
typedef int dummy;
|
||||
]])],
|
||||
[
|
||||
dnl Check for potential -arch flags. It is not universal unless
|
||||
dnl there are at least two -arch flags with different values.
|
||||
arch=
|
||||
prev=
|
||||
for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
|
||||
if test -n "$prev"; then
|
||||
case $word in
|
||||
i?86 | x86_64 | ppc | ppc64)
|
||||
if test -z "$arch" || test "$arch" = "$word"; then
|
||||
arch="$word"
|
||||
else
|
||||
gl_cv_c_multiarch=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
prev=
|
||||
else
|
||||
if test "x$word" = "x-arch"; then
|
||||
prev=arch
|
||||
fi
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test $gl_cv_c_multiarch = yes; then
|
||||
AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1],
|
||||
[Define if the compiler is building for multiple architectures of Apple platforms at once.])
|
||||
APPLE_UNIVERSAL_BUILD=1
|
||||
else
|
||||
APPLE_UNIVERSAL_BUILD=0
|
||||
fi
|
||||
AC_SUBST([APPLE_UNIVERSAL_BUILD])
|
||||
])
|
@ -1,45 +0,0 @@
|
||||
dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
|
||||
# stddef_h.m4 serial 1
|
||||
dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_STDDEF_H],
|
||||
[
|
||||
AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
|
||||
AC_REQUIRE([gt_TYPE_WCHAR_T])
|
||||
if test $gt_cv_c_wchar_t = no; then
|
||||
HAVE_WCHAR_T=0
|
||||
STDDEF_H=stddef.h
|
||||
fi
|
||||
AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
|
||||
[gl_cv_decl_null_works],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
|
||||
int test[2 * (sizeof NULL == sizeof (void *)) -1];
|
||||
]])],
|
||||
[gl_cv_decl_null_works=yes],
|
||||
[gl_cv_decl_null_works=no])])
|
||||
if test $gl_cv_decl_null_works = no; then
|
||||
REPLACE_NULL=1
|
||||
STDDEF_H=stddef.h
|
||||
fi
|
||||
if test -n "$STDDEF_H"; then
|
||||
gl_CHECK_NEXT_HEADERS([stddef.h])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
|
||||
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDDEF_H_DEFAULTS],
|
||||
[
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
|
||||
HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
|
||||
STDDEF_H=''; AC_SUBST([STDDEF_H])
|
||||
])
|
473
md5/m4/stdint.m4
473
md5/m4/stdint.m4
@ -1,473 +0,0 @@
|
||||
# stdint.m4 serial 34
|
||||
dnl Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
dnl 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert and Bruno Haible.
|
||||
dnl Test whether <stdint.h> is supported or must be substituted.
|
||||
|
||||
AC_DEFUN([gl_STDINT_H],
|
||||
[
|
||||
AC_PREREQ([2.59])dnl
|
||||
|
||||
dnl Check for long long int and unsigned long long int.
|
||||
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
||||
if test $ac_cv_type_long_long_int = yes; then
|
||||
HAVE_LONG_LONG_INT=1
|
||||
else
|
||||
HAVE_LONG_LONG_INT=0
|
||||
fi
|
||||
AC_SUBST([HAVE_LONG_LONG_INT])
|
||||
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
|
||||
if test $ac_cv_type_unsigned_long_long_int = yes; then
|
||||
HAVE_UNSIGNED_LONG_LONG_INT=1
|
||||
else
|
||||
HAVE_UNSIGNED_LONG_LONG_INT=0
|
||||
fi
|
||||
AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
|
||||
|
||||
dnl Check for <inttypes.h>.
|
||||
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
|
||||
if test $ac_cv_header_inttypes_h = yes; then
|
||||
HAVE_INTTYPES_H=1
|
||||
else
|
||||
HAVE_INTTYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_INTTYPES_H])
|
||||
|
||||
dnl Check for <sys/types.h>.
|
||||
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
|
||||
if test $ac_cv_header_sys_types_h = yes; then
|
||||
HAVE_SYS_TYPES_H=1
|
||||
else
|
||||
HAVE_SYS_TYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_TYPES_H])
|
||||
|
||||
gl_CHECK_NEXT_HEADERS([stdint.h])
|
||||
if test $ac_cv_header_stdint_h = yes; then
|
||||
HAVE_STDINT_H=1
|
||||
else
|
||||
HAVE_STDINT_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_STDINT_H])
|
||||
|
||||
dnl Now see whether we need a substitute <stdint.h>.
|
||||
if test $ac_cv_header_stdint_h = yes; then
|
||||
AC_CACHE_CHECK([whether stdint.h conforms to C99],
|
||||
[gl_cv_header_working_stdint_h],
|
||||
[gl_cv_header_working_stdint_h=no
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
|
||||
#include <stdint.h>
|
||||
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
|
||||
#if !(defined WCHAR_MIN && defined WCHAR_MAX)
|
||||
#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
|
||||
#endif
|
||||
]
|
||||
gl_STDINT_INCLUDES
|
||||
[
|
||||
#ifdef INT8_MAX
|
||||
int8_t a1 = INT8_MAX;
|
||||
int8_t a1min = INT8_MIN;
|
||||
#endif
|
||||
#ifdef INT16_MAX
|
||||
int16_t a2 = INT16_MAX;
|
||||
int16_t a2min = INT16_MIN;
|
||||
#endif
|
||||
#ifdef INT32_MAX
|
||||
int32_t a3 = INT32_MAX;
|
||||
int32_t a3min = INT32_MIN;
|
||||
#endif
|
||||
#ifdef INT64_MAX
|
||||
int64_t a4 = INT64_MAX;
|
||||
int64_t a4min = INT64_MIN;
|
||||
#endif
|
||||
#ifdef UINT8_MAX
|
||||
uint8_t b1 = UINT8_MAX;
|
||||
#else
|
||||
typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
|
||||
#endif
|
||||
#ifdef UINT16_MAX
|
||||
uint16_t b2 = UINT16_MAX;
|
||||
#endif
|
||||
#ifdef UINT32_MAX
|
||||
uint32_t b3 = UINT32_MAX;
|
||||
#endif
|
||||
#ifdef UINT64_MAX
|
||||
uint64_t b4 = UINT64_MAX;
|
||||
#endif
|
||||
int_least8_t c1 = INT8_C (0x7f);
|
||||
int_least8_t c1max = INT_LEAST8_MAX;
|
||||
int_least8_t c1min = INT_LEAST8_MIN;
|
||||
int_least16_t c2 = INT16_C (0x7fff);
|
||||
int_least16_t c2max = INT_LEAST16_MAX;
|
||||
int_least16_t c2min = INT_LEAST16_MIN;
|
||||
int_least32_t c3 = INT32_C (0x7fffffff);
|
||||
int_least32_t c3max = INT_LEAST32_MAX;
|
||||
int_least32_t c3min = INT_LEAST32_MIN;
|
||||
int_least64_t c4 = INT64_C (0x7fffffffffffffff);
|
||||
int_least64_t c4max = INT_LEAST64_MAX;
|
||||
int_least64_t c4min = INT_LEAST64_MIN;
|
||||
uint_least8_t d1 = UINT8_C (0xff);
|
||||
uint_least8_t d1max = UINT_LEAST8_MAX;
|
||||
uint_least16_t d2 = UINT16_C (0xffff);
|
||||
uint_least16_t d2max = UINT_LEAST16_MAX;
|
||||
uint_least32_t d3 = UINT32_C (0xffffffff);
|
||||
uint_least32_t d3max = UINT_LEAST32_MAX;
|
||||
uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
|
||||
uint_least64_t d4max = UINT_LEAST64_MAX;
|
||||
int_fast8_t e1 = INT_FAST8_MAX;
|
||||
int_fast8_t e1min = INT_FAST8_MIN;
|
||||
int_fast16_t e2 = INT_FAST16_MAX;
|
||||
int_fast16_t e2min = INT_FAST16_MIN;
|
||||
int_fast32_t e3 = INT_FAST32_MAX;
|
||||
int_fast32_t e3min = INT_FAST32_MIN;
|
||||
int_fast64_t e4 = INT_FAST64_MAX;
|
||||
int_fast64_t e4min = INT_FAST64_MIN;
|
||||
uint_fast8_t f1 = UINT_FAST8_MAX;
|
||||
uint_fast16_t f2 = UINT_FAST16_MAX;
|
||||
uint_fast32_t f3 = UINT_FAST32_MAX;
|
||||
uint_fast64_t f4 = UINT_FAST64_MAX;
|
||||
#ifdef INTPTR_MAX
|
||||
intptr_t g = INTPTR_MAX;
|
||||
intptr_t gmin = INTPTR_MIN;
|
||||
#endif
|
||||
#ifdef UINTPTR_MAX
|
||||
uintptr_t h = UINTPTR_MAX;
|
||||
#endif
|
||||
intmax_t i = INTMAX_MAX;
|
||||
uintmax_t j = UINTMAX_MAX;
|
||||
|
||||
#include <limits.h> /* for CHAR_BIT */
|
||||
#define TYPE_MINIMUM(t) \
|
||||
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
|
||||
#define TYPE_MAXIMUM(t) \
|
||||
((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
|
||||
struct s {
|
||||
int check_PTRDIFF:
|
||||
PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
|
||||
&& PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
|
||||
? 1 : -1;
|
||||
/* Detect bug in FreeBSD 6.0 / ia64. */
|
||||
int check_SIG_ATOMIC:
|
||||
SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
|
||||
&& SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
|
||||
? 1 : -1;
|
||||
int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
|
||||
int check_WCHAR:
|
||||
WCHAR_MIN == TYPE_MINIMUM (wchar_t)
|
||||
&& WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
|
||||
? 1 : -1;
|
||||
/* Detect bug in mingw. */
|
||||
int check_WINT:
|
||||
WINT_MIN == TYPE_MINIMUM (wint_t)
|
||||
&& WINT_MAX == TYPE_MAXIMUM (wint_t)
|
||||
? 1 : -1;
|
||||
|
||||
/* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
|
||||
int check_UINT8_C:
|
||||
(-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
|
||||
int check_UINT16_C:
|
||||
(-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
|
||||
|
||||
/* Detect bugs in OpenBSD 3.9 stdint.h. */
|
||||
#ifdef UINT8_MAX
|
||||
int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
|
||||
#endif
|
||||
#ifdef UINT16_MAX
|
||||
int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
|
||||
#endif
|
||||
#ifdef UINT32_MAX
|
||||
int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
|
||||
#endif
|
||||
#ifdef UINT64_MAX
|
||||
int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
|
||||
#endif
|
||||
int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
|
||||
int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
|
||||
int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
|
||||
int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
|
||||
int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
|
||||
int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
|
||||
int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
|
||||
int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
|
||||
int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
|
||||
int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
|
||||
int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
|
||||
};
|
||||
]])],
|
||||
[dnl Determine whether the various *_MIN, *_MAX macros are usable
|
||||
dnl in preprocessor expression. We could do it by compiling a test
|
||||
dnl program for each of these macros. It is faster to run a program
|
||||
dnl that inspects the macro expansion.
|
||||
dnl This detects a bug on HP-UX 11.23/ia64.
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
|
||||
#include <stdint.h>
|
||||
]
|
||||
gl_STDINT_INCLUDES
|
||||
[
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define MVAL(macro) MVAL1(macro)
|
||||
#define MVAL1(expression) #expression
|
||||
static const char *macro_values[] =
|
||||
{
|
||||
#ifdef INT8_MAX
|
||||
MVAL (INT8_MAX),
|
||||
#endif
|
||||
#ifdef INT16_MAX
|
||||
MVAL (INT16_MAX),
|
||||
#endif
|
||||
#ifdef INT32_MAX
|
||||
MVAL (INT32_MAX),
|
||||
#endif
|
||||
#ifdef INT64_MAX
|
||||
MVAL (INT64_MAX),
|
||||
#endif
|
||||
#ifdef UINT8_MAX
|
||||
MVAL (UINT8_MAX),
|
||||
#endif
|
||||
#ifdef UINT16_MAX
|
||||
MVAL (UINT16_MAX),
|
||||
#endif
|
||||
#ifdef UINT32_MAX
|
||||
MVAL (UINT32_MAX),
|
||||
#endif
|
||||
#ifdef UINT64_MAX
|
||||
MVAL (UINT64_MAX),
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
]], [[
|
||||
const char **mv;
|
||||
for (mv = macro_values; *mv != NULL; mv++)
|
||||
{
|
||||
const char *value = *mv;
|
||||
/* Test whether it looks like a cast expression. */
|
||||
if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
|
||||
|| strncmp (value, "((unsigned short)"/*)*/, 17) == 0
|
||||
|| strncmp (value, "((unsigned char)"/*)*/, 16) == 0
|
||||
|| strncmp (value, "((int)"/*)*/, 6) == 0
|
||||
|| strncmp (value, "((signed short)"/*)*/, 15) == 0
|
||||
|| strncmp (value, "((signed char)"/*)*/, 14) == 0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
]])],
|
||||
[gl_cv_header_working_stdint_h=yes],
|
||||
[],
|
||||
[dnl When cross-compiling, assume it works.
|
||||
gl_cv_header_working_stdint_h=yes
|
||||
])
|
||||
])
|
||||
])
|
||||
fi
|
||||
if test "$gl_cv_header_working_stdint_h" = yes; then
|
||||
STDINT_H=
|
||||
else
|
||||
dnl Check for <sys/inttypes.h>, and for
|
||||
dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
|
||||
AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
|
||||
if test $ac_cv_header_sys_inttypes_h = yes; then
|
||||
HAVE_SYS_INTTYPES_H=1
|
||||
else
|
||||
HAVE_SYS_INTTYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_INTTYPES_H])
|
||||
if test $ac_cv_header_sys_bitypes_h = yes; then
|
||||
HAVE_SYS_BITYPES_H=1
|
||||
else
|
||||
HAVE_SYS_BITYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_BITYPES_H])
|
||||
|
||||
dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
|
||||
dnl character support).
|
||||
AC_CHECK_HEADERS_ONCE([wchar.h])
|
||||
|
||||
gl_STDINT_TYPE_PROPERTIES
|
||||
STDINT_H=stdint.h
|
||||
fi
|
||||
AC_SUBST([STDINT_H])
|
||||
])
|
||||
|
||||
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
|
||||
dnl Determine the size of each of the given types in bits.
|
||||
AC_DEFUN([gl_STDINT_BITSIZEOF],
|
||||
[
|
||||
dnl Use a shell loop, to avoid bloating configure, and
|
||||
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
|
||||
dnl config.h.in,
|
||||
dnl - extra AC_SUBST calls, so that the right substitutions are made.
|
||||
m4_foreach_w([gltype], [$1],
|
||||
[AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
|
||||
[Define to the number of bits in type ']gltype['.])])
|
||||
for gltype in $1 ; do
|
||||
AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
|
||||
[AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
|
||||
[$2
|
||||
#include <limits.h>], [result=unknown])
|
||||
eval gl_cv_bitsizeof_${gltype}=\$result
|
||||
])
|
||||
eval result=\$gl_cv_bitsizeof_${gltype}
|
||||
if test $result = unknown; then
|
||||
dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
|
||||
dnl do a syntax check even on unused #if conditions and give an error
|
||||
dnl on valid C code like this:
|
||||
dnl #if 0
|
||||
dnl # if > 32
|
||||
dnl # endif
|
||||
dnl #endif
|
||||
result=0
|
||||
fi
|
||||
GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
|
||||
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
|
||||
eval BITSIZEOF_${GLTYPE}=\$result
|
||||
done
|
||||
m4_foreach_w([gltype], [$1],
|
||||
[AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
|
||||
])
|
||||
|
||||
dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
|
||||
dnl Determine the signedness of each of the given types.
|
||||
dnl Define HAVE_SIGNED_TYPE if type is signed.
|
||||
AC_DEFUN([gl_CHECK_TYPES_SIGNED],
|
||||
[
|
||||
dnl Use a shell loop, to avoid bloating configure, and
|
||||
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
|
||||
dnl config.h.in,
|
||||
dnl - extra AC_SUBST calls, so that the right substitutions are made.
|
||||
m4_foreach_w([gltype], [$1],
|
||||
[AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
|
||||
[Define to 1 if ']gltype[' is a signed integer type.])])
|
||||
for gltype in $1 ; do
|
||||
AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([$2[
|
||||
int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
|
||||
result=yes, result=no)
|
||||
eval gl_cv_type_${gltype}_signed=\$result
|
||||
])
|
||||
eval result=\$gl_cv_type_${gltype}_signed
|
||||
GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
|
||||
if test "$result" = yes; then
|
||||
AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
|
||||
eval HAVE_SIGNED_${GLTYPE}=1
|
||||
else
|
||||
eval HAVE_SIGNED_${GLTYPE}=0
|
||||
fi
|
||||
done
|
||||
m4_foreach_w([gltype], [$1],
|
||||
[AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
|
||||
])
|
||||
|
||||
dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
|
||||
dnl Determine the suffix to use for integer constants of the given types.
|
||||
dnl Define t_SUFFIX for each such type.
|
||||
AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
|
||||
[
|
||||
dnl Use a shell loop, to avoid bloating configure, and
|
||||
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
|
||||
dnl config.h.in,
|
||||
dnl - extra AC_SUBST calls, so that the right substitutions are made.
|
||||
m4_foreach_w([gltype], [$1],
|
||||
[AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
|
||||
[Define to l, ll, u, ul, ull, etc., as suitable for
|
||||
constants of type ']gltype['.])])
|
||||
for gltype in $1 ; do
|
||||
AC_CACHE_CHECK([for $gltype integer literal suffix],
|
||||
[gl_cv_type_${gltype}_suffix],
|
||||
[eval gl_cv_type_${gltype}_suffix=no
|
||||
eval result=\$gl_cv_type_${gltype}_signed
|
||||
if test "$result" = yes; then
|
||||
glsufu=
|
||||
else
|
||||
glsufu=u
|
||||
fi
|
||||
for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
|
||||
case $glsuf in
|
||||
'') gltype1='int';;
|
||||
l) gltype1='long int';;
|
||||
ll) gltype1='long long int';;
|
||||
i64) gltype1='__int64';;
|
||||
u) gltype1='unsigned int';;
|
||||
ul) gltype1='unsigned long int';;
|
||||
ull) gltype1='unsigned long long int';;
|
||||
ui64)gltype1='unsigned __int64';;
|
||||
esac
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([$2[
|
||||
extern $gltype foo;
|
||||
extern $gltype1 foo;]])],
|
||||
[eval gl_cv_type_${gltype}_suffix=\$glsuf])
|
||||
eval result=\$gl_cv_type_${gltype}_suffix
|
||||
test "$result" != no && break
|
||||
done])
|
||||
GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
|
||||
eval result=\$gl_cv_type_${gltype}_suffix
|
||||
test "$result" = no && result=
|
||||
eval ${GLTYPE}_SUFFIX=\$result
|
||||
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
|
||||
done
|
||||
m4_foreach_w([gltype], [$1],
|
||||
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
|
||||
])
|
||||
|
||||
dnl gl_STDINT_INCLUDES
|
||||
AC_DEFUN([gl_STDINT_INCLUDES],
|
||||
[[
|
||||
/* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <signal.h>
|
||||
#if HAVE_WCHAR_H
|
||||
# include <stdio.h>
|
||||
# include <time.h>
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
]])
|
||||
|
||||
dnl gl_STDINT_TYPE_PROPERTIES
|
||||
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
|
||||
dnl of interest to stdint.in.h.
|
||||
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
|
||||
[
|
||||
AC_REQUIRE([gl_MULTIARCH])
|
||||
if test $APPLE_UNIVERSAL_BUILD = 0; then
|
||||
gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
fi
|
||||
gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
gl_cv_type_ptrdiff_t_signed=yes
|
||||
gl_cv_type_size_t_signed=no
|
||||
if test $APPLE_UNIVERSAL_BUILD = 0; then
|
||||
gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
fi
|
||||
gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
])
|
||||
|
||||
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
|
||||
dnl Remove this when we can assume autoconf >= 2.61.
|
||||
m4_ifdef([AC_COMPUTE_INT], [], [
|
||||
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
|
||||
])
|
||||
|
||||
# Hey Emacs!
|
||||
# Local Variables:
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
103
md5/m4/wchar.m4
103
md5/m4/wchar.m4
@ -1,103 +0,0 @@
|
||||
dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
|
||||
|
||||
dnl Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Written by Eric Blake.
|
||||
|
||||
# wchar.m4 serial 25
|
||||
|
||||
AC_DEFUN([gl_WCHAR_H],
|
||||
[
|
||||
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
|
||||
AC_CACHE_CHECK([whether <wchar.h> is standalone],
|
||||
[gl_cv_header_wchar_h_standalone],
|
||||
[AC_COMPILE_IFELSE([[#include <wchar.h>
|
||||
wchar_t w;]],
|
||||
[gl_cv_header_wchar_h_standalone=yes],
|
||||
[gl_cv_header_wchar_h_standalone=no])])
|
||||
|
||||
AC_REQUIRE([gt_TYPE_WINT_T])
|
||||
if test $gt_cv_c_wint_t = yes; then
|
||||
HAVE_WINT_T=1
|
||||
else
|
||||
HAVE_WINT_T=0
|
||||
fi
|
||||
AC_SUBST([HAVE_WINT_T])
|
||||
|
||||
dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
|
||||
AC_REQUIRE([gl_STDDEF_H])
|
||||
|
||||
if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then
|
||||
WCHAR_H=wchar.h
|
||||
fi
|
||||
|
||||
dnl Prepare for creating substitute <wchar.h>.
|
||||
dnl Do it always: WCHAR_H may be empty here but can be set later.
|
||||
dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
|
||||
dnl character support).
|
||||
AC_CHECK_HEADERS_ONCE([wchar.h])
|
||||
if test $ac_cv_header_wchar_h = yes; then
|
||||
HAVE_WCHAR_H=1
|
||||
else
|
||||
HAVE_WCHAR_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_WCHAR_H])
|
||||
gl_CHECK_NEXT_HEADERS([wchar.h])
|
||||
])
|
||||
|
||||
dnl Unconditionally enables the replacement of <wchar.h>.
|
||||
AC_DEFUN([gl_REPLACE_WCHAR_H],
|
||||
[
|
||||
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
|
||||
WCHAR_H=wchar.h
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
|
||||
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_WCHAR_H_DEFAULTS],
|
||||
[
|
||||
GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
|
||||
GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
|
||||
GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
|
||||
GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
|
||||
GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
|
||||
GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
|
||||
GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
|
||||
GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
|
||||
GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
|
||||
GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
|
||||
GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
|
||||
HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
|
||||
HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
|
||||
HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
|
||||
HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
|
||||
HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS])
|
||||
HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
|
||||
HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
|
||||
HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
|
||||
HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
|
||||
HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
|
||||
REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
|
||||
REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC])
|
||||
REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB])
|
||||
REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT])
|
||||
REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC])
|
||||
REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN])
|
||||
REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
|
||||
REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
|
||||
REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB])
|
||||
REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
|
||||
REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
|
||||
REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
|
||||
WCHAR_H=''; AC_SUBST([WCHAR_H])
|
||||
])
|
@ -1,21 +0,0 @@
|
||||
# wchar_t.m4 serial 3 (gettext-0.18)
|
||||
dnl Copyright (C) 2002, 2003, 2008, 2009, 2010 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
dnl Test whether <stddef.h> has the 'wchar_t' type.
|
||||
dnl Prerequisite: AC_PROG_CC
|
||||
|
||||
AC_DEFUN([gt_TYPE_WCHAR_T],
|
||||
[
|
||||
AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
|
||||
[AC_TRY_COMPILE([#include <stddef.h>
|
||||
wchar_t foo = (wchar_t)'\0';], ,
|
||||
[gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
|
||||
if test $gt_cv_c_wchar_t = yes; then
|
||||
AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
|
||||
fi
|
||||
])
|
@ -1,29 +0,0 @@
|
||||
# wint_t.m4 serial 4 (gettext-0.18)
|
||||
dnl Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
dnl Test whether <wchar.h> has the 'wint_t' type.
|
||||
dnl Prerequisite: AC_PROG_CC
|
||||
|
||||
AC_DEFUN([gt_TYPE_WINT_T],
|
||||
[
|
||||
AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
|
||||
[AC_TRY_COMPILE([
|
||||
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
<wchar.h>.
|
||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
|
||||
before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
wint_t foo = (wchar_t)'\0';], ,
|
||||
[gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
|
||||
if test $gt_cv_c_wint_t = yes; then
|
||||
AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
|
||||
fi
|
||||
])
|
455
md5/md5.c
455
md5/md5.c
@ -1,455 +0,0 @@
|
||||
/* Functions to compute MD5 message digest of files or memory blocks.
|
||||
according to the definition of MD5 in RFC 1321 from April 1992.
|
||||
Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006,2008
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
/* We need to keep the namespace clean so define the MD5 function
|
||||
protected using leading __ . */
|
||||
# define md5_init_ctx __md5_init_ctx
|
||||
# define md5_process_block __md5_process_block
|
||||
# define md5_process_bytes __md5_process_bytes
|
||||
# define md5_finish_ctx __md5_finish_ctx
|
||||
# define md5_read_ctx __md5_read_ctx
|
||||
# define md5_stream __md5_stream
|
||||
# define md5_buffer __md5_buffer
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define SWAP(n) \
|
||||
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
|
||||
#else
|
||||
# define SWAP(n) (n)
|
||||
#endif
|
||||
|
||||
#define BLOCKSIZE 4096
|
||||
#if BLOCKSIZE % 64 != 0
|
||||
# error "invalid BLOCKSIZE"
|
||||
#endif
|
||||
|
||||
/* This array contains the bytes used to pad the buffer to the next
|
||||
64-byte boundary. (RFC 1321, 3.1: Step 1) */
|
||||
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
void
|
||||
md5_init_ctx (struct md5_ctx *ctx)
|
||||
{
|
||||
ctx->A = 0x67452301;
|
||||
ctx->B = 0xefcdab89;
|
||||
ctx->C = 0x98badcfe;
|
||||
ctx->D = 0x10325476;
|
||||
|
||||
ctx->total[0] = ctx->total[1] = 0;
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Copy the 4 byte value from v into the memory location pointed to by *cp,
|
||||
If your architecture allows unaligned access this is equivalent to
|
||||
* (uint32_t *) cp = v */
|
||||
static inline void
|
||||
set_uint32 (char *cp, uint32_t v)
|
||||
{
|
||||
memcpy (cp, &v, sizeof v);
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result
|
||||
must be in little endian byte order. */
|
||||
void *
|
||||
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
|
||||
{
|
||||
char *r = resbuf;
|
||||
set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
|
||||
set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
|
||||
set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
|
||||
set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF. */
|
||||
void *
|
||||
md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
uint32_t bytes = ctx->buflen;
|
||||
size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
|
||||
|
||||
/* Now count remaining bytes. */
|
||||
ctx->total[0] += bytes;
|
||||
if (ctx->total[0] < bytes)
|
||||
++ctx->total[1];
|
||||
|
||||
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||||
ctx->buffer[size - 2] = SWAP (ctx->total[0] << 3);
|
||||
ctx->buffer[size - 1] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
|
||||
|
||||
/* Process last bytes. */
|
||||
md5_process_block (ctx->buffer, size * 4, ctx);
|
||||
|
||||
return md5_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int
|
||||
md5_stream (FILE *stream, void *resblock)
|
||||
{
|
||||
struct md5_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
md5_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
while (1)
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
|
||||
if (sum == BLOCKSIZE)
|
||||
break;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
/* Check for the error flag IFF N == 0, so that we don't
|
||||
exit the loop after a partial read due to e.g., EAGAIN
|
||||
or EWOULDBLOCK. */
|
||||
if (ferror (stream))
|
||||
return 1;
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* We've read at least one byte, so ignore errors. But always
|
||||
check for EOF, since feof may be true even though N > 0.
|
||||
Otherwise, we could end up calling fread after EOF. */
|
||||
if (feof (stream))
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 64 == 0
|
||||
*/
|
||||
md5_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
process_partial_block:
|
||||
|
||||
/* Process any remaining bytes. */
|
||||
if (sum > 0)
|
||||
md5_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
md5_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *
|
||||
md5_buffer (const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct md5_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
md5_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 64 bytes. */
|
||||
md5_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return md5_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
if (ctx->buflen != 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
size_t add = 128 - left_over > len ? len : 128 - left_over;
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
|
||||
ctx->buflen += add;
|
||||
|
||||
if (ctx->buflen > 64)
|
||||
{
|
||||
md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
|
||||
|
||||
ctx->buflen &= 63;
|
||||
/* The regions in the following copy operation cannot overlap. */
|
||||
memcpy (ctx->buffer,
|
||||
&((char *) ctx->buffer)[(left_over + add) & ~63],
|
||||
ctx->buflen);
|
||||
}
|
||||
|
||||
buffer = (const char *) buffer + add;
|
||||
len -= add;
|
||||
}
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len >= 64)
|
||||
{
|
||||
#if !_STRING_ARCH_unaligned
|
||||
# define alignof(type) offsetof (struct { char c; type x; }, x)
|
||||
# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
|
||||
if (UNALIGNED_P (buffer))
|
||||
while (len > 64)
|
||||
{
|
||||
md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
|
||||
buffer = (const char *) buffer + 64;
|
||||
len -= 64;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
md5_process_block (buffer, len & ~63, ctx);
|
||||
buffer = (const char *) buffer + (len & ~63);
|
||||
len &= 63;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move remaining bytes in internal buffer. */
|
||||
if (len > 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
|
||||
left_over += len;
|
||||
if (left_over >= 64)
|
||||
{
|
||||
md5_process_block (ctx->buffer, 64, ctx);
|
||||
left_over -= 64;
|
||||
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
|
||||
}
|
||||
ctx->buflen = left_over;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* These are the four functions used in the four steps of the MD5 algorithm
|
||||
and defined in the RFC 1321. The first function is a little bit optimized
|
||||
(as found in Colin Plumbs public domain implementation). */
|
||||
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
|
||||
#define FF(b, c, d) (d ^ (b & (c ^ d)))
|
||||
#define FG(b, c, d) FF (d, b, c)
|
||||
#define FH(b, c, d) (b ^ c ^ d)
|
||||
#define FI(b, c, d) (c ^ (b | ~d))
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 64 == 0. */
|
||||
|
||||
void
|
||||
md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
{
|
||||
uint32_t correct_words[16];
|
||||
const uint32_t *words = buffer;
|
||||
size_t nwords = len / sizeof (uint32_t);
|
||||
const uint32_t *endp = words + nwords;
|
||||
uint32_t A = ctx->A;
|
||||
uint32_t B = ctx->B;
|
||||
uint32_t C = ctx->C;
|
||||
uint32_t D = ctx->D;
|
||||
|
||||
/* First increment the byte count. RFC 1321 specifies the possible
|
||||
length of the file up to 2^64 bits. Here we only compute the
|
||||
number of bytes. Do a double word increment. */
|
||||
ctx->total[0] += len;
|
||||
if (ctx->total[0] < len)
|
||||
++ctx->total[1];
|
||||
|
||||
/* Process all bytes in the buffer with 64 bytes in each round of
|
||||
the loop. */
|
||||
while (words < endp)
|
||||
{
|
||||
uint32_t *cwp = correct_words;
|
||||
uint32_t A_save = A;
|
||||
uint32_t B_save = B;
|
||||
uint32_t C_save = C;
|
||||
uint32_t D_save = D;
|
||||
|
||||
/* First round: using the given function, the context and a constant
|
||||
the next context is computed. Because the algorithms processing
|
||||
unit is a 32-bit word and it is determined to work on words in
|
||||
little endian byte order we perhaps have to change the byte order
|
||||
before the computation. To reduce the work for the next steps
|
||||
we store the swapped words in the array CORRECT_WORDS. */
|
||||
|
||||
#define OP(a, b, c, d, s, T) \
|
||||
do \
|
||||
{ \
|
||||
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
|
||||
++words; \
|
||||
CYCLIC (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
They are defined in RFC 1321 as
|
||||
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
|
||||
|
||||
Here is an equivalent invocation using Perl:
|
||||
|
||||
perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
|
||||
*/
|
||||
|
||||
/* Round 1. */
|
||||
OP (A, B, C, D, 7, 0xd76aa478);
|
||||
OP (D, A, B, C, 12, 0xe8c7b756);
|
||||
OP (C, D, A, B, 17, 0x242070db);
|
||||
OP (B, C, D, A, 22, 0xc1bdceee);
|
||||
OP (A, B, C, D, 7, 0xf57c0faf);
|
||||
OP (D, A, B, C, 12, 0x4787c62a);
|
||||
OP (C, D, A, B, 17, 0xa8304613);
|
||||
OP (B, C, D, A, 22, 0xfd469501);
|
||||
OP (A, B, C, D, 7, 0x698098d8);
|
||||
OP (D, A, B, C, 12, 0x8b44f7af);
|
||||
OP (C, D, A, B, 17, 0xffff5bb1);
|
||||
OP (B, C, D, A, 22, 0x895cd7be);
|
||||
OP (A, B, C, D, 7, 0x6b901122);
|
||||
OP (D, A, B, C, 12, 0xfd987193);
|
||||
OP (C, D, A, B, 17, 0xa679438e);
|
||||
OP (B, C, D, A, 22, 0x49b40821);
|
||||
|
||||
/* For the second to fourth round we have the possibly swapped words
|
||||
in CORRECT_WORDS. Redefine the macro to take an additional first
|
||||
argument specifying the function to use. */
|
||||
#undef OP
|
||||
#define OP(f, a, b, c, d, k, s, T) \
|
||||
do \
|
||||
{ \
|
||||
a += f (b, c, d) + correct_words[k] + T; \
|
||||
CYCLIC (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Round 2. */
|
||||
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
|
||||
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
|
||||
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
|
||||
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
|
||||
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
|
||||
OP (FG, D, A, B, C, 10, 9, 0x02441453);
|
||||
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
|
||||
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
|
||||
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
|
||||
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
|
||||
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
|
||||
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
|
||||
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
|
||||
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
|
||||
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
|
||||
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
|
||||
|
||||
/* Round 3. */
|
||||
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
|
||||
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
|
||||
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
|
||||
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
|
||||
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
|
||||
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
|
||||
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
|
||||
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
|
||||
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
|
||||
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
|
||||
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
|
||||
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
|
||||
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
|
||||
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
|
||||
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
|
||||
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
|
||||
|
||||
/* Round 4. */
|
||||
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
|
||||
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
|
||||
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
|
||||
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
|
||||
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
|
||||
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
|
||||
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
|
||||
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
|
||||
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
|
||||
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
|
||||
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
|
||||
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
|
||||
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
|
||||
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
|
||||
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
|
||||
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
|
||||
|
||||
/* Add the starting values of the context. */
|
||||
A += A_save;
|
||||
B += B_save;
|
||||
C += C_save;
|
||||
D += D_save;
|
||||
}
|
||||
|
||||
/* Put checksum in context given as argument. */
|
||||
ctx->A = A;
|
||||
ctx->B = B;
|
||||
ctx->C = C;
|
||||
ctx->D = D;
|
||||
}
|
126
md5/md5.h
126
md5/md5.h
@ -1,126 +0,0 @@
|
||||
/* Declaration of functions and data types used for MD5 sum computing
|
||||
library functions.
|
||||
Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2004, 2005, 2006,
|
||||
2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program 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 3, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _MD5_H
|
||||
#define _MD5_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define MD5_DIGEST_SIZE 16
|
||||
#define MD5_BLOCK_SIZE 64
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBC
|
||||
# define __md5_buffer md5_buffer
|
||||
# define __md5_finish_ctx md5_finish_ctx
|
||||
# define __md5_init_ctx md5_init_ctx
|
||||
# define __md5_process_block md5_process_block
|
||||
# define __md5_process_bytes md5_process_bytes
|
||||
# define __md5_read_ctx md5_read_ctx
|
||||
# define __md5_stream md5_stream
|
||||
#endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* Structure to save state of computation between the single steps. */
|
||||
struct md5_ctx
|
||||
{
|
||||
uint32_t A;
|
||||
uint32_t B;
|
||||
uint32_t C;
|
||||
uint32_t D;
|
||||
|
||||
uint32_t total[2];
|
||||
uint32_t buflen;
|
||||
uint32_t buffer[32];
|
||||
};
|
||||
|
||||
/*
|
||||
* The following three functions are build up the low level used in
|
||||
* the functions `md5_stream' and `md5_buffer'.
|
||||
*/
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void __md5_process_block (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void __md5_process_bytes (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 16 bytes following RESBUF. The result is always in little
|
||||
endian byte order, so that a byte-wise output yields to the wanted
|
||||
ASCII representation of the message digest. */
|
||||
extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest. */
|
||||
extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int __md5_stream (FILE *stream, void *resblock) __THROW;
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *__md5_buffer (const char *buffer, size_t len,
|
||||
void *resblock) __THROW;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* md5.h */
|
@ -1,86 +0,0 @@
|
||||
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
|
||||
|
||||
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Eric Blake. */
|
||||
|
||||
/*
|
||||
* POSIX 2008 <stddef.h> for platforms that have issues.
|
||||
* <http://www.opengroup.org/susv3xbd/stddef.h.html>
|
||||
*/
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if defined __need_wchar_t || defined __need_size_t \
|
||||
|| defined __need_ptrdiff_t || defined __need_NULL \
|
||||
|| defined __need_wint_t
|
||||
/* Special invocation convention inside gcc header files. In
|
||||
particular, gcc provides a version of <stddef.h> that blindly
|
||||
redefines NULL even when __need_wint_t was defined, even though
|
||||
wint_t is not normally provided by <stddef.h>. Hence, we must
|
||||
remember if special invocation has ever been used to obtain wint_t,
|
||||
in which case we need to clean up NULL yet again. */
|
||||
|
||||
# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
|
||||
# ifdef __need_wint_t
|
||||
# undef _GL_STDDEF_H
|
||||
# define _GL_STDDEF_WINT_T
|
||||
# endif
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
# ifndef _GL_STDDEF_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
|
||||
# ifndef _GL_STDDEF_H
|
||||
# define _GL_STDDEF_H
|
||||
|
||||
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
|
||||
#if @REPLACE_NULL@
|
||||
# undef NULL
|
||||
# ifdef __cplusplus
|
||||
/* ISO C++ says that the macro NULL must expand to an integer constant
|
||||
expression, hence '((void *) 0)' is not allowed in C++. */
|
||||
# if __GNUG__ >= 3
|
||||
/* GNU C++ has a __null macro that behaves like an integer ('int' or
|
||||
'long') but has the same size as a pointer. Use that, to avoid
|
||||
warnings. */
|
||||
# define NULL __null
|
||||
# else
|
||||
# define NULL 0L
|
||||
# endif
|
||||
# else
|
||||
# define NULL ((void *) 0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some platforms lack wchar_t. */
|
||||
#if !@HAVE_WCHAR_T@
|
||||
# define wchar_t int
|
||||
#endif
|
||||
|
||||
# endif /* _GL_STDDEF_H */
|
||||
# endif /* _GL_STDDEF_H */
|
||||
#endif /* __need_XXX */
|
568
md5/stdint.in.h
568
md5/stdint.in.h
@ -1,568 +0,0 @@
|
||||
/* Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
Free Software Foundation, Inc.
|
||||
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
|
||||
This file is part of gnulib.
|
||||
|
||||
This program 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/*
|
||||
* ISO C 99 <stdint.h> for platforms that lack it.
|
||||
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
|
||||
*/
|
||||
|
||||
#ifndef _GL_STDINT_H
|
||||
|
||||
/* When including a system file that in turn includes <inttypes.h>,
|
||||
use the system <inttypes.h>, not our substitute. This avoids
|
||||
problems with (for example) VMS, whose <sys/bitypes.h> includes
|
||||
<inttypes.h>. */
|
||||
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
|
||||
|
||||
/* Get those types that are already defined in other system include
|
||||
files, so that we can "#define int8_t signed char" below without
|
||||
worrying about a later system include file containing a "typedef
|
||||
signed char int8_t;" that will get messed up by our macro. Our
|
||||
macros should all be consistent with the system versions, except
|
||||
for the "fast" types and macros, which we recommend against using
|
||||
in public interfaces due to compiler differences. */
|
||||
|
||||
#if @HAVE_STDINT_H@
|
||||
# if defined __sgi && ! defined __c99
|
||||
/* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
|
||||
with "This header file is to be used only for c99 mode compilations"
|
||||
diagnostics. */
|
||||
# define __STDINT_H__
|
||||
# endif
|
||||
/* Other systems may have an incomplete or buggy <stdint.h>.
|
||||
Include it before <inttypes.h>, since any "#include <stdint.h>"
|
||||
in <inttypes.h> would reinclude us, skipping our contents because
|
||||
_GL_STDINT_H is defined.
|
||||
The include_next requires a split double-inclusion guard. */
|
||||
# if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
# endif
|
||||
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
|
||||
#endif
|
||||
|
||||
#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
|
||||
#define _GL_STDINT_H
|
||||
|
||||
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
|
||||
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
|
||||
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
|
||||
MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
|
||||
relies on the system <stdint.h> definitions, so include
|
||||
<sys/types.h> after @NEXT_STDINT_H@. */
|
||||
#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
|
||||
#include <limits.h>
|
||||
|
||||
#if @HAVE_INTTYPES_H@
|
||||
/* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
|
||||
int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
|
||||
<inttypes.h> also defines intptr_t and uintptr_t. */
|
||||
# include <inttypes.h>
|
||||
#elif @HAVE_SYS_INTTYPES_H@
|
||||
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
|
||||
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
|
||||
# include <sys/inttypes.h>
|
||||
#endif
|
||||
|
||||
#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
|
||||
/* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
|
||||
int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
|
||||
included by <sys/types.h>. */
|
||||
# include <sys/bitypes.h>
|
||||
#endif
|
||||
|
||||
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
|
||||
|
||||
/* Minimum and maximum values for a integer type under the usual assumption.
|
||||
Return an unspecified value if BITS == 0, adding a check to pacify
|
||||
picky compilers. */
|
||||
|
||||
#define _STDINT_MIN(signed, bits, zero) \
|
||||
((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
|
||||
|
||||
#define _STDINT_MAX(signed, bits, zero) \
|
||||
((signed) \
|
||||
? ~ _STDINT_MIN (signed, bits, zero) \
|
||||
: /* The expression for the unsigned case. The subtraction of (signed) \
|
||||
is a nop in the unsigned case and avoids "signed integer overflow" \
|
||||
warnings in the signed case. */ \
|
||||
((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
|
||||
|
||||
/* 7.18.1.1. Exact-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. */
|
||||
|
||||
#undef int8_t
|
||||
#undef uint8_t
|
||||
typedef signed char gl_int8_t;
|
||||
typedef unsigned char gl_uint8_t;
|
||||
#define int8_t gl_int8_t
|
||||
#define uint8_t gl_uint8_t
|
||||
|
||||
#undef int16_t
|
||||
#undef uint16_t
|
||||
typedef short int gl_int16_t;
|
||||
typedef unsigned short int gl_uint16_t;
|
||||
#define int16_t gl_int16_t
|
||||
#define uint16_t gl_uint16_t
|
||||
|
||||
#undef int32_t
|
||||
#undef uint32_t
|
||||
typedef int gl_int32_t;
|
||||
typedef unsigned int gl_uint32_t;
|
||||
#define int32_t gl_int32_t
|
||||
#define uint32_t gl_uint32_t
|
||||
|
||||
/* Do not undefine int64_t if gnulib is not being used with 64-bit
|
||||
types, since otherwise it breaks platforms like Tandem/NSK. */
|
||||
#if LONG_MAX >> 31 >> 31 == 1
|
||||
# undef int64_t
|
||||
typedef long int gl_int64_t;
|
||||
# define int64_t gl_int64_t
|
||||
# define GL_INT64_T
|
||||
#elif defined _MSC_VER
|
||||
# undef int64_t
|
||||
typedef __int64 gl_int64_t;
|
||||
# define int64_t gl_int64_t
|
||||
# define GL_INT64_T
|
||||
#elif @HAVE_LONG_LONG_INT@
|
||||
# undef int64_t
|
||||
typedef long long int gl_int64_t;
|
||||
# define int64_t gl_int64_t
|
||||
# define GL_INT64_T
|
||||
#endif
|
||||
|
||||
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
|
||||
# undef uint64_t
|
||||
typedef unsigned long int gl_uint64_t;
|
||||
# define uint64_t gl_uint64_t
|
||||
# define GL_UINT64_T
|
||||
#elif defined _MSC_VER
|
||||
# undef uint64_t
|
||||
typedef unsigned __int64 gl_uint64_t;
|
||||
# define uint64_t gl_uint64_t
|
||||
# define GL_UINT64_T
|
||||
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
# undef uint64_t
|
||||
typedef unsigned long long int gl_uint64_t;
|
||||
# define uint64_t gl_uint64_t
|
||||
# define GL_UINT64_T
|
||||
#endif
|
||||
|
||||
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
|
||||
#define _UINT8_T
|
||||
#define _UINT32_T
|
||||
#define _UINT64_T
|
||||
|
||||
|
||||
/* 7.18.1.2. Minimum-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
|
||||
are the same as the corresponding N_t types. */
|
||||
|
||||
#undef int_least8_t
|
||||
#undef uint_least8_t
|
||||
#undef int_least16_t
|
||||
#undef uint_least16_t
|
||||
#undef int_least32_t
|
||||
#undef uint_least32_t
|
||||
#undef int_least64_t
|
||||
#undef uint_least64_t
|
||||
#define int_least8_t int8_t
|
||||
#define uint_least8_t uint8_t
|
||||
#define int_least16_t int16_t
|
||||
#define uint_least16_t uint16_t
|
||||
#define int_least32_t int32_t
|
||||
#define uint_least32_t uint32_t
|
||||
#ifdef GL_INT64_T
|
||||
# define int_least64_t int64_t
|
||||
#endif
|
||||
#ifdef GL_UINT64_T
|
||||
# define uint_least64_t uint64_t
|
||||
#endif
|
||||
|
||||
/* 7.18.1.3. Fastest minimum-width integer types */
|
||||
|
||||
/* Note: Other <stdint.h> substitutes may define these types differently.
|
||||
It is not recommended to use these types in public header files. */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
|
||||
are taken from the same list of types. Assume that 'long int'
|
||||
is fast enough for all narrower integers. */
|
||||
|
||||
#undef int_fast8_t
|
||||
#undef uint_fast8_t
|
||||
#undef int_fast16_t
|
||||
#undef uint_fast16_t
|
||||
#undef int_fast32_t
|
||||
#undef uint_fast32_t
|
||||
#undef int_fast64_t
|
||||
#undef uint_fast64_t
|
||||
typedef long int gl_int_fast8_t;
|
||||
typedef unsigned long int gl_uint_fast8_t;
|
||||
typedef long int gl_int_fast16_t;
|
||||
typedef unsigned long int gl_uint_fast16_t;
|
||||
typedef long int gl_int_fast32_t;
|
||||
typedef unsigned long int gl_uint_fast32_t;
|
||||
#define int_fast8_t gl_int_fast8_t
|
||||
#define uint_fast8_t gl_uint_fast8_t
|
||||
#define int_fast16_t gl_int_fast16_t
|
||||
#define uint_fast16_t gl_uint_fast16_t
|
||||
#define int_fast32_t gl_int_fast32_t
|
||||
#define uint_fast32_t gl_uint_fast32_t
|
||||
#ifdef GL_INT64_T
|
||||
# define int_fast64_t int64_t
|
||||
#endif
|
||||
#ifdef GL_UINT64_T
|
||||
# define uint_fast64_t uint64_t
|
||||
#endif
|
||||
|
||||
/* 7.18.1.4. Integer types capable of holding object pointers */
|
||||
|
||||
#undef intptr_t
|
||||
#undef uintptr_t
|
||||
typedef long int gl_intptr_t;
|
||||
typedef unsigned long int gl_uintptr_t;
|
||||
#define intptr_t gl_intptr_t
|
||||
#define uintptr_t gl_uintptr_t
|
||||
|
||||
/* 7.18.1.5. Greatest-width integer types */
|
||||
|
||||
/* Note: These types are compiler dependent. It may be unwise to use them in
|
||||
public header files. */
|
||||
|
||||
#undef intmax_t
|
||||
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
|
||||
typedef long long int gl_intmax_t;
|
||||
# define intmax_t gl_intmax_t
|
||||
#elif defined GL_INT64_T
|
||||
# define intmax_t int64_t
|
||||
#else
|
||||
typedef long int gl_intmax_t;
|
||||
# define intmax_t gl_intmax_t
|
||||
#endif
|
||||
|
||||
#undef uintmax_t
|
||||
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
|
||||
typedef unsigned long long int gl_uintmax_t;
|
||||
# define uintmax_t gl_uintmax_t
|
||||
#elif defined GL_UINT64_T
|
||||
# define uintmax_t uint64_t
|
||||
#else
|
||||
typedef unsigned long int gl_uintmax_t;
|
||||
# define uintmax_t gl_uintmax_t
|
||||
#endif
|
||||
|
||||
/* Verify that intmax_t and uintmax_t have the same size. Too much code
|
||||
breaks if this is not the case. If this check fails, the reason is likely
|
||||
to be found in the autoconf macros. */
|
||||
typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
|
||||
|
||||
/* 7.18.2. Limits of specified-width integer types */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
|
||||
|
||||
/* 7.18.2.1. Limits of exact-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. */
|
||||
|
||||
#undef INT8_MIN
|
||||
#undef INT8_MAX
|
||||
#undef UINT8_MAX
|
||||
#define INT8_MIN (~ INT8_MAX)
|
||||
#define INT8_MAX 127
|
||||
#define UINT8_MAX 255
|
||||
|
||||
#undef INT16_MIN
|
||||
#undef INT16_MAX
|
||||
#undef UINT16_MAX
|
||||
#define INT16_MIN (~ INT16_MAX)
|
||||
#define INT16_MAX 32767
|
||||
#define UINT16_MAX 65535
|
||||
|
||||
#undef INT32_MIN
|
||||
#undef INT32_MAX
|
||||
#undef UINT32_MAX
|
||||
#define INT32_MIN (~ INT32_MAX)
|
||||
#define INT32_MAX 2147483647
|
||||
#define UINT32_MAX 4294967295U
|
||||
|
||||
#undef INT64_MIN
|
||||
#undef INT64_MAX
|
||||
#ifdef GL_INT64_T
|
||||
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
|
||||
evaluates the latter incorrectly in preprocessor expressions. */
|
||||
# define INT64_MIN (- INTMAX_C (1) << 63)
|
||||
# define INT64_MAX INTMAX_C (9223372036854775807)
|
||||
#endif
|
||||
|
||||
#undef UINT64_MAX
|
||||
#ifdef GL_UINT64_T
|
||||
# define UINT64_MAX UINTMAX_C (18446744073709551615)
|
||||
#endif
|
||||
|
||||
/* 7.18.2.2. Limits of minimum-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
|
||||
are the same as the corresponding N_t types. */
|
||||
|
||||
#undef INT_LEAST8_MIN
|
||||
#undef INT_LEAST8_MAX
|
||||
#undef UINT_LEAST8_MAX
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
|
||||
#undef INT_LEAST16_MIN
|
||||
#undef INT_LEAST16_MAX
|
||||
#undef UINT_LEAST16_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
|
||||
#undef INT_LEAST32_MIN
|
||||
#undef INT_LEAST32_MAX
|
||||
#undef UINT_LEAST32_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
|
||||
#undef INT_LEAST64_MIN
|
||||
#undef INT_LEAST64_MAX
|
||||
#ifdef GL_INT64_T
|
||||
# define INT_LEAST64_MIN INT64_MIN
|
||||
# define INT_LEAST64_MAX INT64_MAX
|
||||
#endif
|
||||
|
||||
#undef UINT_LEAST64_MAX
|
||||
#ifdef GL_UINT64_T
|
||||
# define UINT_LEAST64_MAX UINT64_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.2.3. Limits of fastest minimum-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
|
||||
are taken from the same list of types. */
|
||||
|
||||
#undef INT_FAST8_MIN
|
||||
#undef INT_FAST8_MAX
|
||||
#undef UINT_FAST8_MAX
|
||||
#define INT_FAST8_MIN LONG_MIN
|
||||
#define INT_FAST8_MAX LONG_MAX
|
||||
#define UINT_FAST8_MAX ULONG_MAX
|
||||
|
||||
#undef INT_FAST16_MIN
|
||||
#undef INT_FAST16_MAX
|
||||
#undef UINT_FAST16_MAX
|
||||
#define INT_FAST16_MIN LONG_MIN
|
||||
#define INT_FAST16_MAX LONG_MAX
|
||||
#define UINT_FAST16_MAX ULONG_MAX
|
||||
|
||||
#undef INT_FAST32_MIN
|
||||
#undef INT_FAST32_MAX
|
||||
#undef UINT_FAST32_MAX
|
||||
#define INT_FAST32_MIN LONG_MIN
|
||||
#define INT_FAST32_MAX LONG_MAX
|
||||
#define UINT_FAST32_MAX ULONG_MAX
|
||||
|
||||
#undef INT_FAST64_MIN
|
||||
#undef INT_FAST64_MAX
|
||||
#ifdef GL_INT64_T
|
||||
# define INT_FAST64_MIN INT64_MIN
|
||||
# define INT_FAST64_MAX INT64_MAX
|
||||
#endif
|
||||
|
||||
#undef UINT_FAST64_MAX
|
||||
#ifdef GL_UINT64_T
|
||||
# define UINT_FAST64_MAX UINT64_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
|
||||
|
||||
#undef INTPTR_MIN
|
||||
#undef INTPTR_MAX
|
||||
#undef UINTPTR_MAX
|
||||
#define INTPTR_MIN LONG_MIN
|
||||
#define INTPTR_MAX LONG_MAX
|
||||
#define UINTPTR_MAX ULONG_MAX
|
||||
|
||||
/* 7.18.2.5. Limits of greatest-width integer types */
|
||||
|
||||
#undef INTMAX_MIN
|
||||
#undef INTMAX_MAX
|
||||
#ifdef INT64_MAX
|
||||
# define INTMAX_MIN INT64_MIN
|
||||
# define INTMAX_MAX INT64_MAX
|
||||
#else
|
||||
# define INTMAX_MIN INT32_MIN
|
||||
# define INTMAX_MAX INT32_MAX
|
||||
#endif
|
||||
|
||||
#undef UINTMAX_MAX
|
||||
#ifdef UINT64_MAX
|
||||
# define UINTMAX_MAX UINT64_MAX
|
||||
#else
|
||||
# define UINTMAX_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.3. Limits of other integer types */
|
||||
|
||||
/* ptrdiff_t limits */
|
||||
#undef PTRDIFF_MIN
|
||||
#undef PTRDIFF_MAX
|
||||
#if @APPLE_UNIVERSAL_BUILD@
|
||||
# ifdef _LP64
|
||||
# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
|
||||
# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
|
||||
# else
|
||||
# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
|
||||
# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
|
||||
# endif
|
||||
#else
|
||||
# define PTRDIFF_MIN \
|
||||
_STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
|
||||
# define PTRDIFF_MAX \
|
||||
_STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
|
||||
#endif
|
||||
|
||||
/* sig_atomic_t limits */
|
||||
#undef SIG_ATOMIC_MIN
|
||||
#undef SIG_ATOMIC_MAX
|
||||
#define SIG_ATOMIC_MIN \
|
||||
_STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
|
||||
0@SIG_ATOMIC_T_SUFFIX@)
|
||||
#define SIG_ATOMIC_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
|
||||
0@SIG_ATOMIC_T_SUFFIX@)
|
||||
|
||||
|
||||
/* size_t limit */
|
||||
#undef SIZE_MAX
|
||||
#if @APPLE_UNIVERSAL_BUILD@
|
||||
# ifdef _LP64
|
||||
# define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
|
||||
# else
|
||||
# define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
|
||||
# endif
|
||||
#else
|
||||
# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
|
||||
#endif
|
||||
|
||||
/* wchar_t limits */
|
||||
/* Get WCHAR_MIN, WCHAR_MAX.
|
||||
This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
|
||||
includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
|
||||
<stdint.h> and assumes its types are already defined. */
|
||||
#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
|
||||
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
|
||||
# include <wchar.h>
|
||||
# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
|
||||
#endif
|
||||
#undef WCHAR_MIN
|
||||
#undef WCHAR_MAX
|
||||
#define WCHAR_MIN \
|
||||
_STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
|
||||
#define WCHAR_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
|
||||
|
||||
/* wint_t limits */
|
||||
#undef WINT_MIN
|
||||
#undef WINT_MAX
|
||||
#define WINT_MIN \
|
||||
_STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
|
||||
#define WINT_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
|
||||
|
||||
/* 7.18.4. Macros for integer constants */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
|
||||
|
||||
/* 7.18.4.1. Macros for minimum-width integer constants */
|
||||
/* According to ISO C 99 Technical Corrigendum 1 */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
|
||||
|
||||
#undef INT8_C
|
||||
#undef UINT8_C
|
||||
#define INT8_C(x) x
|
||||
#define UINT8_C(x) x
|
||||
|
||||
#undef INT16_C
|
||||
#undef UINT16_C
|
||||
#define INT16_C(x) x
|
||||
#define UINT16_C(x) x
|
||||
|
||||
#undef INT32_C
|
||||
#undef UINT32_C
|
||||
#define INT32_C(x) x
|
||||
#define UINT32_C(x) x ## U
|
||||
|
||||
#undef INT64_C
|
||||
#undef UINT64_C
|
||||
#if LONG_MAX >> 31 >> 31 == 1
|
||||
# define INT64_C(x) x##L
|
||||
#elif defined _MSC_VER
|
||||
# define INT64_C(x) x##i64
|
||||
#elif @HAVE_LONG_LONG_INT@
|
||||
# define INT64_C(x) x##LL
|
||||
#endif
|
||||
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
|
||||
# define UINT64_C(x) x##UL
|
||||
#elif defined _MSC_VER
|
||||
# define UINT64_C(x) x##ui64
|
||||
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
# define UINT64_C(x) x##ULL
|
||||
#endif
|
||||
|
||||
/* 7.18.4.2. Macros for greatest-width integer constants */
|
||||
|
||||
#undef INTMAX_C
|
||||
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
|
||||
# define INTMAX_C(x) x##LL
|
||||
#elif defined GL_INT64_T
|
||||
# define INTMAX_C(x) INT64_C(x)
|
||||
#else
|
||||
# define INTMAX_C(x) x##L
|
||||
#endif
|
||||
|
||||
#undef UINTMAX_C
|
||||
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
|
||||
# define UINTMAX_C(x) x##ULL
|
||||
#elif defined GL_UINT64_T
|
||||
# define UINTMAX_C(x) UINT64_C(x)
|
||||
#else
|
||||
# define UINTMAX_C(x) x##UL
|
||||
#endif
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
|
||||
|
||||
#endif /* _GL_STDINT_H */
|
||||
#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
|
310
md5/wchar.in.h
310
md5/wchar.in.h
@ -1,310 +0,0 @@
|
||||
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
|
||||
|
||||
Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Eric Blake. */
|
||||
|
||||
/*
|
||||
* ISO C 99 <wchar.h> for platforms that have issues.
|
||||
* <http://www.opengroup.org/susv3xbd/wchar.h.html>
|
||||
*
|
||||
* For now, this just ensures proper prerequisite inclusion order and
|
||||
* the declaration of wcwidth().
|
||||
*/
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
/* Special invocation convention:
|
||||
- Inside uClibc header files.
|
||||
- On HP-UX 11.00 we have a sequence of nested includes
|
||||
<wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
|
||||
once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
|
||||
and once directly. In both situations 'wint_t' is not yet defined,
|
||||
therefore we cannot provide the function overrides; instead include only
|
||||
the system's <wchar.h>.
|
||||
- On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
|
||||
the latter includes <wchar.h>. But here, we have no way to detect whether
|
||||
<wctype.h> is completely included or is still being included. */
|
||||
|
||||
#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_WCHAR_H
|
||||
|
||||
#define _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
|
||||
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
<wchar.h>.
|
||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
/* Include the original <wchar.h> if it exists.
|
||||
Some builds of uClibc lack it. */
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_WCHAR_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
|
||||
#endif
|
||||
|
||||
#undef _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
|
||||
#ifndef _GL_WCHAR_H
|
||||
#define _GL_WCHAR_H
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Define wint_t. (Also done in wctype.in.h.) */
|
||||
#if !@HAVE_WINT_T@ && !defined wint_t
|
||||
# define wint_t int
|
||||
# ifndef WEOF
|
||||
# define WEOF -1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Override mbstate_t if it is too small.
|
||||
On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
|
||||
implementing mbrtowc for encodings like UTF-8. */
|
||||
#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
|
||||
typedef int rpl_mbstate_t;
|
||||
# undef mbstate_t
|
||||
# define mbstate_t rpl_mbstate_t
|
||||
# define GNULIB_defined_mbstate_t 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a single-byte character to a wide character. */
|
||||
#if @GNULIB_BTOWC@
|
||||
# if @REPLACE_BTOWC@
|
||||
# undef btowc
|
||||
# define btowc rpl_btowc
|
||||
# endif
|
||||
# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@
|
||||
extern wint_t btowc (int c);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef btowc
|
||||
# define btowc(c) \
|
||||
(GL_LINK_WARNING ("btowc is unportable - " \
|
||||
"use gnulib module btowc for portability"), \
|
||||
btowc (c))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide character to a single-byte character. */
|
||||
#if @GNULIB_WCTOB@
|
||||
# if @REPLACE_WCTOB@
|
||||
# undef wctob
|
||||
# define wctob rpl_wctob
|
||||
# endif
|
||||
# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@
|
||||
/* wctob is provided by gnulib, or wctob exists but is not declared. */
|
||||
extern int wctob (wint_t wc);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wctob
|
||||
# define wctob(w) \
|
||||
(GL_LINK_WARNING ("wctob is unportable - " \
|
||||
"use gnulib module wctob for portability"), \
|
||||
wctob (w))
|
||||
#endif
|
||||
|
||||
|
||||
/* Test whether *PS is in the initial state. */
|
||||
#if @GNULIB_MBSINIT@
|
||||
# if @REPLACE_MBSINIT@
|
||||
# undef mbsinit
|
||||
# define mbsinit rpl_mbsinit
|
||||
# endif
|
||||
# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@
|
||||
extern int mbsinit (const mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbsinit
|
||||
# define mbsinit(p) \
|
||||
(GL_LINK_WARNING ("mbsinit is unportable - " \
|
||||
"use gnulib module mbsinit for portability"), \
|
||||
mbsinit (p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a multibyte character to a wide character. */
|
||||
#if @GNULIB_MBRTOWC@
|
||||
# if @REPLACE_MBRTOWC@
|
||||
# undef mbrtowc
|
||||
# define mbrtowc rpl_mbrtowc
|
||||
# endif
|
||||
# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@
|
||||
extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbrtowc
|
||||
# define mbrtowc(w,s,n,p) \
|
||||
(GL_LINK_WARNING ("mbrtowc is unportable - " \
|
||||
"use gnulib module mbrtowc for portability"), \
|
||||
mbrtowc (w, s, n, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Recognize a multibyte character. */
|
||||
#if @GNULIB_MBRLEN@
|
||||
# if @REPLACE_MBRLEN@
|
||||
# undef mbrlen
|
||||
# define mbrlen rpl_mbrlen
|
||||
# endif
|
||||
# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@
|
||||
extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbrlen
|
||||
# define mbrlen(s,n,p) \
|
||||
(GL_LINK_WARNING ("mbrlen is unportable - " \
|
||||
"use gnulib module mbrlen for portability"), \
|
||||
mbrlen (s, n, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a string to a wide string. */
|
||||
#if @GNULIB_MBSRTOWCS@
|
||||
# if @REPLACE_MBSRTOWCS@
|
||||
# undef mbsrtowcs
|
||||
# define mbsrtowcs rpl_mbsrtowcs
|
||||
# endif
|
||||
# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
|
||||
extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbsrtowcs
|
||||
# define mbsrtowcs(d,s,l,p) \
|
||||
(GL_LINK_WARNING ("mbsrtowcs is unportable - " \
|
||||
"use gnulib module mbsrtowcs for portability"), \
|
||||
mbsrtowcs (d, s, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a string to a wide string. */
|
||||
#if @GNULIB_MBSNRTOWCS@
|
||||
# if @REPLACE_MBSNRTOWCS@
|
||||
# undef mbsnrtowcs
|
||||
# define mbsnrtowcs rpl_mbsnrtowcs
|
||||
# endif
|
||||
# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
|
||||
extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbsnrtowcs
|
||||
# define mbsnrtowcs(d,s,n,l,p) \
|
||||
(GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
|
||||
"use gnulib module mbsnrtowcs for portability"), \
|
||||
mbsnrtowcs (d, s, n, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide character to a multibyte character. */
|
||||
#if @GNULIB_WCRTOMB@
|
||||
# if @REPLACE_WCRTOMB@
|
||||
# undef wcrtomb
|
||||
# define wcrtomb rpl_wcrtomb
|
||||
# endif
|
||||
# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@
|
||||
extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcrtomb
|
||||
# define wcrtomb(s,w,p) \
|
||||
(GL_LINK_WARNING ("wcrtomb is unportable - " \
|
||||
"use gnulib module wcrtomb for portability"), \
|
||||
wcrtomb (s, w, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide string to a string. */
|
||||
#if @GNULIB_WCSRTOMBS@
|
||||
# if @REPLACE_WCSRTOMBS@
|
||||
# undef wcsrtombs
|
||||
# define wcsrtombs rpl_wcsrtombs
|
||||
# endif
|
||||
# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
|
||||
extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcsrtombs
|
||||
# define wcsrtombs(d,s,l,p) \
|
||||
(GL_LINK_WARNING ("wcsrtombs is unportable - " \
|
||||
"use gnulib module wcsrtombs for portability"), \
|
||||
wcsrtombs (d, s, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide string to a string. */
|
||||
#if @GNULIB_WCSNRTOMBS@
|
||||
# if @REPLACE_WCSNRTOMBS@
|
||||
# undef wcsnrtombs
|
||||
# define wcsnrtombs rpl_wcsnrtombs
|
||||
# endif
|
||||
# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
|
||||
extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcsnrtombs
|
||||
# define wcsnrtombs(d,s,n,l,p) \
|
||||
(GL_LINK_WARNING ("wcsnrtombs is unportable - " \
|
||||
"use gnulib module wcsnrtombs for portability"), \
|
||||
wcsnrtombs (d, s, n, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Return the number of screen columns needed for WC. */
|
||||
#if @GNULIB_WCWIDTH@
|
||||
# if @REPLACE_WCWIDTH@
|
||||
# undef wcwidth
|
||||
# define wcwidth rpl_wcwidth
|
||||
extern int wcwidth (wchar_t);
|
||||
# else
|
||||
# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
|
||||
/* wcwidth exists but is not declared. */
|
||||
extern int wcwidth (int /* actually wchar_t */);
|
||||
# endif
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcwidth
|
||||
# define wcwidth(w) \
|
||||
(GL_LINK_WARNING ("wcwidth is unportable - " \
|
||||
"use gnulib module wcwidth for portability"), \
|
||||
wcwidth (w))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL_WCHAR_H */
|
||||
#endif /* _GL_WCHAR_H */
|
||||
#endif
|
@ -1,3 +1,23 @@
|
||||
2010-05-16 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am (LDADD): Remove MD5_LDADD.
|
||||
(MD5_LDADD): Remove definition.
|
||||
(AM_CPPFLAGS): Remove MD5_CPPFLAGS.
|
||||
(version.c): Remove dependency from MD5_LDADD.
|
||||
(../md5/libmd5.a): Remove rule.
|
||||
|
||||
* ftp-opie.c: Include "md5.h". Do not include "gen-md5.h".
|
||||
(skey_response): New variable ctx. Use md5 functions from the gnulib
|
||||
module instead of functions defined previously in the "gen-md5.h" file.
|
||||
|
||||
* gen-md5.h: Remove file.
|
||||
* gen-md5.c: Likewise.
|
||||
|
||||
* http.c: Include "md5.h". Do not include "gen-md5.h".
|
||||
(digest_authentication_encode): New variable ctx. Use md5 functions
|
||||
from the gnulib module instead of functions defined previously in the
|
||||
"gen-md5.h" file.
|
||||
|
||||
2010-05-15 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am: Quote any path using $(top_srcdir) or $(top_builddir).
|
||||
|
@ -47,23 +47,19 @@ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
|
||||
recur.c res.c retr.c snprintf.c spider.c url.c \
|
||||
utils.c exits.c build_info.c $(IRI_OBJ) \
|
||||
css-url.h css-tokens.h connect.h convert.h cookies.h \
|
||||
ftp.h gen-md5.h hash.h host.h html-parse.h html-url.h \
|
||||
ftp.h hash.h host.h html-parse.h html-url.h \
|
||||
http.h http-ntlm.h init.h log.h mswindows.h netrc.h \
|
||||
options.h progress.h ptimer.h recur.h res.h retr.h \
|
||||
spider.h ssl.h sysdep.h url.h utils.h wget.h iri.h \
|
||||
exits.h gettext.h
|
||||
nodist_wget_SOURCES = version.c
|
||||
EXTRA_wget_SOURCES = iri.c
|
||||
LDADD = $(LIBOBJS) ../lib/libgnu.a @MD5_LDADD@
|
||||
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @MD5_CPPFLAGS@
|
||||
MD5_LDADD = @MD5_LDADD@
|
||||
LDADD = $(LIBOBJS) ../lib/libgnu.a
|
||||
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
|
||||
|
||||
../lib/libgnu.a:
|
||||
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
||||
|
||||
../md5/libmd5.a:
|
||||
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
||||
|
||||
build_info.c: $(srcdir)/Makefile.am $(srcdir)/build_info.c.in
|
||||
if test -n "$(VPATH)"; then cp "$(srcdir)/build_info.c.in" .; fi
|
||||
$(PERL) "$(top_srcdir)/build-aux/build_info.pl" \
|
||||
@ -71,7 +67,7 @@ build_info.c: $(srcdir)/Makefile.am $(srcdir)/build_info.c.in
|
||||
if test -n "$(VPATH)"; then rm -f build_info.c.in; fi
|
||||
|
||||
ESCAPEQUOTE = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
|
||||
version.c: $(wget_SOURCES) ../lib/libgnu.a $(MD5_LDADD)
|
||||
version.c: $(wget_SOURCES) ../lib/libgnu.a
|
||||
echo '/* version.c */' > $@
|
||||
echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@
|
||||
echo '' >> $@
|
||||
|
@ -34,7 +34,7 @@ as that of the covered work. */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gen-md5.h"
|
||||
#include "md5.h"
|
||||
#include "ftp.h"
|
||||
|
||||
/* Dictionary for integer-word translations. Available in appendix D
|
||||
@ -2196,22 +2196,22 @@ skey_response (int sequence, const char *seed, const char *pass)
|
||||
the terminating \0. 24+5+1 == 30 */
|
||||
static char english[30];
|
||||
|
||||
ALLOCA_MD5_CONTEXT (md5_ctx);
|
||||
struct md5_ctx ctx;
|
||||
uint32_t checksum[4];
|
||||
|
||||
gen_md5_init (md5_ctx);
|
||||
gen_md5_update ((const unsigned char *)seed, strlen(seed), md5_ctx);
|
||||
gen_md5_update ((const unsigned char *)pass, strlen(pass), md5_ctx);
|
||||
gen_md5_finish (md5_ctx, (unsigned char *)checksum);
|
||||
md5_init_ctx (&ctx);
|
||||
md5_process_bytes ((const unsigned char *) seed, strlen (seed), &ctx);
|
||||
md5_process_bytes ((const unsigned char *) pass, strlen (pass), &ctx);
|
||||
md5_finish_ctx (&ctx, (unsigned char *) checksum);
|
||||
checksum[0] ^= checksum[2];
|
||||
checksum[1] ^= checksum[3];
|
||||
memcpy (key, checksum, 8);
|
||||
|
||||
while (sequence-- > 0)
|
||||
{
|
||||
gen_md5_init (md5_ctx);
|
||||
gen_md5_update ((unsigned char *) key, 8, md5_ctx);
|
||||
gen_md5_finish (md5_ctx, (unsigned char *) checksum);
|
||||
md5_init_ctx (&ctx);
|
||||
md5_process_bytes ((unsigned char *) key, 8, &ctx);
|
||||
md5_finish_ctx (&ctx, (unsigned char *) checksum);
|
||||
checksum[0] ^= checksum[2];
|
||||
checksum[1] ^= checksum[3];
|
||||
memcpy (key, checksum, 8);
|
||||
|
152
src/gen-md5.c
152
src/gen-md5.c
@ -1,152 +0,0 @@
|
||||
/* General MD5 support.
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Wget.
|
||||
|
||||
GNU Wget 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Wget 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 Wget. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permission under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this program, or any covered work, by linking or
|
||||
combining it with the OpenSSL project's OpenSSL library (or a
|
||||
modified version of that library), containing parts covered by the
|
||||
terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
|
||||
grants you additional permission to convey the resulting work.
|
||||
Corresponding Source for a non-source form of such a combination
|
||||
shall include the source code for the parts of OpenSSL used as well
|
||||
as that of the covered work. */
|
||||
|
||||
#include "wget.h"
|
||||
|
||||
#include "gen-md5.h"
|
||||
|
||||
#ifdef HAVE_BUILTIN_MD5
|
||||
# include <md5.h>
|
||||
typedef struct md5_ctx gen_md5_context_imp;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOLARIS_MD5
|
||||
# include <md5.h>
|
||||
typedef MD5_CTX gen_md5_context_imp;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_MD5
|
||||
# include <openssl/md5.h>
|
||||
typedef MD5_CTX gen_md5_context_imp;
|
||||
#endif
|
||||
|
||||
struct gen_md5_context {
|
||||
gen_md5_context_imp imp;
|
||||
};
|
||||
|
||||
/* Originally I planned for these to be macros, but that's very hard
|
||||
because some of these MD5 implementations use the same names for
|
||||
their types. For example, it is impossible to include <md5.h> and
|
||||
<openssl/ssl.h> on Solaris, because the latter includes its own MD5
|
||||
implementation, which clashes with <md5.h>. */
|
||||
|
||||
int
|
||||
gen_md5_context_size (void)
|
||||
{
|
||||
return sizeof (struct gen_md5_context);
|
||||
}
|
||||
|
||||
void
|
||||
gen_md5_init (gen_md5_context *ctx)
|
||||
{
|
||||
gen_md5_context_imp *ctx_imp = &ctx->imp;
|
||||
|
||||
#ifdef HAVE_BUILTIN_MD5
|
||||
md5_init_ctx (ctx_imp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOLARIS_MD5
|
||||
MD5Init (ctx_imp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_MD5
|
||||
MD5_Init (ctx_imp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gen_md5_update (unsigned const char *buffer, int len, gen_md5_context *ctx)
|
||||
{
|
||||
gen_md5_context_imp *ctx_imp = &ctx->imp;
|
||||
|
||||
#ifdef HAVE_BUILTIN_MD5
|
||||
md5_process_bytes (buffer, len, ctx_imp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOLARIS_MD5
|
||||
MD5Update (ctx_imp, (unsigned char *)buffer, len);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_MD5
|
||||
MD5_Update (ctx_imp, buffer, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gen_md5_finish (gen_md5_context *ctx, unsigned char *result)
|
||||
{
|
||||
gen_md5_context_imp *ctx_imp = &ctx->imp;
|
||||
|
||||
#ifdef HAVE_BUILTIN_MD5
|
||||
md5_finish_ctx (ctx_imp, result);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOLARIS_MD5
|
||||
MD5Final (result, ctx_imp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_MD5
|
||||
MD5_Final (result, ctx_imp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* A debugging function for checking whether an MD5 library works. */
|
||||
|
||||
#include "gen-md5.h"
|
||||
|
||||
char *
|
||||
debug_test_md5 (char *buf)
|
||||
{
|
||||
unsigned char raw[16];
|
||||
static char res[33];
|
||||
unsigned char *p1;
|
||||
char *p2;
|
||||
int cnt;
|
||||
ALLOCA_MD5_CONTEXT (ctx);
|
||||
|
||||
gen_md5_init (ctx);
|
||||
gen_md5_update ((unsigned char *)buf, strlen (buf), ctx);
|
||||
gen_md5_finish (ctx, raw);
|
||||
|
||||
p1 = raw;
|
||||
p2 = res;
|
||||
cnt = 16;
|
||||
while (cnt--)
|
||||
{
|
||||
*p2++ = XNUM_TO_digit (*p1 >> 4);
|
||||
*p2++ = XNUM_TO_digit (*p1 & 0xf);
|
||||
++p1;
|
||||
}
|
||||
*p2 = '\0';
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
@ -1,51 +0,0 @@
|
||||
/* General MD5 header file.
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Wget.
|
||||
|
||||
GNU Wget 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Wget 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 Wget. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permission under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this program, or any covered work, by linking or
|
||||
combining it with the OpenSSL project's OpenSSL library (or a
|
||||
modified version of that library), containing parts covered by the
|
||||
terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
|
||||
grants you additional permission to convey the resulting work.
|
||||
Corresponding Source for a non-source form of such a combination
|
||||
shall include the source code for the parts of OpenSSL used as well
|
||||
as that of the covered work. */
|
||||
|
||||
#ifndef GEN_MD5_H
|
||||
#define GEN_MD5_H
|
||||
|
||||
typedef struct gen_md5_context gen_md5_context;
|
||||
|
||||
/* Use a forward declaration so we don't have to include any of the
|
||||
includes. */
|
||||
struct gen_md5_context;
|
||||
|
||||
#define MD5_HASHLEN 16
|
||||
|
||||
#define ALLOCA_MD5_CONTEXT(var_name) \
|
||||
gen_md5_context *var_name = \
|
||||
(gen_md5_context *) alloca (gen_md5_context_size ())
|
||||
|
||||
int gen_md5_context_size (void);
|
||||
void gen_md5_init (gen_md5_context *);
|
||||
void gen_md5_update (const unsigned char *, int, gen_md5_context *);
|
||||
void gen_md5_finish (gen_md5_context *, unsigned char *);
|
||||
|
||||
#endif /* GEN_MD5_H */
|
54
src/http.c
54
src/http.c
@ -56,9 +56,7 @@ as that of the covered work. */
|
||||
# include "http-ntlm.h"
|
||||
#endif
|
||||
#include "cookies.h"
|
||||
#ifdef ENABLE_DIGEST
|
||||
# include "gen-md5.h"
|
||||
#endif
|
||||
#include "md5.h"
|
||||
#include "convert.h"
|
||||
#include "spider.h"
|
||||
|
||||
@ -3286,7 +3284,7 @@ dump_hash (char *buf, const unsigned char *hash)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MD5_HASHLEN; i++, hash++)
|
||||
for (i = 0; i < MD5_DIGEST_SIZE; i++, hash++)
|
||||
{
|
||||
*buf++ = XNUM_TO_digit (*hash >> 4);
|
||||
*buf++ = XNUM_TO_digit (*hash & 0xf);
|
||||
@ -3339,37 +3337,37 @@ digest_authentication_encode (const char *au, const char *user,
|
||||
|
||||
/* Calculate the digest value. */
|
||||
{
|
||||
ALLOCA_MD5_CONTEXT (ctx);
|
||||
unsigned char hash[MD5_HASHLEN];
|
||||
char a1buf[MD5_HASHLEN * 2 + 1], a2buf[MD5_HASHLEN * 2 + 1];
|
||||
char response_digest[MD5_HASHLEN * 2 + 1];
|
||||
struct md5_ctx ctx;
|
||||
unsigned char hash[MD5_DIGEST_SIZE];
|
||||
char a1buf[MD5_DIGEST_SIZE * 2 + 1], a2buf[MD5_DIGEST_SIZE * 2 + 1];
|
||||
char response_digest[MD5_DIGEST_SIZE * 2 + 1];
|
||||
|
||||
/* A1BUF = H(user ":" realm ":" password) */
|
||||
gen_md5_init (ctx);
|
||||
gen_md5_update ((unsigned char *)user, strlen (user), ctx);
|
||||
gen_md5_update ((unsigned char *)":", 1, ctx);
|
||||
gen_md5_update ((unsigned char *)realm, strlen (realm), ctx);
|
||||
gen_md5_update ((unsigned char *)":", 1, ctx);
|
||||
gen_md5_update ((unsigned char *)passwd, strlen (passwd), ctx);
|
||||
gen_md5_finish (ctx, hash);
|
||||
md5_init_ctx (&ctx);
|
||||
md5_process_bytes ((unsigned char *)user, strlen (user), &ctx);
|
||||
md5_process_bytes ((unsigned char *)":", 1, &ctx);
|
||||
md5_process_bytes ((unsigned char *)realm, strlen (realm), &ctx);
|
||||
md5_process_bytes ((unsigned char *)":", 1, &ctx);
|
||||
md5_process_bytes ((unsigned char *)passwd, strlen (passwd), &ctx);
|
||||
md5_finish_ctx (&ctx, hash);
|
||||
dump_hash (a1buf, hash);
|
||||
|
||||
/* A2BUF = H(method ":" path) */
|
||||
gen_md5_init (ctx);
|
||||
gen_md5_update ((unsigned char *)method, strlen (method), ctx);
|
||||
gen_md5_update ((unsigned char *)":", 1, ctx);
|
||||
gen_md5_update ((unsigned char *)path, strlen (path), ctx);
|
||||
gen_md5_finish (ctx, hash);
|
||||
md5_init_ctx (&ctx);
|
||||
md5_process_bytes ((unsigned char *)method, strlen (method), &ctx);
|
||||
md5_process_bytes ((unsigned char *)":", 1, &ctx);
|
||||
md5_process_bytes ((unsigned char *)path, strlen (path), &ctx);
|
||||
md5_finish_ctx (&ctx, hash);
|
||||
dump_hash (a2buf, hash);
|
||||
|
||||
/* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" A2BUF) */
|
||||
gen_md5_init (ctx);
|
||||
gen_md5_update ((unsigned char *)a1buf, MD5_HASHLEN * 2, ctx);
|
||||
gen_md5_update ((unsigned char *)":", 1, ctx);
|
||||
gen_md5_update ((unsigned char *)nonce, strlen (nonce), ctx);
|
||||
gen_md5_update ((unsigned char *)":", 1, ctx);
|
||||
gen_md5_update ((unsigned char *)a2buf, MD5_HASHLEN * 2, ctx);
|
||||
gen_md5_finish (ctx, hash);
|
||||
md5_init_ctx (&ctx);
|
||||
md5_process_bytes ((unsigned char *)a1buf, MD5_DIGEST_SIZE * 2, &ctx);
|
||||
md5_process_bytes ((unsigned char *)":", 1, &ctx);
|
||||
md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx);
|
||||
md5_process_bytes ((unsigned char *)":", 1, &ctx);
|
||||
md5_process_bytes ((unsigned char *)a2buf, MD5_DIGEST_SIZE * 2, &ctx);
|
||||
md5_finish_ctx (&ctx, hash);
|
||||
dump_hash (response_digest, hash);
|
||||
|
||||
res = xmalloc (strlen (user)
|
||||
@ -3377,7 +3375,7 @@ digest_authentication_encode (const char *au, const char *user,
|
||||
+ strlen (realm)
|
||||
+ strlen (nonce)
|
||||
+ strlen (path)
|
||||
+ 2 * MD5_HASHLEN /*strlen (response_digest)*/
|
||||
+ 2 * MD5_DIGEST_SIZE /*strlen (response_digest)*/
|
||||
+ (opaque ? strlen (opaque) : 0)
|
||||
+ 128);
|
||||
sprintf (res, "Digest \
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-05-16 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am (../md5/libmd5.a): Remove rule.
|
||||
(LDADD): Remove MD5_LDADD.
|
||||
|
||||
2010-05-08 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am: Update copyright years.
|
||||
|
@ -53,9 +53,6 @@ test: ../src/wget$(EXEEXT) run-unit-tests run-px-tests
|
||||
../lib/libgnu.a:
|
||||
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
||||
|
||||
../md5/libmd5.a:
|
||||
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
||||
|
||||
run-unit-tests: unit-tests$(EXEEXT) ../src/libunittest.a
|
||||
./unit-tests$(EXEEXT)
|
||||
|
||||
@ -134,6 +131,6 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \
|
||||
|
||||
check_PROGRAMS = unit-tests
|
||||
unit_tests_SOURCES =
|
||||
LDADD = ../src/libunittest.a ../lib/libgnu.a @MD5_LDADD@ $(LIBS)
|
||||
LDADD = ../src/libunittest.a ../lib/libgnu.a $(LIBS)
|
||||
|
||||
CLEANFILES = *~ *.bak core core.[0-9]*
|
||||
|
Loading…
Reference in New Issue
Block a user