#!/bin/sh -- # -*- perl -*-
eval 'exec perl -S $0 "$@"'
    if 0;
########################## -*- Mode: Perl -*- ##########################
##
## File             : Conscript
##
## Description      : 
##
## Author           : Norbert Goevert
## Created On       : Tue Sep  3 16:49:55 1996
##
## Last Modified By : Norbert Goevert
## Last Modified On : Tue Dec 17 16:37:58 1996
##
## $State: Exp $
##
## $Id: Conscript,v 5.1.1.1 1996/12/23 12:52:21 goevert Exp goevert $
##
## $Log: Conscript,v $
## Revision 5.1.1.1  1996/12/23 12:52:21  goevert
## patch6: no replacement for config.sh any longer
##
## Revision 5.1  1996/11/05 16:55:53  goevert
## *** empty log message ***
##
## Revision 5.0.1.1  1996/11/04 13:11:08  goevert
## patch21: cons instead of MakeMaker
##
########################################################################


Import qw (CONS);

@pl = qw(start.pl config.pl client_common.pl
         query.pl parse_query.pl search_index.pl);

Perl $CONS 'start.pl', '#config.sh', 'start';

if ($::CONFIG{USESERVER} eq 'y') {
    Command $CONS 'SFgate-server', @pl, "cat %< > %>; chmod +x %>";
    Install $CONS $::CONFIG{CGIBIN}, 'SFgate-server';
}
else {
    Command $CONS 'SFgate', @pl, "cat %< > %>; chmod +x %>";
    Install $CONS $::CONFIG{CGIBIN}, 'SFgate';
}


## #####################################################################
## subs
## #####################################################################

sub start
{
    my $file = shift;
    my $PERL = $::CONFIG{PERLBIN} || 'perl';

    open(OUT, "> $file") or  die "Couldn't write to '$file': $!\n";

    print OUT <<"EOF";
$::CONFIG{STARTPERL}

eval 'exec $PERL -S \$0 "\$@"'
    if 0;

EOF
    ;
    
    print OUT "use lib qw($::CONFIG{LIBDIRCONFIG});\n\n" if $::CONFIG{LIBDIRCONFIG};
    print OUT "use lib qw($::CONFIG{LIBDIR});\n\n" if $::CONFIG{LIBDIR};

    close OUT;
}

