1use ExtUtils::MakeMaker;
2use Config;
3# See lib/ExtUtils/MakeMaker.pm for details of how to influence
4# the contents of the Makefile that is written.
5
6#added by Lincoln Baxter to fix cflags (for long long on HPUX)
7#guidence from DBD-Oracle module
8{
9    package MY; # SUPER needs package context, $self is not sufficient
10    use strict;
11    use Config;
12    my $os = $^O;
13
14    sub const_cccmd {
15        my ($self) = shift;
16        local($_) = $self->SUPER::const_cccmd(@_);
17        # are we using the non-bundled hpux compiler?
18        if ($os eq "hpux" and $Config::Config{ccflags} =~ /-Aa\b/) {
19            print "Changing -Aa to -Ae for HP-UX in ccmd to allow for long long.\n"
20             if s/-Aa\b/-Ae/g;  # allow "long long" in UUID.h
21        }
22        $_;
23    }
24    sub cflags
25    {
26        my ($self) = shift;
27        local($_) = $self->SUPER::cflags(@_);
28        # are we using the non-bundled hpux compiler?
29        if ($os eq "hpux" and $Config::Config{ccflags} =~ /-Aa\b/) {
30            print "Changing -Aa to -Ae for HP-UX in cflags.\n"
31             if s/-Aa\b/-Ae/g;  # allow "long long" in UUID.h
32        }
33        $_;
34    }
35};
36
37WriteMakefile(
38  ($] >= 5.005 ## Add these new keywords supported since 5.005
39  ? (ABSTRACT_FROM => 'UUID.pm', # retrieve abstract from module
40     AUTHOR        => 'Ricardo Signes <rjbs[at]cpan.org>')
41  : ()),
42
43  NAME                => 'Data::UUID',
44  VERSION_FROM        => 'UUID.pm', # finds $VERSION
45  PREREQ_PM           => {}, # e.g., Module::Name => 1.1
46  LICENSE             => 'unknown',
47  LIBS                => [], # e.g., '-lm'
48  #works without -lsocket
49  DEFINE              => '', # e.g., '-DHAVE_SOMETHING'
50  # Insert -I. if you add *.h files later:
51  INC                 => '', # e.g., '-I/usr/include/other'
52  # Un-comment this if you add C files to link with later:
53  OBJECT              => '$(O_FILES)', # link all the C files too
54  CONFIGURE           => sub {
55    my $d;
56    if ($^O eq 'MSWin32' and -d "c:/tmp/") {
57     $d="c:/tmp";
58    } else {
59     $d=eval { require File::Spec; File::Spec->tmpdir; } || '/var/tmp';
60    }
61    $d = prompt("UUID state storage", $d);
62
63    my $m = '0007';
64    $m = prompt("default umask", $m) unless $^O eq 'MSWin32';
65
66    chmod(0666, sprintf("%s/%s", $d, ".UUID_NODEID"));
67    chmod(0666, sprintf("%s/%s", $d, ".UUID_STATE"));
68    return {
69      DEFINE => qq(-D_STDIR=\\"$d\\")
70              . qq( -D__$Config{osname}__)
71              . qq( -D_DEFAULT_UMASK=$m)
72    };
73  }
74);
75