Debian Codegraph @

configure.in

raw ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 dnl
2 dnl
3 dnl Configure file for Imview 1.1.x
4 dnl
5 dnl Imview is hard to configure because is uses a lot of advanced features
6 dnl such as TCP/IP sockets, shared memory & semaphores (sysv and/or posix)
7 dnl threading and a gui system. Moreover it is portable to Win32 in spite
8 dnl of all that, and I need it available on Linux, Solaris, Tru64 and win2k
9 dnl at the very least, and across a relatively wide variety of C++ compilers,
10 dnl a language that keeps evolving. On top of that I like to support cross-compiling
11 dnl of the win32 version from Linux/Unix, for efficiency reasons. In other words
12 dnl this configure.in file is a nightmare. You have been warned!
13 dnl
14 dnl Here are a few gotchas:
15 dnl
16 dnl LIBS is not used at compilation time, only at configure time.
17 dnl all the various optional LIBS are substituted in the makefile in
18 dnl increments (MATHLIB, IMGLIB, etc).
19 dnl
20
21
22
23
24 dnl Disabling caching
25 dnl I'll want to re-enable it once it all works... (i.e: never Hugues Talbot 8 May 2003)
26 define([AC_CACHE_LOAD], )dnl
27 define([AC_CACHE_SAVE], )dnl
28
29
30 dnl Process this file with autoconf to produce a configure script.
31 dnl Any file will do, this is to check that the srcdir is correct
32 AC_INIT(io/cpostscript.cxx)
33 AC_CANONICAL_SYSTEM
34
35 # generate configure header
36 AC_CONFIG_HEADER(imcfg.h) # the name config.h is used everywhere these days
37
38 # Set version
39 MAJOR_VERSION=1
40 MINOR_VERSION=1
41 MICRO_VERSION=9 # ball is now rolling
42
43 echo "configuring Imview $MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION"
44 AC_SUBST(MAJOR_VERSION)dnl
45 AC_SUBST(MINOR_VERSION)dnl
46 AC_SUBST(MICRO_VERSION)dnl
47
48 # Branch tag
49 BRANCH_TAG=rel-1-1-0
50 echo "Branch $BRANCH_TAG"
51 AC_SUBST(BRANCH_TAG)
52
53 # start of the real thing
54
55 # we need the version number, actually
56 AC_DEFINE_UNQUOTED(IMVIEW_MAJOR, $MAJOR_VERSION)
57 AC_DEFINE_UNQUOTED(IMVIEW_MINOR, $MINOR_VERSION)
58 AC_DEFINE_UNQUOTED(IMVIEW_MICRO, $MICRO_VERSION)
59
60 #
61 # we need the default prefix!
62 #
63 test "x$prefix" = xNONE && prefix=$ac_default_prefix
64 # Let make expand exec_prefix.
65 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
66
67
68 dnl This stuff is hand-generated
69 dnl And heavily pinched from FLTK's autoconf stuff
70 dnl BEGIN Hugues' block
71
72 #dnl Use C++ as the test language.
73 # AC_LANG_CPLUSPLUS
74
75 # does not seem to work...
76 #AC_ARG_VAR ($CC," C compiler of choice")
77 #AC_ARG_VAR ($CXX, "C++ compiler of choice")
78
79 # location of FLTK library
80 AC_ARG_WITH(fltk-dir,
81 [ --with-fltk-dir=[DIR] location of the FLTK distribution directory to use.],
82 [fltk_dist=$withval],
83 [fltk_dist=""])
84
85 # Enable prof-based profiling support
86 AC_ARG_ENABLE(prof,
87 [ --enable-prof enable prof source profiling support [default=disable]],
88 [with_prof=$enableval],
89 [with_prof='no'])
90
91 # Enable gprof-based profiling support
92 AC_ARG_ENABLE(gprof,
93 [ --enable-gprof enable gprof source profiling support [default=disable]],
94 [with_gprof=$enableval],
95 [with_gprof='no'])
96
97 # Enable gcov-based profiling support
98 AC_ARG_ENABLE(gcov,
99 [ --enable-gcov enable gcov source profiling support [default=disable]],
100 [with_gcov=$enableval],
101 [with_gcov='no'])
102
103 with_profiling='no'
104 if test "$with_prof" = 'yes' || test "$with_gprof" = 'yes' || test "$with_gcov" = 'yes'
105 then
106 with_profiling='yes'
107 fi
108
109 # Enable use of double-buffering windows. Doesn't work everywhere yet
110 AC_ARG_ENABLE(dblbuf,
111 [ --enable-dblbuf enable use of double-buffered windows [default=disable]],
112 [with_dblbuf=$enableval],
113 [with_dblbuf='no'])
114
115 AC_ARG_ENABLE(registration,
116 [ --enable-registration enable the registration panel [default=disable]],
117 [with_registration=$withval],
118 [with_registration='no'])
119
120 # diverse optional libraries
121 AC_ARG_WITH(jpeg,
122 [ --without-jpeg disable native JPEG support [default=enable]],
123 [with_jpeg=$withval],
124 [with_jpeg='yes'])
125
126 AC_ARG_WITH(tiff,
127 [ --without-tiff disable native TIFF support [default=enable]],
128 [with_tiff=$withval],
129 [with_tiff='yes'])
130
131 AC_ARG_WITH(magick,
132 [ --without-magick disable ImageMagick support [default=enable]],
133 [with_magick=$withval],
134 [with_magick='yes'])
135
136 AC_ARG_WITH(pink,
137 [ --without-pink disable PINK support [default=enable]],
138 [with_pink=$withval],
139 [with_pink='yes'])
140
141 # the native chooser is MUCH nicer
142 AC_ARG_WITH(native-chooser,
143 [ --without-native-chooser disable experimental native chooser [default=enable]],
144 [with_native_chooser=$withval],
145 [with_native_chooser='yes'])
146
147 dnl# Clear debugging flags and only enable debugging if the user asks for
148 dnl# it.
149
150 DEBUGFLAG=""
151 PICFLAG=0
152 CFLAGS="${CFLAGS:=}"
153 CXXFLAGS="${CXXFLAGS:=}"
154
155 AC_ARG_ENABLE(debug,
156 [ --enable-debug turn on debugging [default=disable]], \
157 [with_debug=$enableval],
158 [with_debug='no'])
159
160 if test "$with_debug" != "no"
161 then
162 # [if eval "test x$enable_debug = xyes"; then DEBUGFLAG="-g " ; fi])
163 DEBUGFLAG="-g "
164 fi
165
166
167 # Enable support for image server
168 AC_ARG_WITH(server,
169 [ --without-server disable image server [default=with]],
170 [with_server=$withval],
171 [with_server='yes'])
172
173
174 # enable support for SYSV type shared memory (not shared library!)
175 AC_ARG_WITH(sysv-ipc,
176 [ --without-sysv-ipc disable Unix SYSV shared memory support [default=with]],
177 [with_sysv_ipc=$withval],
178 [with_sysv_ipc='yes'])
179
180 # enable support for POSIX type shared memory (not shared library!)
181 AC_ARG_WITH(posix-ipc,
182 [ --without-posix-ipc disable Unix POSIX shared memory support [default=with]],
183 [with_posix_ipc=$withval],
184 [with_posix_ipc='yes'])
185
186
187 # if server is disabled, so is SYSV and POSIX
188 if test "$with_server" != "yes" ; then
189 with_sysv_ipc="no"
190 with_posix_ipc="no"
191 fi
192
193
194 dnl# save the user-definable options, so that the user can check at the end
195 dnl# if they worked!
196 save_prof=$with_prof
197 save_gprof=$with_gprof
198 save_gcov=$with_gcov
199 save_jpeg=$with_jpeg
200 save_tiff=$with_tiff
201 save_magick=$with_magick
202 save_pink=$with_pink
203 save_native_chooser=$with_native_chooser
204 save_debug=$with_debug
205 save_server=$with_server
206 save_sysv_ipc=$with_sysv_ipc
207 save_posix_ipc=$with_posix_ipc
208 save_dblbuf=$with_dblbuf
209 save_registration=$with_registration
210
211 # Evaluate shell variable equivalents to Makefile directory variables
212 eval "eval BIN_DIR=$bindir"
213 eval "eval DATA_DIR=$datadir"
214 eval "eval INCLUDE_DIR=$includedir"
215 eval "eval LIB_DIR=$libdir"
216
217 srcdirfull=`cd $srcdir && pwd`
218
219 # so that we also look where the software will be installed (the `local' /usr/local...)
220 LDFLAGS="$LDFLAGS -L$LIB_DIR"
221 CPPFLAGS="$CPPFLAGS -I. "
222
223
224 # by default we build for Unix and we need X.
225 have_x="yes"
226 have_carbon="no" # Carbon environment
227 have_wingdi="no" # Windows GDI
228 exec_extension="" # Unix executable are not known by their extention
229 # use the host type
230 LIBXTRA=""
231
232 # trying for a `standard' echo
233 ECHO=echo
234 # other standard commands
235 CP=/bin/cp
236 MV=/bin/mv
237
238 #needed to work around a bug in mingw
239 START=""
240
241
242 dnl Check for presence of FLTK helper application
243 AC_CHECK_PROG(have_fltk_config, fltk-config, "yes", "no",${fltk_dist}:$PATH)
244 if test "$have_fltk_config" != "yes"
245 then
246 echo "*** Fltk-config was not found!"
247 echo "*** You need to upgrade FLTK to version 1.1.x, exiting"
248 exit 1
249 fi
250
251
252 dnl Find location of FLTK libs & include files, etc
253 if test "$fltk_dist" != ""
254 then
255 dnl User gave location of library to use
256 my_fltk_config=${fltk_dist}/fltk-config
257 my_fltk_version=`${fltk_dist}/fltk-config --version`
258 fltk_config_name=`$my_fltk_config --libs` # that's pre-installation, no good
259 fltk_cfg_nm=`echo $fltk_config_name | sed 's%.*/lib\(fltk.*\).a%\1%'` # short name still OK
260 fltk_config_name=${fltk_dist}/lib/lib${fltk_cfg_nm}.a
261 fltk_images_name=${fltk_dist}/lib/lib${fltk_cfg_nm}_images.a
262 dnl Extra include flags
263 fltk_include_flags=`$my_fltk_config --use-images --cxxflags`
264 LDFLAGS="-L${fltk_dist}/lib $LDFLAGS"
265 CPPFLAGS="-I${fltk_dist} $fltk_include_flags $CPPFLAGS"
266 FLUID=${START}${fltk_dist}/fluid/fluid
267 dnl no check for library, we trust what the user gave us
268 FLTKLIB=" $fltk_images_name $fltk_config_name"
269 fltklib=fltk
270 # one more hack for the road... This is needed to get the `framework` information on macos
271 LDFLAGS="$LDFLAGS `$my_fltk_config --ldflags`"
272 else
273 dnl Must find out where FLTK is, if present
274 dnl Since we know that we have fltk-config, use it for flags...
275 my_fltk_config=fltk-config
276 my_fltk_version=`fltk-config --version`
277 fltk_config_name=`$my_fltk_config --libs` # long path
278 fltk_cfg_nm=`echo $fltk_config_name | sed 's%.*/lib\(fltk.*\).a%\1%'` # short name
279 fltk_images_name=`$my_fltk_config --libs | sed 's/\(.*fltk\)\(\.a$\)/\1_images.a/'`
280 dnl extra include flags
281 fltk_include_flags=`$my_fltk_config --use-images --cxxflags`
282 FLUID=${START}fluid
283 dnl Include extra library (FLTK-1.1.x) for handling various image formats.
284 LDFLAGS="$LDFLAGS `$my_fltk_config --use-images --ldstaticflags`"
285 Cppflags="$CPPFLAGS $fltk_include_flags"
286 FLTKLIB="`$my_fltk_config --use-images --ldstaticflags`"
287 fltklib=$fltk_cfg_name
288 fi
289
290 dnl Are we using X?
291 fltk_x11_ldflags=`$my_fltk_config --ldflags | grep '\-lX11'`
292 if test "$fltk_x11_ldflags" != "" ; then
293 fltk_uses_x11=yes
294 else
295 fltk_uses_x11=no
296 fi
297
298
299 FLTK_CONFIG=$my_fltk_config
300 AC_SUBST(FLTK_CONFIG)
301
302
303 case $target in
304 *linux*)
305 # our favourite platform :-)
306 CPPFLAGS="-DLinux $CPPFLAGS"
307 ;;
308
309 *dec-osf*)
310 # Compaq Tru64, aka DEC Unix, aka OSF1
311 CPPFLAGS="-DOSF1 $CPPFLAGS"
312 ;;
313
314 *sun-solaris2*)
315 # Sun Solaris. Broken X headers are no fun
316 CPPFLAGS="-DSolaris -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ $CPPFLAGS"
317 # Sun POSIX IPC does not allow paths under /tmp
318 AC_DEFINE(POSIX_IPC_PREFIX, "/")
319 # Solaris /usr/bin/echo does not understand `-n'
320 ECHO=/usr/ucb/echo
321 ;;
322
323 *pc-mingw32*)
324 # MINGW32. Nothing special, but no X!
325 have_x="no"
326 have_wingdi="yes"
327 exec_extension=".exe" # Windows executable are `.exe' files.
328 CPPFLAGS="$CPPFLAGS -O2" # my compiler doesn't produce correct executable unless optimizing!
329 WINTHREAD="pthreadGC" # use the pthread-win32 without structured exceptions.
330 START="/bin/start " # to be able non-mingw GUI applications like fluid, NOTE: space is important
331 LDFLAGS="$LDFLAGS -mwindows -lole32 -luuid -lcomctl32 -lwsock32 -lsupc++"
332 ;;
333
334 *i686-pc-cygwin)
335 # MINGW32. Nothing special, but no X!
336 have_x="no"
337 have_wingdi="yes"
338 exec_extension=".exe" # Windows executable are `.exe' files.
339 CPPFLAGS="$CPPFLAGS -O2 -mwin32" # my compiler doesn't produce correct executable unless optimizing!
340 WINTHREAD="pthread"
341 ;;
342
343 *darwin*)
344 # Mac OS/X
345 echo "*** Oooh, MacOS/X"
346 if test "$fltk_uses_x11" = "no" ; then
347 echo "*** Using Carbon too"
348 have_x="no" # use Carbon instead
349 have_carbon="yes"
350 CPPFLAGS="-DMACOSX_CARBON $CPPFLAGS"
351 else
352 echo "*** Still using X11"
353 fi
354 # removed dependency on FINK (/sw)
355 CPPFLAGS="-DDARWIN -O2 $CPPFLAGS"
356 LDFLAGS="$LDFLAGS"
357 if test "$with_magick" = "yes" ; then
358 echo "Silencing magick warnings at link time"
359 LDFLAGS="$LDFLAGS -Xlinker -multiply_defined -Xlinker suppress"
360 echo "*NOTE: You might see a lot of warnings at link time if your version"
361 echo " of ImageMagick embeds symbols from various other standard libraries"
362 echo " such as libjpeg or libz. This is pretty harmless."
363 fi
364 CP=/Developer/Tools/CpMac
365 MV=/Developer/Tools/MvMac
366 ;;
367
368
369 *)
370 echo "*** A platform I haven't tried! Some definitions might be lacking"
371 echo "*** Please contribute your changes if any required."
372 echo "*** mailto: [email protected]"
373 ;;
374 esac
375
376 AC_SUBST(CP)
377 AC_SUBST(MV)
378 EEXT=$exec_extension
379 AC_SUBST(EEXT)
380
381 dnl Checks for programs.
382 AC_PROG_CXX
383 AC_PROG_CC
384 AC_PROG_INSTALL
385 AC_PROG_RANLIB
386
387
388 if test "$RANLIB" != ":"; then
389 LIBCOMMAND="ar cr"
390 else
391 LIBCOMMAND="ar crs"
392 fi
393
394 AC_PROG_MAKE_SET
395
396 dnl Find out compiler quirks
397 dnl http://research.cys.de/autoconf-archive
398 AC_CXX_MEMBER_TEMPLATES
399 AC_CXX_TEMPLATE_KEYWORD_QUALIFIER
400 AC_CXX_TEMPLATES_AS_TEMPLATE_ARGUMENTS
401 AC_CXX_DEFAULT_TEMPLATE_PARAMETERS
402 AC_CXX_STD_CHAR_TRAITS
403
404 dnl home-brewed compiler error detection
405 AC_CXX_TEMPLATE_CAST_ARRAY
406
407
408 dnl Checks for header files.
409 AC_HEADER_DIRENT
410
411
412 AC_CHECK_HEADER(sys/select.h)
413 AC_CHECK_HEADER(winsock.h)
414
415 dnl Check for socken_t in accept
416 AC_ACCEPT_USES_SOCKLEN_T
417
418 AC_CHECK_FUNC(scandir,
419 if test "$uname" = "SunOS"; then
420 echo Not using Solaris scandir BSD emulation function.
421 else
422 AC_DEFINE(HAVE_SCANDIR)
423 fi)
424
425 AC_CHECK_FUNC(vsnprintf,
426 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
427 echo Not using built-in vsnprintf function because you are running HP-UX 10.20.
428 else
429 AC_DEFINE(HAVE_VSNPRINTF)
430 fi)
431
432 AC_CHECK_FUNC(snprintf,
433 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
434 echo Not using built-in snprintf function because you are running HP-UX 10.20.
435 else
436 AC_DEFINE(HAVE_SNPRINTF)
437 fi)
438
439 AC_CHECK_FUNCS(vsprintf)
440
441 dnl # checks for a reasonable wait function that takes sub-second argument
442 AC_CHECK_FUNCS(usleep nanosleep)
443
444 if test "$have_x" = "yes" ; then
445 dnl some headers might be poorly defined, in particular regarding X11 headers and Solaris (things have improved lately)
446 # Check for X
447 AC_PATH_XTRA
448 echo "Ignoring libraries \"$X_PRE_LIBS\" requested by configure."
449 dnl# LIBS="$LIBS$X_LIBS$X_PRE_LIBS"
450 if test "$with_magick" != "no" ; then
451 # this seems to be sufficient somehow
452 # as Magick will include the right libraries and flags already
453 XLIBS="-lX11 -lXext -lXpm"
454 else
455 # I'm not sure how reliable this is...
456 XLIBS="$X_LIBS -lX11 -lXext -lXpm"
457 fi
458 # LIBS="$LIBS$X_LIBS"
459 CFLAGS="$CFLAGS $X_CFLAGS"
460 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
461 AC_SUBST(XLIBS)
462 # advertise we are using X, as under some platform we may choose to use X11 or not
463 AC_DEFINE(FLTK_USES_X)
464 # check for some incorrect X11 headers
465 AC_CXX_X11_HEADER_PERMISSIVE
466 # check for Xinerama
467 AC_X11_HAS_XINERAMA
468 XLIBS="$XLIBS $XINERAMA"
469 fi
470
471 MAKEDEPEND="\$(CXX) -M"
472
473 dnl# add warnings to compiler switches:
474 dnl# do this last so messing with switches does not break tests
475 if test -n "$GXX"; then
476 GCC_ACCEPTS_INCLUDE_DIR # this will add -I$INCLUDE_DIR if the compiler does not complain about it.
477 GCC_ACCEPTS_DEPRECATED_HEADERS # this will test if -Wno-deprecated is necessary
478
479 CFLAGS="-Wall $CFLAGS"
480 # GNU C++ is sometimes missing bits of the STL
481 AC_CXX_STRSTREAM
482 # other bits for g++
483 CXXFLAGS="-Wall -Wno-return-type -Wno-unknown-pragmas $CXXFLAGS"
484 if test -z "$DEBUGFLAG"; then
485 CFLAGS="-O2 $CFLAGS"
486 CXXFLAGS="-O2 $CXXFLAGS"
487 else
488 CFLAGS="$DEBUGFLAG $CFLAGS"
489 CXXFLAGS="$DEBUGFLAG $CXXFLAGS"
490 fi
491 else
492 case `(uname) 2>/dev/null` in
493 IRIX*)
494 # Running some flavor of IRIX; see which version and
495 # set things up according...
496 if test "$uversion" -ge 62; then
497 # We are running IRIX 6.2 or higher; uncomment the following
498 # lines if you don't have IDO 7.2 or higher:
499 #
500 # CXX="CC -n32"
501 # CC="cc -n32"
502 # LD="ld -n32"
503 # MAKEDEPEND="CC -M"
504
505 echo "FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI -n32"
506 # -woff 3322 is necessary due to errors in Xlib headers on IRIX
507 CFLAGS="-fullwarn $CFLAGS"
508 CXXFLAGS="-fullwarn -woff 1685,3322 $CXXFLAGS"
509 else
510 CXXFLAGS="+w +pp $CXXFLAGS"
511 fi
512 if test -z "$DEBUGFLAG"; then
513 CFLAGS="-O2 $CFLAGS"
514 CXXFLAGS="-O2 $CXXFLAGS"
515 fi
516 ;;
517 HP-UX*)
518 # Running HP-UX; these options should work for the HP compilers.
519 if test -z "$DEBUGFLAG"; then
520 CFLAGS="+O2 $CFLAGS"
521 CXXFLAGS="+O2 +W336,501,736,740,749,829 $CXXFLAGS"
522 fi
523 ;;
524 SunOS*)
525 # Solaris
526 if test -z "$DEBUGFLAG"; then
527 CFLAGS="-O"
528 CXXFLAGS="-O"
529 fi
530 ;;
531 OSF*)
532 # DEC Unix (Compaq silly tru64)
533 if test -z "$DEBUGFLAG"; then
534 CFLAGS="-O2 -Olimit 2000 $CFLAGS"
535 CXXFLAGS="-ttimestamp -O2 -Olimit 2000 $CXXFLAGS"
536 else
537 CFLAGS="$DEBUGFLAG $CFLAGS"
538 CXXFLAGS="$DEBUGFLAG $CXXFLAGS"
539 fi
540
541 CFLAGS="$CFLAGS -I${prefix}/include"
542 CXXFLAGS="$CXXFLAGS -I${prefix}/include"
543
544 LIBCOMMAND="/usr/bin/ar cr" # make sure we use the system's archiver. GNU's not compatible with cxx
545 # we need the IOStream library, and we enable ALL the compiler messages
546 CXXFLAGS="-w1 -D__USE_STD_IOSTREAM $CXXFLAGS"
547 # the CXX compiler requires this when using automated template
548 # instantiation.
549 LIBXTRA="cxx_repository/*.o"
550 ;;
551
552 Linux*)
553 # test for the Intel compiler
554 if test "$CXX" = "icc" ; then
555 if test -z "$DEBUGFLAG"; then
556 CFLAGS="-O2 -w1"
557 CXXFLAGS="-O2"
558 fi
559 else
560 echo "+++ Unknown compiler, using safe optimization flags"
561 if test -z "$DEBUGFLAG"; then
562 CFLAGS="-O"
563 CXXFLAGS="-O"
564 fi
565 fi
566 ;;
567
568 Darwin*)
569 # Mac OS/X, where cc is really gcc
570 # assume presence of fink
571 ;;
572
573 *)
574 # Running some other operating system; inform the user they
575 # should contribute the necessary options to [email protected]...
576 echo "+++ Untried platform"
577 echo "+++ Building Imview with default compiler flags; contact"
578 echo "+++ hugues.talbot at gmail dot com with uname and compiler options needed"
579 echo "+++ for your platform, or set the CFLAGS and CXXFLAGS options"
580 echo "+++ before running configure."
581 ;;
582 esac
583 fi
584
585 dnl extra stuff needed by some compilers (such as CXX under DEC Unix, for automated
586 dnl template instanciation, that occurs using the STL)
587 AC_SUBST(LIBXTRA)
588
589
590 #
591 # Find math library
592 #
593 MATHLIB=''
594 AC_CHECK_LIB(m,sqrt,MATHLIB=" -lm",,)
595 LIBS="$LIBS $MATHLIB" # -lm is needed almost everywhere
596 AC_SUBST(MATHLIB)
597
598 dnl These library are problematic?
599 dnl Checks for libraries.
600 dnl We do not use OpenGL, but sometimes fltk may require it.
601 #AC_CHECK_LIB(GL, main)
602
603
604 dnl Checking for correct version
605 dnl
606
607 $ECHO -n "Checking for fltk version: <${my_fltk_version}> "
608 majorver=`(${FLUID} -o /tmp/toto -c /dev/null ; grep 'version' /tmp/toto | awk '{printf("%.0f\n", $NF)}' )`
609 minorver=`( grep 'version' /tmp/toto | awk '{printf("%0.f\n", ($NF-int($NF)) * 100)}' )`
610 patchver=`( grep 'version' /tmp/toto | awk '{printf("%0.f\n", 100*((($NF-int($NF))*100)-int(($NF-int($NF))*100)))}' )`
611 rm /tmp/toto # clean up
612 if test $majorver -eq 1 -a $minorver -ge 1
613 then
614 echo "... OK"
615 else
616 echo ""
617 echo "*** Please select FLTK version 1.1.x"
618 echo "*** NOTE that FLTK 2.0 or greater is not supported yet..."
619 echo "*** FLTK 1.0.x is only supported by imview-1.0.x or lesser"
620 exit 1
621 fi
622
623 fltk_alt_suff=`echo $CXX | sed 's%/%_%g'`
624 echo "Alternative libfltk name: " libfltk_${fltk_alt_suff}.a
625 echo "Configured libfltk name: " $fltk_config_name
626
627 AC_SUBST(FLUID)
628 AC_SUBST(FLTKLIB)
629
630 dnl add extra flags for linking
631 xtra_cflags=`$my_fltk_config --cflags`
632 xtra_ldflags=`$my_fltk_config --ldflags`
633 if test "$have_wingdi" = 'yes' ; then
634 echo "Building for the Windows GDI"
635 CPPFLAGS="$CPPFLAGS ${xtra_cflags}"
636 XLIBS="$XLIBS ${xtra_ldflags}"
637 fi
638
639 if test "$have_macos" = 'yes' ; then
640 echo "Building for MacOS Carbon environment"
641 XLIBS="$XLIBS -framework Carbon -framework ApplicationServices"
642 fi
643
644
645 dnl See if we need the True-Type renderer
646 need_Xft=`$my_fltk_config --ldflags | grep Xft`
647 echo -n "Testing if $fltklib needs True Type rendering"
648 if test "$need_Xft" != ""
649 then
650 echo "... Yes"
651 FLTKEXTRA="$FLTKEXTRA -lXft"
652 else
653 echo "... No"
654 fi
655
656 AC_SUBST(FLTKEXTRA)
657
658 dnl PThreads. Very very very useful!
659 dnl Without them, no server!
660 THREADLIB=''
661 if test "$with_server" != 'no'
662 then
663 # Unix
664 if test "$have_x" != "no" -o "$have_carbon" != "no" ; then
665 echo "Testing for Unix threads"
666 echo "Standard Pthreads:"
667 AC_CHECK_LIB(pthread,pthread_attr_init,
668 [AC_DEFINE(HAVE_PTHREADS, 1,Define if you have Posix thread methods.)
669 THREADLIB="-lpthread"
670 THREADDEF="-D_REENTRANT"],
671 echo "Old DEC threads:"
672 AC_CHECK_LIB(pthreads, pthread_attr_create,
673 [AC_DEFINE(HAVE_DECTHREADS, 1,Define if you have DEC unix thread methods, very close to pthreads.)
674 AC_DEFINE(HAVE_PTHREADS, 1, We fake the Pthreads.)
675 THREADLIB="-lpthreads"],
676 with_server="no"; echo "*** The server would not be able to run",
677 ),
678 )
679 else # for Windows we use a compatibility library, slightly different name
680 echo "Testing for windows compatible pthreads"
681 AC_CHECK_LIB(${WINTHREAD},pthread_attr_init,
682 [AC_DEFINE(HAVE_PTHREADS, 1,Define if you have Posix thread methods.)
683 THREADLIB="-l${WINTHREAD}"
684 THREADDEF=""], with_server="no"; echo "*** The server would not be able to run",)
685 fi
686 # LIBS="$THREADLIB $LIBS"
687 CPPFLAGS="$THREADDEF $CPPFLAGS"
688 fi
689 AC_SUBST(THREADLIB)
690
691 dnl Check for Unix SYSV shared memory and semaphores IPC.
692 if test "$with_sysv_ipc" != "no"
693 then
694 AC_CHECK_FUNC(ftok,
695 AC_DEFINE(HAVE_SYSV_IPC, 1,Define if you have Unix SYSV IPC.),
696 with_sysv_ipc='no')
697 CPPFLAGS="$SYSVDEF $CPPFLAGS"
698 fi
699
700 dnl Check for POSIX IPC
701 if test "$with_posix_ipc" != "no"
702 then
703 POSIX_IPC_LIB=''
704 AC_CHECK_LIB(rt,shm_open,
705 [SAVELIBS=$LIBS
706 LIBS="$LIBS -lrt"
707 $ECHO -n "checking if the POSIX semaphores actually work... "
708 AC_TRY_RUN([
709 #include <stdio.h>
710 #include <errno.h>
711 #include <semaphore.h>
712 #include <fcntl.h>
713 #include <unistd.h>
714 #include <stdlib.h>
715 #ifdef Solaris
716 #define TESTPATH "/px_ipc_test"
717 #else
718 #define TESTPATH "/tmp/px_ipc_test"
719 #endif
720 int main()
721 {
722 sem_t *sem;
723 int err;
724 fputs("testpath = " TESTPATH, stderr);
725 sem=sem_open(TESTPATH, O_RDWR | O_CREAT, 0600,0);
726 if (sem == SEM_FAILED) {
727 perror("semtest, sem_open failed:");
728 exit(1);
729 }
730 if ((err = sem_close(sem)) != 0) {
731 perror("semtest, sem_close failed:");
732 return(err);
733 }
734 if ((err = sem_unlink(TESTPATH)) != 0) {
735 perror("semtest, sem_unlink failed:");
736 }
737 return(err);
738 }
739 ],
740 [echo "yes"
741 AC_DEFINE(HAVE_POSIX_IPC) POSIX_IPC_LIB="-lrt"],
742 [echo "no"
743 POSIX_IPC_LIB=""
744 with_posix_ipc=no],
745 [echo "no (cross-compiling)"
746 POSIX_IPC_LIB=""
747 with_posix_ipc=no])
748 LIBS=$SAVELIBS], with_posix_ipc=no)
749 AC_SUBST(POSIX_IPC_LIB)
750 fi
751
752 dnl ImageMagick is very useful, but optional
753 dnl Moreover the API keeps changing and that's really annoying.
754
755 if test "$with_magick" != "no"
756 then
757 MAGICKLIB=''
758 # check if we can find the configuration utility
759 AC_CHECK_PROG(have_magick_config, Magick-config, "yes", "no")
760 if test "$have_magick_config" != "no"
761 then
762 # verify that Magick associated libraries are not incompatible
763 if test "$have_x" != "yes" -a "`Magick-config --libs | grep X11`" != "" ; then
764 # conflict
765 echo "Magick library conflicts with requested absence of X11 library usage"
766 with_magick=no
767 else
768 # this might turn really ugly
769 CPPFLAGS="$CPPFLAGS "`Magick-config --cppflags`
770 LDFLAGS="$LDFLAGS "`Magick-config --ldflags`
771 IMLIBS="$IMLIBS "`Magick-config --libs`
772 # we are not finished: we must check we have the correct version
773 # Try first with libMagick.so .a .dll or .dylib
774 AC_CHECK_LIB(Magick, DispatchImage,
775 AC_DEFINE(HAVE_MAGICK) MAGICKLIB=" -lMagick",
776 MAGICKLIB="",
777 $IMLIBS)
778 if test "$MAGICKLIB" != " -lMagick" ; then
779 # then try with newer MagickCore.blabla
780 echo "Magick lib not found, trying with MagickCore"
781 AC_CHECK_LIB(MagickCore, DispatchImage,
782 AC_DEFINE(HAVE_MAGICK) MAGICKLIB=" -lMagickCore",
783 MAGICKLIB="",
784 $IMLIBS)
785 if test "$MAGICKLIB" != " -lMagickCore" ; then
786 echo "Magick-config found, but library does not appear compatible."
787 echo "Please report to developers : [email protected]"
788 echo "Magic-config version is " `Magick-config --version`
789 with_magick="no"
790 fi
791 fi
792
793 if test "$with_magic" != "no" ; then
794 # check if ImageMagick uses the new exception structure
795 AC_MAGICK_REASON
796 # check if ImageMagick uses InitMagick now
797 AC_MAGICK_INIT
798 # check if some extra arguments are required
799 AC_MAGICK_NEEDS_MORE_EXCEPTION
800 fi
801 fi
802 else
803 echo "*** Magick-config not found in path!"
804 with_magick="no"
805 fi
806 fi
807
808
809 # ZLIB is not an option, required by some libraries
810 ZLIB=""
811 AC_CHECK_LIB(z, gzopen, AC_DEFINE(HAVE_LIBZ) ZLIB=" -lz")
812 if test "$ZLIB" = ""
813 then
814 ## second chance
815 AC_CHECK_LIB(fltk_z, gzopen, AC_DEFINE(HAVE_LIBZ) ZLIB=" -lfltk_z")
816 fi
817
818 dnl JPEG Library, also optional, maybe needed by Magick
819 if test "$with_jpeg" != "no"
820 then
821 JPEGLIB=''
822 AC_CHECK_LIB(jpeg, jpeg_write_raw_data, AC_DEFINE(HAVE_JPEG) JPEGLIB=" -ljpeg", with_jpeg=no, ${ZLIB})
823 # second chance
824 if test "$JPEGLIB" = ""
825 then
826 # try if fltk_jpeg exists
827 AC_CHECK_LIB(fltk_jpeg, jpeg_write_raw_data, AC_DEFINE(HAVE_JPEG) JPEGLIB=" -lfltk_jpeg", with_jpeg=no, ${ZLIB})
828 fi
829 AC_SUBST(JPEGLIB)
830
831 fi
832
833 dnl TIFF library, you know the deal by now
834 if test "$with_tiff" != "no"
835 then
836 TIFFLIB=''
837 AC_CHECK_LIB(tiff, TIFFClose, AC_DEFINE(HAVE_TIFF) TIFFLIB=" -ltiff", with_tiff=no, ${JPEGLIB} ${ZLIB})
838 AC_SUBST(TIFFLIB)
839 fi
840
841 dnl PINK support, requires no library, but the declaration of a Macro
842 if test "$with_pink" != "no"
843 then
844 AC_DEFINE(HAVE_PINK_PGM_EXTENSIONS)
845 fi
846
847
848
849 # check for libpng as well, this is not a choice at this point,
850 # it may be required by libfltk_image.a
851 PNGLIB=''
852 if test "$ZLIB" != ""
853 then
854 AC_CHECK_LIB(png, png_read_rows, AC_DEFINE(HAVE_PNG) PNGLIB=" -lpng", ,${ZLIB})
855 if test "$PNGLIB" = ""
856 then
857 ## second chance
858 AC_CHECK_LIB(flt_png, png_read_rows, AC_DEFINE(HAVE_PNG) PNGLIB=" -lfltk_png", ,${ZLIB})
859 fi
860 AC_SUBST(PNGLIB)
861 fi
862
863 dnl This is really not fun at all
864 dnl Native chooser support
865
866 AC_LANG_PUSH(C++)
867
868 if test "$with_native_chooser" != "no"
869 then
870 dnl try if the extension has been put in the imview directory
871 if test -d "${srcdirfull}/extensions/Fl_Native_File_Chooser"
872 then
873 SAVECPP=$CPPFLAGS
874 SAVECXX=$CXXFLAGS
875 CPPFLAGS="$CPPFLAGS -I${srcdirfull}/extensions/Fl_Native_File_Chooser"
876 CXXFLAGS="$CXXFLAGS -I${srcdirfull}/extensions/Fl_Native_File_Chooser"
877 AC_CHECK_HEADER([FL/Fl_Native_File_Chooser.H], [AC_DEFINE(HAVE_NATIVE_CHOOSER)], [
878 with_native_chooser='no'
879 CXXFLAGS=$SAVECXX
880 CPPFLAGS=$SAVECPP
881 ], [
882 #include <stdio.h>
883 #include <FL/Fl.H>
884 ])
885 else
886 dnl try if the extention has been installed with fltk
887 AC_CHECK_HEADERS(FL/Fl_Native_File_Chooser.H, AC_DEFINE(HAVE_NATIVE_CHOOSER),[
888 with_native_chooser='no'
889 CXXFLAGS=$SAVECXX
890 CPPFLAGS=$SAVECPP
891 ], [
892 #include <stdio.h>
893 #include <FL/Fl.H>
894 ])
895 fi
896 fi
897
898 # stop using C++
899 AC_LANG_POP()
900
901 dnl Create the `image lib' variable
902 IMLIBS="$IMLIBS $TIFFLIB $JPEGLIB $PNGLIB $ZLIB"
903 AC_SUBST(IMLIBS)
904
905
906 dnl Installation stuff
907 eval PrefPath="${DATA_DIR}/Imview/"
908 AC_DEFINE_UNQUOTED(PrefPath,"$PrefPath",Define directory where preference and .lut files will live.)
909
910 # optional
911 #dnl Replace `main' with a function in -lefence:
912 #AC_CHECK_LIB(efence, main)
913 dnl Replace `main' with a function in -lgdi32:
914 #AC_CHECK_LIB(gdi32, main)
915 dnl Replace `main' with a function in -lgen:
916 #AC_CHECK_LIB(gen, main)
917 dnl Replace `main' with a function in -lnsl:
918 #AC_CHECK_LIB(nsl, main)
919 dnl Replace `main' with a function in -lpthread32:
920 #AC_CHECK_LIB(pthread32, main)
921 dnl Replace `main' with a function in -lsocket:
922 #AC_CHECK_LIB(socket, main)
923 dnl Replace `main' with a function in -luser32:
924 #AC_CHECK_LIB(user32, main)
925 dnl Replace `main' with a function in -lwsock32:
926 #AC_CHECK_LIB(wsock32, main)
927
928
929 # Add '-p' if prof source profiling support enabled
930 if test "$with_prof" = 'yes'
931 then
932 CFLAGS="-p $CFLAGS"
933 LDFLAGS="-p $LDFLAGS"
934 fi
935
936 # Add '-pg' if gprof source profiling support enabled
937 if test "$with_gprof" = 'yes'
938 then
939 CFLAGS="-pg $CFLAGS"
940 LDFLAGS="-pg $LDFLAGS"
941 fi
942
943 # Add '-ftest-coverage -fprofile-arcs' if gcov source profiling support enabled
944 # This is a gcc-specific feature
945 if test "$with_gcov" = 'yes'
946 then
947 CFLAGS="-ftest-coverage -fprofile-arcs $CFLAGS"
948 LDFLAGS="-ftest-coverage -fprofile-arcs $LDFLAGS"
949 fi
950
951 # use double-buffering?
952 if test "$with_dblbuf" = 'yes'
953 then
954 AC_DEFINE(IMVIEW_USES_DBLBUF)
955 fi
956
957 # use registration panel?
958 if test "$with_registration" = 'yes'
959 then
960 AC_DEFINE(IMVIEW_USES_REGISTRATION)
961 fi
962
963 #dnl For these we go back to using the C language, as c++ 2.95 has become way too picky
964 #dnl
965 #AC_LANG_C
966
967 #AC_C_INLINE this is creating more problem than it is solving
968 AC_HEADER_STDC
969 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/time.h unistd.h)
970
971 dnl Checks for typedefs, structures, and compiler characteristics.
972 AC_C_CONST
973 AC_TYPE_SIZE_T
974 AC_HEADER_TIME
975 AC_STRUCT_TM
976
977 dnl Checks for library functions.
978 #AC_FUNC_SETVBUF_REVERSED
979 AC_TYPE_SIGNAL
980 AC_FUNC_VPRINTF
981 AC_CHECK_FUNCS(select socket)
982 AC_CHECK_FUNCS(getcwd strdup strerror strstr strtol uname)
983
984 dnl some substitutions
985 AC_SUBST(LIBCOMMAND)
986 AC_SUBST(MAKEDEPEND)
987
988
989 AC_OUTPUT(fluid/Makefile server/Makefile io/Makefile extensions/Makefile Makefile imview.list, echo timestamp > stamp-h)
990
991
992 echo ""
993
994 echo "Imview is configured as follows. Please verify that this"
995 echo "configuration matches your expectations."
996 echo ""
997 echo "Host system type : $host"
998 echo "Target system : $target"
999 echo ""
1000 echo "Option Configure option Configured value"
1001 echo "----------------------------------------------------------"
1002 echo "System --with-server=$save_server $with_server"
1003 echo " --with-sysv-ipc=$save_sysv_ipc $with_sysv_ipc"
1004 echo " --with-posix-ipc=$save_posix_ipc $with_posix_ipc"
1005 echo "----------------------------------------------------------"
1006 echo "Compiling options --with-prof=$save_prof $with_prof"
1007 echo " --with-gprof=$save_gprof $with_gprof"
1008 echo " --with-gcov=$save_gcov $with_gcov"
1009 echo " --enable-debug=$save_debug $with_debug"
1010 echo "------------------------------------------------------------"
1011 echo "JPEG --with-jpeg=$save_jpeg $with_jpeg"
1012 echo "TIFF --with-tiff=$save_tiff $with_tiff"
1013 echo "MAGICK --with-magick=$save_magick $with_magick"
1014 echo "PINK --with-pink=$save_pink $with_pink"
1015 echo "Native Chooser --with-native-chooser=$save_native_chooser $with_native_chooser"
1016 echo "Registration --enable-registration=$save_registration $with_registration"
1017
1018 echo ""
1019
1020 if test "$save_server" != "$with_server" ; then
1021 echo "** Warning: Imview cannot be configured with the default server option"
1022 fi
1023
1024 if test "$save_sysv_ipc" != "$with_sysv_ipc" ; then
1025 echo "** Warning: Imview cannot be configured with the default SYSV IPC option"
1026 fi
1027
1028 if test "$save_posix_ipc" != "$with_posix_ipc" ; then
1029 echo "** Warning: Imview cannot be configured with the default POSIX IPC option"
1030 if test "$with_sysv_ipc" = "yes" ; then
1031 echo "** Warning: But you will be fine with the SYSV IPC, no worries."
1032 echo ""
1033 fi
1034 fi
1035
1036 if test "$save_jpeg" != "$with_jpeg" ; then
1037 echo "** Warning: Imview cannot be configured with the desired JPEG option"
1038 fi
1039
1040 if test "$save_tiff" != "$with_tiff" ; then
1041 echo "** Warning: Imview cannot be configured with the desired TIFF option"
1042 fi
1043
1044 if test "$save_magick" != "$with_magick" ; then
1045 echo "** Warning: Imview cannot be configured with the desired Magick option"
1046 fi
1047
1048 if test "$ac_cv_cxx_standard_char_traits" = "no" \
1049 -o "$ac_cv_cxx_default_template_parameters" = "no" \
1050 -o "$ac_cv_cxx_templates_as_template_arguments" = "no" ; then
1051 echo "** Warning: Your C++ compiler is not ISO compliant enough,"
1052 echo "** Warning: this configuration is unsupported."
1053 echo "** Warning: See prerequisites in INSTALL file"
1054 fi
1055
1056 if test "$have_x" = "yes"
1057 then
1058 echo ""
1059 echo "X configuration"
1060 echo " X_CFLAGS = $X_CFLAGS"
1061 echo " X_PRE_LIBS = $X_PRE_LIBS"
1062 echo " X_LIBS = $X_LIBS"
1063 echo " X_EXTRA_LIBS = $X_EXTRA_LIBS"
1064 fi
1065
1066 if test "$have_wingdi" = 'yes'
1067 then
1068 echo ""
1069 echo "GDI configuration"
1070 echo " "
1071 fi
1072
1073 if test "$have_carbon" = 'yes'
1074 then
1075 echo ""
1076 echo "MacOS Carbon configuration"
1077 echo " "
1078 fi
1079
1080 echo ""
1081 echo "Final Compilation Flags:"
1082 echo " CC = $CC"
1083 echo " CXX = $CXX"
1084 echo " CFLAGS = $CFLAGS"
1085 echo " CXXFLAGS = $CXXFLAGS"
1086 echo " CPPFLAGS = $CPPFLAGS"
1087 echo " LDFLAGS = $LDFLAGS"
1088 echo " LIBRARIES = $FLTKLIB $FLTKEXTRA $IMLIBS $XLIBS $X_EXTRA_LIBS $THREADLIB $POSIX_IPC_LIB $MATHLIB"
1089 #echo " LIBS = $LIBS"
1090
1091 if test "$ac_cv_cxx_needs_permissive" = 'yes' ; then
1092 echo ""
1093 echo "**** Warning ***"
1094 echo "** Your X11 headers are not compatible with ANSI C++"
1095 echo "** Imview should still compile, but you are going to see "
1096 echo "** a **LOT** of compilation warnings. The best way to"
1097 echo "** avoid this problem is to upgrade your X11 headers to"
1098 echo "** a more recent version, or to downgrade your compiler"
1099 echo "** to a more lenient one. If your X11 headers are under"
1100 echo "** /usr/include/X11, you can also try to upgrade your gcc"
1101 echo "** to version 2.95.3 or later"
1102 echo "****************"
1103 fi
1104
1105 echo ""
1106
1107
1108 dnl The End