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