-
Notifications
You must be signed in to change notification settings - Fork 0
/
rnumber-config.in
267 lines (231 loc) · 5.37 KB
/
rnumber-config.in
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
bindir=${exec_prefix}/bin
datadir=${exec_prefix}/share/
pkglibdir=${libdir}/@PACKAGE@
pkgdatadir=${datadir}/@PACKAGE@
transform=@program_transform_name@
CFLAGS="@PROFILE@ -I@includedir@ "
RFLAG="-Wl,-R${pkglibdir}"
LIBDIRS="-L${pkglibdir} $RFLAG"
LIBS="-lRNumber"
HELPER_PATH="${pkgdatadir}"
rnumber_ltlibs="${pkglibdir}/libRNumber.la"
rnumber_libs="$LIBDIRS $LIBS "
rnumber_bl_libs="-lstdc++ -lbl-rnumber_s-@BIGLOO_REVISION@ "
rnumber_bl_lib_path="-L ${pkglibdir} "
rnumber_cflags="$CFLAGS"
rnumber_perl_libs="${pkglibdir}"
STATIC_LIBS_DEPEND="${pkglibdir}/libRNumber.a "
STATIC_LIBS="${pkglibdir}/libRNumber.a "
usage()
{
cat <<EOF
Usage: rnumber-config [OPTION]... [LIBRARY]...
Generic options
--version output library version information
--help display this help and exit
--prefix display installation root directory
Compilation support options
--cflags print pre-processor and compiler flags
--depend give list of libraries that target could depend on.
--helper-path print path to installed scripts and binaries
that support RNUMBER.
--libs print library linking information
--ltlibs print Libtool library information
--libs-only-L only print the -L/-R part of --libs
--libs-only-l only print the -l part of --libs
--perl-libs print library path for perl. Cannot be combined with any other flags.
--static-libs print path to .a file.
--bl-libs library path and library flag for bigloo.
--bl-libs-only-l library for bigloo.
--bl-libs-only-L library path for bigloo.
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
cflags=false
depend=false
libs_L=false
bl_libs_l=false
bl_libs_L=false
libs_l=false
perl_libs=false
helper_path=false
static_libs=false
ltlibs=false
any=no
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--version)
echo @VERSION@
exit 0
;;
--help)
usage 0
;;
--prefix)
echo $prefix
exit 0
;;
--helper-path)
helper_path=true
;;
--ltlibs)
ltlibs=true
;;
--static-libs)
libs_L=true
static_libs=true
;;
--depend)
depend=true
;;
--cflags)
cflags=true
;;
--perl-libs)
printf "$rnumber_perl_libs"
exit 0;
;;
--libs)
libs_L=true
libs_l=true
;;
--libs-only-L)
libs_L=true
;;
--libs-only-l)
libs_l=true
;;
--bl-libs)
bl_libs_l=true
bl_libs_L=true
;;
--bl-libs-only-l)
bl_libs_l=true
;;
--bl-libs-only-L)
bl_libs_L=true
;;
rnumber)
# defined above to avoid double definiton with default values below
the_libs="$the_libs $rnumber_libs"
the_flags="$the_flags $rnumber_cflags"
any=yes
;;
*)
usage 1
;;
esac
shift
done
# default to rnumber
if test "x$any" = xno; then
the_libs="$the_libs $rnumber_libs"
the_flags="$the_flags $rnumber_cflags"
fi
if $cflags; then
all_flags="$the_flags"
fi
if $depend; then
all_flags=$STATIC_LIBS_DEPEND
fi
if $ltlibs; then
all_flags="$all_flags $rnumber_ltlibs"
fi
if $libs_l; then
all_flags="$LIBS"
fi
if $libs_L; then
all_flags="$all_flags $LIBDIRS"
fi
if $perl_libs; then
all_flags="$all_flags $rnumber_perl_libs"
fi
if $bl_libs_L; then
all_flags="$rnumber_bl_lib_path "
fi
if $bl_libs_l; then
all_flags="$all_flags $rnumber_bl_libs"
fi
if $helper_path; then
all_flags="$HELPER_PATH"
fi
if $static_libs; then
all_flags="$STATIC_LIBS"
fi
if test -z "$all_flags" || test "x$all_flags" = "x "; then
exit 1
fi
# Straight out any possible duplicates, but be careful to
# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
other_flags=
lib_L_flags=
rev_libs=
if $bl_libs_l || $bl_libs_L; then
lib_L_flags=$all_flags
else
for i in $all_flags; do
case "$i" in
# a library, save it for later, in reverse order
-l*) rev_libs="$i $rev_libs" ;;
-L*)
if $libs_L; then
case " $lib_L_flags " in
*\ $i\ *) ;; # already there
*) lib_L_flags="$lib_L_flags $i" ;; # add it to output
esac
elif
$bl_libs_L; then
case " $lib_L_flags " in
*\ $i\ *) ;; # already there
*) lib_L_flags="$lib_L_flags $i" ;; # add it to output
esac
fi;;
-R*)
if $libs_L; then
case " $lib_L_flags " in
*\ $i\ *) ;; # already there
*) lib_L_flags="$lib_L_flags $i" ;; # add it to output
esac
fi;;
*)
case " $other_flags " in
*\ $i\ *) ;; # already there
*) other_flags="$other_flags $i" ;; # add it to output
esac ;;
esac
done
ord_libs=
if [ $libs_l -o $static_libs ]; then
for i in $rev_libs; do
case " $ord_libs " in
*\ $i\ *) ;; # already there
*) ord_libs="$i $ord_libs" ;; # add it to output in reverse order
esac
done
fi
fi
#printf "other_flags |$other_flags|\n"
#printf "lib_L_flags |$lib_L_flags|\n"
#printf "ord_libs |$ord_libs|\n"
if test "x$other_flags" != "x"; then
printf "$other_flags"
fi
if test "x$lib_L_flags" != "x"; then
printf " $lib_L_flags"
fi
if test "x$ord_libs" != "x"; then
printf " $ord_libs"
fi
#printf "$other_flags $lib_L_flags $ord_libs";
exit 0