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