pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/digest/files Make pkgtools/digest cross-compi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/97efd66dcf44
branches:  trunk
changeset: 530667:97efd66dcf44
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Jul 03 18:54:02 2007 +0000

description:
Make pkgtools/digest cross-compilation ready and actually improve
portability somewhat:
- consistently use POSIX uint{8,16,32,64}_t throughout the code.
- asssume for now that the compiler supports ULL as suffix
- use AC_TYPE_UINT{8,16,32,64}_T instead of bits.c to compute
  possible replacement types.

Bump to 20070703. Tested by Thorsten Glaser on Interix and tnn@ on
Solaris.

diffstat:

 pkgtools/digest/files/Makefile.in  |    25 +-
 pkgtools/digest/files/bits.c       |   184 -
 pkgtools/digest/files/config.h.in  |    77 +-
 pkgtools/digest/files/configure    |  6564 ++++++++++++++++-------------------
 pkgtools/digest/files/configure.ac |    27 +-
 pkgtools/digest/files/digest.c     |     6 +-
 pkgtools/digest/files/md5.h        |     6 +-
 pkgtools/digest/files/md5c.c       |     8 +-
 pkgtools/digest/files/md5hl.c      |     8 +-
 pkgtools/digest/files/rmd160.c     |    36 +-
 pkgtools/digest/files/rmd160.h     |    12 +-
 pkgtools/digest/files/rmd160hl.c   |     8 +-
 pkgtools/digest/files/sha1.c       |    26 +-
 pkgtools/digest/files/sha1.h       |     8 +-
 pkgtools/digest/files/sha1hl.c     |     8 +-
 pkgtools/digest/files/sha2.c       |     3 -
 pkgtools/digest/files/sha2.h       |    53 +-
 pkgtools/digest/files/sha2hl.c     |     6 +-
 pkgtools/digest/files/tiger.c      |     2 -
 pkgtools/digest/files/whirlpool.c  |     2 -
 pkgtools/digest/files/whirlpool.h  |    46 +-
 21 files changed, 3060 insertions(+), 4055 deletions(-)

diffs (truncated from 9499 to 300 lines):

diff -r e23bd2057bf5 -r 97efd66dcf44 pkgtools/digest/files/Makefile.in
--- a/pkgtools/digest/files/Makefile.in Tue Jul 03 18:51:34 2007 +0000
+++ b/pkgtools/digest/files/Makefile.in Tue Jul 03 18:54:02 2007 +0000
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.4 2005/03/23 14:32:19 agc Exp $
+# $Id: Makefile.in,v 1.5 2007/07/03 18:54:02 joerg Exp $
 
 @SET_MAKE@
 SHELL = @SHELL@
@@ -44,10 +44,9 @@
 
 digest_OBJS = digest.o md5c.o rmd160.o rmd160hl.o sha2.o sha2hl.o \
 md5hl.o sha1.o sha1hl.o tiger.o whirlpool.o
-bits_OBJS = bits.o
 
 SRCS= digest.c md5c.c rmd160.c rmd160hl.c sha2.c sha2hl.c md5hl.c sha1.c \
-sha1hl.c bits.c md5.h rmd160.h sha1.h sha2.h tiger.c tiger.h whirlpool.c \
+sha1hl.c md5.h rmd160.h sha1.h sha2.h tiger.c tiger.h whirlpool.c \
 whirlpool.h
 
 DISTFILES= $(SRCS) AUTHORS COPYING DESCR INSTALL Makefile.in NEWS aclocal.m4 \
@@ -59,32 +58,14 @@
 
 all: digest
 
-digest-types.h: bits
-       ./bits digest-types.h
-
-bits: bits.o
-       $(LINK) $(bits_OBJS) $(LIBS)
-
 digest: $(digest_OBJS)
        $(LINK) $(digest_OBJS) $(LIBS)
 
 check: digest
        @SHELL@ $(srcdir)/regress.sh
 
-digest.o: digest-types.h
-md5c.o: digest-types.h
-rmd160.o: digest-types.h
-rmd160hl.o: digest-types.h
-sha2.o: digest-types.h
-sha2hl.o: digest-types.h
-md5hl.o: digest-types.h
-sha1.o: digest-types.h
-sha1hl.o: digest-types.h
-tiger.o: digest-types.h
-whirlpool.o: digest-types.h
-
 clean:
-       rm -f *.o digest bits digest-types.h
+       rm -f *.o digest
 
 distclean: clean
        rm -f Makefile config.h
diff -r e23bd2057bf5 -r 97efd66dcf44 pkgtools/digest/files/bits.c
--- a/pkgtools/digest/files/bits.c      Tue Jul 03 18:51:34 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden). 
- * All rights reserved. 
- *
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following conditions 
- * are met: 
- *
- * 1. Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer. 
- *
- * 2. Redistributions in binary form must reproduce the above copyright 
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the distribution. 
- *
- * 3. Neither the name of the Institute nor the names of its contributors 
- *    may be used to endorse or promote products derived from this software 
- *    without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
- * SUCH DAMAGE. 
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-__RCSID("$Id: bits.c,v 1.1 2002/12/21 04:06:13 schmonz Exp $");
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#define BITSIZE(TYPE)                                          \
-{                                                              \
-    int b = 0; TYPE x = 1, zero = 0; char *pre = "u";          \
-    char tmp[128], tmp2[128];                                  \
-    while(x){ x <<= 1; b++; if(x < zero) pre=""; }             \
-    if(b >= len){                                              \
-        int tabs;                                              \
-       sprintf(tmp, "%sint%d_t" , pre, len);                   \
-       sprintf(tmp2, "typedef %s %s;", #TYPE, tmp);            \
-       tabs = 5 - strlen(tmp2) / 8;                            \
-        fprintf(f, "%s", tmp2);                                        \
-       while(tabs-- > 0) fprintf(f, "\t");                     \
-       fprintf(f, "/* %2d bits */\n", b);                      \
-        return;                                                 \
-    }                                                          \
-}
-
-#ifndef HAVE___ATTRIBUTE__
-#define __attribute__(x)
-#endif
-
-static void
-try_signed(FILE *f, int len)  __attribute__ ((unused));
-
-static void
-try_unsigned(FILE *f, int len) __attribute__ ((unused));
-
-static int
-print_bt(FILE *f, int flag) __attribute__ ((unused));
-
-static void
-try_signed(FILE *f, int len)
-{
-    BITSIZE(signed char);
-    BITSIZE(short);
-    BITSIZE(int);
-    BITSIZE(long);
-#ifdef HAVE_LONG_LONG
-    BITSIZE(long long);
-#endif
-    fprintf(f, "/* There is no %d bit type */\n", len);
-}
-
-static void
-try_unsigned(FILE *f, int len)
-{
-    BITSIZE(unsigned char);
-    BITSIZE(unsigned short);
-    BITSIZE(unsigned int);
-    BITSIZE(unsigned long);
-#ifdef HAVE_LONG_LONG
-    BITSIZE(unsigned long long);
-#endif
-    fprintf(f, "/* There is no %d bit type */\n", len);
-}
-
-int main(int argc, char **argv)
-{
-    FILE *f;
-    char *fn, *hb;
-    
-    if(argc < 2){
-       fn = "bits.h";
-       hb = "__BITS_H__";
-       f = stdout;
-    } else {
-       char *p;
-       fn = argv[1];
-       hb = malloc(strlen(fn) + 5);
-       sprintf(hb, "__%s__", fn);
-       for(p = hb; *p; p++){
-           if(!isalnum((unsigned char)*p))
-               *p = '_';
-       }
-       f = fopen(argv[1], "w");
-    }
-    fprintf(f, "/* %s -- this file was generated for %s by\n", fn, HOST);
-    fprintf(f, "   %*s    %s */\n\n", (int)strlen(fn), "", 
-           "$Id: bits.c,v 1.1 2002/12/21 04:06:13 schmonz Exp $");
-    fprintf(f, "#ifndef %s\n", hb);
-    fprintf(f, "#define %s\n", hb);
-    fprintf(f, "\n");
-#ifdef HAVE_SYS_TYPES_H
-    fprintf(f, "#include <sys/types.h>\n");
-#endif
-#ifdef HAVE_INTTYPES_H
-    fprintf(f, "#include <inttypes.h>\n");
-#endif
-#ifdef HAVE_SYS_BITYPES_H
-    fprintf(f, "#include <sys/bitypes.h>\n");
-#endif
-#ifdef HAVE_BIND_BITYPES_H
-    fprintf(f, "#include <bind/bitypes.h>\n");
-#endif
-#ifdef HAVE_NETINET_IN6_MACHTYPES_H
-    fprintf(f, "#include <netinet/in6_machtypes.h>\n");
-#endif
-    fprintf(f, "\n");
-
-#ifndef HAVE_INT8_T
-    try_signed (f, 8);
-#endif /* HAVE_INT8_T */
-#ifndef HAVE_INT16_T
-    try_signed (f, 16);
-#endif /* HAVE_INT16_T */
-#ifndef HAVE_INT32_T
-    try_signed (f, 32);
-#endif /* HAVE_INT32_T */
-#ifndef HAVE_INT64_T
-    try_signed (f, 64);
-#endif /* HAVE_INT64_T */
-
-#ifndef HAVE_UINT8_T
-    try_unsigned (f, 8);
-#endif /* HAVE_UINT8_T */
-#ifndef HAVE_UINT16_T
-    try_unsigned (f, 16);
-#endif /* HAVE_UINT16_T */
-#ifndef HAVE_UINT32_T
-    try_unsigned (f, 32);
-#endif /* HAVE_UINT32_T */
-#ifndef HAVE_UINT64_T
-    try_unsigned (f, 64);
-#endif /* HAVE_UINT64_T */
-
-#define X(S) fprintf(f, "typedef uint" #S "_t u_int" #S "_t;\n")
-#ifndef HAVE_U_INT8_T
-    X(8);
-#endif /* HAVE_U_INT8_T */
-#ifndef HAVE_U_INT16_T
-    X(16);
-#endif /* HAVE_U_INT16_T */
-#ifndef HAVE_U_INT32_T
-    X(32);
-#endif /* HAVE_U_INT32_T */
-#ifndef HAVE_U_INT64_T
-    X(64);
-#endif /* HAVE_U_INT64_T */
-
-    fprintf(f, "#endif /* %s */\n", hb);
-    return 0;
-}
diff -r e23bd2057bf5 -r 97efd66dcf44 pkgtools/digest/files/config.h.in
--- a/pkgtools/digest/files/config.h.in Tue Jul 03 18:51:34 2007 +0000
+++ b/pkgtools/digest/files/config.h.in Tue Jul 03 18:54:02 2007 +0000
@@ -19,27 +19,12 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
-/* Define to 1 if the system has the type `int16_t'. */
-#undef HAVE_INT16_T
-
-/* Define to 1 if the system has the type `int32_t'. */
-#undef HAVE_INT32_T
-
-/* Define to 1 if the system has the type `int64_t'. */
-#undef HAVE_INT64_T
-
-/* Define to 1 if the system has the type `int8_t'. */
-#undef HAVE_INT8_T
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
-/* Define to 1 if the system has the type `long long'. */
-#undef HAVE_LONG_LONG
-
 /* Define to 1 if you have the <machine/endian.h> header file. */
 #undef HAVE_MACHINE_ENDIAN_H
 
@@ -94,39 +79,12 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
-/* Define to 1 if the system has the type `uint16_t'. */
-#undef HAVE_UINT16_T
-
-/* Define to 1 if the system has the type `uint32_t'. */
-#undef HAVE_UINT32_T
-
-/* Define to 1 if the system has the type `uint64_t'. */
-#undef HAVE_UINT64_T
-
-/* Define to 1 if the system has the type `uint8_t'. */
-#undef HAVE_UINT8_T
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define to 1 if the system has the type `u_int16_t'. */
-#undef HAVE_U_INT16_T
-
-/* Define to 1 if the system has the type `u_int32_t'. */
-#undef HAVE_U_INT32_T
-
-/* Define to 1 if the system has the type `u_int64_t'. */



Home | Main Index | Thread Index | Old Index