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
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"
38 selfdir
=`dirname "$0"`
41 exec_prefix
=@exec_prefix@
44 includedir
=@includedir@
52 # flags for C++ compiler:
53 ARCHFLAGS
="@ARCHFLAGS@"
54 CFLAGS
="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
55 CXXFLAGS
="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
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"
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:
97 IMAGELIBS
="@IMAGELIBS@"
98 STATICIMAGELIBS
="@STATICIMAGELIBS@"
99 CAIROLIBS
="@CAIROLIBS@"
100 SHAREDSUFFIX
="@SHAREDSUFFIX@"
104 echo "Usage: fltk-config [OPTIONS]
109 Options telling what we are doing:
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
138 if test $# -eq 0; then
147 # Parse command line options
152 optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
175 --use-gl |
--use-glut)
197 echo_ldstaticflags
=yes
212 CXXFLAGS
="$CXXFLAGS $1"
229 if test "$includedir" != /usr
/include
; then
230 includes
=-I$includedir
235 if test "$libdir" != /usr
/lib
-a "$libdir" != /usr
/lib32
; then
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
271 if test -n "$compile"; then
274 prog
="`basename \"$compile\" .cxx`"
277 prog
="`basename \"$compile\" .cpp`"
280 prog
="`basename \"$compile\" .cc`"
283 prog
="`basename \"$compile\" .C`"
286 echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
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
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"
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">
319 <key>CFBundleInfoDictionaryVersion</key>
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>
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
348 if test "$echo_ldflags" = "yes"; then
352 for i
in $LDLIBS ; do
353 if test $i != -L$libdir ; then
354 if test -z "$my_libs" ; then
357 my_libs
="$my_libs $i"
361 echo $libdirs $my_libs
364 if test "$echo_ldstaticflags" = "yes"; then
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"
396 if test "$echo_prefix" = "yes"; then
400 if test "$echo_includedir" = "yes"; then
405 # End of "$Id: fltk-config.in 8149 2011-01-01 00:10:38Z mike $".