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