makes more sense the other way :)
[yasql.git] / config.pl
blobc5f19706ee836e77d7d3054b4e38abf4b9dfa110
1 #! /usr/bin/env perl
3 use strict;
5 my $perlpath = shift;
6 my $bindir = shift;
7 my $mandir = shift;
8 my $sysconfdir = shift;
9 my $version = shift;
11 # read in yasql
12 open(YIN, "yasql.in") or die("Could not open yasql.in! $!");
13 # open yasql for writing
14 open(YOUT, ">yasql") or die("Could not open yasql for writing! $!");
15 flock(YOUT, 2) or die("Could not flock yasql! $!");
17 for(my $i = 0; <YIN>; $i++) {
18 if($i == 0) {
19 print YOUT "#!" . $perlpath . "\n";
20 } elsif(/^\$sysconfdir = /) {
21 print YOUT "\$sysconfdir = \"" . $sysconfdir . "\";\n";
22 } elsif(/^ \$VERSION = /) {
23 print YOUT " \$VERSION = \"" . $version . "\";\n";
24 } else {
25 print YOUT;
29 close(YOUT);
30 close(YIN);
32 eval {
33 require Pod::Man;
34 my $pod = Pod::Man->new(section=>1);
35 $pod->parse_from_file ('yasql', 'yasql.1');
37 if($@) {
38 warn "Generating man page failed, install Pod::Man to fix this"
41 print "Configuration successful\n";