3 # "$Id: ntk-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.ntk.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@
/ntk
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/libntk_jpeg.a"; then
68 CFLAGS
="-I$includedir/jpeg $CFLAGS"
69 CXXFLAGS
="-I$includedir/jpeg $CXXFLAGS"
72 if test -f "$libdir/libntk_z.a"; then
73 CFLAGS
="-I$includedir/zlib $CFLAGS"
74 CXXFLAGS
="-I$includedir/zlib $CXXFLAGS"
77 if test -f "$libdir/libntk_png.a"; then
78 CFLAGS
="-I$includedir/png $CFLAGS"
79 CXXFLAGS
="-I$includedir/png $CXXFLAGS"
83 if test -d $includedir/ntk
/FL
/images
; then
84 CFLAGS
="-I$includedir/ntk/FL/images $CFLAGS"
85 CXXFLAGS
="-I$includedir/ntk/FL/images $CXXFLAGS"
88 # libraries to link with:
92 IMAGELIBS
="@IMAGELIBS@"
93 STATICIMAGELIBS
="@STATICIMAGELIBS@"
94 CAIROLIBS
="@CAIROLIBS@"
95 SHAREDSUFFIX
="@SHAREDSUFFIX@"
99 echo "Usage: ntk-config [OPTIONS]
104 Options telling what we are doing:
106 [--use-images] use extra image formats (PNG, JPEG)
107 [--use-glut] use glut compatibility layer
108 [--use-cairo] use cairo graphics lib
110 Options telling what information we request:
111 [--cc] return C compiler used to compile FLTK
112 [--cxx] return C++ compiler used to compile FLTK
113 [--optim] return compiler optimization used to compile FLTK
114 [--cflags] return flags to compile C using FLTK
115 [--cxxflags] return flags to compile C++ using FLTK
116 [--ldflags] return flags to link against FLTK
117 [--ldstaticflags] return flags to link against static FLTK library
118 even if there are DSOs installed
119 [--libs] return FLTK libraries full path for dependencies
120 [--prefix] return FLTK install time --prefix directory
121 [--includedir] return FLTK install time include directory
123 Options to compile and link an application:
124 [-g] compile the program with debugging information
125 [-Dname[=value]] compile the program with the given define
126 [--compile program.cxx]
127 [--post program] prepare the program for desktop use
132 if test $# -eq 0; then
141 # Parse command line options
146 optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
169 --use-gl |
--use-glut)
188 echo_ldstaticflags
=yes
203 CXXFLAGS
="$CXXFLAGS $1"
220 if test "$includedir" != /usr
/include
; then
221 includes
=-I$includedir
226 if test "$libdir" != /usr
/lib
-a "$libdir" != /usr
/lib32
; then
232 # Calculate needed libraries
233 LDSTATIC
="$libdir/libntk.a $LDLIBS"
234 LDLIBS
="-lntk$SHAREDSUFFIX $LDLIBS"
236 if test x
$use_gl = xyes
; then
237 LDLIBS
="-lntk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
238 LDSTATIC
="$libdir/libntk_gl.a @GLLIB@ $LDSTATIC"
240 if test x
$use_images = xyes
; then
241 LDLIBS
="-lntk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
242 LDSTATIC
="$libdir/libntk_images.a $STATICIMAGELIBS $LDSTATIC"
245 if test x
$use_cairo = xyes
; then
246 LDLIBS
="$CAIROLIBS $LDLIBS"
247 LDSTATIC
="$CAIROLIBS $LDSTATIC"
250 LDLIBS
="$DSOLINK $LDFLAGS $libs $LDLIBS"
251 LDSTATIC
="$LDFLAGS $LDSTATIC"
253 # Answer to user requests
254 if test -n "$echo_help"; then
258 if test -n "$compile"; then
261 prog
="`basename \"$compile\" .cxx`"
264 prog
="`basename \"$compile\" .cpp`"
267 prog
="`basename \"$compile\" .cc`"
270 prog
="`basename \"$compile\" .C`"
273 echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
280 echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
281 $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC ||
exit 1
284 if test -n "$post"; then
287 echo Creating
"'$post.app'" bundle
for desktop...
288 id
=`echo $post | tr ' ' '_'`
290 # Make the bundle directory and move the executable there
291 rm -rf "$post.app/Contents/MacOS"
292 mkdir
-p "$post.app/Contents/MacOS"
293 mv "$post" "$post.app/Contents/MacOS"
295 # Make a shell script that runs the bundled executable
296 echo "#!/bin/sh" >"$post"
297 echo 'dir="`dirname \"$0\"`"' >>"$post"
298 echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
301 # Make the simplest Info.plist needed for an application
302 cat >"$post.app/Contents/Info.plist" <<EOF
303 <?xml version="1.0" encoding="UTF-8"?>
304 <plist version="0.9">
306 <key>CFBundleInfoDictionaryVersion</key>
308 <key>CFBundleExecutable</key>
309 <string>$post</string>
310 <key>CFBundleIdentifier</key>
311 <string>org.ntk.$id</string>
312 <key>CFBundleName</key>
313 <string>$post</string>
314 <key>CFBundlePackageType</key>
315 <string>APPL</string>
323 if test "$echo_cflags" = "yes"; then
324 echo $includes $CFLAGS
327 if test "$echo_cxxflags" = "yes"; then
328 echo $includes $CXXFLAGS
331 if test "$echo_optim" = "yes"; then
335 if test "$echo_ldflags" = "yes"; then
339 for i
in $LDLIBS ; do
340 if test $i != -L$libdir ; then
341 if test -z "$my_libs" ; then
344 my_libs
="$my_libs $i"
348 echo $libdirs $my_libs
351 if test "$echo_ldstaticflags" = "yes"; then
355 if test "$echo_libs" = "yes"; then
356 USELIBS
="$libdir/libntk.a"
358 if test x
$use_gl = xyes
; then
359 USELIBS
="$libdir/libntk_gl.a $USELIBS"
362 if test x
$use_cairo = xyes
; then
366 if test x
$use_images = xyes
; then
367 USELIBS
="$libdir/libntk_images.a $USELIBS"
369 for lib
in ntk_jpeg ntk_png ntk_z
; do
370 if test -f $libdir/lib
$lib.a
; then
371 USELIBS
="$libdir/lib$lib.a $USELIBS"
379 if test "$echo_prefix" = "yes"; then
383 if test "$echo_includedir" = "yes"; then
388 # End of "$Id: ntk-config.in 8149 2011-01-01 00:10:38Z mike $".