Implement new Fl_Panzoomer widget, for panning and zooming around a thumbnail instead...
[ntk.git] / ntk-config.in
blob94adc15f492a6282ea3e029512dd268056c77251
1 #!/bin/sh
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
24 # USA.
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"
37 ### BEGIN ntk-config
38 selfdir=`dirname "$0"`
40 prefix=@prefix@
41 exec_prefix=@exec_prefix@
42 exec_prefix_set=no
43 bindir=@bindir@
44 includedir=@includedir@/ntk
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/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:
89 LIBNAME="@LIBNAME@"
90 DSONAME="@DSONAME@"
91 DSOLINK="@DSOLINK@"
92 IMAGELIBS="@IMAGELIBS@"
93 STATICIMAGELIBS="@STATICIMAGELIBS@"
94 CAIROLIBS="@CAIROLIBS@"
95 SHAREDSUFFIX="@SHAREDSUFFIX@"
97 usage ()
99 echo "Usage: ntk-config [OPTIONS]
100 Options:
101 [--version]
102 [--api-version]
104 Options telling what we are doing:
105 [--use-gl] use GL
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
129 exit $1
132 if test $# -eq 0; then
133 usage 1
136 no_plugins=no
137 compile=
138 post=
139 debug=
141 # Parse command line options
142 while test $# -gt 0
144 case "$1" in
145 -*=*)
146 optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
149 optarg=
151 esac
153 case $1 in
154 --version)
155 echo $VERSION
157 --api-version)
158 echo $APIVERSION
160 --cc)
161 echo $CC
163 --cxx)
164 echo $CXX
166 --optim)
167 echo_optim=yes
169 --use-gl | --use-glut)
170 use_gl=yes
172 --use-images)
173 use_images=yes
175 --use-cairo)
176 use_cairo=yes
178 --cflags)
179 echo_cflags=yes
181 --cxxflags)
182 echo_cxxflags=yes
184 --ldflags)
185 echo_ldflags=yes
187 --ldstaticflags)
188 echo_ldstaticflags=yes
190 --libs)
191 echo_libs=yes
193 --prefix)
194 echo_prefix=yes
196 --includedir)
197 echo_includedir=yes
200 debug=-g
202 -D*)
203 CXXFLAGS="$CXXFLAGS $1"
205 --compile)
206 compile="$2"
207 shift
209 --post)
210 post="$2"
211 shift
214 echo_help=yes
216 esac
217 shift
218 done
220 if test "$includedir" != /usr/include; then
221 includes=-I$includedir
222 else
223 includes=
226 if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
227 libs=-L$libdir
228 else
229 libs=
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
255 usage 1
258 if test -n "$compile"; then
259 case "$compile" in
260 *.cxx)
261 prog="`basename \"$compile\" .cxx`"
263 *.cpp)
264 prog="`basename \"$compile\" .cpp`"
266 *.cc)
267 prog="`basename \"$compile\" .cc`"
269 *.C)
270 prog="`basename \"$compile\" .C`"
273 echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
274 exit 1
276 esac
278 post="$prog"
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
285 case "`uname`" in
286 Darwin)
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"
299 chmod +x "$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">
305 <dict>
306 <key>CFBundleInfoDictionaryVersion</key>
307 <string>6.0</string>
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>
316 </dict>
317 </plist>
320 esac
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
332 echo $OPTIM
335 if test "$echo_ldflags" = "yes"; then
336 my_libs=
337 libdirs=$libs
339 for i in $LDLIBS ; do
340 if test $i != -L$libdir ; then
341 if test -z "$my_libs" ; then
342 my_libs="$i"
343 else
344 my_libs="$my_libs $i"
347 done
348 echo $libdirs $my_libs
351 if test "$echo_ldstaticflags" = "yes"; then
352 echo $LDSTATIC
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
363 USELIBS="$USELIBS"
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"
373 done
376 echo $USELIBS
379 if test "$echo_prefix" = "yes"; then
380 echo $prefix
383 if test "$echo_includedir" = "yes"; then
384 echo $includedir
388 # End of "$Id: ntk-config.in 8149 2011-01-01 00:10:38Z mike $".