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