This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Latin1 chars can fold match UTF8_ALL
[perl5.git] / cpan / Digest-MD5 / Makefile.PL
CommitLineData
ee7ea0b1
RGS
1#!perl -w
2
3357b1b1
JH
3use strict;
4use Config qw(%Config);
5use ExtUtils::MakeMaker;
6
7my @extra;
9a03235d 8@extra = (DEFINE => "-DU32_ALIGNMENT_REQUIRED") unless free_u32_alignment();
92dc3567 9
55315086
PP
10if ($^O eq 'VMS') {
11 if (defined($Config{ccname})) {
614d5782
CB
12 if (grep(/VMS_VAX/, @INC) && ($Config{ccname} eq 'DEC')) {
13 # VAX compiler optimizer even as late as v6.4 gets stuck
9a03235d 14 push(@extra, OPTIMIZE => "/Optimize=(NODISJOINT)");
55315086
PP
15 }
16 }
17}
3357b1b1 18
9a03235d 19
3357b1b1
JH
20WriteMakefile(
21 'NAME' => 'Digest::MD5',
22 'VERSION_FROM' => 'MD5.pm',
326fafaa
CBW
23 'ABSTRACT' => 'Perl interface to the MD-5 algorithm',
24 'AUTHOR' => 'Gisle Aas <gisle@activestate.com>',
25 'LICENSE' => 'perl',
62d37bf0 26 'MIN_PERL_VERSION' => 5.008,
ee7ea0b1
RGS
27 'PREREQ_PM' => { 'File::Spec' => 0,
28 'Digest::base' => '1.00',
47a7661d 29 'XSLoader' => 0,
ee7ea0b1 30 },
326fafaa 31 'META_MERGE' => {
c059848d
FR
32 resources => {
33 repository => 'http://github.com/gisle/digest-md5',
34 }
326fafaa 35 },
62d37bf0 36 'INSTALLDIRS' => 'perl',
3357b1b1 37 @extra,
3357b1b1 38);
3357b1b1 39
9a03235d
GA
40
41
42sub free_u32_alignment
43{
ee7ea0b1
RGS
44 $|=1;
45 if (exists $Config{d_u32align}) {
46 print "Perl's config says that U32 access must ";
47 print "not " unless $Config{d_u32align};
48 print "be aligned.\n";
49 return !$Config{d_u32align};
50 }
51
52 if ($^O eq 'VMS' || $^O eq 'MSWin32') {
53 print "Assumes that $^O implies free alignment for U32 access.\n";
54 return 1;
55 }
56
57 if ($^O eq 'hpux' && $Config{osvers} < 11.0) {
58 print "Will not test for free alignment on older HP-UX.\n";
59 return 0;
60 }
61
62 print "Testing alignment requirements for U32... ";
63 open(ALIGN_TEST, ">u32align.c") or die "$!";
64 print ALIGN_TEST <<'EOT'; close(ALIGN_TEST);
65/*--------------------------------------------------------------*/
66/* This program allocates a buffer of U8 (char) and then tries */
67/* to access it through a U32 pointer at every offset. The */
68/* program is expected to die with a bus error/seg fault for */
69/* machines that do not support unaligned integer read/write */
70/*--------------------------------------------------------------*/
71
72#include <stdio.h>
73#include "EXTERN.h"
74#include "perl.h"
75
76#ifdef printf
77 #undef printf
78#endif
79
80int main(int argc, char** argv, char** env)
81{
82#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
326fafaa
CBW
83 volatile U8 buf[] = "\0\0\0\1\0\0\0\0";
84 volatile U32 *up;
ee7ea0b1
RGS
85 int i;
86
87 if (sizeof(U32) != 4) {
88 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
89 exit(1);
90 }
91
92 fflush(stdout);
93
94 for (i = 0; i < 4; i++) {
95 up = (U32*)(buf + i);
96 if (! ((*up == 1 << (8*i)) || /* big-endian */
97 (*up == 1 << (8*(3-i))) /* little-endian */
98 )
99 )
100 {
101 printf("read failed (%x)\n", *up);
102 exit(2);
103 }
104 }
105
106 /* write test */
107 for (i = 0; i < 4; i++) {
108 up = (U32*)(buf + i);
109 *up = 0xBeef;
110 if (*up != 0xBeef) {
111 printf("write failed (%x)\n", *up);
112 exit(3);
113 }
114 }
115
116 printf("no restrictions\n");
117 exit(0);
118#else
119 printf("unusual byteorder, playing safe\n");
120 exit(1);
121#endif
122 return 0;
123}
124/*--------------------------------------------------------------*/
125EOT
126
127 my $cc_cmd = "$Config{cc} $Config{ccflags} -I$Config{archlibexp}/CORE";
128 my $exe = "u32align$Config{exe_ext}";
129 $cc_cmd .= " -o $exe";
130 my $rc;
131 $rc = system("$cc_cmd $Config{ldflags} u32align.c $Config{libs}");
132 if ($rc) {
133 print "Can't compile test program. Will ensure alignment to play safe.\n\n";
134 unlink("u32align.c", $exe, "u32align$Config{obj_ext}");
135 return 0;
136 }
137
138 $rc = system("./$exe");
139 unlink("u32align.c", $exe, "u32align$Config{obj_ext}");
140
141 return 1 unless $rc;
142
143 if ($rc > 0x80) {
6e770d9c
SP
144 (my $cp = $rc) >>= 8;
145 print "Test program exit status was $cp\n";
146 }
147 if ($rc & 0x80) {
148 $rc &= ~0x80;
149 unlink("core") && print "Core dump deleted\n";
ee7ea0b1 150 }
6e770d9c 151 print "signal $rc\n" if $rc && $rc < 0x80;
9a03235d
GA
152 return 0;
153}
326fafaa
CBW
154
155BEGIN {
156 # compatibility with older versions of MakeMaker
157 my $developer = -d ".git";
158 my %mm_req = (
159 LICENCE => 6.31,
160 META_MERGE => 6.45,
161 META_ADD => 6.45,
162 MIN_PERL_VERSION => 6.48,
163 );
164 undef(*WriteMakefile);
165 *WriteMakefile = sub {
166 my %arg = @_;
167 for (keys %mm_req) {
168 unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) {
169 warn "$_ $@" if $developer;
170 delete $arg{$_};
171 }
172 }
173 ExtUtils::MakeMaker::WriteMakefile(%arg);
174 };
175}