File: plplot-config.in

package info (click to toggle)
plplot 5.3.1-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 26,248 kB
  • ctags: 11,687
  • sloc: ansic: 86,045; xml: 17,249; sh: 12,400; tcl: 8,113; cpp: 6,824; perl: 4,383; python: 3,915; makefile: 2,899; java: 2,788; fortran: 290; sed: 5; awk: 1
file content (181 lines) | stat: -rwxr-xr-x 4,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/sh
#
# plplot-config -- Utility to help building projects against plplot
#
# Copyright (C) 2004  Maurice LeBrun
# Copyright (C) 2004  Alan W. Irwin
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PLplot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


#----------------------------------------------------------------------------
# Spits out cflags

output_cflags () {
    OUT="$OUT @INCLUDE_DIR_CMD@"
    if test "$with_tcl" = "yes" -a "$enable_tcl" = "yes" ; then
        OUT="$OUT @TCLINCCMD@ @TKINCCMD@"
    fi
}

#----------------------------------------------------------------------------
# Spits out libs

output_libs () {
    # Set up library spec
    plplot_libspec="-L${prefix}/lib -lplplot@LIB_TAG@"
    LINKER=@CC@
    if test "$with_cxx" = "yes" -a "$enable_cxx" = "yes" ; then
	plplot_libspec="-L${prefix}/lib -lplplotcxx@LIB_TAG@"
	LINKER=@CXX@
    fi
    if test "$with_f77" = "yes" -a "$enable_f77" = "yes" ; then
	plplot_libspec="-L${prefix}/lib -lplplotf77@LIB_TAG@"
	LINKER=@F77@
    fi
    if test "$with_tcl" = "yes" -a "$enable_tcl" = "yes" ; then
	plplot_libspec="-L${prefix}/lib -lplplottcltk@LIB_TAG@"
	LINKER=@CC@
    fi

    # Snarf libs from plplot_libtool output & process
    process_libtool_output \
     `plplot_libtool -n --mode=link ${LINKER} ${plplot_libspec} -o OUTPUT`
}

#----------------------------------------------------------------------------
# Throw away anything we don't want from plplot_libtool output

process_libtool_output () {
    for i in $*; do
	case $i in
	    -L*) emit_lib_output $*; return;;
	    * )  shift;;
	esac
    done
}

#----------------------------------------------------------------------------
# Output filtered linker args
# Filter out /usr/lib and all but one $prefix/lib.
# Todo: should filter out all duplicates.

emit_lib_output () {
    libs=""
    if test ${prefix}/lib != /usr/lib ; then
	libs=-L${prefix}/lib
    fi
    for i in $* ; do
	if test $i != -L${prefix}/lib ; then
	    libs="$libs $i"
	fi
    done
    OUT="$OUT $libs"
}

#----------------------------------------------------------------------------
# Spits out usage message & exits

usage () {
	cat <<EOF
Usage: plplot-config [OPTIONS]
Options:
	[--prefix[=DIR]]
	[--version]
	[--libs]
	[--cflags]
        [--with-c++]
        [--with-f77]
        [--with-tcl]
	[--help]

Note: --with-c++, --with-f77, and --with-tcl are mutually exclusive
EOF
	exit $1
}

#----------------------------------------------------------------------------
# Set up config/control variables

prefix=@prefix@
version=@VERSION@
enable_cxx=@enable_cxx@
enable_f77=@enable_f77@
enable_tcl=@enable_tcl@

if test $# -eq 0; then
    usage 1 1>&2
fi

# Loop over command line args
# Don't abort for unrecognized arg to allow for future extension!
while test $# -gt 0; do
    case "$1" in
	-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
	*) optarg= ;;
    esac

    case $1 in
	--prefix=*)
	    prefix=$optarg
	    ;;
	--prefix)
	    echo $prefix
	    ;;
	--version)
	    echo $version
	    ;;
	--cflags)
	    echo_cflags=yes
	    ;;
	--libs)
	    echo_libs=yes
	    ;;
	--with-c++)
	    if test "$with_f77" = "yes" -o "$with_tcl" = "yes"; then
	      usage 1 1>&2
	    fi
	    with_cxx=yes
	    ;;
	--with-f77)
	    if test "$with_cxx" = "yes" -o "$with_tcl" = "yes"; then
	      usage 1 1>&2
	    fi
	    with_f77=yes
	    ;;
	--with-tcl)
	    if test "$with_f77" = "yes" -o "$with_cxx" = "yes"; then
	      usage 1 1>&2
	    fi
	    with_tcl=yes
	    ;;
	--help)
	    usage 1 1>&2
	    ;;
    esac
    shift
done

OUT=""
if test "$echo_cflags" = "yes"; then
    output_cflags
fi

if test "$echo_libs" = "yes"; then
    output_libs
fi
echo $OUT