3 # "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $"
5 # FLTK configuration utility.
7 # Copyright 2000-2009 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
34 VERSION
="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
35 APIVERSION
="$MAJOR_VERSION.$MINOR_VERSION"
38 selfdir
=`dirname "$0"`
43 bindir
=${exec_prefix}/bin
44 includedir
=${prefix}/include
45 libdir
=${exec_prefix}/lib
52 # flags for C++ compiler:
54 CFLAGS
=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
55 CXXFLAGS
="-I/usr/include/freetype2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
57 LDLIBS
="-lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm -lX11 "
58 OPTIM
=" -Os -Wall -Wunused -Wno-format-y2k -fno-exceptions -fno-strict-aliasing"
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:
94 LIBNAME
="../lib/libfltk.a"
97 IMAGELIBS
="-lpng -lz -ljpeg "
98 STATICIMAGELIBS
="-lpng -lz -ljpeg "
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
127 Options to compile and link an application:
128 [-g] compile the program with debugging information
129 [-Dname[=value]] compile the program with the given define
130 [--compile program.cxx]
131 [--post program] prepare the program for desktop use
136 if test $# -eq 0; then
145 # Parse command line options
150 optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
173 --use-gl |
--use-glut)
195 echo_ldstaticflags
=yes
204 CXXFLAGS
="$CXXFLAGS $1"
221 if test "$includedir" != /usr
/include
; then
222 includes
=-I$includedir
227 if test "$libdir" != /usr
/lib
-a "$libdir" != /usr
/lib32
; then
233 # Calculate needed libraries
234 LDSTATIC
="$libdir/libfltk.a $LDLIBS"
235 LDLIBS
="-lfltk$SHAREDSUFFIX $LDLIBS"
237 if test x
$use_forms = xyes
; then
238 LDLIBS
="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
239 LDSTATIC
="$libdir/libfltk_forms.a $LDSTATIC"
241 if test x
$use_gl = xyes
; then
242 LDLIBS
="-lfltk_gl$SHAREDSUFFIX -lGLU -lGL $LDLIBS"
243 LDSTATIC
="$libdir/libfltk_gl.a -lGLU -lGL $LDSTATIC"
245 if test x
$use_images = xyes
; then
246 LDLIBS
="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
247 LDSTATIC
="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
250 if test x
$use_cairo = xyes
; then
251 LDLIBS
="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS"
252 LDSTATIC
="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC"
255 LDLIBS
="$DSOLINK $LDFLAGS $libs $LDLIBS"
256 LDSTATIC
="$LDFLAGS $LDSTATIC"
258 # Answer to user requests
259 if test -n "$echo_help"; then
263 if test -n "$compile"; then
266 prog
="`basename \"$compile\" .cxx`"
269 prog
="`basename \"$compile\" .cpp`"
272 prog
="`basename \"$compile\" .cc`"
275 prog
="`basename \"$compile\" .C`"
278 echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
285 echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
286 $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC ||
exit 1
289 if test -n "$post"; then
292 echo Creating
"'$post.app'" bundle
for desktop...
293 id
=`echo $post | tr ' ' '_'`
295 # Make the bundle directory and move the executable there
296 rm -rf "$post.app/Contents/MacOS"
297 mkdir
-p "$post.app/Contents/MacOS"
298 mv "$post" "$post.app/Contents/MacOS"
300 # Make a shell script that runs the bundled executable
301 echo "#!/bin/sh" >"$post"
302 echo 'dir="`dirname '"'"'$0'"'"'`"' >>"$post"
303 echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
306 # Make the simplest Info.plist needed for an application
307 cat >"$post.app/Contents/Info.plist" <<EOF
308 <?xml version="1.0" encoding="UTF-8"?>
309 <plist version="0.9">
311 <key>CFBundleInfoDictionaryVersion</key>
313 <key>CFBundleExecutable</key>
314 <string>$post</string>
315 <key>CFBundleIdentifier</key>
316 <string>org.fltk.$id</string>
317 <key>CFBundleName</key>
318 <string>$post</string>
319 <key>CFBundlePackageType</key>
320 <string>APPL</string>
328 if test "$echo_cflags" = "yes"; then
329 echo $includes $CFLAGS
332 if test "$echo_cxxflags" = "yes"; then
333 echo $includes $CXXFLAGS
336 if test "$echo_optim" = "yes"; then
340 if test "$echo_ldflags" = "yes"; then
344 for i
in $LDLIBS ; do
345 if test $i != -L$libdir ; then
346 if test -z "$my_libs" ; then
349 my_libs
="$my_libs $i"
353 echo $libdirs $my_libs
356 if test "$echo_ldstaticflags" = "yes"; then
360 if test "$echo_libs" = "yes"; then
361 echo $libdir/libfltk.a
363 if test x
$use_forms = xyes
; then
364 echo $libdir/libfltk_forms.a
367 if test x
$use_gl = xyes
; then
368 echo $libdir/libfltk_gl.a
371 if test x
$use_cairo = xyes
; then
372 echo $libdir/libfltk_cairo.a
375 if test x
$use_images = xyes
; then
376 echo $libdir/libfltk_images.a
378 for lib
in fltk_jpeg fltk_png fltk_z
; do
379 if test -f $libdir/lib
$lib.a
; then
380 echo $libdir/lib
$lib.a
387 # End of "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $".