]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
Make configure.in changes recommended by Markus Elfring
[bacula/bacula] / bacula / autoconf / configure.in
1 dnl
2 dnl
3 dnl Process this file with autoconf to produce a configure script.
4 dnl
5 dnl require a recent autoconf
6 AC_PREREQ(2.61)
7 AC_INIT(src/version.h)
8 BUILD_DIR=`pwd`
9 cd ..
10 TOP_DIR=`pwd`
11 cd ${BUILD_DIR}
12 AC_SUBST(BUILD_DIR)
13 AC_SUBST(TOP_DIR)
14 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
15 AC_CONFIG_HEADERS(src/config.h:autoconf/config.h.in)
16
17 dnl minimal Win32 stuff for "make clean"
18 WIN32BUILDDIR=${BUILD_DIR}/src/win32
19 WIN32MAINDIR=${BUILD_DIR}
20 WIN32TOPDIR=${TOP_DIR}    
21 AC_SUBST(WIN32BUILDDIR)
22 AC_SUBST(WIN32MAINDIR)
23 AC_SUBST(WIN32TOPDIR)
24
25 dnl search for true and false programs.
26 AC_PATH_PROGS(TRUEPRG, true, :)
27 AC_PATH_PROGS(FALSEPRG, false, :)
28
29
30 dnl bacula version
31 post_host=
32 if test "x$BACULA" != x; then
33    post_host=`echo -${BACULA} | tr 'A-Z ' 'a-z-'`
34 fi
35 BACULA=${BACULA:-Bacula}
36 VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
37 DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
38 LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
39 AC_SUBST(VERSION)dnl 
40 AC_SUBST(DATE)dnl 
41 AC_SUBST(LSMDATE)dnl 
42 AC_SUBST(BACULA)dnl
43 AC_SUBST(post_host)dnl
44 echo "configuring for ${BACULA} $VERSION ($DATE)"
45
46 dnl -------------------------------------------------------
47 dnl Check for compiler.
48 dnl ------------------------------------------------------
49
50 AC_PROG_CC
51 AC_PROG_CXX
52 AC_PROG_CC_C_O         dnl Determine if C compiler support -c -o.
53 AC_PROG_GCC_TRADITIONAL    dnl Determine if ioctl() need -traditional.
54
55 BASECC=`basename $CC`
56 have_gcc=no
57 if test "x$BASECC" = xgcc; then
58    AC_DEFINE(HAVE_GCC)
59    have_gcc=yes
60 fi
61 AC_PATH_PROG(CXX, $CXX, $CXX)
62 if test ! -e $CXX; then
63    AC_MSG_ERROR(Unable to find C++ compiler)
64 fi
65
66 dnl -------------------------------------------------------
67 dnl Check for programs.
68 dnl ------------------------------------------------------
69 AC_PROG_INSTALL
70 AC_PATH_PROG(MV, mv, mv)
71 dnl Alert !!!
72 dnl If we name the variable RM it will shadow the RM variable in the configure script and we overwrite the
73 dnl value with the name of the rm command and not rm -f which is its normal content. This gives all kind
74 dnl of strange output of the configure script (like things don't exist etc.).
75 dnl So we name it REMOVE (more software has run into this problem)
76 AC_PATH_PROG(REMOVE, rm, rm)
77 AC_PATH_PROG(CP, cp, cp)
78 AC_PATH_PROG(SED, sed, sed)
79 AC_PATH_PROG(ECHO, echo, echo)
80 AC_PATH_PROG(CMP, cmp, cmp)
81 AC_PATH_PROG(TBL, tbl, tbl)
82 AC_PATH_PROG(AR, ar, ar)
83 AC_PATH_PROG(OPENSSL, openssl, none)
84 AC_PATH_PROG(MTX, mtx, mtx)
85 AC_PATH_PROG(DD, dd, dd)
86 AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
87 AC_PATH_PROG(PYTHON, python, python)
88 AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
89 AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
90 AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
91 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
92 AC_PATH_PROG(QMAKE, qmake, none)
93 AC_PATH_PROG(QMAKEQT4, qmake-qt4, none)
94 AC_PATH_PROG(GMAKE, gmake, none)
95 AC_ARG_VAR(WXCONFIG, [wx-config command. On some systems, you must set it to wx-config-2.6 to use wxWidgets 2.6.])
96 if test "x$WXCONFIG" = x; then
97    WXCONFIG=wx-config
98 fi
99 AC_PATH_PROG(WXCONFIG, ${WXCONFIG}, ${WXCONFIG})
100 AC_ARG_VAR(WXFLAGS, [Parameters to pass to wx-config (e.g. --unicode=no).])
101 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
102 AC_PATH_PROG(PIDOF, pidof, pidof)
103 AC_PROG_AWK
104 # Some AWK programs fail, so test it and warn the user
105 if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 } 
106       { if ((prog == $2) || (("(" prog ")") == $2) ||
107       (("[" prog "]") == $2) ||
108       ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
109 else
110   AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
111    The regex engine of $AWK is too broken to be used you 
112    might want to install GNU AWK.
113    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
114 fi
115 THE_AWK=$AWK
116 AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
117
118
119 test -n "$ARFLAG" || ARFLAGS="cr"
120 AC_SUBST(ARFLAGS)
121
122 MAKE_SHELL=/bin/sh
123 AC_SUBST(MAKE_SHELL)
124
125 AC_SUBST(LOCAL_LIBS)
126 AC_SUBST(LOCAL_CFLAGS)
127 AC_SUBST(LOCAL_LDFLAGS)
128 AC_SUBST(LOCAL_DEFS)
129
130 dnl --------------------------------------------------
131 dnl Libtool config
132 dnl --------------------------------------------------
133 use_libtool=yes
134 AC_ARG_ENABLE(libtool,
135    AC_HELP_STRING([--enable-libtool], [enable building using GNU libtool @<:@default=yes@:>@]),
136    [
137        if test x$enableval = xno; then
138           use_libtool=no
139        fi
140    ]
141 )
142 LT_INIT([shared disable-static])
143 LT_LANG([C++])
144
145 if test x$use_libtool != xno; then
146    DEFAULT_OBJECT_TYPE=".lo"
147    DEFAULT_ARCHIVE_TYPE=".la"
148    DEFAULT_SHARED_OBJECT_TYPE=".la"
149    LIBTOOL="\$(LIBTOOL)"
150    LIBTOOL_INSTALL_TARGET="libtool-install"
151    LIBTOOL_UNINSTALL_TARGET="libtool-uninstall"
152    LIBTOOL_CLEAN_TARGET="libtool-clean"
153    QMAKE_LIBTOOL="${BUILD_DIR}/libtool"
154    FD_PLUGIN_DIR="src/plugins/fd"
155    have_plugins=yes
156 else
157    DEFAULT_OBJECT_TYPE=".o"
158    DEFAULT_ARCHIVE_TYPE=".a"
159    DEFAULT_SHARED_OBJECT_TYPE=".so"
160    LIBTOOL="# \$(LIBTOOL)"
161    LIBTOOL_INSTALL_TARGET=""
162    LIBTOOL_UNINSTALL_TARGET=""
163    LIBTOOL_CLEAN_TARGET=""
164    QMAKE_LIBTOOL="# ${BUILD_DIR}/libtool"
165    FD_PLUGIN_DIR=""
166    have_plugins=no
167 fi
168
169 AC_SUBST(DEFAULT_OBJECT_TYPE)
170 AC_SUBST(DEFAULT_ARCHIVE_TYPE)
171 AC_SUBST(DEFAULT_SHARED_OBJECT_TYPE)
172 AC_SUBST(LIBTOOL)
173 AC_SUBST(LIBTOOL_INSTALL_TARGET)
174 AC_SUBST(LIBTOOL_UNINSTALL_TARGET)
175 AC_SUBST(LIBTOOL_CLEAN_TARGET)
176 AC_SUBST(QMAKE_LIBTOOL)
177 AC_SUBST(FD_PLUGIN_DIR)
178
179 dnl --------------------------------------------------
180 dnl Include file handling
181 dnl --------------------------------------------------
182 AC_ARG_ENABLE(includes,
183    AC_HELP_STRING([--enable-includes], [enable installing of include files @<:@default=no@:>@]),
184    [
185        if test x$enableval = xyes; then
186           install_includes=yes
187        fi
188    ]
189 )
190
191 dnl It only makes sense to install include files when you install libraries which only happens when
192 dnl libtool is enabled
193
194 if test x$use_libtool != xno -a x$install_includes = xyes; then
195    INCLUDE_INSTALL_TARGET="install-includes"
196    INCLUDE_UNINSTALL_TARGET="uninstall-includes"
197 else
198    INCLUDE_INSTALL_TARGET=""
199    INCLUDE_UNINSTALL_TARGET=""
200 fi
201 AC_SUBST(INCLUDE_INSTALL_TARGET)
202 AC_SUBST(INCLUDE_UNINSTALL_TARGET)
203
204 dnl --------------------------------------------------
205 dnl Bacula OP Sys determination (see aclocal.m4)
206 dnl --------------------------------------------------
207 BA_CHECK_OPSYS
208
209 dnl -----------------------------------------------------------
210 dnl Bacula OPSys Distribution determination (see aclocal.m4)
211 dnl ----------------------------------------------------------
212 BA_CHECK_OPSYS_DISTNAME
213
214 dnl --------------------------------------------------
215 dnl Suppport for gettext (translations)
216 dnl By default, $datarootdir is ${prefix}/share
217 dnl --------------------------------------------------
218 AM_GNU_GETTEXT([external])
219
220 dnl ------------------------------------------------------------------
221 dnl If the user has not set --prefix, we set our default to nothing.
222 dnl In this case, if the user has not set --sysconfdir, we set it
223 dnl to the package default of /etc/bacula.  If either --prefix or
224 dnl --sysconfdir is set, we leave sysconfdir alone except to eval it.
225 dnl If the user has not set --libdir, we set it to the package
226 dnl default of /usr/lib. If either --prefix or --libdir is set,
227 dnl we leave libdir alone except to eval it. If the user has not set
228 dnl --includedir, we set it to the package default of /usr/include.
229 dnl If either --prefix or --includedir is set, we leave includedir
230 dnl alone except to eval it
231 dnl ------------------------------------------------------------------
232 os_name=`uname -s 2>/dev/null`
233 if test x${prefix} = xNONE ; then
234    if test `eval echo ${sysconfdir}` = NONE/etc ; then
235       sysconfdir=/etc/bacula
236    fi
237
238    if test `eval echo ${libdir}` = NONE/lib ; then
239       case ${os_name} in
240       Linux)
241          os_processor=`uname -p 2>/dev/null`
242          case ${os_processor} in
243          x86_64)
244             libdir=/usr/lib64
245             ;;
246          *)
247             libdir=/usr/lib
248             ;;
249          esac
250          ;;
251       *)
252          libdir=/usr/lib
253          ;;
254       esac
255    fi
256
257    if test `eval echo ${includedir}` = NONE/include ; then
258       includedir=/usr/include
259    fi
260
261    if test `eval echo ${datarootdir}` = NONE/share ; then
262       datarootdir=/usr/share
263    fi
264    prefix=
265 fi
266
267 dnl -------------------------------------------------------------------------
268 dnl  If the user has not set --exec-prefix, we default to ${prefix}
269 dnl -------------------------------------------------------------------------
270 if test x${exec_prefix} = xNONE ; then
271    exec_prefix=${prefix}
272 fi
273
274 sysconfdir=`eval echo ${sysconfdir}`
275 datarootdir=`eval echo ${datarootdir}`
276 docdir=`eval echo ${docdir}`
277 htmldir=`eval echo ${htmldir}`
278 libdir=`eval echo ${libdir}`
279 includedir=`eval echo ${includedir}`
280 localedir=`eval echo ${datarootdir}/locale`
281 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
282 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir") 
283
284 dnl ------------------------------------------------------------------
285 dnl If the user has not set --sbindir, we set our default as /sbin
286 dnl ------------------------------------------------------------------
287 if test x$sbindir = x'${exec_prefix}/sbin' ; then
288    sbindir=${exec_prefix}/sbin
289 fi
290 sbindir=`eval echo ${sbindir}`
291
292 dnl -------------------------------------------------------------------------
293 dnl  If the user has not set --mandir, we default to /usr/share/man
294 dnl -------------------------------------------------------------------------
295 if test x$mandir = x'${prefix}/man' ; then
296    mandir=/usr/share/man
297 fi
298
299 dnl -------------------------------------------------------------------------
300 dnl  If the user has not set --htmldir, we default to /usr/share/doc/bacula/html
301 dnl -------------------------------------------------------------------------
302 if test x$htmldir = x${docdir} ; then
303    htmldir=`eval echo ${docdir}bacula/html`
304 fi
305
306 dnl -------------------------------------------------------------------------
307 dnl  If the user has not set --docdir, we default to /usr/share/doc/
308 dnl -------------------------------------------------------------------------
309 if test x$docdir = x'/usr/share/doc/' ; then
310    docdir=`eval echo ${docdir}bacula`
311 fi
312
313             
314 AC_PATH_PROGS(MSGFMT, msgfmt, no)
315 if test "$MSGFMT" = "no"
316 then
317    echo 'msgfmt program not found, disabling NLS !'
318    USE_NLS=no
319    USE_INCLUDED_LIBINTL=no
320 #else
321    AM_GNU_GETTEXT
322 fi
323
324 support_mysql=no
325 support_sqlite=no
326 support_sqlite3=no
327 support_postgresql=no
328 support_ingres=no
329 support_dbi=no
330 support_smartalloc=yes
331 support_readline=yes
332 support_conio=yes
333 support_gnome=no
334 support_bat=no
335 support_wx_console=no
336 support_tray_monitor=no
337 support_tls=no
338 support_crypto=no
339 gnome_version=
340 wx_version=
341 support_static_tools=no
342 support_static_fd=no
343 support_static_sd=no
344 support_static_dir=no
345 support_static_cons=no
346 support_python=no
347 build_client_only=no
348 build_dird=yes
349 build_stored=yes
350 cats=
351 db_type=Internal
352 support_lockmgr=no
353 DB_TYPE=bdb
354
355 dnl --------------------------------------------------------------------------
356 dnl CHECKING COMMAND LINE OPTIONS
357 dnl --------------------------------------------------------------------------
358
359 dnl -------------------------------------------
360 dnl gnome (default off)
361 dnl -------------------------------------------
362 AC_ARG_ENABLE(gnome,
363    AC_HELP_STRING([--enable-gnome], [enable build of bgnome-console GUI @<:@default=no@:>@]),
364    [
365        if test x$enableval = xyes; then
366           support_gnome=yes
367        fi
368    ]
369 )
370
371 GNOME_DIR=
372 if test x$support_gnome = xyes; then
373    AC_MSG_ERROR(bgnome-console no longer supported)
374    AC_MSG_ERROR(--enable-gnome option no longer supported)
375 fi
376 # AC_SUBST(GNOME_DIR)
377
378 dnl -------------------------------------------
379 dnl bat (default off)
380 dnl -------------------------------------------
381 AC_ARG_ENABLE(bat,
382    AC_HELP_STRING([--enable-bat], [enable build of bat Qt4 GUI @<:@default=no@:>@]),
383    [
384        if test x$enableval = xyes; then
385           AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4 GUI support enabled]) 
386           support_bat=yes
387        fi
388    ]
389 )
390
391 BAT_DIR=
392 if test x$support_bat = xyes; then
393    abc=`$PKGCONFIG --atleast-version=4.2 QtGui`
394    pkg=$?
395    if test $pkg = 0; then
396       BAT_DIR=src/qt-console
397    else
398       AC_MSG_ERROR(Unable to find Qt4 installation needed by bat)
399    fi
400 fi
401
402 dnl 
403 dnl  The qwt library was used with bat, but that is no longer the case
404 dnl 
405 got_qwt=no
406 QWT_INC=
407 QWT_LDFLAGS=
408 QWT_LIB=
409 QWT=
410 no_qwt=no
411 dnl if test x$support_bat = xyes; then
412 dnl    AC_MSG_CHECKING(for qwt support)
413 dnl    AC_ARG_WITH(qwt,
414 dnl       AC_HELP_STRING([--with-qwt@<:@=DIR@:>@], [specify qwt library directory]),
415 dnl       [
416 dnl           case "$with_qwt" in
417 dnl           no)
418 dnl              no_qwt=yes
419 dnl              ;;
420 dnl           yes|*)
421 dnl              if test -f ${with_qwt}/include/qwt.h; then
422 dnl                 QWT_INC="${with_qwt}/include"
423 dnl                 QWT_LDFLAGS="-L${with_qwt}/lib"
424 dnl                 QWT_LIB="-lqwt"
425 dnl                 QWT="qwt"
426 dnl              fi
427 dnl              ;;
428 dnl           esac
429 dnl       ]    
430 dnl    )
431
432 dnl    dnl
433 dnl    dnl Search in standard places, or --with-qwt not specified
434 dnl    dnl
435 dnl    if test $no_qwt = no; then 
436 dnl       if test x$QWT_INC = x; then
437 dnl          for root in /usr /usr/local; do
438 dnl             for ver in qwt qwt5 qwt-qt4; do
439 dnl                if test -f ${root}/include/${ver}/qwt.h; then
440 dnl                   QWT_INC="${root}/include/${ver}"
441 dnl                   if test -d ${root}/lib64/; then
442 dnl                      QWT_LDFLAGS="-L${root}/lib64"
443 dnl                   elif test -d ${root}/lib/64/; then
444 dnl                      QWT_LDFLAGS="-L${root}/64"
445 dnl                   else
446 dnl                      QWT_LDFLAGS="-L${root}/lib"
447 dnl                   fi
448 dnl                   QWT_LIB="-lqwt"
449 dnl                   QWT="qwt"
450 dnl                   got_qwt=yes
451 dnl                   break;
452 dnl                fi
453 dnl             done
454 dnl          done
455 dnl       fi
456 dnl    fi
457 dnl    if test x$QWT_INC = x; then
458 dnl       AC_MSG_RESULT(no)
459 dnl    else
460 dnl       AC_DEFINE(HAVE_QWT, 1, [Set if bat QWT library found])
461 dnl       AC_MSG_RESULT(yes)
462 dnl    fi
463 dnl fi
464
465 AC_SUBST(BAT_DIR)
466 AC_SUBST(QWT_INC)
467 AC_SUBST(QWT_LDFLAGS)
468 AC_SUBST(QWT_LIB)
469 AC_SUBST(QWT)
470
471 dnl -------------------------------------------
472 dnl bwx-console (default off)
473 dnl -------------------------------------------
474 AC_ARG_ENABLE(bwx-console,
475    AC_HELP_STRING([--enable-bwx-console], [enable build of wxWidgets console @<:@default=no@:>@]),
476    [
477        if test x$enableval = xyes; then
478           support_wx_console=yes
479        fi
480    ]
481 )
482
483 WX_DIR=
484 if test x$support_wx_console = xyes; then
485    abc=`$WXCONFIG $WXFLAGS --cppflags`
486    pkg=$?
487    if test $pkg = 0; then
488       wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
489       WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
490       WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
491
492       AC_SUBST(WXCONS_CPPFLAGS)
493       AC_SUBST(WXCONS_LDFLAGS)
494       WX_DIR="src/wx-console"
495    else
496       echo " "
497       echo "wx-config program not found. bwx-console disabled."
498       echo " "
499       support_wx_console=no
500    fi
501 fi
502 AC_SUBST(WX_DIR)
503
504 dnl -------------------------------------------
505 dnl tray-monitor (default off)
506 dnl -------------------------------------------
507 AC_ARG_ENABLE(tray-monitor,
508    AC_HELP_STRING([--enable-tray-monitor], [enable build of Gnome tray monitor (compatible with KDE @<:@default=no@:>@]),
509    [
510        if test x$enableval = xyes; then
511           support_tray_monitor=yes
512        fi
513    ]
514 )
515
516 TRAY_MONITOR_DIR=
517 if test x$support_tray_monitor = xyes; then
518    abc=`$PKGCONFIG --exists gtk+-2.0`
519    pkg=$?
520    if test $pkg = 0; then
521       TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
522       TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
523       AC_SUBST(TRAY_MONITOR_CPPFLAGS)
524       AC_SUBST(TRAY_MONITOR_LDFLAGS)
525       TRAY_MONITOR_DIR=src/tray-monitor
526       abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
527       pkg=$?
528       if test $pkg = 0; then
529          AC_DEFINE(HAVE_GTK_2_4, 1, [Set if you have GTK 4.2 or greater loaded])
530       fi
531    fi
532 fi
533 AC_SUBST(TRAY_MONITOR_DIR)
534
535 dnl -------------------------------------------
536 dnl smartalloc (default off)
537 dnl -------------------------------------------
538 AC_ARG_ENABLE(smartalloc,
539    AC_HELP_STRING([--enable-smartalloc], [enable smartalloc debugging support @<:@default=no@:>@]),
540    [
541        if test x$enableval = xno; then
542           support_smartalloc=no
543        fi
544    ]
545 )
546
547 if test x$support_smartalloc = xyes; then
548    AC_DEFINE(SMARTALLOC, 1, [Set if you want Smartalloc enabled])
549 fi
550
551 dnl -------------------------------------------
552 dnl Lock Manager (default off)
553 dnl -------------------------------------------
554 AC_ARG_ENABLE(lockmgr,
555    AC_HELP_STRING([--enable-lockmgr], [enable lock manager support @<:@default=no@:>@]),
556    [
557        if test x$enableval = xyes; then
558           support_lockmgr=yes
559        fi
560    ]
561 )
562
563 if test x$support_lockmgr = xyes; then
564    AC_DEFINE(_USE_LOCKMGR, 1, [Set if you want Lock Manager enabled])
565 fi
566
567
568 dnl -------------------------------------------
569 dnl static-tools (default off)
570 dnl -------------------------------------------
571 AC_ARG_ENABLE(static-tools,
572    AC_HELP_STRING([--enable-static-tools], [enable static tape tools @<:@default=no@:>@]),
573    [
574        if test x$enableval = xyes; then
575           if test x$use_libtool = xyes; then
576              AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
577   please rerun configure with --disable-libtool])
578           fi
579           support_static_tools=yes
580        fi
581    ]
582 )
583
584 TTOOL_LDFLAGS=
585 if test x$support_static_tools = xyes; then
586    TTOOL_LDFLAGS="-static"
587 fi
588 AC_SUBST(TTOOL_LDFLAGS)
589
590 dnl -------------------------------------------
591 dnl static-fd    (default off)
592 dnl -------------------------------------------
593 AC_ARG_ENABLE(static-fd,
594    AC_HELP_STRING([--enable-static-fd], [enable static File daemon @<:@default=no@:>@]),
595    [
596        if test x$enableval = xyes; then
597           if test x$use_libtool = xyes; then
598              AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
599   please rerun configure with --disable-libtool])
600           fi
601           support_static_fd=yes
602        fi
603    ]
604 )
605
606 STATIC_FD=
607 if test x$support_static_fd = xyes; then
608    STATIC_FD="static-bacula-fd"
609 fi
610 AC_SUBST(STATIC_FD)
611
612 dnl -------------------------------------------
613 dnl static-sd    (default off)
614 dnl -------------------------------------------
615 AC_ARG_ENABLE(static-sd,
616    AC_HELP_STRING([--enable-static-sd], [enable static Storage daemon @<:@default=no@:>@]),
617    [
618        if test x$enableval = xyes; then
619           if test x$use_libtool = xyes; then
620              AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
621   please rerun configure with --disable-libtool])
622           fi
623           support_static_sd=yes
624        fi
625    ]
626 )
627
628 STATIC_SD=
629 if test x$support_static_sd = xyes; then
630    STATIC_SD="static-bacula-sd"
631 fi
632 AC_SUBST(STATIC_SD)
633
634 dnl -------------------------------------------
635 dnl static-dir   (default off)
636 dnl -------------------------------------------
637 AC_ARG_ENABLE(static-dir,
638    AC_HELP_STRING([--enable-static-dir], [enable static Director @<:@default=no@:>@]),
639    [
640        if test x$enableval = xyes; then
641           if test x$use_libtool = xyes; then
642              AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
643   please rerun configure with --disable-libtool])
644           fi
645           support_static_dir=yes
646        fi
647    ]
648 )
649
650 STATIC_DIR=
651 if test x$support_static_dir = xyes; then
652    STATIC_DIR="static-bacula-dir"
653 fi
654 AC_SUBST(STATIC_DIR)
655
656 dnl -------------------------------------------
657 dnl static-cons  (default off)
658 dnl -------------------------------------------
659 AC_ARG_ENABLE(static-cons,
660    AC_HELP_STRING([--enable-static-cons], [enable static Console @<:@default=no@:>@]),
661    [
662        if test x$enableval = xyes; then
663           if test x$use_libtool = xyes; then
664              AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
665   please rerun configure with --disable-libtool])
666           fi
667           support_static_cons=yes
668        fi
669    ]
670 )
671
672 STATIC_CONS=
673 STATIC_GNOME_CONS=
674 STATIC_WX_CONS=
675 if test x$support_static_cons = xyes; then
676    STATIC_CONS="static-bconsole"
677    STATIC_GNOME_CONS="static-bgnome-console"
678    STATIC_WX_CONS="static-bwx-console"
679 fi
680 AC_SUBST(STATIC_CONS)
681 AC_SUBST(STATIC_GNOME_CONS)
682 AC_SUBST(STATIC_WX_CONS)
683
684 dnl -------------------------------------------
685 dnl client_only  (default off)
686 dnl -------------------------------------------
687 AC_ARG_ENABLE(client-only,
688    AC_HELP_STRING([--enable-client-only], [build client (File daemon) only @<:@default=no@:>@]),
689    [
690        if test x$enableval = xyes; then
691           build_client_only=yes
692           db_type=None
693           DB_TYPE=none
694        fi
695    ]
696 )
697 if test x$build_client_only = xno; then
698    ALL_DIRS="subdirs"
699 else
700    ALL_DIRS=""
701 fi
702 AC_SUBST(ALL_DIRS)
703
704 dnl -------------------------------------------
705 dnl director  (default on)
706 dnl -------------------------------------------
707 AC_ARG_ENABLE(build-dird,
708    AC_HELP_STRING([--enable-build-dird], [enable building of dird (Director) @<:@default=yes@:>@]),
709    [
710        if test x$enableval = xno; then
711           build_dird=no
712        fi
713    ]
714 )
715 if test x$build_dird = xyes; then
716    DIRD_DIR="src/dird"
717    DIR_TOOLS="DIRTOOLS"
718 else
719    DIRD_DIR=""
720    DIR_TOOLS="NODIRTOOLS"
721 fi
722 AC_SUBST(DIRD_DIR)
723 AC_SUBST(DIR_TOOLS)
724
725 dnl -------------------------------------------
726 dnl stored  (default on)
727 dnl -------------------------------------------
728 AC_ARG_ENABLE(build-stored,
729    AC_HELP_STRING([--enable-build-stored], [enable building of stored (Storage daemon) @<:@default=yes@:>@]),
730    [
731       if test x$enableval = xno; then
732          build_stored=no
733       fi
734    ]
735 )
736 if test x$build_stored = xyes; then
737    STORED_DIR="src/stored"
738 else
739    STORED_DIR=""
740 fi
741 AC_SUBST(STORED_DIR)
742
743 dnl ---------------------------------------------------
744 dnl Check for conio (Bacula readline substitute)(
745 dnl ---------------------------------------------------
746 dnl this allows you to turn it completely off
747 AC_ARG_ENABLE(conio,
748    AC_HELP_STRING([--disable-conio], [disable conio support @<:@default=no@:>@]),
749    [
750        if test x$enableval = xno; then
751           support_conio=no
752        fi
753    ]
754 )
755   
756
757 dnl ---------------------------------------------------
758 dnl Check for IPv6 support
759 dnl ---------------------------------------------------
760 dnl this allows you to turn it completely off
761 support_ipv6=yes
762 AC_ARG_ENABLE(ipv6,   
763    AC_HELP_STRING([--enable-ipv6], [enable ipv6 support @<:@default=yes@:>@]),
764    [
765        if test x$enableval = xno; then
766           support_ipv6=no  
767        fi
768    ]
769 )
770
771 if test x$support_ipv6 = xyes; then
772     AC_TRY_LINK([ #include <sys/types.h>
773 #include <sys/socket.h>
774 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
775       [support_ipv6=yes], [support_ipv6=no])
776 fi
777
778 if test x$support_ipv6 = xyes; then
779    AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
780 fi
781
782 got_conio="no"
783 if test x$support_conio = xyes; then
784    AC_CHECK_HEADER(termcap.h, 
785      [ AC_CHECK_LIB(termcap, tgetent, 
786        [ CONS_LIBS="-ltermcap"
787     CONS_OBJ="conio.o"
788     CONS_SRC="conio.c"
789     got_conio="yes"
790     support_readline=no
791     AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
792        ],   
793        [ AC_CHECK_LIB(ncurses, tgetent,
794     [ CONS_LIBS="-lncurses"
795       CONS_OBJ="conio.o"
796       CONS_SRC="conio.c"
797       got_conio="yes"
798       support_readline=no
799       AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
800     ])
801        ])
802      ],
803      [
804     AC_CHECK_HEADERS(curses.h)
805     AC_CHECK_HEADER(term.h,
806           [ AC_CHECK_LIB(curses, tgetent, 
807        [ CONS_LIBS="-lcurses"
808          CONS_OBJ="conio.o"
809          CONS_SRC="conio.c"
810          got_conio="yes"
811          support_readline=no
812          AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
813        ])
814           ],
815           [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
816 [#if HAVE_CURSES_H
817 #include <curses.h>
818 #endif
819 ])
820      ])
821 fi
822
823
824 dnl ---------------------------------------------------
825 dnl Check for readline support/directory (default off)
826 dnl ---------------------------------------------------
827 dnl this allows you to turn it completely off
828 AC_ARG_ENABLE(readline,
829    AC_HELP_STRING([--disable-readline], [disable readline support @<:@default=yes@:>@]),
830    [
831        if test x$enableval = xno; then
832           support_readline=no
833        fi
834    ]
835 )
836
837 got_readline="no"
838 READLINE_SRC=
839 if test x$support_readline = xyes; then
840    AC_ARG_WITH(readline,
841       AC_HELP_STRING([--with-readline@<:@=DIR@:>@], [specify readline library directory]),
842       [
843           case "$with_readline" in
844           no)
845              :
846              ;;
847           yes|*)
848              if test -f ${with_readline}/readline.h; then
849                 CONS_INC="-I${with_readline}"
850                 CONS_LDFLAGS="-L$with_readline"
851              elif test -f ${with_readline}/include/readline/readline.h; then
852                 CONS_INC="-I${with_readline}/include/readline"
853                 CONS_LDFLAGS="-L${with_readline}/lib"
854                 with_readline="${with_readline}/include/readline"
855              else
856                 with_readline="/usr/include/readline" 
857              fi
858
859              AC_CHECK_HEADER(${with_readline}/readline.h, 
860                 [
861                     AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
862                     CONS_LIBS="-lreadline -lhistory -ltermcap"
863                     got_readline="yes"   
864                 ], [
865                     echo " "
866                     echo "readline.h not found. readline turned off ..."
867                     echo " "
868                 ]
869              )
870              ;;
871           esac
872       ],[
873          dnl check for standard readline library
874          AC_CHECK_HEADER(/usr/include/readline/readline.h, 
875             [
876                 AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
877                 got_readline="yes"
878                 CONS_INC="-I/usr/include/readline"
879                 CONS_LIBS="-lreadline -ltermcap"
880             ], [
881                 dnl Did not find standard library, so try Bacula's default
882                 AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
883                     [
884                         AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
885                         got_readline="yes"   
886                         CONS_INC="-I${TOP_DIR}/depkgs/readline"
887                         CONS_LIBS="-lreadline -lhistory -ltermcap"
888                         CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
889                         PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
890                     ], [
891                         echo " "
892                         echo "readline.h not found. readline turned off ..."
893                         echo " "
894                     ]
895                 )
896             ]
897          )
898       ]    
899    )
900 fi
901
902 AC_SUBST(CONS_INC)
903 AC_SUBST(CONS_OBJ)
904 AC_SUBST(CONS_SRC)
905 AC_SUBST(CONS_LIBS)
906 AC_SUBST(CONS_LDFLAGS)
907 AC_SUBST(READLINE_SRC)
908
909 dnl Minimal stuff for readline Makefile configuration
910 MAKE_SHELL=/bin/sh
911 AC_SUBST(MAKE_SHELL)
912 AC_HEADER_STAT
913 AC_HEADER_DIRENT
914 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
915 AC_CHECK_FUNCS(nanosleep nl_langinfo)
916 AC_CHECK_HEADERS(varargs.h)
917
918 dnl End of readline/conio stuff
919 dnl -----------------------------------------------------------------------
920
921 dnl -----------------------------------------------------------------------
922 dnl  Check for Python support
923 dnl
924 AC_MSG_CHECKING(for Python support)
925 AC_ARG_WITH(python,
926    AC_HELP_STRING([--with-python@<:@=DIR@:>@], [Include Python support. DIR is the Python base install directory, default is to search through a number of common places for the Python files.]),
927    [
928        PYTHON_INCDIR= 
929        PYTHON_LIBS=
930        if test "$withval" != "no"; then
931           if test "$withval" = "yes"; then
932              if test -e /usr/bin/python-config ; then
933                 PYTHON_INCDIR=`/usr/bin/python-config --includes`
934                 PYTHON_LIBS=`/usr/bin/python-config --libs`
935              else
936                 for python_root in /usr /usr/local /usr/sfw; do
937                    for ver in python2.2 python2.3 python2.4 python2.5 python2.6 python3; do
938                       if test -f $python_root/include/${ver}/Python.h; then
939                          PYTHON_INCDIR=-I$python_root/include/${ver}
940                          if test -d $python_root/lib64/${ver}/config; then
941                             PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
942                          else
943                             PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
944                          fi
945                          break 
946                       fi
947                    done
948                 done
949
950                 if test x$PYTHON_INCDIR = x; then
951                    if test -f $prefix/include/Python.h; then
952                       PYTHON_INCDIR=-I$prefix/include
953                       if test -d $prefix/lib64/config; then
954                          PYTHON_LIBS="-L$prefix/lib64/config -lpython"
955                       else
956                          PYTHON_LIBS="-L$prefix/lib/config -lpython"
957                       fi
958                    else
959                       AC_MSG_RESULT(no)
960                       AC_MSG_ERROR(Unable to find Python.h in standard locations)
961                    fi
962                 fi
963              fi
964           else
965              if test -e $withval/bin/python-config ; then
966                 PYTHON_INCDIR=`$withval/bin/python-config --includes`
967                 PYTHON_LIBS=`$withval/bin/python-config --libs`
968              elif test -f $withval/Python.h; then
969                 PYTHON_INCDIR=-I$withval
970                 PYTHON_LIBS="-L$withval/config -lpython"
971              elif test -f $withval/include/Python.h; then
972                 PYTHON_INCDIR=-I$withval/include
973                 if test -d $withval/lib64/config; then
974                    PYTHON_LIBS="-L$withval/lib64/config -lpython"
975                 else
976                    PYTHON_LIBS="-L$withval/lib/config -lpython"
977                 fi
978              elif test -f $withval/include/python/Python.h; then
979                 PYTHON_INCDIR=-I$withval/include/python
980                 if test -d $withval/lib64/python/config; then
981                    PYTHON_LIBS="-L$withval/lib64/python/config -lpython"
982                 else
983                    PYTHON_LIBS="-L$withval/lib/python/config -lpython"
984                 fi
985              else
986                 AC_MSG_RESULT(no)
987                 AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
988              fi
989           fi
990
991           AC_DEFINE([HAVE_PYTHON], 1)
992           AC_MSG_RESULT(yes)
993           support_python=yes
994           AC_MSG_NOTICE(checking for more Python libs)
995           saved_LIBS="$LIBS"; LIBS=
996           AC_SEARCH_LIBS(shm_open, [rt])
997           AC_CHECK_LIB(util, openpty)
998           PYTHON_LIBS="$PYTHON_LIBS $LIBS"
999           LIBS="$saved_LIBS"
1000        else
1001           AC_MSG_RESULT(no)
1002        fi
1003    ],[
1004        AC_MSG_RESULT(no)
1005    ]
1006 )
1007 AC_SUBST(PYTHON_LIBS)
1008 AC_SUBST(PYTHON_INCDIR)
1009
1010 dnl
1011 dnl Find where sockets are (especially for Solaris)
1012 dnl Do this before the TCP Wrappers test since tcp wrappers
1013 dnl uses the socket library and some linkers are stupid.
1014 dnl
1015 AC_CHECK_FUNC(socket,
1016     AC_MSG_RESULT(using libc's socket),
1017     AC_CHECK_LIB(xnet,socket)
1018     AC_CHECK_LIB(socket,socket)
1019     AC_CHECK_LIB(inet,socket))
1020
1021 dnl -----------------------------------------------------------
1022 dnl Check whether user wants TCP wrappers support (default off)
1023 dnl -----------------------------------------------------------
1024 TCPW_MSG="no" 
1025 WRAPLIBS=""
1026 AC_ARG_WITH(tcp-wrappers,
1027    AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable tcpwrappers support]),
1028    [
1029        if test "x$withval" != "xno" ; then
1030           saved_LIBS="$LIBS"
1031           LIBS="$saved_LIBS -lwrap"
1032           AC_SEARCH_LIBS(nanosleep, [rt])
1033           AC_MSG_CHECKING(for libwrap)
1034           AC_TRY_LINK(
1035              [ 
1036                #include <sys/types.h>
1037                #include <tcpd.h>
1038                int deny_severity = 0;
1039                int allow_severity = 0;
1040                struct request_info *req;
1041              ], [
1042                 hosts_access(req);
1043              ], [
1044                  AC_MSG_RESULT(yes)
1045                  AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
1046                  TCPW_MSG="yes" 
1047                  LIBS="$saved_LIBS"
1048                  WRAPLIBS="-lwrap"
1049              ], [
1050                  LIBS="$saved_LIBS -lwrap -lnsl"
1051                  WRAPLIBS="$saved_LIBS -lwrap -lnsl"
1052                  AC_TRY_LINK(
1053                    [
1054                        #include <sys/types.h>
1055                        #include <tcpd.h>
1056                        int deny_severity = 0;
1057                        int allow_severity = 0;
1058                        struct request_info *req;
1059                    ], [
1060                        hosts_access(req);
1061                    ], [
1062                       AC_MSG_RESULT(yes)
1063                       AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
1064                       TCPW_MSG="yes" 
1065                       LIBS="$saved_LIBS"
1066                       WRAPLIBS="-lwrap"
1067                    ], [
1068                       AC_MSG_ERROR([*** libwrap missing])
1069                    ]
1070                 )
1071              ]
1072           )
1073        fi
1074    ]
1075 )
1076
1077 dnl -----------------------------------------------------------
1078 dnl Check whether OpenSSL is available
1079 dnl -----------------------------------------------------------
1080 AC_MSG_CHECKING([for OpenSSL])
1081 dnl The following uses quadrigraphs:
1082 dnl '@<:@' = '['
1083 dnl '@:>@' = ']'
1084 AC_ARG_WITH(openssl,
1085     AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
1086     [
1087         with_openssl_directory=${withval}
1088     ]
1089 )
1090
1091 if test "x$with_openssl_directory" != "xno"; then
1092    OPENSSL_LIBS="-lssl -lcrypto"
1093    OPENSSL_INC=""
1094
1095    if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
1096       #
1097       # Make sure the $with_openssl_directory also makes sense
1098       #
1099       if test -d "$with_openssl_directory/lib" -a -d "$with_openssl_directory/include"; then
1100          OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
1101          OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
1102       fi
1103    fi
1104
1105    saved_LIBS="${LIBS}"
1106    saved_CFLAGS="${CFLAGS}"
1107    LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
1108    CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"
1109
1110    AC_TRY_LINK(
1111       [
1112           #include <openssl/ssl.h>
1113       ], [
1114            CRYPTO_set_id_callback(NULL);
1115       ], [
1116           support_tls="yes"
1117           support_crypto="yes"
1118       ], [
1119           support_tls="no"
1120           support_crypto="no"
1121       ]
1122    )
1123
1124    AC_TRY_LINK(
1125       [
1126           #include <openssl/evp.h>
1127       ], [
1128           EVP_sha512();
1129       ], [
1130           ac_cv_openssl_sha2="yes"
1131       ], [
1132           ac_cv_openssl_sha2="no"
1133       ]
1134    )
1135
1136    dnl Solaris disables greater than 128+ bit encryption in their OpenSSL
1137    dnl implementation, presumably for export reasons. If 192bit AES
1138    dnl is available, we assume that we're running with a 'non-export'
1139    dnl openssl library.
1140    AC_TRY_LINK(
1141       [
1142           #include <openssl/evp.h>
1143       ], [
1144           EVP_aes_192_cbc();
1145       ], [
1146           ac_cv_openssl_export="no"
1147       ], [
1148           ac_cv_openssl_export="yes"
1149       ]
1150    )
1151
1152    LIBS="${saved_LIBS}"
1153    CFLAGS="${saved_CFLAGS}"
1154
1155    if test "$support_tls" = "yes"; then
1156       AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
1157       AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
1158       AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
1159    fi
1160
1161    if test "$ac_cv_openssl_sha2" = "yes"; then
1162       AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
1163    fi
1164
1165    if test "$ac_cv_openssl_export" = "yes"; then
1166       AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
1167    fi
1168 else
1169    support_tls="no"
1170    support_crypto="no"
1171    OPENSSL_LIBS=""
1172    OPENSSL_INC=""
1173 fi
1174
1175 if test "$support_tls" = "no"; then
1176    OPENSSL_LIBS=""
1177    OPENSSL_INC=""
1178 fi  
1179 if test "$support_crypto" = "no"; then
1180    OPENSSL_LIBS=""
1181    OPENSSL_INC=""
1182 fi  
1183
1184 AC_MSG_RESULT([$support_tls])
1185 AC_SUBST(OPENSSL_LIBS)
1186 AC_SUBST(OPENSSL_INC)
1187
1188 dnl -----------------------------------------------------------
1189 dnl dlopen is needed for plugins
1190 dnl -----------------------------------------------------------
1191 AC_SEARCH_LIBS(dlopen, [dl])
1192
1193 dnl ------------------------------------------
1194 dnl Where to place working dir
1195 dnl ------------------------------------------
1196 working_dir=`eval echo ${prefix}/var/bacula/working`
1197 AC_ARG_WITH(working-dir,
1198    AC_HELP_STRING([--with-working-dir=PATH], [specify path of Bacula working directory]),
1199    [
1200        if test "x$withval" != "xno" ; then     
1201          working_dir=$withval
1202        fi
1203    ]
1204 )
1205
1206 AC_SUBST(working_dir)
1207
1208 dnl ------------------------------------------------------------------
1209 dnl If the user has not set archivedir, we set our default as /tmp
1210 dnl ------------------------------------------------------------------
1211 archivedir=/tmp
1212 AC_ARG_WITH(archivedir,
1213    AC_HELP_STRING([--with-archivedir=PATH], [specify path of SD archive directory]),
1214    [
1215        if test "x$withval" != "xno" ; then     
1216           archivedir=$withval
1217        fi
1218    ]
1219 )
1220
1221 AC_SUBST(archivedir)
1222
1223 dnl ------------------------------------------------------------------
1224 dnl Allow the user to specify the daemon resource name default hostname
1225 dnl ------------------------------------------------------------------
1226 basename=`hostname`
1227 AC_ARG_WITH(basename,
1228    AC_HELP_STRING([--with-basename=RESNAME], [specify base resource name for daemons]),
1229    [
1230        if test "x$withval" != "xno" ; then     
1231           basename=$withval
1232        fi
1233    ]
1234 )
1235
1236 AC_SUBST(basename)
1237
1238 dnl ------------------------------------------------------------------
1239 dnl Allow the user to override the hostname (default = machine hostname)
1240 dnl ------------------------------------------------------------------
1241 hostname=`uname -n | cut -d '.' -f 1`
1242 if test x${hostname} = x ; then
1243   hostname="localhost"
1244 fi
1245 AC_ARG_WITH(hostname,
1246    AC_HELP_STRING([--with-hostname=RESNAME], [specify host name for daemons]),
1247    [
1248        if test "x$withval" != "xno" ; then
1249          hostname=$withval
1250        fi
1251    ]
1252 )
1253
1254 AC_SUBST(hostname)
1255
1256
1257 dnl ------------------------------------------
1258 dnl Where to place scriptdir (script files)
1259 dnl ------------------------------------------
1260 scriptdir=`eval echo ${sysconfdir}`
1261 AC_ARG_WITH(scriptdir,
1262    AC_HELP_STRING([--with-scriptdir=PATH], [specify path of Bacula scripts directory]),
1263    [
1264        if test "x$withval" != "xno" ; then     
1265           scriptdir=$withval
1266        fi
1267    ]
1268 )
1269
1270 AC_SUBST(scriptdir)
1271
1272
1273 dnl ------------------------------------------
1274 dnl Where to place bsrdir (bsr files)
1275 dnl ------------------------------------------
1276 bsrdir=/tmp
1277 AC_ARG_WITH(bsrdir,
1278    AC_HELP_STRING([--with-bsrdir=PATH], [specify path of Bacula bsrs directory]),
1279    [
1280        if test "x$withval" != "xno" ; then     
1281           bsrdir=$withval
1282        fi
1283    ]
1284 )
1285
1286 AC_SUBST(bsrdir)
1287
1288 dnl ------------------------------------------
1289 dnl Where to place logdir (bsr files)
1290 dnl ------------------------------------------
1291 logdir=/tmp
1292 AC_ARG_WITH(logdir,
1293    AC_HELP_STRING([--with-logdir=PATH], [specify path of Bacula logs directory]),
1294    [
1295        if test "x$withval" != "xno" ; then     
1296           logdir=$withval
1297        fi
1298    ]
1299 )
1300
1301 AC_SUBST(logdir)
1302
1303
1304 # ------------------------------------------
1305 # Where to place plugindir (plugin files)
1306 # ------------------------------------------
1307 plugindir=`eval echo ${libdir}`
1308 AC_ARG_WITH(plugindir,
1309    AC_HELP_STRING([--with-plugindir=PATH], [specify path of Bacula plugins directory]),
1310    [
1311        if test "x$withval" != "xno" ; then     
1312           plugindir=$withval
1313        fi
1314    ]
1315 )
1316
1317 AC_SUBST(plugindir)
1318
1319 dnl ------------------------------------------
1320 dnl Where to send dump email
1321 dnl ------------------------------------------
1322 dump_email=root@localhost
1323 AC_ARG_WITH(dump-email,
1324    AC_HELP_STRING([--with-dump-email=EMAIL], [dump email address]),
1325    [
1326        if test "x$withval" != "xno" ; then     
1327           dump_email=$withval
1328        fi
1329    ]
1330 )
1331
1332 AC_SUBST(dump_email)
1333
1334 dnl ------------------------------------------
1335 dnl Where to send job email
1336 dnl ------------------------------------------
1337 job_email=root@localhost
1338 AC_ARG_WITH(job-email,
1339    AC_HELP_STRING([--with-job-email=EMAIL], [job output email address]),
1340    [
1341        if test "x$withval" != "xno" ; then     
1342           job_email=$withval
1343        fi
1344    ]
1345 )
1346
1347 AC_SUBST(job_email)
1348
1349 dnl ------------------------------------------
1350 dnl Where to find smtp host
1351 dnl ------------------------------------------
1352 smtp_host=localhost
1353 AC_ARG_WITH(smtp_host,
1354    AC_HELP_STRING([--with-smtp-host=HOST], [SMTP mail host address]),
1355    [
1356        if test "x$withval" != "xno" ; then     
1357           smtp_host=$withval
1358        fi
1359    ]
1360 )
1361
1362 AC_SUBST(smtp_host)
1363
1364 dnl ------------------------------------
1365 dnl Where to place pid files
1366 dnl ------------------------------------
1367 piddir=/var/run
1368 AC_ARG_WITH(pid-dir,
1369    AC_HELP_STRING([--with-pid-dir=PATH], [specify location of Bacula pid files]),
1370    [
1371        if test "x$withval" != "xno" ; then   
1372           piddir=$withval
1373        fi
1374    ]
1375 )
1376
1377 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
1378 AC_SUBST(piddir)
1379
1380 dnl ------------------------------------
1381 dnl Where to place subsys "lock file"
1382 dnl ------------------------------------
1383 subsysdir=/var/run/subsys
1384 if test -d /var/run/subsys; then
1385    subsysdir=/var/run/subsys
1386 elif test -d /var/lock/subsys; then
1387    subsysdir=/var/lock/subsys
1388 else
1389    subsysdir=/var/run/subsys
1390 fi
1391 AC_ARG_WITH(subsys-dir,
1392    AC_HELP_STRING([--with-subsys-dir=PATH], [specify location of Bacula subsys file]),
1393    [
1394        if test "x$withval" != "xno" ; then   
1395           subsysdir=$withval
1396        fi
1397    ]
1398 )
1399
1400 AC_SUBST(subsysdir)
1401
1402 dnl ------------------------------------
1403 dnl Where to start assigning ports
1404 dnl ------------------------------------
1405 baseport=9101
1406 AC_ARG_WITH(baseport,
1407    AC_HELP_STRING([--with-baseport=PORT], [specify base port address for daemons]),
1408    [
1409        if test "x$withval" != "xno" ; then   
1410           baseport=$withval
1411        fi
1412    ]
1413 )
1414
1415 AC_SUBST(baseport)
1416 dir_port=`expr $baseport`
1417 fd_port=`expr $baseport + 1`
1418 sd_port=`expr $fd_port + 1`
1419
1420 AC_SUBST(dir_port)
1421 AC_SUBST(fd_port)
1422 AC_SUBST(sd_port)
1423
1424 dnl ------------------------------------------
1425 dnl Generate passwords
1426 dnl ------------------------------------------
1427 dir_password=
1428 AC_ARG_WITH(dir-password,
1429    AC_HELP_STRING([--with-dir-password=PASSWORD], [specify Director's password]),
1430    [
1431        if test "x$withval" != "xno" ; then     
1432           dir_password=$withval
1433        fi
1434    ]
1435 )
1436
1437 if test "x$dir_password" = "x" ; then
1438    if test "x$OPENSSL" = "xnone" ; then
1439       key=`autoconf/randpass 33`
1440    else
1441       key=`openssl rand -base64 33`
1442    fi
1443    dir_password=$key
1444 fi
1445
1446 fd_password=
1447 AC_ARG_WITH(fd-password,
1448    AC_HELP_STRING([--with-fd-password=PASSWORD], [specify Client's password]),
1449    [
1450        if test "x$withval" != "xno" ; then     
1451           fd_password=$withval
1452        fi
1453    ]
1454 )
1455
1456 if test "x$fd_password" = "x" ; then
1457    if test "x$OPENSSL" = "xnone" ; then
1458       key=`autoconf/randpass 37`
1459    else
1460       key=`openssl rand -base64 33`
1461    fi
1462    fd_password=$key
1463 fi
1464
1465 sd_password=
1466 AC_ARG_WITH(sd-password,
1467    AC_HELP_STRING([--with-sd-password=PASSWORD], [specify Storage daemon's password]),
1468    [
1469        if test "x$withval" != "xno" ; then     
1470           sd_password=$withval
1471        fi
1472    ]
1473 )
1474
1475 if test "x$sd_password" = "x" ; then
1476    if test "x$OPENSSL" = "xnone" ; then
1477       key=`autoconf/randpass 41`
1478    else
1479       key=`openssl rand -base64 33`
1480    fi
1481    sd_password=$key
1482 fi
1483
1484 mon_dir_password=
1485 AC_ARG_WITH(mon-dir-password,
1486    AC_HELP_STRING([--with-mon-dir-password=PASSWORD], [specify Director's password used by the monitor]),
1487    [
1488        if test "x$withval" != "xno" ; then     
1489           mon_dir_password=$withval
1490        fi
1491    ]
1492 )
1493
1494 if test "x$mon_dir_password" = "x" ; then
1495    if test "x$OPENSSL" = "xnone" ; then
1496       key=`autoconf/randpass 33`
1497    else
1498       key=`openssl rand -base64 33`
1499    fi
1500    mon_dir_password=$key
1501 fi
1502
1503 mon_fd_password=
1504 AC_ARG_WITH(mon-fd-password,
1505    AC_HELP_STRING([--with-mon-fd-password=PASSWORD], [specify Client's password used by the monitor]),
1506    [
1507        if test "x$withval" != "xno" ; then     
1508           mon_fd_password=$withval
1509        fi
1510    ]
1511 )
1512
1513 if test "x$mon_fd_password" = "x" ; then
1514    if test "x$OPENSSL" = "xnone" ; then
1515       key=`autoconf/randpass 37`
1516    else
1517       key=`openssl rand -base64 33`
1518    fi
1519    mon_fd_password=$key
1520 fi
1521
1522 mon_sd_password=
1523 AC_ARG_WITH(mon-sd-password,
1524    AC_HELP_STRING([--with-mon-sd-password=PASSWORD], [specify Storage daemon's password used by the monitor]),
1525    [
1526        if test "x$withval" != "xno" ; then     
1527           mon_sd_password=$withval
1528        fi
1529    ]
1530 )
1531
1532 if test "x$mon_sd_password" = "x" ; then
1533    if test "x$OPENSSL" = "xnone" ; then
1534       key=`autoconf/randpass 41`
1535    else
1536       key=`openssl rand -base64 33`
1537    fi
1538    mon_sd_password=$key
1539 fi
1540
1541 AC_SUBST(dir_password)
1542 AC_SUBST(fd_password)
1543 AC_SUBST(sd_password)
1544 AC_SUBST(mon_dir_password)
1545 AC_SUBST(mon_fd_password)
1546 AC_SUBST(mon_sd_password)
1547
1548 dnl
1549 dnl Pickup any database name
1550 dnl
1551 db_name=bacula
1552 AC_ARG_WITH(db_name,
1553    AC_HELP_STRING([--with-db-name=DBNAME], [specify database name @<:@default=bacula@:>@]),
1554    [
1555        if test "x$withval" != "x" ; then   
1556           db_name=$withval
1557        fi
1558    ]
1559 )
1560 AC_SUBST(db_name)
1561
1562 db_user=bacula
1563 AC_ARG_WITH(db_user,
1564    AC_HELP_STRING([--with-db-user=UNAME], [specify database user @<:@default=bacula@:>@]),
1565    [
1566        if test "x$withval" != "x" ; then   
1567           db_user=$withval
1568        fi
1569    ]
1570 )
1571 AC_SUBST(db_user)
1572
1573 db_password=
1574 AC_ARG_WITH(db_password,
1575    AC_HELP_STRING([--with-db-password=PWD], [specify database password @<:@default=*none*@:>@]),
1576    [
1577        if test "x$withval" != "x" ; then   
1578           db_password=$withval
1579        fi
1580    ]
1581 )
1582 AC_SUBST(db_password)
1583
1584 dnl
1585 dnl Pickup a database port
1586 dnl
1587 db_port=" "
1588 AC_ARG_WITH(db_port,
1589    AC_HELP_STRING([--with-db-port=DBPORT], [specify a database port @<:@default=null@:>@]),
1590    [
1591        if test "x$withval" != "x" ; then
1592           db_port=$withval
1593        fi
1594    ]
1595 )
1596 AC_SUBST(db_port)
1597
1598 #
1599 # Handle users and groups for each daemon
1600 #
1601 dir_user=
1602 AC_ARG_WITH(dir_user,
1603    AC_HELP_STRING([--with-dir-user=USER], [specify user for Director daemon]),
1604    [
1605        if test "x$withval" != "x" ; then   
1606            dir_user=$withval
1607        fi
1608    ]
1609 )
1610
1611 dir_group=
1612 AC_ARG_WITH(dir_group,
1613    AC_HELP_STRING([--with-dir-group=GROUP], [specify group for Director daemon]),
1614    [
1615        if test "x$withval" != "x" ; then   
1616           dir_group=$withval
1617        fi
1618    ]
1619 )
1620
1621 sd_user=
1622 AC_ARG_WITH(sd_user,
1623    AC_HELP_STRING([--with-sd-user=USER], [specify user for Storage daemon]),
1624    [
1625        if test "x$withval" != "x" ; then   
1626           sd_user=$withval
1627        fi
1628    ]
1629 )
1630
1631 sd_group=
1632 AC_ARG_WITH(sd_group,
1633    AC_HELP_STRING([--with-sd-group=GROUP], [specify group for Storage daemon]),
1634    [
1635        if test "x$withval" != "x" ; then   
1636           sd_group=$withval
1637        fi
1638    ]
1639 )
1640
1641 fd_user=
1642 AC_ARG_WITH(fd_user,
1643    AC_HELP_STRING([--with-fd-user=USER], [specify user for File daemon]),
1644    [
1645        if test "x$withval" != "x" ; then   
1646           fd_user=$withval
1647        fi
1648    ]
1649 )
1650
1651 fd_group=
1652 AC_ARG_WITH(fd_group,
1653    AC_HELP_STRING([--with-fd-group=GROUP], [specify group for File daemon]),
1654    [
1655        if test "x$withval" != "x" ; then   
1656           fd_group=$withval
1657        fi
1658    ]
1659 )
1660
1661 AC_SUBST(dir_user)
1662 AC_SUBST(dir_group)
1663 AC_SUBST(sd_user)
1664 AC_SUBST(sd_group)
1665 AC_SUBST(fd_user)
1666 AC_SUBST(fd_group)
1667
1668 dnl
1669 dnl allow setting default executable permissions
1670 dnl
1671 SBINPERM=0754
1672 AC_ARG_WITH(sbin-perm,
1673    AC_HELP_STRING([--with-sbin-perm=MODE], [specify permissions for sbin binaries @<:@default=0754@:>@]),
1674    [
1675        if test "x$withval" != "x" ; then   
1676           SBINPERM=$withval
1677        fi
1678    ]
1679 )
1680
1681 AC_SUBST(SBINPERM)
1682
1683 dnl ------------------------------------------------
1684 dnl Bacula check for various SQL database engines
1685 dnl ------------------------------------------------
1686 SQL_LIB=
1687 BA_CHECK_POSTGRESQL_DB
1688
1689 BA_CHECK_MYSQL_DB
1690
1691 BA_CHECK_INGRES_DB
1692
1693 BA_CHECK_SQLITE3_DB
1694
1695 # BA_CHECK_SQLITE_DB
1696
1697 BA_CHECK_DBI_DB
1698
1699 BA_CHECK_DBI_DRIVER
1700
1701 AC_SUBST(cats)
1702 AC_SUBST(DB_TYPE)
1703
1704 dnl -------------------------------------------
1705 dnl enable batch attribute DB insert (default on)
1706 dnl -------------------------------------------
1707 support_batch_insert=no
1708 A=`test -f $SQL_LIB && nm $SQL_LIB | grep pthread_mutex_lock`
1709 pkg=$?
1710 if test $pkg = 0; then
1711    support_batch_insert=yes
1712    AC_ARG_ENABLE(batch-insert,
1713       AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=no@:>@]),
1714       [
1715           if test x$enableval = xno; then
1716              support_batch_insert=no
1717           else
1718              support_batch_insert=yes
1719           fi
1720       ]
1721    )
1722 fi
1723    
1724 dnl Check if postgresql can support batch mode   
1725 if test x$DB_TYPE = xpostgresql; then
1726    AC_CHECK_LIB(pq, PQisthreadsafe, AC_DEFINE(HAVE_PQISTHREADSAFE, 1, [Set if have PQisthreadsafe]))
1727    AC_CHECK_LIB(pq, PQputCopyData, AC_DEFINE(HAVE_PQ_COPY, 1, [Set if have PQputCopyData]))
1728    if test "x$ac_cv_lib_pq_PQputCopyData" != "xyes"
1729     then
1730         support_batch_insert=no
1731    fi
1732 fi
1733
1734 if test x$DB_TYPE = xdbi; then
1735    DB_TYPE=$DB_PROG
1736    db_type=$DB_PROG
1737    pkg=1
1738    dnl Check for batch insert
1739    if test $DB_PROG = postgresql; then
1740       AC_CHECK_LIB(pq, PQisthreadsafe, AC_DEFINE(HAVE_PQISTHREADSAFE))
1741       AC_CHECK_LIB(pq, PQputCopyData, AC_DEFINE(HAVE_PQ_COPY))
1742       test "x$ac_cv_lib_pq_PQputCopyData" != "xyes"
1743       pkg=$?
1744    fi
1745
1746    if test $DB_PROG = mysql; then
1747       A=`test -f $SQL_LIB && nm $DB_PROG_LIB | grep pthread_mutex_lock`
1748       pkg=$?    
1749    fi
1750
1751    if test $DB_PROG = sqlite3; then
1752       A=`test -f $SQL_LIB && nm $DB_PROG_LIB | grep pthread_mutex_lock`
1753       pkg=$?
1754    fi
1755
1756    if test $pkg = 0; then
1757       AC_ARG_ENABLE(batch-insert,
1758          AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=no@:>@]),
1759          [
1760              if test x$enableval = xno; then
1761                 support_batch_insert=no
1762              else
1763                 support_batch_insert=yes
1764              fi
1765          ]
1766       )
1767    fi
1768 else 
1769    dnl If dbi was not chosen, let the comment in file
1770    uncomment_dbi="#"  
1771 fi
1772
1773 AC_SUBST(uncomment_dbi)
1774
1775 if test $support_batch_insert = yes ; then
1776    AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
1777 fi
1778
1779 AC_DEFINE(PROTOTYPES)
1780
1781 dnl --------------------------------------------------------------------------
1782 dnl Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1783 dnl
1784 if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1785    if test -z "$CCOPTS"; then
1786       CCOPTS='-g -O2 -Wall'
1787    fi
1788    CFLAGS="$CCOPTS"
1789 fi
1790
1791 dnl A few others 
1792 AC_EXEEXT
1793
1794 dnl See if we can use 64 bit file addresses
1795 largefile_support="no"
1796 AC_BAC_LARGEFILE
1797
1798 AC_PATH_XTRA
1799
1800 dnl --------------------------------------------------------------------------
1801 dnl CHECKING FOR HEADER FILES
1802 dnl --------------------------------------------------------------------------
1803 AC_CHECK_HEADERS( \
1804    assert.h \
1805    fcntl.h \
1806    grp.h \
1807    pwd.h \
1808    libc.h \
1809    limits.h \
1810    stdarg.h \
1811    stdlib.h \
1812    stdint.h \
1813    string.h \
1814    strings.h \
1815    termios.h \
1816    termcap.h \
1817    term.h \
1818    unistd.h \
1819    sys/bitypes.h \
1820    sys/byteorder.h \
1821    sys/ioctl.h \
1822    sys/select.h \
1823    sys/socket.h \
1824    sys/sockio.h \
1825    sys/stat.h \
1826    sys/time.h \
1827    sys/types.h \
1828    arpa/nameser.h \
1829    mtio.h \
1830    sys/mtio.h \
1831    sys/tape.h \
1832    regex.h \
1833 )
1834 AC_HEADER_STDC
1835 AC_HEADER_MAJOR
1836 AC_HEADER_DIRENT
1837 AC_HEADER_STAT
1838 AC_HEADER_SYS_WAIT
1839 AC_HEADER_TIME
1840 AC_STRUCT_ST_BLKSIZE
1841 AC_STRUCT_ST_BLOCKS
1842 AC_STRUCT_TIMEZONE
1843
1844 dnl --------------------------------------------------------------------------
1845 dnl Check for utime.h structure 
1846 dnl --------------------------------------------------------------------------
1847 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1848    [
1849        AC_TRY_COMPILE(
1850           [
1851               #include <sys/types.h>
1852               #include <utime.h>
1853           ], [
1854               struct utimbuf foo
1855           ], [
1856               ba_cv_header_utime_h=yes
1857           ], [
1858               ba_cv_header_utime_h=no
1859           ]
1860        )
1861    ]
1862 )
1863 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])
1864
1865 dnl --------------------------------------------------------------------------
1866 dnl Check for socklen_t
1867 dnl --------------------------------------------------------------------------
1868 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1869    [
1870        AC_TRY_COMPILE(
1871           [
1872               #include <sys/types.h>
1873               #include <sys/socket.h>
1874           ], [
1875               socklen_t x
1876           ], [
1877              ba_cv_header_socklen_t=yes
1878           ], [
1879              ba_cv_header_socklen_t=no
1880           ]
1881        )
1882    ]
1883 )
1884 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T, 1, [Set if socklen_t exists])
1885
1886 dnl --------------------------------------------------------------------------
1887 dnl Check for ioctl request type
1888 dnl --------------------------------------------------------------------------
1889 AC_LANG(C++)
1890 AC_CACHE_CHECK(for ioctl_req_t, ba_cv_header_ioctl_req_t,
1891    [
1892        AC_TRY_COMPILE(
1893           [
1894               #include <unistd.h>
1895               #include <sys/types.h>
1896               #include <sys/ioctl.h>
1897           ], [
1898               int (*d_ioctl)(int fd, unsigned long int request, ...);
1899               d_ioctl = ::ioctl;
1900           ], [
1901              ba_cv_header_ioctl_req_t=yes
1902           ], [
1903              ba_cv_header_ioctl_req_t=no
1904           ]
1905        )
1906    ]
1907 )
1908 test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [Set if ioctl request is unsigned long int])
1909
1910 dnl Note: it is more correct to use AC_LANG(C++) but some of the older
1911 dnl   *BSD systems still use old style C prototypes, which are wrong with
1912 dnl   compiled with a C++ compiler. 
1913 AC_LANG(C)
1914
1915 dnl --------------------------------------------------------------------------
1916 dnl Check for typeof()
1917 dnl --------------------------------------------------------------------------
1918 AC_LANG_PUSH(C++)
1919 AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
1920    [
1921        AC_TRY_RUN(
1922           [
1923               main(){char *a = 0; a = (typeof a)a;}
1924           ], [
1925               ba_cv_have_typeof=yes
1926           ], [
1927               ba_cv_have_typeof=no
1928           ], [
1929               ba_cv_have_typeof=no
1930           ]
1931        )
1932    ]
1933 )
1934 test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
1935 AC_LANG_POP(C++)
1936
1937 AC_C_CONST
1938
1939 dnl --------------------------------------------------------------------------
1940 dnl CHECKING FOR FILESYSTEM TYPE
1941 dnl --------------------------------------------------------------------------
1942 AC_MSG_CHECKING(how to get filesystem type)
1943 fstype=no
1944 # The order of these tests is important.
1945 AC_TRY_CPP(
1946    [
1947        #include <sys/statvfs.h>
1948        #include <sys/fstyp.h>
1949    ],
1950    AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4
1951 )
1952 if test $fstype = no; then
1953    AC_TRY_CPP(
1954       [
1955           #include <sys/statfs.h>
1956           #include <sys/fstyp.h>
1957       ],
1958       AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3
1959    )
1960 fi
1961 if test $fstype = no; then
1962    AC_TRY_CPP(
1963       [
1964           #include <sys/statfs.h>
1965           #include <sys/vmount.h>
1966       ],
1967       AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX
1968    )
1969 fi
1970 if test $fstype = no; then  
1971    AC_TRY_CPP(
1972       [
1973           #include <mntent.h>
1974       ],
1975       AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD
1976    )
1977 fi
1978 if test $fstype = no; then  
1979    AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1980 fi
1981 if test $fstype = no; then  
1982    AC_TRY_CPP(
1983       [
1984           #include <sys/mount.h>
1985           #include <sys/fs_types.h>
1986       ],
1987       AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix
1988    )
1989 fi
1990 AC_MSG_RESULT($fstype)
1991
1992 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
1993
1994 dnl --------------------------------------------------------------------------
1995 dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
1996 dnl --------------------------------------------------------------------------
1997 AC_TYPE_SIGNAL
1998 SIGNAL_CHECK
1999 AC_TYPE_MODE_T
2000 AC_TYPE_UID_T
2001 AC_TYPE_SIZE_T
2002 AC_TYPE_PID_T
2003 AC_TYPE_OFF_T
2004 AC_TYPE_INTPTR_T
2005 AC_TYPE_UINTPTR_T
2006 AC_CHECK_TYPE(ino_t, unsigned long)
2007 AC_CHECK_TYPE(dev_t, unsigned long)
2008 AC_CHECK_TYPE(daddr_t, long)
2009 AC_CHECK_TYPE(major_t, int)
2010 AC_CHECK_TYPE(minor_t, int)
2011 AC_CHECK_TYPE(ssize_t, int)
2012 AC_STRUCT_ST_BLOCKS
2013 AC_STRUCT_ST_RDEV
2014 AC_STRUCT_TM
2015 AC_C_CONST
2016
2017 AC_CHECK_SIZEOF(char, 1)
2018 AC_CHECK_SIZEOF(short int, 2)
2019 AC_CHECK_SIZEOF(int, 4)
2020 AC_CHECK_SIZEOF(long int, 4)
2021 AC_CHECK_SIZEOF(long long int, 8)
2022 AC_CHECK_SIZEOF(int *, 4)
2023
2024 dnl Check for sys/types.h types
2025 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int,
2026    [
2027        AC_TRY_COMPILE(
2028           [
2029               #include <sys/types.h>
2030           ], [
2031               u_int a; a = 1;
2032           ], [
2033               ac_cv_have_u_int="yes"
2034           ], [
2035               ac_cv_have_u_int="no"
2036           ]
2037        )
2038    ]
2039 )
2040 if test "x$ac_cv_have_u_int" = "xyes" ; then
2041    AC_DEFINE(HAVE_U_INT)
2042    have_u_int=1
2043 fi
2044
2045 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t,
2046    [
2047        AC_TRY_COMPILE(
2048           [
2049               #include <sys/types.h>
2050           ], [
2051               intmax_t a; a = 1;
2052           ], [
2053               ac_cv_have_intmax_t="yes"
2054           ], [ 
2055               AC_TRY_COMPILE(
2056                  [
2057                      #include <stdint.h>
2058                  ], [
2059                      intmax_t a; a = 1;
2060                  ], [
2061                      ac_cv_have_intmax_t="yes"
2062                  ], [
2063                      ac_cv_have_intmax_t="no"
2064                  ]
2065               )
2066           ]
2067        )       
2068    ]
2069 )
2070 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
2071    AC_DEFINE(HAVE_INTMAX_T)
2072    have_intmax_t=1
2073 fi
2074
2075 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t,
2076    [
2077        AC_TRY_COMPILE(
2078           [
2079               #include <sys/types.h>
2080           ], [
2081               u_intmax_t a; a = 1;
2082           ], [
2083               ac_cv_have_u_intmax_t="yes"
2084           ], [ 
2085               AC_TRY_COMPILE(
2086                  [
2087                      #include <stdint.h>
2088                  ], [
2089                     u_intmax_t a; a = 1;
2090                  ], [
2091                     ac_cv_have_u_intmax_t="yes"
2092                  ], [
2093                     ac_cv_have_u_intmax_t="no"
2094                  ]
2095               )
2096           ]
2097        )
2098    ]
2099 )
2100 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
2101    AC_DEFINE(HAVE_U_INTMAX_T)
2102    have_u_intmax_t=1
2103 fi
2104
2105 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t,
2106    [
2107        AC_TRY_COMPILE(
2108           [
2109               #include <sys/types.h>
2110           ], [
2111               int8_t a; int16_t b; int32_t c; a = b = c = 1;
2112           ], [
2113               ac_cv_have_intxx_t="yes"
2114           ], [
2115               ac_cv_have_intxx_t="no"
2116           ]
2117        )
2118    ]
2119 )
2120 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2121    AC_DEFINE(HAVE_INTXX_T)
2122    have_intxx_t=1
2123 fi
2124    
2125 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t,
2126    [
2127        AC_TRY_COMPILE(
2128           [
2129               #include <sys/types.h>
2130           ], [
2131               int64_t a; a = 1;
2132           ], [
2133               ac_cv_have_int64_t="yes"
2134           ], [
2135               ac_cv_have_int64_t="no"
2136           ]
2137        )
2138    ]
2139 )
2140 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2141    AC_DEFINE(HAVE_INT64_T)
2142    have_int64_t=1
2143 fi
2144    
2145 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t,
2146    [
2147        AC_TRY_COMPILE(
2148           [
2149               #include <sys/types.h>
2150           ], [
2151               u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;
2152           ], [
2153              ac_cv_have_u_intxx_t="yes"
2154           ], [
2155              ac_cv_have_u_intxx_t="no"
2156           ]
2157        )
2158    ]
2159 )
2160 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2161    AC_DEFINE(HAVE_U_INTXX_T)
2162    have_u_intxx_t=1
2163 fi
2164
2165 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t,
2166    [
2167        AC_TRY_COMPILE(
2168           [
2169               #include <sys/types.h>
2170           ], [
2171               u_int64_t a; a = 1;
2172           ], [
2173              ac_cv_have_u_int64_t="yes"
2174           ], [
2175              ac_cv_have_u_int64_t="no"
2176           ]
2177        )
2178    ]
2179 )
2180 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2181    AC_DEFINE(HAVE_U_INT64_T)
2182    have_u_int64_t=1
2183 fi
2184
2185 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2186     test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2187 then
2188    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2189    AC_TRY_COMPILE(
2190       [
2191           #include <sys/bitypes.h>
2192       ], [
2193           int8_t a; int16_t b; int32_t c;
2194           u_int8_t e; u_int16_t f; u_int32_t g;
2195           a = b = c = e = f = g = 1;
2196       ], [
2197           AC_DEFINE(HAVE_U_INTXX_T)
2198           AC_DEFINE(HAVE_INTXX_T)
2199           AC_DEFINE(HAVE_SYS_BITYPES_H)
2200           AC_MSG_RESULT(yes)
2201       ], [
2202           AC_MSG_RESULT(no)
2203       ]
2204    ) 
2205 fi
2206
2207 if test -z "$have_u_intxx_t" ; then
2208    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t,
2209       [
2210           AC_TRY_COMPILE(
2211              [
2212                  #include <sys/types.h>
2213              ], [
2214                  uint8_t a; uint16_t b; 
2215                  uint32_t c; a = b = c = 1;
2216              ], [
2217                 ac_cv_have_uintxx_t="yes"
2218              ], [
2219                 ac_cv_have_uintxx_t="no"
2220              ]
2221           )
2222       ]
2223    )
2224    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2225       AC_DEFINE(HAVE_UINTXX_T)
2226    fi
2227 fi
2228
2229 if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
2230     test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2231 then
2232    AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
2233    AC_TRY_COMPILE(
2234       [
2235           #include <sys/bitypes.h>
2236       ], [
2237           int64_t a; u_int64_t b; 
2238           a = b = 1;
2239       ], [
2240           AC_DEFINE(HAVE_U_INT64_T)
2241           AC_DEFINE(HAVE_INT64_T)
2242           AC_MSG_RESULT(yes)
2243       ], [
2244           AC_MSG_RESULT(no)
2245       ]
2246    ) 
2247 fi
2248
2249 if (test -z "$have_uintxx_t" && \
2250     test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2251 then
2252    AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
2253    AC_TRY_COMPILE(
2254       [
2255           #include <sys/bitypes.h>
2256       ], [
2257           uint8_t a; uint16_t b; 
2258           uint32_t c; a = b = c = 1;
2259       ], [
2260           AC_DEFINE(HAVE_UINTXX_T)
2261           AC_MSG_RESULT(yes)
2262       ], [
2263           AC_MSG_RESULT(no)
2264       ]
2265    ) 
2266 fi
2267
2268 dnl --------------------------------------------------------------------------
2269 dnl CHECKING FOR REQUIRED LIBRARY FUNCTIONS
2270 dnl --------------------------------------------------------------------------
2271 AC_CHECK_FUNCS( \
2272    fork \
2273    getcwd \
2274    gethostname \
2275    getpid \
2276    gettimeofday \
2277    setpgid \
2278    setpgrp \
2279    setsid \
2280    signal \
2281    strerror \
2282    strncmp \
2283    strncpy \
2284    vfprintf \
2285    ,,
2286    [echo 'configure: cannot find needed function.'; exit 1]
2287 )
2288
2289 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
2290 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
2291 AC_CHECK_FUNCS(posix_fadvise)
2292 AC_CHECK_FUNCS(fdatasync)
2293
2294 AC_CHECK_FUNCS(chflags) 
2295
2296 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
2297
2298 AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
2299    [
2300        AC_TRY_LINK(
2301           [
2302               #include <stdarg.h>
2303               void use_va_copy(va_list args){va_list args2; va_copy(args2,args); va_end(args2);}
2304               void call_use_va_copy(int junk,...){va_list args; va_start(args,junk); use_va_copy(args); va_end(args);}
2305           ], [
2306               call_use_va_copy(1,2,3)
2307           ], [
2308               ba_cv_va_copy=yes,
2309           ], [
2310               ba_cv_va_copy=no
2311           ]
2312        )
2313    ]
2314 )
2315 test $ba_cv_va_copy = yes && AC_DEFINE(HAVE_VA_COPY, 1, [Set if va_copy exists])
2316
2317 dnl --------------------------------------------------------------------------
2318 dnl CHECKING FOR THREAD SAFE FUNCTIONS
2319 dnl --------------------------------------------------------------------------
2320 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
2321
2322 # If resolver functions are not in libc check for -lnsl or -lresolv.
2323 AC_CHECK_FUNC(gethostbyname_r,
2324     AC_MSG_RESULT(using libc's resolver),
2325     AC_CHECK_LIB(nsl,gethostbyname_r)
2326     AC_CHECK_LIB(resolv,gethostbyname_r))
2327
2328 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
2329 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
2330 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
2331
2332 dnl ----------------------------
2333 dnl check sa_len of sockaddr
2334 dnl ----------------------------
2335 AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
2336    [
2337        AC_TRY_COMPILE(
2338           [
2339               #include <sys/socket.h>
2340           ], [
2341               struct sockaddr s; s.sa_len;
2342           ], [
2343              ac_cv_struct_sockaddr_sa_len=yes
2344           ], [ac_cv_struct_sockaddr_sa_len=no
2345           ]
2346        )
2347    ]
2348 )
2349
2350 if test $ac_cv_struct_sockaddr_sa_len = yes; then
2351   AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
2352 fi
2353
2354 AC_FUNC_STRFTIME
2355 AC_FUNC_VPRINTF
2356 AC_FUNC_ALLOCA
2357 AC_FUNC_GETMNTENT
2358 AC_FUNC_CLOSEDIR_VOID
2359 AC_FUNC_SETPGRP             dnl check for BSD setpgrp.
2360 # AC_FUNC_FNMATCH    dnl use local version
2361
2362 AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
2363
2364 AC_CHECK_LIB(sun, getpwnam)
2365
2366 AC_CHECK_HEADERS(zlib.h)
2367 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
2368 have_zlib=no
2369 if test x$FDLIBS = x-lz; then
2370    AC_DEFINE(HAVE_LIBZ)
2371    have_zlib=yes
2372 fi
2373
2374 dnl
2375 dnl Check for ACL support and libraries
2376 dnl
2377 support_acl=auto
2378 AC_ARG_ENABLE(acl,
2379    AC_HELP_STRING([--disable-acl], [disable acl support @<:@default=auto@:>@]),
2380    [
2381        if test x$enableval = xyes; then
2382           support_acl=yes
2383        elif test x$enableval = xno; then
2384           support_acl=no
2385        fi
2386    ]
2387 )
2388
2389 have_acl=no
2390 have_extended_acl=no
2391 if test x$support_acl = xyes -o x$support_acl = xauto; then
2392    AC_CHECK_HEADER(sys/acl.h, [ AC_DEFINE(HAVE_SYS_ACL_H,1,[Defines if your system have the sys/acl.h header file])] , )
2393    AC_CHECK_FUNC(acl_get_file,
2394       [
2395           have_acl=yes
2396       ], [
2397           AC_CHECK_LIB(acl, acl_get_file,
2398              [
2399                  have_acl=yes;
2400                  FDLIBS="-lacl $FDLIBS"
2401              ], [
2402                  AC_CHECK_LIB(pacl, acl_get_file,
2403                     [
2404                         have_acl=yes;
2405                         FDLIBS="-lpacl $FDLIBS"
2406                     ], [
2407                         AC_CHECK_LIB(sec, acltotext,
2408                            [
2409                                have_acl=yes;
2410                                FDLIBS="-lsec $FDLIBS"
2411
2412                                AC_CHECK_LIB(sec, acl_totext,
2413                                   [
2414                                       have_extended_acl=yes
2415                                   ]
2416                                )
2417                            ]
2418                         )
2419                     ]
2420                  )
2421              ]
2422           )
2423       ]
2424    )
2425
2426    if test x$support_acl = xyes -a $have_acl != yes; then
2427       AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found, 
2428   please either load the acl libraries or rerun configure without --enable-acl])
2429    else
2430       if test $have_acl = yes; then
2431          AC_DEFINE([HAVE_ACL],1,[Normal acl support])
2432       fi
2433
2434       if test $have_extended_acl = yes; then
2435          AC_DEFINE([HAVE_EXTENDED_ACL],1,[Extended acl support])
2436       fi
2437    fi
2438 fi
2439
2440 dnl
2441 dnl Check for XATTR support
2442 dnl
2443 support_xattr=auto
2444 AC_ARG_ENABLE(xattr,
2445    AC_HELP_STRING([--disable-xattr], [disable xattr support @<:@default=auto@:>@]),
2446    [
2447        if test x$enableval = xyes; then
2448           support_xattr=yes
2449        elif test x$enableval = xno; then
2450           support_xattr=no
2451        fi
2452    ]
2453 )
2454
2455 have_xattr=no
2456 if test x$support_xattr = xyes -o x$support_xattr = xauto; then
2457    dnl
2458    dnl First check for *BSD support
2459    dnl
2460    AC_CHECK_HEADER(sys/extattr.h, [ AC_DEFINE(HAVE_SYS_EXTATTR_H,1,[Defines if your system have the sys/extattr.h header file])] , )
2461    AC_CHECK_HEADER(libutil.h, [ AC_DEFINE(HAVE_LIBUTIL_H,1,[Defines if your system have the libutil.h header file])] , )
2462    AC_CHECK_FUNCS(extattr_get_link extattr_set_link extattr_list_link,
2463       [
2464           have_xattr=yes
2465           AC_DEFINE([HAVE_EXTATTR_GET_LINK],1,[Define to 1 if you have the 'extattr_get_link' function.])
2466           AC_DEFINE([HAVE_EXTATTR_SET_LINK],1,[Define to 1 if you have the 'extattr_set_link' function.])
2467           AC_DEFINE([HAVE_EXTATTR_LIST_LINK],1,[Define to 1 if you have the 'extattr_list_link' function.])
2468       ]
2469    )
2470    
2471    if test $have_xattr = no; then
2472       AC_CHECK_FUNCS(extattr_get_file extattr_set_file extattr_list_file,
2473          [
2474              have_xattr=yes
2475              AC_DEFINE([HAVE_EXTATTR_GET_FILE],1,[Define to 1 if you have the 'extattr_get_file' function.])
2476              AC_DEFINE([HAVE_EXTATTR_SET_FILE],1,[Define to 1 if you have the 'extattr_set_file' function.])
2477              AC_DEFINE([HAVE_EXTATTR_LIST_FILE],1,[Define to 1 if you have the 'extattr_list_file' function.])
2478          ]
2479       )
2480    fi
2481    
2482    if test $have_xattr = yes; then
2483       have_extattr_string_in_libc=no
2484       AC_CHECK_FUNCS(extattr_namespace_to_string extattr_string_to_namespace,
2485          [
2486              have_extattr_string_in_libc=yes
2487              AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
2488              AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
2489          ]
2490       )
2491
2492       dnl
2493       dnl If extattr_namespace_to_string and extattr_string_to_namespace are not in libc see if they are in libutil
2494       dnl
2495       if test $have_extattr_string_in_libc = no; then
2496          AC_CHECK_LIB(util, extattr_namespace_to_string extattr_string_to_namespace,
2497             [
2498                 AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
2499                 AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
2500                 FDLIBS="-lutil $FDLIBS"
2501             ]
2502          )
2503       fi
2504    fi
2505
2506    dnl
2507    dnl If we failed to find *BSD support try the Linux or OSX implementation of xattr
2508    dnl
2509    if test $have_xattr = no; then
2510       AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , )
2511       AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr,
2512          [
2513              have_xattr=yes
2514              AC_DEFINE([HAVE_LLISTXATTR],1,[Define to 1 if you have the 'llistxattr' function.])
2515              AC_DEFINE([HAVE_LGETXATTR],1,[Define to 1 if you have the 'lgetxattr' function.])
2516              AC_DEFINE([HAVE_LSETXATTR],1,[Define to 1 if you have the 'lsetxattr' function.])
2517          ]
2518       )
2519
2520       if test $have_xattr = no; then
2521          AC_CHECK_FUNCS(listxattr getxattr setxattr,
2522             [
2523                 have_xattr=yes
2524                 AC_DEFINE([HAVE_LISTXATTR],1,[Define to 1 if you have the 'listxattr' function.])
2525                 AC_DEFINE([HAVE_GETXATTR],1,[Define to 1 if you have the 'getxattr' function.])
2526                 AC_DEFINE([HAVE_SETXATTR],1,[Define to 1 if you have the 'setxattr' function.])
2527             ]
2528          )
2529       fi
2530    fi
2531
2532    dnl
2533    dnl If we failed to find *BSD support and the Linux or OSX implementation of xattr try the Solaris xattr implementation
2534    dnl
2535    if test $have_xattr = no; then
2536       AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , )
2537       AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , )
2538       AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , )
2539
2540       AC_CHECK_FUNCS(openat fstatat unlinkat fchownat futimesat,
2541          [
2542              have_xattr=yes
2543              AC_DEFINE([HAVE_OPENAT],1,[Define to 1 if you have the 'openat' function.])
2544              AC_DEFINE([HAVE_FSTATAT],1,[Define to 1 if you have the 'fstatat' function.])
2545              AC_DEFINE([HAVE_UNLINKAT],1,[Define to 1 if you have the 'unlinkat' function.])
2546              AC_DEFINE([HAVE_FCHOWNAT],1,[Define to 1 if you have the 'fchownat' function.])
2547              AC_DEFINE([HAVE_FUTIMESAT],1,[Define to 1 if you have the 'futimesat' function.])
2548          ]
2549       )
2550
2551       if test $have_xattr = yes; then
2552          AC_CHECK_LIB(nvpair, nvlist_next_nvpair,
2553             [
2554                 AC_DEFINE([HAVE_NVLIST_NEXT_NVPAIR],1,[Define to 1 if you have the 'nvlist_next_nvpair' function.])
2555                 FDLIBS="-lnvpair $FDLIBS"
2556             ]
2557          )
2558       fi
2559    fi
2560
2561    if test x$support_xattr = xyes -a $have_xattr != yes; then
2562       AC_MSG_ERROR([xattr support explicitly enabled but no supported xattr implementation found, 
2563   please either load the xattr libraries or rerun configure without --enable-xattr])
2564    else
2565       if test $have_xattr = yes; then
2566          AC_DEFINE([HAVE_XATTR],1,[Extended Attributes support])
2567       fi
2568    fi
2569 fi
2570
2571 dnl
2572 dnl Check for pthread libraries
2573 dnl
2574 PTHREAD_LIB=""
2575 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
2576    [
2577        AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
2578           [
2579               AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
2580                  [
2581                      AC_CHECK_FUNC(pthread_create)
2582                  ]
2583               )
2584           ]
2585        )
2586    ]
2587 )
2588
2589 dnl
2590 dnl Check for headers, functions and libraries required to support
2591 dnl keeping readall capabilities
2592 dnl
2593 AC_CHECK_HEADERS(sys/prctl.h sys/capability.h)
2594 AC_CHECK_FUNCS(prctl setreuid)
2595 AC_CHECK_LIB([cap], [cap_set_proc], [CAP_LIBS="-lcap"], [CAP_LIBS=])
2596 if test x$CAP_LIBS = x-lcap; then
2597    AC_DEFINE(HAVE_LIBCAP, 1, [Define if you have libcap])
2598 fi
2599 AC_SUBST(CAP_LIBS)
2600
2601 AC_SUBST(FDLIBS)
2602 AC_DEFINE(FDLIBS)
2603
2604 CFLAGS=${CFLAGS--O}
2605
2606 if test x$have_gcc = xyes ; then
2607    CPPFLAGS="$CPPFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
2608    CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
2609 fi
2610 LDFLAGS=${LDFLAGS--O}
2611 DB_LIBS="${SQL_LFLAGS}"
2612 CPPFLAGS="$CPPFLAGS"
2613 CFLAGS="$CFLAGS"
2614 AC_SUBST(DEBUG)
2615 AC_SUBST(DINCLUDE)
2616 AC_SUBST(CFLAGS)
2617 AC_SUBST(CPPFLAGS)
2618 AC_SUBST(LDFLAGS)
2619 AC_SUBST(X_CFLAGS)
2620 AC_SUBST(DEFS)
2621 AC_SUBST(LIBS)
2622 AC_SUBST(DLIB)
2623 AC_SUBST(DB_LIBS)
2624 AC_SUBST(X_LIBS)
2625 AC_SUBST(X_EXTRA_LIBS)
2626 AC_SUBST(WCFLAGS)
2627 AC_SUBST(WLDFLAGS)
2628 AC_SUBST(WRAPLIBS)
2629
2630 dnl extra configurable objects
2631 OBJLIST=
2632 AC_SUBST(OBJLIST)
2633
2634 lld="lld"
2635 llu="llu"
2636
2637 WCFLAGS=
2638 WLDFLAGS=
2639
2640 dnl
2641 dnl Finally we set appropriate distribution specific
2642 dnl  variables and defaults
2643 dnl
2644 dnl PFILES are platform specific files
2645 PFILES="platforms/Makefile"
2646 PSCMD="ps -e"
2647 WIN32=
2648 MACOSX=
2649
2650 hostname=`uname -n | cut -d '.' -f 1`
2651 if test x${hostname} = x ; then
2652    hostname="localhost"
2653 fi
2654 dnl Make sure hostname is resolved
2655 ping -c 1 $hostname 2>/dev/null 1>/dev/null
2656 if test ! $? = 0; then
2657   hostname="localhost"
2658 fi
2659
2660 case "$DISTNAME" in
2661 aix)
2662    DISTVER=`uname -r`
2663    PSCMD="ps -e -o pid,comm"
2664    PFILES="${PFILES} \
2665       platforms/aix/Makefile"
2666    TAPEDRIVE="/dev/rmt0.1" 
2667   ;;     
2668 alpha)
2669    DISTVER=`uname -r`
2670    PTHREAD_LIB="-lpthread -lexc"
2671    if test "${CC}" = "gcc" ; then
2672       lld="lld"
2673       llu="llu"
2674    else
2675       lld="ld"
2676       llu="lu"
2677    fi
2678    TAPEDRIVE="/dev/nrmt0"
2679   ;;
2680 bsdi)
2681    DISTVER=`uname -a |awk '{print $3}'`
2682    TAPEDRIVE="/dev/nrmt0"
2683    PTHREAD_LIB="-pthread"
2684    CFLAGS="${CFLAGS} -pthread"
2685    PSCMD="ps -ax -o pid,command"
2686    lld="qd"
2687    llu="qu"
2688    PFILES="${PFILES} \
2689        platforms/bsdi/Makefile \
2690        platforms/bsdi/bacula-fd \
2691        platforms/bsdi/bacula-sd \
2692        platforms/bsdi/bacula-dir"
2693    largefile_support="yes"
2694   ;;
2695 cygwin)
2696    DISTVER=`uname -a |awk '{print $3}'`
2697    TAPEDRIVE="/dev/nrst0"
2698    WIN32=win32
2699    WCFLAGS="-mwindows"
2700    WLDFLAGS="-mwindows"
2701   ;;
2702 darwin)
2703    DISTVER=`uname -r`
2704    TAPEDRIVE="/dev/nst0"
2705    PSCMD="ps -e -o pid,command"
2706    MACOSX=macosx
2707    PFILES="${PFILES} \
2708       platforms/darwin/Makefile"
2709   ;;
2710 osx)
2711    DISTVER=`uname -r`
2712    TAPEDRIVE="/dev/nst0"
2713    PSCMD="ps -e -o pid,command"
2714    MACOSX=macosx
2715    PFILES="${PFILES} \
2716       platforms/osx/Makefile"
2717   ;;
2718 debian)
2719    if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
2720       DISTNAME="ubuntu"
2721    fi
2722    DISTVER=`cat /etc/debian_version`
2723    if test -f /etc/lsb-release ; then
2724       . /etc/lsb-release
2725       if test "x$DISTRIB_ID" != "x" ; then
2726          DISTNAME=$DISTRIB_ID
2727       fi
2728       if test "x$DISTRIB_RELEASE" != "x" ; then
2729          DISTVER=$DISTRIB_RELEASE
2730       fi
2731    fi
2732    if test "$DISTNAME" = "Ubuntu" ; then
2733       DISTNAME="ubuntu"
2734    fi
2735    TAPEDRIVE="/dev/nst0"
2736    PSCMD="ps -e -o pid,command"
2737    if test "$DISTNAME" = "ubuntu" ; then
2738       PFILES="${PFILES} \
2739          platforms/ubuntu/Makefile \
2740          platforms/ubuntu/bacula-fd \
2741          platforms/ubuntu/bacula-sd \
2742          platforms/ubuntu/bacula-dir"
2743    else 
2744       PFILES="${PFILES} \
2745          platforms/debian/Makefile \
2746          platforms/debian/bacula-fd \
2747          platforms/debian/bacula-sd \
2748          platforms/debian/bacula-dir"
2749    fi
2750   ;;
2751 freebsd)
2752    DISTVER=`uname -a |awk '{print $3}'`
2753    VER=`echo $DISTVER | cut -c 1`
2754    if test x$VER = x4 ; then
2755       PTHREAD_LIB="${PTHREAD_LIBS:--pthread}"
2756       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS:--pthread}"
2757    fi
2758    lld="qd"
2759    llu="qu"
2760    TAPEDRIVE="/dev/nrsa0"
2761    PSCMD="ps -ax -o pid,command"
2762    PFILES="${PFILES} \
2763        platforms/freebsd/Makefile \
2764        platforms/freebsd/bacula-fd \
2765        platforms/freebsd/bacula-sd \
2766        platforms/freebsd/bacula-dir"
2767    largefile_support="yes"
2768   ;;
2769 hpux)
2770    PSCMD="UNIX95=1; ps -e -o pid,comm"
2771    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
2772    DISTVER=`uname -r`
2773    TAPEDRIVE="/dev/rmt/0hnb"
2774    PTHREAD_LIB="-lpthread"
2775    AC_DEFINE([_INCLUDE_LONGLONG])
2776   ;;
2777 irix)
2778    DISTVER=`uname -r`
2779    TAPEDRIVE="/dev/rmt/0cbn"
2780    PSCMD="ps -e -o pid,comm"
2781    PFILES="${PFILES} \
2782        platforms/irix/Makefile \
2783        platforms/irix/bacula-fd \
2784        platforms/irix/bacula-sd \
2785        platforms/irix/bacula-dir"
2786   ;;
2787 netbsd)
2788    DISTVER=`uname -a |awk '{print $3}'`
2789    lld="qd"
2790    llu="qu"
2791    TAPEDRIVE="/dev/nrst0"
2792    PSCMD="ps -ax -o pid,command"
2793    PTHREAD_LIB="-pthread"
2794    CFLAGS="${CFLAGS} -pthread"
2795   ;;
2796 openbsd)
2797    DISTVER=`uname -a |awk '{print $3}'`
2798    lld="qd"
2799    llu="qu"
2800    TAPEDRIVE="/dev/nrst0"
2801    PSCMD="ps -ax -o pid,command"
2802    PTHREAD_LIB="-pthread"
2803    CFLAGS="${CFLAGS} -pthread"
2804    PFILES="${PFILES} \
2805        platforms/openbsd/Makefile \
2806        platforms/openbsd/bacula-fd \
2807        platforms/openbsd/bacula-sd \
2808        platforms/openbsd/bacula-dir"
2809   ;;
2810 redhat)
2811    if test -f /etc/whitebox-release ; then
2812       f=/etc/whitebox-release
2813    else
2814       f=/etc/redhat-release
2815    fi
2816    if test `cat $f | grep release |\
2817          cut -f 3 -d ' '`x = "Enterprise"x ; then
2818       DISTVER="Enterprise "`cat $f | grep release |\
2819           cut -f 6 -d ' '`
2820    else
2821        DISTVER=`cat /etc/redhat-release | grep release |\
2822            cut -f 5 -d ' '`
2823    fi
2824    TAPEDRIVE="/dev/nst0"
2825    PSCMD="ps -e -o pid,command"
2826    PFILES="${PFILES} \
2827        platforms/redhat/Makefile \
2828        platforms/redhat/bacula-fd \
2829        platforms/redhat/bacula-sd \
2830        platforms/redhat/bacula-dir
2831        "
2832   ;;
2833 mandrake)
2834    DISTVER=`cat /etc/mandrake-release | grep release |\
2835       cut -f 5 -d ' '`
2836    TAPEDRIVE="/dev/nst0"
2837    PSCMD="ps -e -o pid,command"
2838    PFILES="${PFILES} \
2839        platforms/mandrake/Makefile \
2840        platforms/mandrake/bacula-fd \
2841        platforms/mandrake/bacula-sd \
2842        platforms/mandrake/bacula-dir \
2843        platforms/mandrake/bacula.spec \
2844        "
2845   ;;
2846 gentoo)
2847    DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
2848    TAPEDRIVE="/dev/nst0"
2849    PSCMD="ps -e -o pid,command"
2850    PFILES="${PFILES} \
2851        platforms/gentoo/Makefile \
2852     platforms/gentoo/bacula-init \
2853        platforms/gentoo/bacula-fd \
2854        platforms/gentoo/bacula-sd \
2855        platforms/gentoo/bacula-dir"
2856   ;;
2857 slackware)
2858    DISTVER=`cat /etc/slackware-version`
2859    TAPEDRIVE="/dev/nst0"
2860    PSCMD="ps -e -o pid,command"
2861    PFILES="${PFILES} \
2862        platforms/slackware/Makefile \
2863        platforms/slackware/rc.bacula-fd \
2864        platforms/slackware/rc.bacula-sd \
2865        platforms/slackware/rc.bacula-dir\
2866        platforms/slackware/functions.bacula"
2867   ;;
2868 solaris)
2869    DISTVER=`uname -r`
2870    TAPEDRIVE="/dev/rmt/0cbn"
2871    PSCMD="ps -e -o pid,comm"
2872    PFILES="${PFILES} \
2873        platforms/solaris/Makefile \
2874        platforms/solaris/bacula-fd \
2875        platforms/solaris/bacula-sd \
2876        platforms/solaris/bacula-dir"
2877    if test x$DISTVER = x5.6 ; then
2878        AC_DEFINE(HAVE_OLD_SOCKOPT)
2879    fi
2880    LIBS="$LIBS -lresolv"
2881   ;;
2882 suse)
2883    DISTVER=`cat /etc/SuSE-release |grep VERSION|\
2884        cut -f 3 -d ' '`
2885    TAPEDRIVE="/dev/nst0"
2886    PSCMD="ps -e -o pid,command"
2887    PFILES="${PFILES} \
2888        platforms/suse/Makefile \
2889        platforms/suse/bacula-fd \
2890        platforms/suse/bacula-sd \
2891        platforms/suse/bacula-dir \
2892        platforms/suse/bacula \
2893        platforms/suse/bacula.spec"
2894   ;;
2895 suse5)
2896    DISTNAME=suse
2897    DISTVER=5.x
2898    TAPEDRIVE="/dev/nst0"
2899    PSCMD="ps -e -o pid,command"
2900    PFILES="${PFILES} \
2901        platforms/suse/Makefile \
2902        platforms/suse/bacula-fd \
2903        platforms/suse/bacula-sd \
2904        platforms/suse/bacula-dir"
2905   ;;
2906 unknown)
2907    DISTVER=unknown
2908    TAPEDRIVE="/dev/nst0"
2909   ;;
2910 *)
2911   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
2912   ;;
2913 esac  
2914
2915 AC_SUBST(hostname)
2916
2917 LIBS="$PTHREAD_LIB $LIBS"
2918
2919 AC_DEFINE_UNQUOTED(lld, "$lld")
2920 AC_DEFINE_UNQUOTED(llu, "$llu")
2921 AC_SUBST(TAPEDRIVE)
2922 AC_SUBST(PSCMD)
2923 AC_SUBST(WIN32)
2924 AC_SUBST(MACOSX)
2925 AC_SUBST(DISTNAME)
2926 AC_SUBST(DISTVER)
2927
2928 dnl common parts of the Makefile
2929 MCOMMON=./autoconf/Make.common
2930 AC_SUBST_FILE(MCOMMON)
2931
2932 dnl Insanity check
2933 if test "x${subsysdir}" = "x${sbindir}" ; then
2934    echo " "
2935    echo " "
2936    echo "You have set both --sbindir and --with-subsys-dir"
2937    echo "  equal to: ${subsysdir} "
2938    echo "This is not permitted. Please reconfigure."
2939    echo " "
2940    echo "Aborting configuration ..."
2941    echo " "
2942    echo " "
2943    exit 1
2944 fi 
2945
2946 AC_OUTPUT([autoconf/Make.common \
2947            Makefile \
2948            manpages/Makefile \
2949            scripts/startmysql \
2950            scripts/stopmysql \
2951            scripts/btraceback \
2952            scripts/startit \
2953            scripts/stopit \
2954            scripts/bconsole \
2955            scripts/gconsole \
2956            scripts/bacula \
2957            scripts/bacula-ctl-dir \
2958            scripts/bacula-ctl-fd \
2959            scripts/bacula-ctl-sd \
2960            scripts/devel_bacula \
2961            scripts/Makefile \
2962            scripts/logrotate \
2963            scripts/bacula.desktop.gnome1 \
2964            scripts/bacula.desktop.gnome2 \
2965            scripts/bacula.desktop.gnome1.consolehelper \
2966            scripts/bacula.desktop.gnome2.consolehelper \
2967            scripts/bacula.desktop.gnome1.xsu \
2968            scripts/bacula.desktop.gnome2.xsu \
2969            scripts/bgnome-console.console_apps \
2970            scripts/mtx-changer \
2971            scripts/disk-changer \
2972            scripts/dvd-handler \
2973            scripts/dvd-simulator \
2974            scripts/bacula-tray-monitor.desktop \
2975            scripts/logwatch/Makefile \
2976            scripts/logwatch/logfile.bacula.conf \
2977            scripts/wxconsole.console_apps \
2978            scripts/wxconsole.desktop.consolehelper \
2979            scripts/wxconsole.desktop.xsu \
2980            scripts/bat.desktop \
2981            scripts/bat.desktop.xsu \
2982            scripts/bat.desktop.consolehelper \
2983            scripts/bat.console_apps \
2984            src/Makefile \
2985            src/host.h \
2986            src/console/Makefile \
2987            src/console/bconsole.conf \
2988            src/qt-console/bat.conf \
2989            src/qt-console/bat.pro \
2990            src/qt-console/bat.pro.mingw32 \
2991            src/qt-console/install_conf_file \
2992            src/wx-console/Makefile \
2993            src/wx-console/bwx-console.conf \
2994            src/tray-monitor/Makefile \
2995            src/tray-monitor/tray-monitor.conf \
2996            src/dird/Makefile \
2997            src/dird/bacula-dir.conf \
2998            src/lib/Makefile \
2999            src/stored/Makefile \
3000            src/stored/bacula-sd.conf \
3001            src/filed/Makefile \
3002            src/filed/bacula-fd.conf \
3003            src/cats/Makefile \
3004            src/cats/make_catalog_backup.pl \
3005            src/cats/make_catalog_backup \
3006            src/cats/delete_catalog_backup \
3007            src/cats/create_postgresql_database \
3008            src/cats/update_postgresql_tables \
3009            src/cats/make_postgresql_tables \
3010            src/cats/grant_postgresql_privileges \
3011            src/cats/drop_postgresql_tables \
3012            src/cats/drop_postgresql_database \
3013            src/cats/create_mysql_database \
3014            src/cats/update_mysql_tables \
3015            src/cats/make_mysql_tables \
3016            src/cats/grant_mysql_privileges \
3017            src/cats/drop_mysql_tables \
3018            src/cats/drop_mysql_database \
3019            src/cats/create_sqlite3_database \
3020            src/cats/update_sqlite3_tables \
3021            src/cats/make_sqlite3_tables \
3022            src/cats/grant_sqlite3_privileges \
3023            src/cats/drop_sqlite3_tables \
3024            src/cats/drop_sqlite3_database \
3025            src/cats/create_ingres_database \
3026            src/cats/update_ingres_tables \
3027            src/cats/make_ingres_tables \
3028            src/cats/grant_ingres_privileges \
3029            src/cats/drop_ingres_tables \
3030            src/cats/drop_ingres_database \
3031            src/cats/sqlite \
3032            src/cats/mysql \
3033            src/cats/create_bdb_database \
3034            src/cats/update_bdb_tables \
3035            src/cats/make_bdb_tables \
3036            src/cats/grant_bdb_privileges \
3037            src/cats/drop_bdb_tables \
3038            src/cats/drop_bdb_database \
3039            src/cats/create_bacula_database \
3040            src/cats/update_bacula_tables \
3041            src/cats/grant_bacula_privileges \
3042            src/cats/make_bacula_tables \
3043            src/cats/drop_bacula_tables \
3044            src/cats/drop_bacula_database \
3045            src/findlib/Makefile \
3046            src/tools/Makefile \
3047            src/plugins/fd/Makefile \
3048            src/plugins/sd/Makefile \
3049            src/plugins/dir/Makefile \
3050            src/win32/Makefile.inc \
3051            po/Makefile.in \
3052            updatedb/update_mysql_tables_9_to_10 \
3053            updatedb/update_sqlite3_tables_9_to_10 \
3054            updatedb/update_postgresql_tables_9_to_10 \
3055            updatedb/update_mysql_tables_10_to_11 \
3056            updatedb/update_sqlite3_tables_10_to_11 \
3057            updatedb/update_postgresql_tables_10_to_11 \
3058            examples/nagios/check_bacula/Makefile \
3059            $PFILES ],  
3060      [ ]
3061 )
3062
3063 if test "${support_bat}" = "yes" ; then
3064    if test "x$QMAKE" = "xnone" && test "x$QMAKEQT4" = "xnone"; then
3065       AC_MSG_ERROR([Could not find qmake or qmake-qt4 in $PATH. Check your Qt installation])
3066    fi
3067
3068    QMAKEBIN="qmake"
3069
3070    if test "x$QMAKEQT4" != "xnone"; then
3071        QMAKEBIN=qmake-qt4
3072    fi
3073   
3074    cd src/qt-console
3075    echo "Creating bat Makefile"
3076    touch bat
3077    chmod 755 bat
3078    $QMAKEBIN
3079    ${MAKE:-make} clean
3080    cd ${BUILD_DIR}
3081 fi
3082
3083 dnl
3084 dnl if CC is gcc, we can rebuild the dependencies (since the depend rule
3085 dnl requires gcc).  If it's not, don't rebuild dependencies
3086 dnl
3087 if test X"$GCC" = "Xyes" ; then
3088   echo "Doing make of dependencies"
3089   ${MAKE:-make} depend
3090 fi
3091
3092 cd src/qt-console
3093 chmod 755 install_conf_file build-depkgs-qt-console
3094 cd ${BUILD_DIR}
3095
3096 cd scripts
3097 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
3098 chmod 755 dvd-handler dvd-simulator
3099 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
3100 cd ..
3101
3102 c=updatedb
3103 chmod 755 $c/update_mysql_tables_10_to_11   $c/update_sqlite3_tables_10_to_11
3104 chmod 755 $c/update_postgresql_tables_10_to_11
3105
3106 c=src/cats
3107
3108 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
3109 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
3110
3111 chmod 755 $c/create_bdb_database      $c/update_bdb_tables     $c/make_bdb_tables
3112 chmod 755 $c/grant_bdb_privileges     $c/drop_bdb_tables       $c/drop_bdb_database
3113
3114 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
3115 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
3116
3117 chmod 755 $c/create_sqlite3_database   $c/update_sqlite3_tables  $c/make_sqlite3_tables
3118 chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables    $c/drop_sqlite3_database
3119
3120 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
3121 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
3122
3123 chmod 755 $c/create_ingres_database  $c/update_ingres_tables $c/make_ingres_tables
3124 chmod 755 $c/grant_ingres_privileges $c/drop_ingres_tables   $c/drop_ingres_database
3125
3126
3127 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  $c/make_catalog_backup.pl
3128 chmod 755 $c/sqlite
3129 chmod 755 $c/mysql
3130
3131 chmod 755 src/win32/build-depkgs-mingw32
3132
3133 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
3134    largefile_support="yes"
3135 fi
3136
3137 dnl Only try to find out the version number of the compiler when we know its some kind of GCC compiler
3138 if test X"$GCC" = "Xyes" ; then
3139    dnl
3140    dnl A whole lot of hand springs to get the compiler version.
3141    dnl  This is because gcc changed the output in version 3.0
3142    dnl
3143    CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
3144    if test "x${CCVERSION}" = "x" ; then
3145       CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
3146    fi
3147    CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
3148    if test x"${CXXVERSION}" = x ; then
3149       CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
3150    fi
3151 fi
3152
3153 # clean up any old junk
3154 echo " "
3155 echo "Cleaning up"
3156 echo " "
3157 ${MAKE:-make} clean
3158
3159 if test "x${db_type}" = "xInternal" ; then
3160    echo " "
3161    echo " "
3162    echo "You have not specified either --enable-client-only or one of the"
3163    echo "  supported databases: MySQL, PostgreSQL, Ingres, SQLite3 or DBI."
3164    echo "  This is not permitted. Please reconfigure."
3165    echo " "
3166    echo "Aborting the configuration ..."
3167    echo " "
3168    echo " "
3169    exit 1
3170 fi
3171
3172 echo "
3173 Configuration on `date`:
3174
3175    Host:                    ${host}${post_host} -- ${DISTNAME} ${DISTVER}
3176    Bacula version:          ${BACULA} ${VERSION} (${DATE})
3177    Source code location:    ${srcdir}
3178    Install binaries:        ${sbindir}
3179    Install libraries:       ${libdir}
3180    Install config files:    ${sysconfdir}
3181    Scripts directory:       ${scriptdir}
3182    Archive directory:       ${archivedir}
3183    Working directory:       ${working_dir}
3184    PID directory:           ${piddir}
3185    Subsys directory:        ${subsysdir}
3186    Man directory:           ${mandir}
3187    Data directory:          ${datarootdir}
3188    Plugin directory:        ${plugindir}
3189    C Compiler:              ${CC} ${CCVERSION}
3190    C++ Compiler:            ${CXX} ${CXXVERSION}
3191    Compiler flags:          ${WCFLAGS} ${CFLAGS} 
3192    Linker flags:            ${WLDFLAGS} ${LDFLAGS}
3193    Libraries:               ${LIBS}
3194    Statically Linked Tools: ${support_static_tools}
3195    Statically Linked FD:    ${support_static_fd}
3196    Statically Linked SD:    ${support_static_sd}
3197    Statically Linked DIR:   ${support_static_dir}
3198    Statically Linked CONS:  ${support_static_cons}
3199    Database type:           ${db_type}
3200    Database port:           ${db_port}
3201    Database lib:            ${DB_LIBS}
3202    Database name:           ${db_name}
3203    Database user:           ${db_user}
3204  
3205    Job Output Email:        ${job_email}
3206    Traceback Email:         ${dump_email}
3207    SMTP Host Address:       ${smtp_host}
3208  
3209    Director Port:           ${dir_port}
3210    File daemon Port:        ${fd_port}
3211    Storage daemon Port:     ${sd_port}
3212  
3213    Director User:           ${dir_user}
3214    Director Group:          ${dir_group}
3215    Storage Daemon User:     ${sd_user}
3216    Storage DaemonGroup:     ${sd_group}
3217    File Daemon User:        ${fd_user}
3218    File Daemon Group:       ${fd_group}
3219  
3220    SQL binaries Directory   ${SQL_BINDIR}
3221  
3222    Large file support:      $largefile_support
3223    Bacula conio support:    ${got_conio} ${CONS_LIBS}
3224    readline support:        ${got_readline} ${PRTREADLINE_SRC}
3225    TCP Wrappers support:    ${TCPW_MSG} ${WRAPLIBS}
3226    TLS support:             ${support_tls}
3227    Encryption support:      ${support_crypto} 
3228    ZLIB support:            ${have_zlib}
3229    enable-smartalloc:       ${support_smartalloc} 
3230    enable-lockmgr:          ${support_lockmgr}
3231    bat support:             ${support_bat}
3232    enable-gnome:            ${support_gnome} ${gnome_version}
3233    enable-bwx-console:      ${support_wx_console} ${wx_version}
3234    enable-tray-monitor:     ${support_tray_monitor}
3235    client-only:             ${build_client_only}
3236    build-dird:              ${build_dird}
3237    build-stored:            ${build_stored}
3238    Plugin support:          ${have_plugins}
3239    ACL support:             ${have_acl}
3240    XATTR support:           ${have_xattr}
3241    Python support:          ${support_python} ${PYTHON_LIBS}
3242    Batch insert enabled:    ${support_batch_insert}
3243
3244   " > config.out
3245
3246 # create a small shell script useful for support with
3247 # configure options and config.out info
3248 cat > scripts/bacula_config << EOF
3249 #!/bin/sh
3250 cat << __EOC__
3251 $ $0 $ac_configure_args
3252 EOF
3253 cat config.out >> scripts/bacula_config
3254 echo __EOC__ >> scripts/bacula_config
3255 chmod 755 scripts/bacula_config
3256
3257 cat config.out
3258
3259 # Display a warning message if postgresql client lib is <= 8.1
3260 if test x$DB_TYPE = xpostgresql -a x$ac_cv_lib_pq_PQisthreadsafe != xyes \
3261         -a x$support_batch_insert = xyes
3262 then
3263         echo "WARNING: Your PostgreSQL client library is too old to detect "
3264         echo " if it was compiled with --enable-thread-safety, consider to"
3265         echo " upgrade it in order to avoid problems with Batch insert mode"
3266         echo
3267 fi