Use cairo to draw everything.
[ntk.git] / fltk-config.in
blobefee820544080047a93adabd15348c57ca496187
1 #!/bin/sh
3 # "$Id: fltk-config.in 8149 2011-01-01 00:10:38Z mike $"
5 # FLTK configuration utility.
7 # Copyright 2000-2010 by Bill Spitzak and others.
8 # Original version Copyright 2000 by James Dean Palmer
9 # Adapted by Vincent Penne and Michael Sweet
11 # This library is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU Library General Public
13 # License as published by the Free Software Foundation; either
14 # version 2 of the License, or (at your option) any later version.
16 # This library is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # Library General Public License for more details.
21 # You should have received a copy of the GNU Library General Public
22 # License along with this library; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 # USA.
26 # Please report all bugs and problems on the following page:
28 # http://www.fltk.org/str.php
31 MAJOR_VERSION=@FL_MAJOR_VERSION@
32 MINOR_VERSION=@FL_MINOR_VERSION@
33 PATCH_VERSION=@FL_PATCH_VERSION@
34 VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
35 APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
37 ### BEGIN fltk-config
38 selfdir=`dirname "$0"`
40 prefix=@prefix@
41 exec_prefix=@exec_prefix@
42 exec_prefix_set=no
43 bindir=@bindir@
44 includedir=@includedir@
45 libdir=@libdir@
46 srcdir=@srcdir@
48 # compiler names
49 CC="@CC@"
50 CXX="@CXX@"
52 # flags for C++ compiler:
53 ARCHFLAGS="@ARCHFLAGS@"
54 CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
55 CXXFLAGS="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
56 LDFLAGS="@LDFLAGS@"
57 LDLIBS="@LIBS@"
58 OPTIM="@OPTIM@"
59 CAIROFLAGS="@CAIROFLAGS@"
61 # Check for local invocation, and update paths accordingly...
62 if test -f "$selfdir/FL/Fl_Window.H"; then
63 bindir="$selfdir/fluid"
64 includedir="$selfdir"
65 libdir="$selfdir/lib"
67 if test -f "$libdir/libfltk_jpeg.a"; then
68 CFLAGS="-I$includedir/jpeg $CFLAGS"
69 CXXFLAGS="-I$includedir/jpeg $CXXFLAGS"
72 if test -f "$libdir/libfltk_z.a"; then
73 CFLAGS="-I$includedir/zlib $CFLAGS"
74 CXXFLAGS="-I$includedir/zlib $CXXFLAGS"
77 if test -f "$libdir/libfltk_png.a"; then
78 CFLAGS="-I$includedir/png $CFLAGS"
79 CXXFLAGS="-I$includedir/png $CXXFLAGS"
83 if test -d $includedir/FL/images; then
84 CFLAGS="-I$includedir/FL/images $CFLAGS"
85 CXXFLAGS="-I$includedir/FL/images $CXXFLAGS"
88 if test -f "$libdir/libfltk_cairo.a"; then
89 CFLAGS="$CAIROFLAGS $CFLAGS"
90 CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
93 # libraries to link with:
94 LIBNAME="@LIBNAME@"
95 DSONAME="@DSONAME@"
96 DSOLINK="@DSOLINK@"
97 IMAGELIBS="@IMAGELIBS@"
98 STATICIMAGELIBS="@STATICIMAGELIBS@"
99 CAIROLIBS="@CAIROLIBS@"
100 SHAREDSUFFIX="@SHAREDSUFFIX@"
102 usage ()
104 echo "Usage: fltk-config [OPTIONS]
105 Options:
106 [--version]
107 [--api-version]
109 Options telling what we are doing:
110 [--use-gl] use GL
111 [--use-images] use extra image formats (PNG, JPEG)
112 [--use-glut] use glut compatibility layer
113 [--use-forms] use forms compatibility layer
114 [--use-cairo] use cairo graphics lib
116 Options telling what information we request:
117 [--cc] return C compiler used to compile FLTK
118 [--cxx] return C++ compiler used to compile FLTK
119 [--optim] return compiler optimization used to compile FLTK
120 [--cflags] return flags to compile C using FLTK
121 [--cxxflags] return flags to compile C++ using FLTK
122 [--ldflags] return flags to link against FLTK
123 [--ldstaticflags] return flags to link against static FLTK library
124 even if there are DSOs installed
125 [--libs] return FLTK libraries full path for dependencies
126 [--prefix] return FLTK install time --prefix directory
127 [--includedir] return FLTK install time include directory
129 Options to compile and link an application:
130 [-g] compile the program with debugging information
131 [-Dname[=value]] compile the program with the given define
132 [--compile program.cxx]
133 [--post program] prepare the program for desktop use
135 exit $1
138 if test $# -eq 0; then
139 usage 1
142 no_plugins=no
143 compile=
144 post=
145 debug=
147 # Parse command line options
148 while test $# -gt 0
150 case "$1" in
151 -*=*)
152 optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
155 optarg=
157 esac
159 case $1 in
160 --version)
161 echo $VERSION
163 --api-version)
164 echo $APIVERSION
166 --cc)
167 echo $CC
169 --cxx)
170 echo $CXX
172 --optim)
173 echo_optim=yes
175 --use-gl | --use-glut)
176 use_gl=yes
178 --use-forms)
179 use_forms=yes
181 --use-images)
182 use_images=yes
184 --use-cairo)
185 use_cairo=yes
187 --cflags)
188 echo_cflags=yes
190 --cxxflags)
191 echo_cxxflags=yes
193 --ldflags)
194 echo_ldflags=yes
196 --ldstaticflags)
197 echo_ldstaticflags=yes
199 --libs)
200 echo_libs=yes
202 --prefix)
203 echo_prefix=yes
205 --includedir)
206 echo_includedir=yes
209 debug=-g
211 -D*)
212 CXXFLAGS="$CXXFLAGS $1"
214 --compile)
215 compile="$2"
216 shift
218 --post)
219 post="$2"
220 shift
223 echo_help=yes
225 esac
226 shift
227 done
229 if test "$includedir" != /usr/include; then
230 includes=-I$includedir
231 else
232 includes=
235 if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
236 libs=-L$libdir
237 else
238 libs=
241 # Calculate needed libraries
242 LDSTATIC="$libdir/libfltk.a $LDLIBS"
243 LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS"
245 if test x$use_forms = xyes; then
246 LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
247 LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC"
249 if test x$use_gl = xyes; then
250 LDLIBS="-lfltk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
251 LDSTATIC="$libdir/libfltk_gl.a @GLLIB@ $LDSTATIC"
253 if test x$use_images = xyes; then
254 LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
255 LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
258 if test x$use_cairo = xyes; then
259 LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS"
260 LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC"
263 LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
264 LDSTATIC="$LDFLAGS $LDSTATIC"
266 # Answer to user requests
267 if test -n "$echo_help"; then
268 usage 1
271 if test -n "$compile"; then
272 case "$compile" in
273 *.cxx)
274 prog="`basename \"$compile\" .cxx`"
276 *.cpp)
277 prog="`basename \"$compile\" .cpp`"
279 *.cc)
280 prog="`basename \"$compile\" .cc`"
282 *.C)
283 prog="`basename \"$compile\" .C`"
286 echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
287 exit 1
289 esac
291 post="$prog"
293 echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
294 $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
297 if test -n "$post"; then
298 case "`uname`" in
299 Darwin)
300 echo Creating "'$post.app'" bundle for desktop...
301 id=`echo $post | tr ' ' '_'`
303 # Make the bundle directory and move the executable there
304 rm -rf "$post.app/Contents/MacOS"
305 mkdir -p "$post.app/Contents/MacOS"
306 mv "$post" "$post.app/Contents/MacOS"
308 # Make a shell script that runs the bundled executable
309 echo "#!/bin/sh" >"$post"
310 echo 'dir="`dirname \"$0\"`"' >>"$post"
311 echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
312 chmod +x "$post"
314 # Make the simplest Info.plist needed for an application
315 cat >"$post.app/Contents/Info.plist" <<EOF
316 <?xml version="1.0" encoding="UTF-8"?>
317 <plist version="0.9">
318 <dict>
319 <key>CFBundleInfoDictionaryVersion</key>
320 <string>6.0</string>
321 <key>CFBundleExecutable</key>
322 <string>$post</string>
323 <key>CFBundleIdentifier</key>
324 <string>org.fltk.$id</string>
325 <key>CFBundleName</key>
326 <string>$post</string>
327 <key>CFBundlePackageType</key>
328 <string>APPL</string>
329 </dict>
330 </plist>
333 esac
336 if test "$echo_cflags" = "yes"; then
337 echo $includes $CFLAGS
340 if test "$echo_cxxflags" = "yes"; then
341 echo $includes $CXXFLAGS
344 if test "$echo_optim" = "yes"; then
345 echo $OPTIM
348 if test "$echo_ldflags" = "yes"; then
349 my_libs=
350 libdirs=$libs
352 for i in $LDLIBS ; do
353 if test $i != -L$libdir ; then
354 if test -z "$my_libs" ; then
355 my_libs="$i"
356 else
357 my_libs="$my_libs $i"
360 done
361 echo $libdirs $my_libs
364 if test "$echo_ldstaticflags" = "yes"; then
365 echo $LDSTATIC
368 if test "$echo_libs" = "yes"; then
369 USELIBS="$libdir/libfltk.a"
371 if test x$use_forms = xyes; then
372 USELIBS="$libdir/libfltk_forms.a $USELIBS"
375 if test x$use_gl = xyes; then
376 USELIBS="$libdir/libfltk_gl.a $USELIBS"
379 if test x$use_cairo = xyes; then
380 USELIBS="$libdir/libfltk_cairo.a $USELIBS"
383 if test x$use_images = xyes; then
384 USELIBS="$libdir/libfltk_images.a $USELIBS"
386 for lib in fltk_jpeg fltk_png fltk_z; do
387 if test -f $libdir/lib$lib.a; then
388 USELIBS="$libdir/lib$lib.a $USELIBS"
390 done
393 echo $USELIBS
396 if test "$echo_prefix" = "yes"; then
397 echo $prefix
400 if test "$echo_includedir" = "yes"; then
401 echo $includedir
405 # End of "$Id: fltk-config.in 8149 2011-01-01 00:10:38Z mike $".