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