root/src/scripts/noit-config.in

Revision bd1849ba615cc9b65f1b31c3d29956777cd06719, 1.1 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

add a helper for compiling external module

  • Property mode set to 100644
Line 
1 #!/usr/bin/perl
2
3 use strict;
4 my %opts;
5 my $worked = 0;
6
7 while(<DATA>) {
8   chomp;
9   my ($o, $v) = split /=/, $_, 2;
10   $v =~ s#-I\$\(top_srcdir\)/src#-I\${includedir}#g;
11   $opts{$o} = $v;
12 }
13
14 sub help {
15   print STDERR "help:\n";
16   for my $o (keys %opts) {
17     print STDERR "\t--$o\n";
18   }
19   return 1;
20 }
21
22 sub interp {
23   my $o = shift;
24   my $v = $o;
25   $v =~ s#\$\{([^\}]+)\}#$opts{$1}#eg;
26   return $v if $o eq $v;
27   return interp($v);
28 }
29
30 foreach my $v (@ARGV) {
31   if($v eq '-h' || $v eq '--help') {
32     help && exit;
33   }
34   (my $o = $v) =~ s/^--//;
35   $o =~ s/_/-/g;
36   die "Bad option: $v" if "--$o" ne $v;
37   die "No such option: $o" unless exists $opts{$o};
38   print interp($opts{$o});
39   $worked = 1;
40 }
41
42 unless ($worked) {
43   help && exit;
44 }
45
46 __END__
47 cc=@CC@
48 cppflags=@CPPFLAGS@
49 flags=@CFLAGS@ @PGCFLAGS@
50 ldflags=@LDFLAGS@
51 libs=@LIBS@ @PGLIBS@
52 prefix=@prefix@
53 exec_prefix=@exec_prefix@
54 bindir=@bindir@
55 sbindir=@sbindir@
56 libdir=@libdir@
57 includedir=${prefix}/include
58 libexecdir=@libexecdir@
59 datarootdir=@datarootdir@
60 mandir=@mandir@
61 mansubdir=@mansubdir@
62 docdir=${prefix}/@docdir@
63 sysconfdir=@sysconfdir@
64 srcdir=@srcdir@
65 top_srcdir=@top_srcdir@
66 modules_dir=@MODULES_DIR@
Note: See TracBrowser for help on using the browser.