# HG changeset patch # User jwe # Date 795817619 0 # Node ID e98dac05db248a5fc5d32271cfb8049246374bcb # Parent 99fbb85d81527db91013e70c8d5d0fb7a876f069 [project @ 1995-03-21 20:26:59 by jwe] Initial revision diff -r 99fbb85d8152 -r e98dac05db24 cxxlibs.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cxxlibs.sh Tue Mar 21 20:26:59 1995 +0000 @@ -0,0 +1,88 @@ +#!/bin/sh +# +# cxxlibs -- try to get the C++ compiler to tell us what libraries +# it expects to link to, and echo the result to the standard output. +# +# John W. Eaton +# jwe@che.utexas.edu +# Department of Chemical Engineering +# The University of Texas at Austin + +trap 'rm -f conftest* core; exit 1' 1 3 15 + +# Write a minimal program and compile it with -v. I don't know what +# to do if your compiler doesn't have -v... + +echo "int main (void) { return 0; }" > conftest.c + +# I don't think that stripping commas out of this will ever hurt. + +coutput=`${CXX-c++} -v -o conftest conftest.c 2>&1 | sed 's/,/ /g'` + +clibs= +lflags= +want_arg= + +for arg in $coutput +do + if test x$want_arg = x + then + want_arg= + case $arg in + /*.a) + exists=false + for f in $lflags + do + if test x$arg = x$f + then + exists=true + fi + done + if $exists + then + arg= + else + lflags="$lflags $arg" + fi + ;; + -[LR]*) + exists=false + for f in $lflags + do + if test x$arg = x$f + then + exists=true + fi + done + ;; + -l*) + if test x$arg = x-lang-c++ + then + arg= + else + lflags="$lflags $arg" + fi + ;; + -u) + want_arg=$arg + ;; + *) + arg= + ;; + esac + else + want_arg= + fi + if test x$arg != x + then + clibs="$clibs $arg" + fi +done + +echo "$clibs" + +rm -f conftest* core + +# Bye-bye. + +exit 0