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