Subject: | Removing dependency on endian.h |
Hi,
Crypt::IDEA won't compile without changes on platforms lacking the
endian.h header. I'd like to suggest the following patch to remove
the dependency on endian.h:
diff -u Crypt-IDEA-1.02.orig/Makefile.PL Crypt-IDEA-1.02/Makefile.PL
--- Crypt-IDEA-1.02.orig/Makefile.PL 2003-01-19 03:49:56.000000000 +0100
+++ Crypt-IDEA-1.02/Makefile.PL 2004-02-03 17:36:20.000000000 +0100
@@ -1,6 +1,11 @@
#! /usr/local/bin/perl
use ExtUtils::MakeMaker;
+
+# Determine byte order
+$is_little_endian = unpack('c', pack('s', 1));
+$byte_order = $is_little_endian ? "LITTLE_ENDIAN" : "BIG_ENDIAN";
+
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile being created.
WriteMakefile(
@@ -8,6 +13,7 @@
'DISTNAME' => 'Crypt-IDEA',
'VERSION' => '1.02',
'OBJECT' => 'IDEA.o _idea.o',
+ 'DEFINE' => "-DBYTE_ORDER=$byte_order",
'dist' => {COMPRESS=>'gzip', SUFFIX=>'gz'}
);
diff -u Crypt-IDEA-1.02.orig/_idea.c Crypt-IDEA-1.02/_idea.c
--- Crypt-IDEA-1.02.orig/_idea.c 1999-05-22 22:30:48.000000000 +0200
+++ Crypt-IDEA-1.02/_idea.c 2004-02-03 17:32:48.000000000 +0100
@@ -5,8 +5,6 @@
#include "idea.h"
-#include <endian.h>
-
#define KEYS_PER_ROUND 6
#define ROUNDS 8
#define KEYLEN (KEYS_PER_ROUND*ROUNDS+4)