
BEGIN {
    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
    die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
}

use Cwd;
require util;    

if (!defined $ENV{'GEXTVIDEO'}) {
    

    $ENV{'GEXTVIDEO'} = cwd();
    print STDERR "**** GEXTVIDEO=$ENV{'GEXTVIDEO'}\n";
    
    $ENV{'GEXTVIDEO_INSTALLED'}
    = &util::filename_cat($ENV{'GEXTVIDEO'},"installed");

    my $server_bin  = "$ENV{'GEXTVIDEO_INSTALLED'}/server/bin";
    my $cmdline_bin = "$ENV{'GEXTVIDEO_INSTALLED'}/cmdline/bin";

    &util::envvar_append("PATH",$server_bin);
    &util::envvar_append("PATH",$cmdline_bin);

    my $server_lib  = "$ENV{'GEXTVIDEO_INSTALLED'}/server/lib";
    my $cmdline_lib = "$ENV{'GEXTVIDEO_INSTALLED'}/cmdline/lib";

    # For Linux (no harm is setting is this for MacOs)
    &util::envvar_append("LD_LIBRARY_PATH",$server_lib);
    &util::envvar_append("LD_LIBRARY_PATH",$cmdline_lib);
    
    # For MacOs (no harm is setting is this for Linux etc)
    &util::envvar_append("DYLD_LIBRARY_PATH",$server_lib);
    &util::envvar_append("DYLD_LIBRARY_PATH",$cmdline_lib);


    # GSDLEXTS always uses : as a separator
    if (defined $ENV{'GSDLEXTS'}) {
	$ENV{'GSDLEXTS'} .= ":video" ;
    }
    else {
	$ENV{'GSDLEXTS'} .="video";
    }

}
