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