summaryrefslogtreecommitdiff
path: root/perl-RPM2/Makefile.PL
diff options
context:
space:
mode:
Diffstat (limited to 'perl-RPM2/Makefile.PL')
-rw-r--r--perl-RPM2/Makefile.PL17
1 files changed, 13 insertions, 4 deletions
diff --git a/perl-RPM2/Makefile.PL b/perl-RPM2/Makefile.PL
index 83f50c13b..e6fe3c91d 100644
--- a/perl-RPM2/Makefile.PL
+++ b/perl-RPM2/Makefile.PL
@@ -2,26 +2,35 @@ use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-my $libs = "-lrpm-4.1 -lrpmdb-4.1 -lrpmio-4.1 -lpopt";
+my $libs = "-lrpm -lrpmdb -lrpmio -lpopt";
# try to be smart about which shared libs we should load.
# use the .la file. probably linux only.
-if (0 and open FH, "</usr/lib/librpm.la") {
+if (open FH, "</usr/lib/librpm.la") {
my ($line, @rest) = grep { /^dependency_libs=/ } <FH>;
if ($line and not @rest) {
if ($line =~ /^dependency_libs='(.*)'$/) {
- $libs = "-lrpm-4.1 $1";
+ $libs = "-lrpm $1";
}
}
}
+my @defines;
+# detect which rpm is running. ugly but necessary... for now.
+if (-e '/usr/include/rpm/rpmts.h') {
+ push @defines, '-DRPM2_RPM41';
+}
+else {
+ push @defines, '-DRPM2_RPM40';
+}
+
WriteMakefile(
'NAME' => 'RPM2',
'VERSION_FROM' => 'RPM2.pm', # finds $VERSION
'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
'LIBS' => [ $libs ], # e.g., '-lm'
- 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
+ 'DEFINE' => join(" ", @defines), # e.g., '-DHAVE_SOMETHING'
'INC' => '-I/usr/include/rpm', # e.g., '-I/usr/include/other'
'TYPEMAPS' => [ 'typemap' ],
'OPTIMIZE' => '-g'