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