]> git.mxchange.org Git - flightgear.git/blob - acinclude.m4
Variant of innosetup config file for developer snapshot release. Uses separate
[flightgear.git] / acinclude.m4
1 dnl
2 dnl originally from ncftp 2.3.0
3 dnl added wi_EXTRA_PDIR and wi_ANSI_C
4 dnl $Id$
5 dnl
6 AC_DEFUN([wi_EXTRA_IDIR], [
7 incdir="$1"
8 if test -r $incdir ; then
9         case "$CPPFLAGS" in
10                 *-I${incdir}*)
11                         # echo "   + already had $incdir" 1>&6
12                         ;;
13                 *)
14                         if test "$CPPFLAGS" = "" ; then
15                                 CPPFLAGS="-I$incdir"
16                         else
17                                 CPPFLAGS="$CPPFLAGS -I$incdir"
18                         fi
19                         echo "   + found $incdir" 1>&6
20                         ;;
21         esac
22 fi
23 ])
24 dnl
25 dnl
26 dnl
27 dnl
28 AC_DEFUN([wi_EXTRA_LDIR], [
29 mylibdir="$1"
30 if test -r $mylibdir ; then
31         case "$LDFLAGS" in
32                 *-L${mylibdir}*)
33                         # echo "   + already had $mylibdir" 1>&6
34                         ;;
35                 *)
36                         if test "$LDFLAGS" = "" ; then
37                                 LDFLAGS="-L$mylibdir"
38                         else
39                                 LDFLAGS="$LDFLAGS -L$mylibdir"
40                         fi
41                         echo "   + found $mylibdir" 1>&6
42                         ;;
43         esac
44 fi
45 ])
46 dnl
47 dnl __FP__
48 dnl
49 dnl
50 AC_DEFUN([wi_EXTRA_PDIR], [
51 progdir="$1"
52 if test -r $progdir ; then
53         case "$PATH" in
54                 *:${progdir}*)
55                         # echo "   + already had $progdir" 1>&6
56                         ;;
57                 *${progdir}:*)
58                         # echo "   + already had $progdir" 1>&6
59                         ;;
60                 *)
61                         if test "$PATH" = "" ; then
62                                 PATH="$progdir"
63                         else
64                                 PATH="$PATH:$progdir"
65                         fi
66                         echo "   + found $progdir" 1>&6
67                         ;;
68         esac
69 fi
70 ])
71 dnl
72 dnl
73 dnl If you want to also look for include and lib subdirectories in the
74 dnl $HOME tree, you supply "yes" as the first argument to this macro.
75 dnl
76 dnl If you want to look for subdirectories in include/lib directories,
77 dnl you pass the names in argument 3, otherwise pass a dash.
78 dnl
79 AC_DEFUN([wi_EXTRA_DIRS], [echo "checking for extra include and lib directories..." 1>&6
80 ifelse([$1], yes, [dnl
81 b1=`cd .. ; pwd`
82 b2=`cd ../.. ; pwd`
83 exdirs="$HOME $j $b1 $b2 $prefix $2"
84 ],[dnl
85 exdirs="$prefix $2"
86 ])
87 subexdirs="$3"
88 if test "$subexdirs" = "" ; then
89         subexdirs="-"
90 fi
91 for subexdir in $subexdirs ; do
92 if test "$subexdir" = "-" ; then
93         subexdir=""
94 else
95         subexdir="/$subexdir"
96 fi
97 for exdir in $exdirs ; do
98         if test "$exdir" != "/usr" || test "$subexdir" != ""; then
99                 incdir="${exdir}/include${subexdir}"
100                 wi_EXTRA_IDIR($incdir)
101
102                 mylibdir="${exdir}/lib${subexdir}"
103                 wi_EXTRA_LDIR($mylibdir)
104
105                 progdir="${exdir}/bin${subexdir}"
106                 wi_EXTRA_PDIR($progdir)
107         fi
108 done
109 done
110 ])
111 dnl
112 dnl
113 dnl
114 AC_DEFUN([wi_HPUX_CFLAGS],
115 [AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
116 AC_REQUIRE([AC_PROG_CC])
117 os=`uname -s | tr '[A-Z]' '[a-z]'`
118 ac_cv_hpux_flags=no
119 if test "$os" = hp-ux ; then
120         if test "$ac_cv_prog_gcc" = yes ; then
121                 if test "$CFLAGS" != "" ; then
122                         # Shouldn't be in there.
123                         CFLAGS=`echo "$CFLAGS" | sed 's/-Aa//g'`
124                 fi
125         else
126                 # If you're not using gcc, then you better have a cc/c89
127                 # that is usable.  If you have the barebones compiler, it
128                 # won't work.  The good compiler uses -Aa for the ANSI
129                 # compatible stuff.
130                 x=`echo $CFLAGS | grep 'Aa' 2>/dev/null`
131                 if test "$x" = "" ; then
132                         CFLAGS="$CFLAGS -Aa"
133                 fi
134                 ac_cv_hpux_flags=yes
135         fi
136         # Also add _HPUX_SOURCE to get the extended namespace.
137         x=`echo $CFLAGS | grep '_HPUX_SOURCE' 2>/dev/null`
138         if test "$x" = "" ; then
139                 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
140         fi
141 fi
142 AC_MSG_RESULT($ac_cv_hpux_flags)
143 ])
144 dnl
145 dnl
146 dnl
147 AC_DEFUN([wi_CFLAGS], [AC_REQUIRE([AC_PROG_CC])
148 wi_HPUX_CFLAGS
149         if test "$CFLAGS" = "" ; then
150                 CFLAGS="-O"
151         elif test "$ac_cv_prog_gcc" = "yes" ; then
152                 case "$CFLAGS" in
153                         *"-g -O"*)
154                                 #echo "using -g as default gcc CFLAGS" 1>&6
155                                 CFLAGS=`echo $CFLAGS | sed 's/-g\ -O/-O/'`
156                                 ;;
157                         *"-O -g"*)
158                                 # Leave the -g, but remove all -O options.
159                                 #echo "using -g as default gcc CFLAGS" 1>&6
160                                 CFLAGS=`echo $CFLAGS | sed 's/-O\ -g/-O/'`
161                                 ;;
162                 esac
163         fi
164 ])
165 dnl
166 dnl
167 dnl
168 AC_DEFUN([wi_PROTOTYPES], [
169 AC_MSG_CHECKING(if the compiler supports function prototypes)
170 AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
171 AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
172 AC_MSG_RESULT($wi_cv_prototypes)
173 ])
174 dnl
175 dnl
176 dnl
177 AC_DEFUN([wi_ANSI_C], [
178 AC_MSG_CHECKING(ANSI-style function definitions)
179 AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes
180 AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no)
181 AC_MSG_RESULT($wi_cv_ansi_funcs)
182 ])
183 dnl
184 dnl
185 dnl
186 AC_DEFUN([wi_HEADER_SYS_SELECT_H], [
187 # See if <sys/select.h> is includable after <sys/time.h>
188 if test "$ac_cv_header_sys_time_h" = no ; then
189 AC_CHECK_HEADERS(sys/time.h sys/select.h)
190 else
191 AC_CHECK_HEADERS(sys/select.h)
192 fi
193 if test "$ac_cv_header_sys_select_h" = yes ; then
194         AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
195         selecth=yes
196         if test "$ac_cv_header_sys_time_h" = yes ; then
197                 AC_TRY_COMPILE([#include <sys/time.h>
198                 #include <sys/select.h>],[
199                 fd_set a;
200                 struct timeval tmval;
201
202                 tmval.tv_sec = 0;],selecth=yes,selecth=no)
203
204                 if test "$selecth" = yes ; then
205                         AC_DEFINE(CAN_USE_SYS_SELECT_H)
206                 fi
207         fi
208         AC_MSG_RESULT($selecth)
209 fi
210 ])
211 dnl
212 dnl
213 dnl
214 AC_DEFUN([wi_LIB_RESOLV], [
215 # See if we could access two well-known sites without help of any special
216 # libraries, like resolv.
217
218 AC_TRY_RUN([
219 #include <sys/types.h>
220 #include <sys/socket.h>
221 #include <netinet/in.h>
222 #include <netdb.h>
223  
224 main()
225 {
226         struct hostent *hp1, *hp2;
227         int result;
228
229         hp1 = gethostbyname("gatekeeper.dec.com");
230         hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
231         result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
232         exit(! result);
233 }],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
234
235 AC_MSG_CHECKING([if we need to look for -lresolv])
236 AC_MSG_RESULT($look_for_resolv)
237 if test "$look_for_resolv" = yes ; then
238 AC_CHECK_LIB(resolv,main)
239 else
240         ac_cv_lib_resolv=no
241 fi
242 ])
243 dnl
244 dnl
245 dnl
246
247 AC_DEFUN([wi_LIB_NSL], [
248 AC_MSG_CHECKING(if we can use -lnsl)
249 ac_save_LIBS="$LIBS";
250 LIBS="$LIBS -lnsl";
251 AC_CACHE_VAL(r_cv_use_libnsl, [
252 AC_TRY_RUN(
253 main() { if (getpwuid(getuid())) exit(0); exit(-1); },
254 nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no)
255 ])
256 if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi
257 AC_MSG_RESULT($nc_cv_use_libnsl)
258 ])dnl
259
260 dnl
261 dnl
262 dnl
263
264 AC_DEFUN([nc_PATH_PROG_ZCAT], [
265 AC_PATH_PROG(GZCAT,gzcat)
266 AC_PATH_PROG(ZCAT,zcat)
267 if test "x$GZCAT" = x ; then
268         if test "x$ZCAT" != x ; then
269                 # See if zcat is really gzcat.  gzcat has a --version option, regular
270                 # zcat does not.
271                 AC_MSG_CHECKING(if zcat is really gzcat in disguise)
272                 if $ZCAT --version 2> /dev/null ; then
273                         AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT")
274                         AC_MSG_RESULT(yes)
275                 else
276                         AC_MSG_RESULT(no)
277                 fi
278         fi
279 else
280         AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT")
281 fi
282
283 if test "x$ZCAT" != x ; then
284         AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT")
285 fi
286 ])
287 dnl
288 dnl
289 dnl
290 AC_DEFUN([wi_SYSV_EXTRA_DIRS], [
291 # Use System V because their curses extensions are required.  This must
292 # be done early so we use the -I and -L in the library checks also.
293 # This is mostly a Solaris/SunOS hack.  Note that doing this will also
294 # use all of the other System V libraries and headers.
295
296 AC_MSG_CHECKING(for alternative System V libraries)
297 if test -f /usr/5include/curses.h ; then
298         CPPFLAGS="$CPPFLAGS -I/usr/5include"
299         LDFLAGS="$LDFLAGS -L/usr/5lib"
300         AC_MSG_RESULT(yes)
301 else
302         AC_MSG_RESULT(no)
303 fi
304 ])
305 dnl
306 dnl
307 dnl
308 AC_DEFUN([wi_DEFINE_UNAME], [
309 # Get first 127 chars of all uname information.  Some folks have
310 # way too much stuff there, so grab only the first 127.
311 unam=`uname -a 2>/dev/null | cut -c1-127`
312 if test "$unam" != "" ; then
313         AC_DEFINE_UNQUOTED(UNAME, "$unam")
314 fi
315 ])
316 dnl
317 dnl
318 dnl
319 AC_DEFUN([wi_READLINE_WITH_NCURSES], [
320 # Readline and Ncurses could both define "backspace".
321 # Warn about this if we have both things in our definitions list.
322
323 if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then
324
325 AC_MSG_CHECKING(if readline and ncurses will link together)
326 j="$LIBS"
327 LIBS="-lreadline -lncurses"
328 AC_TRY_LINK(,[
329 readline("prompt");
330 endwin();
331 ],k=yes,k=no)
332 if test "$k" = no ; then
333         AC_MSG_RESULT(no)
334         # Remove '-lreadline' from LIBS.
335         LIBS=`echo $j | sed s/-lreadline//g`
336         ac_cv_lib_readline=no
337         AC_WARN([The versions of GNU readline and ncurses you have installed on this system
338 can't be used together, because they use the same symbol, backspace. If
339 possible, recompile one of the libraries with -Dbackspace=back_space, then
340 re-run configure.])
341
342 else
343         AC_MSG_RESULT(yes)
344         LIBS="$j"
345 fi
346
347 fi
348 ])
349 dnl
350 dnl
351 dnl
352
353 dnl AC_EXT_DAYLIGHT
354 dnl Check for an external variable daylight. Stolen from w3c-libwww.
355 AC_DEFUN([AC_EXT_DAYLIGHT],
356 [ AC_MSG_CHECKING(int daylight variable)
357 AC_TRY_COMPILE([#include <time.h>], [return daylight;],
358   have_daylight=yes,
359   have_daylight=no)
360 AC_MSG_RESULT($have_daylight)
361 ])dnl
362
363 dnl AC_EXT_TIMEZONE
364 dnl Check for an external variable timezone. Stolen from tcl-8.0.
365 AC_DEFUN([AC_EXT_TIMEZONE],
366 [
367 #
368 # Its important to include time.h in this check, as some systems (like convex)
369 # have timezone functions, etc.
370 #
371 have_timezone=no
372 AC_MSG_CHECKING([long timezone variable])
373 AC_TRY_COMPILE([#include <time.h>],
374         [extern long timezone;
375          timezone += 1;
376          exit (0);],
377         [have_timezone=yes
378          AC_MSG_RESULT(yes)],
379          AC_MSG_RESULT(no))
380
381 #
382 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
383 #
384 if test "$have_timezone" = no; then
385    AC_MSG_CHECKING([time_t timezone variable])
386    AC_TRY_COMPILE([#include <time.h>],
387         [extern time_t timezone;
388          timezone += 1;
389          exit (0);],
390         [have_timezone=yes
391          AC_MSG_RESULT(yes)],
392          AC_MSG_RESULT(no))
393 fi
394 ])dnl
395
396 pushdef([AC_PROG_INSTALL],
397 [
398   dnl our own version, testing for a -p flag
399   popdef([AC_PROG_INSTALL])
400   dnl as AC_PROG_INSTALL works as it works we first have
401   dnl to save if the user didn't specify INSTALL, as the
402   dnl autoconf one overwrites INSTALL and we have no chance to find
403   dnl out afterwards
404   AC_PROG_INSTALL
405
406     # OK, user hasn't given any INSTALL, autoconf found one for us
407     # now we test, if it supports the -p flag
408     AC_MSG_CHECKING(for -p flag to install)
409     rm -f confinst.$$.* > /dev/null 2>&1
410     echo "Testtest" > confinst.$$.orig
411     ac_res=no
412     if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
413       if test -f confinst.$$.new ; then
414         # OK, -p seems to do no harm to install
415         INSTALL="${INSTALL} -p"
416         ac_res=yes
417       fi
418     fi
419     rm -f confinst.$$.*
420     AC_MSG_RESULT($ac_res)
421   dnl the following tries to resolve some signs and wonders coming up
422   dnl with different autoconf/automake versions
423   dnl e.g.:
424   dnl  *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
425   dnl   and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
426   dnl   it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
427   dnl  *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
428   dnl   INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
429   dnl   install-@DIR@PROGRAMS targets to explicitly use that flag
430   dnl  *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
431   dnl   INSTALL_SCRIPT, which breaks with automake <= 1.4
432   dnl  *autoconf >2.13 (since 10.Apr 1999) has not that failure
433   dnl to clean up that mess we:
434   dnl  +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
435   dnl   which cleans KDE's program with automake > 1.4;
436   dnl  +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
437   dnl   with automake<=1.4
438   dnl  note that dues to this sometimes two '-s' flags are used
439     INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
440     INSTALL_SCRIPT='${INSTALL}'
441 ])dnl
442
443 # ===========================================================================
444 #             http://autoconf-archive.cryp.to/ax_boost_base.html
445 # ===========================================================================
446 #
447 # SYNOPSIS
448 #
449 #   AX_BOOST_BASE([MINIMUM-VERSION])
450 #
451 # DESCRIPTION
452 #
453 #   Test for the Boost C++ libraries of a particular version (or newer)
454 #
455 #   If no path to the installed boost library is given the macro searchs
456 #   under /usr, /usr/local, /opt and /opt/local and evaluates the
457 #   $BOOST_ROOT environment variable. Further documentation is available at
458 #   <http://randspringer.de/boost/index.html>.
459 #
460 #   This macro calls:
461 #
462 #     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
463 #
464 #   And sets:
465 #
466 #     HAVE_BOOST
467 #
468 # LAST MODIFICATION
469 #
470 #   2008-04-12
471 #
472 # COPYLEFT
473 #
474 #   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
475 #
476 #   Copying and distribution of this file, with or without modification, are
477 #   permitted in any medium without royalty provided the copyright notice
478 #   and this notice are preserved.
479
480 AC_DEFUN([AX_BOOST_BASE],
481 [
482 AC_ARG_WITH([boost],
483         AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
484         [
485     if test "$withval" = "no"; then
486                 want_boost="no"
487     elif test "$withval" = "yes"; then
488         want_boost="yes"
489         ac_boost_path=""
490     else
491             want_boost="yes"
492         ac_boost_path="$withval"
493         fi
494     ],
495     [want_boost="yes"])
496
497
498 AC_ARG_WITH([boost-libdir],
499         AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
500         [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
501         [
502         if test -d $withval
503         then
504                 ac_boost_lib_path="$withval"
505         else
506                 AC_MSG_ERROR(--with-boost-libdir expected directory name)
507         fi
508         ],
509         [ac_boost_lib_path=""]
510 )
511
512 if test "x$want_boost" = "xyes"; then
513         boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
514         boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
515         boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
516         boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
517         boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
518         if test "x$boost_lib_version_req_sub_minor" = "x" ; then
519                 boost_lib_version_req_sub_minor="0"
520         fi
521         WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
522         AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
523         succeeded=no
524
525         dnl first we check the system location for boost libraries
526         dnl this location ist chosen if boost libraries are installed with the --layout=system option
527         dnl or if you install boost with RPM
528         if test "$ac_boost_path" != ""; then
529                 BOOST_LDFLAGS="-L$ac_boost_path/lib"
530                 BOOST_CPPFLAGS="-I$ac_boost_path/include"
531         else
532                 for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
533                         if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
534                                 BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
535                                 BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
536                                 break;
537                         fi
538                 done
539         fi
540
541     dnl overwrite ld flags if we have required special directory with
542     dnl --with-boost-libdir parameter
543     if test "$ac_boost_lib_path" != ""; then
544        BOOST_LDFLAGS="-L$ac_boost_lib_path"
545     fi
546
547         CPPFLAGS_SAVED="$CPPFLAGS"
548         CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
549         export CPPFLAGS
550
551         LDFLAGS_SAVED="$LDFLAGS"
552         LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
553         export LDFLAGS
554
555         AC_LANG_PUSH(C++)
556         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
557         @%:@include <boost/version.hpp>
558         ]], [[
559         #if BOOST_VERSION >= $WANT_BOOST_VERSION
560         // Everything is okay
561         #else
562         #  error Boost version is too old
563         #endif
564         ]])],[
565         AC_MSG_RESULT(yes)
566         succeeded=yes
567         found_system=yes
568         ],[
569         ])
570         AC_LANG_POP([C++])
571
572
573
574         dnl if we found no boost with system layout we search for boost libraries
575         dnl built and installed without the --layout=system option or for a staged(not installed) version
576         if test "x$succeeded" != "xyes"; then
577                 _version=0
578                 if test "$ac_boost_path" != ""; then
579                         if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
580                                 for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
581                                         _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
582                                         V_CHECK=`expr $_version_tmp \> $_version`
583                                         if test "$V_CHECK" = "1" ; then
584                                                 _version=$_version_tmp
585                                         fi
586                                         VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
587                                         BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
588                                 done
589                         fi
590                 else
591                         for ac_boost_path in /usr /usr/local /opt /opt/local ; do
592                                 if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
593                                         for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
594                                                 _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
595                                                 V_CHECK=`expr $_version_tmp \> $_version`
596                                                 if test "$V_CHECK" = "1" ; then
597                                                         _version=$_version_tmp
598                                                         best_path=$ac_boost_path
599                                                 fi
600                                         done
601                                 fi
602                         done
603
604                         VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
605                         BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
606             if test "$ac_boost_lib_path" = ""
607             then
608                BOOST_LDFLAGS="-L$best_path/lib"
609             fi
610
611                         if test "x$BOOST_ROOT" != "x"; then
612                                 if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
613                                         version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
614                                         stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
615                                         stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
616                                         V_CHECK=`expr $stage_version_shorten \>\= $_version`
617                     if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
618                                                 AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
619                                                 BOOST_CPPFLAGS="-I$BOOST_ROOT"
620                                                 BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
621                                         fi
622                                 fi
623                         fi
624                 fi
625
626                 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
627                 export CPPFLAGS
628                 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
629                 export LDFLAGS
630
631                 AC_LANG_PUSH(C++)
632                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
633                 @%:@include <boost/version.hpp>
634                 ]], [[
635                 #if BOOST_VERSION >= $WANT_BOOST_VERSION
636                 // Everything is okay
637                 #else
638                 #  error Boost version is too old
639                 #endif
640                 ]])],[
641                 AC_MSG_RESULT(yes)
642                 succeeded=yes
643                 found_system=yes
644                 ],[
645                 ])
646                 AC_LANG_POP([C++])
647         fi
648
649         if test "$succeeded" != "yes" ; then
650                 if test "$_version" = "0" ; then
651                         AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
652                 else
653                         AC_MSG_ERROR([Your boost libraries seems to old (version $_version).])
654                 fi
655         else
656                 AC_SUBST(BOOST_CPPFLAGS)
657                 AC_SUBST(BOOST_LDFLAGS)
658                 AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
659         fi
660
661         CPPFLAGS="$CPPFLAGS_SAVED"
662         LDFLAGS="$LDFLAGS_SAVED"
663 fi
664
665 ])
666
667 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
668
669 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
670 #
671 # This program is free software; you can redistribute it and/or modify
672 # it under the terms of the GNU General Public License as published by
673 # the Free Software Foundation; either version 2 of the License, or
674 # (at your option) any later version.
675 #
676 # This program is distributed in the hope that it will be useful, but
677 # WITHOUT ANY WARRANTY; without even the implied warranty of
678 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
679 # General Public License for more details.
680 #
681 # You should have received a copy of the GNU General Public License
682 # along with this program; if not, write to the Free Software
683 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
684 #
685 # As a special exception to the GNU General Public License, if you
686 # distribute this file as part of a program that contains a
687 # configuration script generated by Autoconf, you may include it under
688 # the same distribution terms that you use for the rest of that program.
689
690 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
691 # ----------------------------------
692 AC_DEFUN([PKG_PROG_PKG_CONFIG],
693 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
694 m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
695 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
696 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
697         AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
698 fi
699 if test -n "$PKG_CONFIG"; then
700         _pkg_min_version=m4_default([$1], [0.9.0])
701         AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
702         if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
703                 AC_MSG_RESULT([yes])
704         else
705                 AC_MSG_RESULT([no])
706                 PKG_CONFIG=""
707         fi
708                 
709 fi[]dnl
710 ])# PKG_PROG_PKG_CONFIG
711
712 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
713 #
714 # Check to see whether a particular set of modules exists.  Similar
715 # to PKG_CHECK_MODULES(), but does not set variables or print errors.
716 #
717 #
718 # Similar to PKG_CHECK_MODULES, make sure that the first instance of
719 # this or PKG_CHECK_MODULES is called, or make sure to call
720 # PKG_CHECK_EXISTS manually
721 # --------------------------------------------------------------
722 AC_DEFUN([PKG_CHECK_EXISTS],
723 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
724 if test -n "$PKG_CONFIG" && \
725     AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
726   m4_ifval([$2], [$2], [:])
727 m4_ifvaln([$3], [else
728   $3])dnl
729 fi])
730
731
732 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
733 # ---------------------------------------------
734 m4_define([_PKG_CONFIG],
735 [if test -n "$$1"; then
736     pkg_cv_[]$1="$$1"
737  elif test -n "$PKG_CONFIG"; then
738     PKG_CHECK_EXISTS([$3],
739                      [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
740                      [pkg_failed=yes])
741  else
742     pkg_failed=untried
743 fi[]dnl
744 ])# _PKG_CONFIG
745
746 # _PKG_SHORT_ERRORS_SUPPORTED
747 # -----------------------------
748 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
749 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
750 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
751         _pkg_short_errors_supported=yes
752 else
753         _pkg_short_errors_supported=no
754 fi[]dnl
755 ])# _PKG_SHORT_ERRORS_SUPPORTED
756
757
758 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
759 # [ACTION-IF-NOT-FOUND])
760 #
761 #
762 # Note that if there is a possibility the first call to
763 # PKG_CHECK_MODULES might not happen, you should be sure to include an
764 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
765 #
766 #
767 # --------------------------------------------------------------
768 AC_DEFUN([PKG_CHECK_MODULES],
769 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
770 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
771 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
772
773 pkg_failed=no
774 AC_MSG_CHECKING([for $1])
775
776 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
777 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
778
779 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
780 and $1[]_LIBS to avoid the need to call pkg-config.
781 See the pkg-config man page for more details.])
782
783 if test $pkg_failed = yes; then
784         _PKG_SHORT_ERRORS_SUPPORTED
785         if test $_pkg_short_errors_supported = yes; then
786                 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
787         else 
788                 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
789         fi
790         # Put the nasty error message in config.log where it belongs
791         echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
792
793         ifelse([$4], , [AC_MSG_ERROR(dnl
794 [Package requirements ($2) were not met:
795
796 $$1_PKG_ERRORS
797
798 Consider adjusting the PKG_CONFIG_PATH environment variable if you
799 installed software in a non-standard prefix.
800
801 _PKG_TEXT
802 ])],
803                 [AC_MSG_RESULT([no])
804                 $4])
805 elif test $pkg_failed = untried; then
806         ifelse([$4], , [AC_MSG_FAILURE(dnl
807 [The pkg-config script could not be found or is too old.  Make sure it
808 is in your PATH or set the PKG_CONFIG environment variable to the full
809 path to pkg-config.
810
811 _PKG_TEXT
812
813 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
814                 [$4])
815 else
816         $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
817         $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
818         AC_MSG_RESULT([yes])
819         ifelse([$3], , :, [$3])
820 fi[]dnl
821 ])# PKG_CHECK_MODULES