-
Notifications
You must be signed in to change notification settings - Fork 5
/
autotrace-config.in
215 lines (184 loc) · 3.89 KB
/
autotrace-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
#!/bin/sh
af_libs=
af_cflags=
prefix=@prefix@
exec_prefix=@exec_prefix@
##
## Define usage()
##
usage()
{
cat <<EOF
Usage: autotrace-config [OPTIONS] [LIBRARIES]
Options:
--cflags print pre-processor and compiler flags
--libs print library linking information
--libs-dirs only print the -L/-R part of --libs
--libs-names only print the -l part of --libs
--help display this help and exit
--prefix[=DIR]
--exec_prefix[=DIR]
--version output autotrace version information
Libraries:
autotrace
EOF
exit $1
}
##
## Process options
##
parse()
{
# we must be called with at least one argument
if test $# -eq 0; then
usage 1 1>&2
fi
# at least one option should be selected
case "$1" in
--*)
;;
*)
usage 1 1>&2
;;
esac
# grab all -- arguments
while test $# -gt 0; do
case "$1" in
-*=*) af_optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) af_optarg= ;;
esac
case $1 in
--help)
usage 0 0>&2
;;
--cflags)
af_echo_cflags=yes
;;
--libs)
af_echo_libs_L=yes
af_echo_libs_l=yes
;;
--libs-dirs)
af_echo_libs_L=yes
;;
--libs-names)
af_echo_libs_l=yes
;;
--prefix=*)
prefix=$af_optarg
af_prefix_set=yes
;;
--prefix)
af_echo_prefix=yes
;;
--exec_prefix=*)
exec_prefix=$af_optarg
af_exec_prefix_set=yes
;;
--exec_prefix)
af_echo_exec_prefix=yes
;;
--version)
af_echo_version=yes
;;
--*)
usage 1 1>&2
;;
*)
break
;;
esac
shift
done
# if we have a default library use it
if test $# -eq 0; then
if test "X$af_lib_default" != "X"; then
af_lib__AF_LIB_DEFAULT=yes
return
fi
fi
while test $# -gt 0; do
case $1 in
autotrace)
af_lib_autotrace=yes
;;
*)
usage 1 1>&2
;;
esac
shift
done
}
print_result()
{
if test "X$af_echo_cflags" = "Xyes"; then
af_all_flags="$af_cflags"
fi
if test "X$af_echo_libs_L" = "Xyes" || test "X$af_echo_libs_l" = "Xyes"; then
af_all_flags="$af_all_flags $af_libs"
fi
if test -z "$af_all_flags" || test "X$af_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'
af_other_flags=
af_lib_L_flags=
af_rev_libs=
for i in $af_all_flags; do
case "$i" in
# a library, save it for later, in reverse order
-l*) af_rev_libs="$i $af_rev_libs" ;;
-L*|-R*)
if test "X$af_echo_libs_L" = "Xyes"; then
case " $af_lib_L_flags " in
*\ $i\ *) ;; # already there
*) af_lib_L_flags="$af_lib_L_flags $i" ;; # add it to output
esac
fi;;
*)
case " $af_other_flags " in
*\ $i\ *) ;; # already there
*) af_other_flags="$af_other_flags $i" ;; # add it to output
esac ;;
esac
done
af_ord_libs=
if test "X$af_echo_libs_l" = "Xyes"; then
for i in $af_rev_libs; do
case " $af_ord_libs " in
*\ $i\ *) ;; # already there
*) af_ord_libs="$i $af_ord_libs" ;; # add it to output in reverse order
esac
done
fi
echo $af_other_flags $af_lib_L_flags $af_ord_libs
}
##
## Main Body
##
parse $*
##
## Initialize names
##
##
## Available options
##
if test "X$af_echo_prefix" = "Xyes"; then
echo $prefix
fi
if test "X$af_echo_exec_prefix" = "Xyes"; then
echo $exec_prefix
fi
if test "X$af_echo_version" = "Xyes"; then
echo @VERSION@
exit 0
fi
##
## Libraries
##
#dummy because this should always be selected
af_cflags="$af_cflags -I@includedir@ @MAGICK_CFLAGS@ @LIBPSTOEDIT_CFLAGS@ @GLIB2_CFLAGS@"
af_libs="-L@libdir@ -lautotrace @LIBPNG_LDFLAGS@ @MAGICK_LDFLAGS@ @LIBSWF_LDFLAGS@ @LIBPSTOEDIT_LIBS@ @GLIB2_LIBS@ $af_libs"
print_result
exit 0