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