## 
## Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006 The Regents of the University of California 
## All Rights Reserved 
## 
## Permission to use, copy, modify and distribute any part of this
## CoralReef software package for educational, research and non-profit
## purposes, without fee, and without a written agreement is hereby
## granted, provided that the above copyright notice, this paragraph
## and the following paragraphs appear in all copies.
## 
## Those desiring to incorporate this into commercial products or use
## for commercial purposes should contact the Technology Transfer
## Office, University of California, San Diego, 9500 Gilman Drive, La
## Jolla, CA 92093-0910, Ph: (858) 534-5815, FAX: (858) 534-7345.
## 
## IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
## PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
## DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS
## SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
## THE POSSIBILITY OF SUCH DAMAGE.
## 
## THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE
## UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
## SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY
## OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES
## OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED
## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
## PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
## ANY PATENT, TRADEMARK OR OTHER RIGHTS.
## 
## The CoralReef software package is developed by the CoralReef
## development team at the University of California, San Diego under
## the Cooperative Association for Internet Data Analysis (CAIDA)
## Program. Support for this effort is provided by the CAIDA grant
## NCR-9711092, DARPA NGI Contract N66001-98-2-8922, DARPA NMS Grant
## N66001-01-1-8909, and by CAIDA members.
## 
## Report bugs and suggestions to coral-bugs@caida.org.
## 

## $Id: configure.pl,v 1.17 2006/02/28 19:14:29 kkeys Exp $

use Config;

print "# created by ", $0, "\n\n";

foreach (@INC) {
    if (-d "$_/CORE") {
        $core_dir = "$_/CORE";
        last;
    }
}
print "PERL_INC = -I$core_dir\n";

# Linker used by perl.  Extract zero or more leading environment variable
# assignments into PERL_LD_ENV, everything else into PERL_LD.
# ($Config{ld} on MacOSX is known to set an environment variable.)
$Config{ld} =~ /^(([A-Za-z][A-Za-z_]*=[^ ]* )*)(.*)/;
print "PERL_LD_ENV = $1\n";
print "PERL_LD = $3\n";
if ($3 !~ /(^|\/)(cc|ld)$/) {
    print STDERR "Warning: unexpected value in PERL_LD: $3\n";
}

# flags for cpp
print "PERL_CPPFLAGS = $Config{cppflags}\n";

# flags for $ld to create a shared library
print "PERL_LDDLFLAGS = $Config{lddlflags}\n";

# flags for cc -c to compile modules to be used to create a shared library
print "PERL_CCCDLFLAGS = $Config{cccdlflags}\n";

# extra linker flags needed to work around bug on FreeBSD 4.0 and 4.1 with g++
if ($Config{gccversion} =~ /^2/ && `uname -sr` =~ /^FreeBSD 4.[01]/) {
    print "PERL_CXX_LDDLFLAGS = -lstdc++ -lgcc\n";
}
