#!/usr/bin/perl -w
#
# @(#)$Id: esqlld version /main/10 2000-02-03 16:04:35 $ 
#
# Informix Database Driver for Perl Version 1.00.PC1 (2000-03-03)
#
# Surrogate Linker for Informix ESQL/C versions 4.10.UC1 upwards
# -- Used to create shared libraries.
#
# Portions Copyright 1996-99 Jonathan Leffler
# Portions Copyright 2000    Informix Software Inc
#
# You may distribute under the terms of either the GNU General Public
# License or the Artistic License, as specified in the Perl README file.

use strict;
use DBD::Informix::Configuration;

my $arg;
my $cmd;
my @cmd;

my $map = ($ENV{DBD_INFORMIX_RELOCATABLE_INFORMIXDIR}) ? 0 : 1;
my @ARGS = $map ? &map_informix_lib_names(@ARGV) : @ARGV;

# Remove C preprocessor options from linker command line
@ARGS = grep { !m/^-[DIU]/o } @ARGS;

# Sort out the real compiler.
# Note that if $ENV{ESQLLD} contains, for example, 'cc -G', then we
# need to split this into two words for the exec to work correctly.
$cmd = $ENV{ESQLLD};
$cmd = 'cc' unless ($cmd);
@cmd = split /\s+/, $cmd;

print STDERR "@cmd @ARGS -lc\n" if $ENV{DBD_INFORMIX_DEBUG_ESQLLD};
exec @cmd, @ARGS, "-lc";
