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