source: trunk/perl/Makefile.PL.in @ 497

Last change on this file since 497 was 497, checked in by dkearney, 18 years ago

added checks to configure.in to find where python and perl live,
added .in files for python and perl build files
configure now builds perl/Makefile.PL and python/setup.py and fits
it with the correct values needed to build and install the module
in the correct directory, where it will live in the rappture distribution.
there had been talk of using env variables to point python and perl
to where these modules live, so that is the current line of thinking.
added queue module for python. the Rappture.queue module's purpose
is to make it easy to send a job to the pbs and condor queues and
track the job using rappture. pbs is kinda complete, condor is not
complete and is still being worked on. the signalHandler and tools
python modules came from left over code that all python rappture
applications might want to include to make the developers life
a little more enjoyable.

File size: 6.6 KB
RevLine 
[497]1use 5.008;
2use ExtUtils::MakeMaker;
3use Config;
4use File::Spec;
5
6$CC = $Config{"cc"};
7$LD = $Config{"ld"};
8
9if ($ARGV[0] eq "DEBUG") {
10        shift @ARGV;
11        $DEBUG = 1;
12}
13
14if ($^O ne "MSWin32") {
15    $CC = '@CXX@';
16    $LD = '@CXX@';
17    @SCEW_INC_SEARCHPATH = ( "@prefix@/include",
18        "/apps/rappture/include", "/opt/rappture/include",
19        "/usr/local/include", "/opt/include", "../../scew-0.4.0",
20        "../../scew", "/apps/scew-0.4.0", "/apps/scew", "/opt/scew-0.4.0",
21        "/opt/scew" );
22    $SCEW_INC="scew/scew.h";
23    @EXPAT_INC_SEARCHPATH = ( "@prefix@/include",
24        "/apps/rappture/include", "/opt/rappture/include",
25        "/usr/local/include", "/opt/include", "../../expat-2.0.0/lib",
26        "../../expat/lib", "/apps/expat-2.0.0/lib", "/apps/expat/lib",
27        "/opt/expat-2.0.0/lib", "/opt/expat/lib" );
28    $EXPAT_INC="expat.h";
29    @RAPPTURE_INC_SEARCHPATH = ( "@prefix@/include",
30        "/apps/rappture/include",
31        "/opt/rappture/include", "/usr/local/include", "/opt/include",
32        "../include" );
33    $RAPPTURE_INC = "core/rappture.h";
34    @SCEW_LIB_SEARCHPATH = ( "@prefix@/lib",
35        "/apps/rappture/lib", "/opt/rappture/lib",
36        "/usr/local/lib", "/opt/lib", "../../scew-0.4.0/scew",
37        "../../scew/scew", "/apps/scew-0.4.0/scew", "/apps/scew/scew",
38        "/opt/scew-0.4.0/scew", "/opt/scew/scew" );
39    @SCEW_LIBS=("libscew.so","libscew.a");
40    @EXPAT_LIB_SEARCHPATH = ( "@prefix@/lib",
41        "/apps/rappture/lib", "/opt/rappture/lib",
42        "/usr/local/lib", "/opt/lib", "../../expat-2.0.0/lib",
43        "../../expat/lib", "/apps/expat-2.0.0/lib", "/apps/expat/lib",
44        "/opt/expat-2.0.0/lib", "/opt/expat/lib" );
45    @EXPAT_LIBS=("libexpat.so", "libexpat.a");
46    @RAPPTURE_LIB_SEARCHPATH = ( "@prefix@/lib",
47        "/apps/rappture/lib", "/opt/rappture/lib",
48        "/usr/local/lib", "/opt/lib", "../src" );
49    @RAPPTURE_LIBS=("librappture.so","librappture.a");
50}
51else {
52    if ($Config{"cc"} eq "cl") {
53        $CFLAGS = "/TP /EHsc";
54        @LIBS = ("msvcprt.lib");
55    }
56
57    @SCEW_INC_SEARCHPATH = ( "C:\\Program Files\\Rappture\\include",
58        "C:\\opt\\rappture\\include", "C:\\opt\\include", "..\\..\\scew-0.4.0",
59        "..\\..\\scew", "C:\\Program Files\\scew-0.4.0",
60        "C:\\Program Files\\scew", "C:\\opt\\scew-0.4.0", "C:\\opt\\scew" );
61    $SCEW_INC="scew\\scew.h";
62    @EXPAT_INC_SEARCHPATH = ( "C:\\Program Files\\Rappture\\include",
63        "C:\\opt\\rappture\\include", "C:\\opt\\include",
64        "..\\..\\expat-2.0.0\\lib", "..\\..\\expat\\lib",
65        "C:\\Program Files\\Expat-2.0.0\\Source\\lib",
66        "C:\\Program Files\\Expat\\Source\\lib",
67        "C:\\opt\\expat-2.0.0\\lib", "C:\\opt\\expat\\lib" );
68    $EXPAT_INC="expat.h";
69    @RAPPTURE_INC_SEARCHPATH = ( "C:\\Program Files\\Rappture\\include",
70        "C:\\opt\\rappture\\include", "C:\\opt\\include", "..\\include" );
71    $RAPPTURE_INC = "core\\rappture.h";
72    @SCEW_LIB_SEARCHPATH = ( "C:\\Program Files\\Rappture\\lib",
73        "C:\\opt\\rappture\\lib", "C:\\opt\\lib",
74        "..\\..\\scew-0.4.0\\win32\\lib", "..\\..\\scew\\win32\\lib",
75        "C:\\Program Files\\scew-0.4.0\\win32\\lib",
76        "C:\\Program Files\\scew\\win32\\lib",
77        "C:\\opt\\scew-0.4.0\\win32\\lib", "C:\\opt\\scew\\win32\\lib" );
78    @SCEW_LIBS=("scew_s.lib", "libscew_s.lib", "scew.lib", "libscew.lib");
79    @SCEWD_LIBS=("scew_sd.lib", "libscew_sd.lib", "scewd.lib", "libscewd.lib");
80    @EXPAT_LIB_SEARCHPATH = ( "C:\\Program Files\\Rappture\\lib",
81        "C:\\opt\\rappture\\lib", "C:\\opt\\lib",
82        "..\\..\\expat-2.0.0\\lib\\Release_static",
83        "..\\..\\expat\\lib\\Release_static",
84        "C:\\Program Files\\Expat-2.0.0\\StaticLibs",
85        "C:\\Program Files\\Expat\\StaticLibs",
86        "C:\\opt\\expat-2.0.0\\lib\\Release_static",
87        "C:\\opt\\expat\\lib\\Release_static" );
88    @EXPAT_LIBS=("libexpat.lib", "libexpatMT.lib");
89    @RAPPTURE_LIB_SEARCHPATH = ( "C:\\Program Files\\Rappture\\lib",
90        "C:\\opt\\rappture\\lib", "C:\\opt\\lib", "..\\src" );
91    @RAPPTURE_LIBS=("librappture.lib");
92}
93
94sub
95find_include {
96    my ($dirs, $filename, $incref) = @_;
97    foreach $component (@$dirs) {
98        if (-e File::Spec->catfile($component, $filename)) {
99            ($sdir = $component) =~ s/\\/\\\\/g;
100            if (!(grep /^-I$sdir/, @$incref)) {
101                push @$incref, "-I$component";
102            }
103            return 1;
104            last;
105        }
106    }
107
108    return 0;
109}
110
111sub
112find_lib {
113    my ($dirs, $filenames, $libref) = @_;
114
115    SEARCH: foreach $component (@$dirs) {
116        foreach $lib (@$filenames) {
117            $file = File::Spec->catfile($component, $lib);
118            if (-e $file) {
119                if ($lib =~ /^lib(.+)(.a|.so)$/) {
120                    if (grep /^-L$component/, @$libref) {
121                        push @$libref, "-l$1";
122                    }
123                    else {
124                        push @$libref, "-L$component -l$1";
125                    }
126                }
127                else {
128                    push @$libref, $file;
129                }
130                return 1;
131                last SEARCH;
132            }
133        }
134    }
135    return 0;
136}
137
138find_include(\@SCEW_INC_SEARCHPATH, $SCEW_INC, \@INCLUDES);
139find_include(\@EXPAT_INC_SEARCHPATH, $EXPAT_INC, \@INCLUDES);
140find_include(\@RAPPTURE_INC_SEARCHPATH, $RAPPTURE_INC, \@INCLUDES);
141find_lib(\@EXPAT_LIB_SEARCHPATH, \@EXPAT_LIBS, \@LIBS);
142find_lib(\@RAPPTURE_LIB_SEARCHPATH, \@RAPPTURE_LIBS, \@LIBS);
143if ($DEBUG) {
144    if (!find_lib(\@SCEW_LIB_SEARCHPATH, \@SCEWD_LIBS, \@LIBS)) {
145        find_lib(\@SCEW_LIB_SEARCHPATH, \@SCEW_LIBS, \@LIBS);
146    }
147}
148
149WriteMakefile(
150    NAME              => 'Rappture',
151    VERSION_FROM      => 'lib/Rappture.pm', # finds $VERSION
152    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
153    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
154      (ABSTRACT_FROM  => 'lib/Rappture.pm', # retrieve abstract from module
155       AUTHOR         => 'Nicholas J. Kisseberth') : ()),
156    LIBS              => ["@LIBS"],
157    DEFINE            => "$CFLAGS",
158    INC               => "@INCLUDES",
159    CC                => $CC,
160    LD                => $LD,
161    XSOPT             => '-C++',
162);
163
164package MY;
165use Config;
166
167sub dynamic_lib {
168        my $inherited = shift->SUPER::dynamic_lib(@_);
169        if (($^O eq "MSWin32") && ($Config{'cc'} eq "cl")) {
170            $inherited .= "\tMT.EXE -manifest \$@.manifest -outputresource:\$@;2\n";
171            $inherited .= "\t\$(RM_F) \$@.manifest\n";
172        }
173        return($inherited);
174}
175
176
Note: See TracBrowser for help on using the repository browser.