]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
- Integrate the majority of the Mingw cross-tools submission
[bacula/bacula] / bacula / autoconf / configure.in
1 lal#
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 require a recent autoconf
16 AC_PREREQ(2.59)
17
18
19 dnl search for true and false programs.
20 AC_PATH_PROGS(TRUEPRG, true, :)
21 AC_PATH_PROGS(FALSEPRG, false, :)
22
23 #AC_CANONICAL_HOST
24
25 dnl bacula version
26 VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
27 DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
28 LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
29 AC_SUBST(VERSION)dnl 
30 AC_SUBST(DATE)dnl 
31 AC_SUBST(LSMDATE)dnl 
32 echo "configuring for bacula $VERSION ($DATE)"
33
34
35 dnl -------------------------------------------------------
36 dnl# Check for compiler.
37 dnl ------------------------------------------------------
38
39 AC_PROG_CC
40 AC_PROG_CXX
41 AC_PROG_CC_C_O                  dnl Determine if C compiler support -c -o.
42 AC_PROG_GCC_TRADITIONAL         dnl Determine if ioctl() need -traditional.
43
44 if test "x$CC" = xgcc; then
45    AC_DEFINE(HAVE_GCC)
46 fi
47 AC_PATH_PROG(CXX, $CXX, $CXX)
48 if test ! -e $CXX; then
49    AC_MSG_ERROR(Unable to find C++ compiler)
50 fi
51
52 dnl -------------------------------------------------------
53 dnl# Check for programs.
54 dnl ------------------------------------------------------
55 AC_PROG_INSTALL
56 AC_PROG_RANLIB
57 AC_PATH_PROG(MV, mv, mv)
58 AC_PATH_PROG(RM, rm, rm)
59 AC_PATH_PROG(CP, cp, cp)
60 AC_PATH_PROG(SED, sed, sed)
61 AC_PATH_PROG(ECHO, echo, echo)
62 AC_PATH_PROG(CMP, cmp, cmp)
63 AC_PATH_PROG(TBL, tbl, tbl)
64 AC_PATH_PROG(AR, ar, ar)
65 dnl AC_PATH_PROG(RANLIB, ranlib, ranlib)
66 AC_PATH_PROG(OPENSSL, openssl, none)
67 AC_PATH_PROG(MTX, mtx, mtx)
68 AC_PATH_PROG(DD, dd, dd)
69 AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
70 AC_PATH_PROG(PYTHON, python, python)
71 AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
72 AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
73 AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
74 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
75 AC_ARG_VAR(WXCONFIG, [wx-config command. On some systems, you must set it to wx-config-2.6 to use wxWidgets 2.6.])
76 if test "x$WXCONFIG" = x; then
77   WXCONFIG=wx-config
78 fi
79 AC_PATH_PROG(WXCONFIG, ${WXCONFIG}, ${WXCONFIG})
80 AC_ARG_VAR(WXFLAGS, [Parameters to pass to wx-config (e.g. --unicode=no).])
81 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
82 AC_PATH_PROG(PIDOF, pidof, pidof)
83 AC_PROG_AWK
84 # Some AWK programs fail, so test it and warn the user
85 if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 } 
86       { if ((prog == $2) || (("(" prog ")") == $2) ||
87            (("[" prog "]") == $2) ||
88            ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
89 else
90   AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
91    The regex engine of $AWK is too broken to be used you 
92    might want to install GNU AWK.
93    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
94 fi
95 THE_AWK=$AWK
96 AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
97
98 test -n "$ARFLAG" || ARFLAGS="cr"
99 AC_SUBST(ARFLAGS)
100
101 MAKE_SHELL=/bin/sh
102 AC_SUBST(MAKE_SHELL)
103
104 AC_SUBST(LOCAL_LIBS)
105 AC_SUBST(LOCAL_CFLAGS)
106 AC_SUBST(LOCAL_LDFLAGS)
107 AC_SUBST(LOCAL_DEFS)
108
109 dnl --------------------------------------------------
110 dnl Bacula OP Sys determination (see aclocal.m4)
111 dnl --------------------------------------------------
112 BA_CHECK_OPSYS
113
114 # -----------------------------------------------------------
115 dnl Bacula OPSys Distribution determination (see aclocal.m4)
116 # ----------------------------------------------------------
117 BA_CHECK_OPSYS_DISTNAME
118
119 # --------------------------------------------------
120 # Suppport for gettext (translations)
121 # By default, $datadir is ${prefix}/share
122 # --------------------------------------------------
123 AM_GNU_GETTEXT([external])
124 if test x${prefix} = xNONE ; then
125    if test `eval echo ${datadir}` = NONE/share ; then
126       datadir=/usr/share
127    fi
128 fi
129
130 # ------------------------------------------------------------------
131 #  If the user has not set --prefix, we set our default to nothing.
132 #  In this case, if the user has not set --sysconfdir, we set it
133 #  to the package default of /etc/bacula.  If either --prefix or
134 #  --sysconfdir is set, we leave sysconfdir alone except to eval it.
135 # ------------------------------------------------------------------
136 if test x${prefix} = xNONE ; then
137     if test `eval echo ${sysconfdir}` = NONE/etc ; then
138         sysconfdir=/etc/bacula
139     fi
140     prefix=
141 fi
142 sysconfdir=`eval echo ${sysconfdir}`
143 datadir=`eval echo ${datadir}`
144 localedir=`eval echo ${datadir}/locale`
145 AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir") 
146
147 # -------------------------------------------------------------------------
148 #  If the user has not set --exec-prefix, we default to ${prefix}
149 # -------------------------------------------------------------------------
150 if test x${exec_prefix} = xNONE ; then
151     exec_prefix=${prefix}
152 fi
153
154 # ------------------------------------------------------------------
155 # If the user has not set --sbindir, we set our default as /sbin
156 # ------------------------------------------------------------------
157 if test x$sbindir = x'${exec_prefix}/sbin' ; then
158     sbindir=${exec_prefix}/sbin
159 fi
160 sbindir=`eval echo ${sbindir}`
161
162 # -------------------------------------------------------------------------
163 #  If the user has not set --mandir, we default to /usr/share/man
164 # -------------------------------------------------------------------------
165 if test x$mandir = x'${prefix}/man' ; then
166    mandir=/usr/share/man
167 fi
168
169                       
170 # ------------------------------------------------------------------
171 # All list of languages for which a translation exist. Each
172 #  language is separated by a space.
173 # ------------------------------------------------------------------
174 ALL_LINGUAS=""
175
176 AC_PATH_PROGS(MSGFMT, msgfmt, no)
177 if test "$MSGFMT" = "no"
178 then
179    echo 'msgfmt program not found, disabling NLS !'
180    USE_NLS=no
181    USE_INCLUDED_LIBINTL=no
182 #else
183     AM_GNU_GETTEXT
184 fi
185
186
187 support_mysql=no
188 support_sqlite=no
189 support_sqlite3=no
190 support_postgresql=no
191 support_smartalloc=yes
192 support_readline=yes
193 support_conio=yes
194 support_gnome=no
195 support_wx_console=no
196 support_tls=no
197 support_crypto=no
198 gnome_version=
199 wx_version=
200 support_static_tools=no
201 support_static_fd=no
202 support_static_sd=no
203 support_static_dir=no
204 support_static_cons=no
205 support_python=no
206 build_client_only=no
207 build_dird=yes
208 build_stored=yes
209 cats=
210 db_name=Internal
211 DB_NAME=bdb
212
213 dnl# --------------------------------------------------------------------------
214 dnl# CHECKING COMMAND LINE OPTIONS
215 dnl# --------------------------------------------------------------------------
216
217 # -------------------------------------------
218 # gnome (default off)
219 # -------------------------------------------
220 AC_ARG_ENABLE(gnome,
221   [  --enable-gnome       enable build of gnome-console GUI [disabled]],
222   [if test x$enableval = xyes; then
223     support_gnome=yes
224   fi])
225
226 GNOME_DIR=
227 if test x$support_gnome = xyes; then
228   abc=`$PKGCONFIG --exists libgnomeui-2.0`
229   pkg=$?
230   if test $pkg = 0; then
231      GNOME_INCLUDEDIR=`$PKGCONFIG --cflags-only-I libgnomeui-2.0`
232      GNOMEUI_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
233      GNOME_LIBDIR=`$PKGCONFIG --libs libgnomeui-2.0`
234      GNOME_LIBS=`$PKGCONFIG --libs-only-l libgnomeui-2.0`
235      AC_SUBST(GNOME_INCLUDEDIR)
236      AC_SUBST(GNOMEUI_LIBS)
237      AC_SUBST(GNOME_LIBDIR)
238      AC_SUBST(GNOME_LIBS)
239      GNOME_DIR=src/gnome2-console
240      gnome_version="Version 2.x"
241   else
242      AC_MSG_ERROR(Unable to find Gnome 2 installation)
243   fi
244 fi
245 AC_SUBST(GNOME_DIR)
246
247
248 # -------------------------------------------
249 # wx-console (default off)
250 # -------------------------------------------
251 AC_ARG_ENABLE(wx-console,
252   [  --enable-wx-console     enable build of wxWidgets console [disabled]],
253   [if test x$enableval = xyes; then
254     support_wx_console=yes
255   fi])
256
257 WX_DIR=
258 if test x$support_wx_console = xyes; then
259   abc=`$WXCONFIG $WXFLAGS --cppflags`
260   pkg=$?
261   if test $pkg = 0; then
262      wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
263      WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
264      WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
265
266      AC_SUBST(WXCONS_CPPFLAGS)
267      AC_SUBST(WXCONS_LDFLAGS)
268      WX_DIR=src/wx-console
269   else
270      echo " "
271      echo "wx-config program not found. wx-console disabled."
272      echo " "
273      support_wx_console=no
274   fi
275 fi
276 AC_SUBST(WX_DIR)
277
278
279 # -------------------------------------------
280 # tray-monitor (default off)
281 # -------------------------------------------
282 AC_ARG_ENABLE(tray-monitor,
283   [  --enable-tray-monitor   enable build of Gnome tray monitor (compatible with KDE) [disabled]],
284   [if test x$enableval = xyes; then
285     support_tray_monitor=yes
286   fi])
287
288 TRAY_MONITOR_DIR=
289 if test x$support_tray_monitor = xyes; then
290   abc=`$PKGCONFIG --exists gtk+-2.0`
291   pkg=$?
292   if test $pkg = 0; then
293      TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
294      TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
295      AC_SUBST(TRAY_MONITOR_CPPFLAGS)
296      AC_SUBST(TRAY_MONITOR_LDFLAGS)
297      TRAY_MONITOR_DIR=src/tray-monitor
298      abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
299      pkg=$?
300      if test $pkg = 0; then
301         AC_DEFINE(HAVE_GTK_2_4)
302      fi
303   fi
304 fi
305 AC_SUBST(TRAY_MONITOR_DIR)
306
307 # -------------------------------------------
308 # smartalloc (default off)
309 # -------------------------------------------
310 AC_ARG_ENABLE(smartalloc,
311   [  --enable-smartalloc     enable smartalloc debugging support [disabled]],
312   [if test x$enableval = xno; then
313     support_smartalloc=no
314   fi])
315
316 if test x$support_smartalloc = xyes; then
317    AC_DEFINE(SMARTALLOC)
318 fi
319
320 # -------------------------------------------
321 # static-tools (default off)
322 # -------------------------------------------
323 AC_ARG_ENABLE(static-tools,
324    [  --enable-static-tools   enable static tape tools [disabled]],
325    [if test x$enableval = xyes; then
326      support_static_tools=yes
327    fi])
328
329 TTOOL_LDFLAGS=
330 if test x$support_static_tools = xyes; then
331    TTOOL_LDFLAGS="-static"
332 fi
333 AC_SUBST(TTOOL_LDFLAGS)
334
335 # -------------------------------------------
336 # static-fd    (default off)
337 # -------------------------------------------
338 AC_ARG_ENABLE(static-fd,
339    [  --enable-static-fd      enable static File daemon [disabled]],
340    [if test x$enableval = xyes; then
341      support_static_fd=yes
342    fi])
343
344 STATIC_FD=
345 if test x$support_static_fd = xyes; then
346    STATIC_FD="static-bacula-fd"
347 fi
348 AC_SUBST(STATIC_FD)
349
350 # -------------------------------------------
351 # static-sd    (default off)
352 # -------------------------------------------
353 AC_ARG_ENABLE(static-sd,
354    [  --enable-static-sd      enable static Storage daemon [disabled]],
355    [if test x$enableval = xyes; then
356      support_static_sd=yes
357    fi])
358
359 STATIC_SD=
360 if test x$support_static_sd = xyes; then
361    STATIC_SD="static-bacula-sd"
362 fi
363 AC_SUBST(STATIC_SD)
364
365 # -------------------------------------------
366 # static-dir   (default off)
367 # -------------------------------------------
368 AC_ARG_ENABLE(static-dir,
369    [  --enable-static-dir     enable static Director [disabled]],
370    [if test x$enableval = xyes; then
371      support_static_dir=yes
372    fi])
373
374 STATIC_DIR=
375 if test x$support_static_dir = xyes; then
376    STATIC_DIR="static-bacula-dir"
377 fi
378 AC_SUBST(STATIC_DIR)
379
380 # -------------------------------------------
381 # static-cons  (default off)
382 # -------------------------------------------
383 AC_ARG_ENABLE(static-cons,
384    [  --enable-static-cons    enable static Console [disabled]],
385    [if test x$enableval = xyes; then
386      support_static_cons=yes
387    fi])
388
389 STATIC_CONS=
390 STATIC_GNOME_CONS=
391 STATIC_WX_CONS=
392 if test x$support_static_cons = xyes; then
393    STATIC_CONS="static-bconsole"
394    STATIC_GNOME_CONS="static-gnome-console"
395    STATIC_WX_CONS="static-wx-console"
396 fi
397 AC_SUBST(STATIC_CONS)
398 AC_SUBST(STATIC_GNOME_CONS)
399 AC_SUBST(STATIC_WX_CONS)
400
401 # -------------------------------------------
402 # client_only  (default off)
403 # -------------------------------------------
404 AC_ARG_ENABLE(client-only,
405    [  --enable-client-only    build client (File daemon) only [disabled]],
406    [if test x$enableval = xyes; then
407       build_client_only=yes
408       db_name=None
409       DB_NAME=none
410    fi])
411 if test x$build_client_only = xno; then
412    ALL_DIRS="subdirs"
413 else
414    ALL_DIRS=""
415 fi
416 AC_SUBST(ALL_DIRS)
417
418 # -------------------------------------------
419 # director  (default on)
420 # -------------------------------------------
421 AC_ARG_ENABLE(build-dird,
422    [  --enable-build-dird     enable building of dird (Director) [enabled]],
423    [if test x$enableval = xno; then
424       build_dird=no
425    fi])
426 if test x$build_dird = xyes; then
427    DIRD_DIR="src/dird"
428    DIR_TOOLS="DIRTOOLS"
429 else
430    DIRD_DIR=""
431    DIR_TOOLS="NODIRTOOLS"
432 fi
433 AC_SUBST(DIRD_DIR)
434 AC_SUBST(DIR_TOOLS)
435
436 # -------------------------------------------
437 # stored  (default on)
438 # -------------------------------------------
439 AC_ARG_ENABLE(build-stored,
440    [  --enable-build-stored   enable building of stored (Storage daemon) [enabled]],
441    [if test x$enableval = xno; then
442       build_stored=no
443    fi])
444 if test x$build_stored = xyes; then
445    STORED_DIR="src/stored"
446 else
447    STORED_DIR=""
448 fi
449 AC_SUBST(STORED_DIR)
450
451 # ---------------------------------------------------
452 # Check for conio (Bacula readline substitute)(
453 # ---------------------------------------------------
454 # this allows you to turn it completely off
455 AC_ARG_ENABLE(conio,   
456   [  --disable-conio         disable conio support [enabled]
457                                                       ],
458   [if test x$enableval = xno; then
459     support_conio=no
460   fi])
461
462 got_conio="no"
463 if test x$support_conio = xyes; then
464    AC_CHECK_HEADER(termcap.h, 
465      [ AC_CHECK_LIB(termcap, tgetent, 
466        [ CONS_LIBS="-ltermcap"
467          CONS_OBJ="conio.o"
468          CONS_SRC="conio.c"
469          got_conio="yes"
470          support_readline=no
471          AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
472        ],   
473        [ AC_CHECK_LIB(ncurses, tgetent,
474          [ CONS_LIBS="-lncurses"
475            CONS_OBJ="conio.o"
476            CONS_SRC="conio.c"
477            got_conio="yes"
478            support_readline=no
479            AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
480          ])
481        ])
482      ],
483      [
484          AC_CHECK_HEADERS(curses.h)
485          AC_CHECK_HEADER(term.h,
486                [ AC_CHECK_LIB(curses, tgetent, 
487                  [ CONS_LIBS="-lcurses"
488                    CONS_OBJ="conio.o"
489                    CONS_SRC="conio.c"
490                    got_conio="yes"
491                    support_readline=no
492                    AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
493                  ])
494                ],
495                [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
496 [#if HAVE_CURSES_H
497 #include <curses.h>
498 #endif
499 ])
500      ])
501 fi
502
503
504 # ---------------------------------------------------
505 # Check for readline support/directory (default off)
506 # ---------------------------------------------------
507 # this allows you to turn it completely off
508 AC_ARG_ENABLE(readline,
509   [  --disable-readline      disable readline support [disable]
510                                                       ],
511   [if test x$enableval = xno; then
512     support_readline=no
513   fi])
514
515 got_readline="no"
516 READLINE_SRC=
517 if test x$support_readline = xyes; then
518    AC_ARG_WITH(readline,
519      [ --with-readline=DIR               specify readline library directory],
520      [
521         case "$with_readline" in
522         no) : ;;
523         yes|*)
524           if test -f ${with_readline}/readline.h; then
525              CONS_INC="-I${with_readline}"
526              CONS_LDFLAGS="-L$with_readline"
527           elif test -f ${with_readline}/include/readline/readline.h; then
528              CONS_INC="-I${with_readline}/include/readline"
529              CONS_LDFLAGS="-L${with_readline}/lib"
530              with_readline="${with_readline}/include/readline"
531           else
532              with_readline="/usr/include/readline" 
533           fi
534           AC_CHECK_HEADER(${with_readline}/readline.h, 
535              [ AC_DEFINE(HAVE_READLINE) 
536                CONS_LIBS="-lreadline -lhistory -ltermcap"
537                got_readline="yes"   
538              ],
539              [ echo " "
540                echo "readline.h not found. readline turned off ..."
541                echo " "
542              ]
543           )
544           ;;
545         esac
546      ],[
547        # check for standard readline library
548        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
549          [ AC_DEFINE(HAVE_READLINE)
550            got_readline="yes"
551            CONS_INC="-I/usr/include/readline"
552            CONS_LIBS="-lreadline -ltermcap"
553          ], [
554            # Did not find standard library, so try Bacula's default
555             AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
556               [ AC_DEFINE(HAVE_READLINE) 
557                  got_readline="yes"   
558                  CONS_INC="-I${TOP_DIR}/depkgs/readline"
559                  CONS_LIBS="-lreadline -lhistory -ltermcap"
560                  CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
561                  PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
562               ],
563               [ echo " "
564                 echo "readline.h not found. readline turned off ..."
565                 echo " "
566               ]
567             )
568          ]
569        )
570      ]   
571    )
572 fi
573
574
575
576 AC_SUBST(CONS_INC)
577 AC_SUBST(CONS_OBJ)
578 AC_SUBST(CONS_SRC)
579 AC_SUBST(CONS_LIBS)
580 AC_SUBST(CONS_LDFLAGS)
581 AC_SUBST(READLINE_SRC)
582
583 # Minimal stuff for readline Makefile configuration
584 MAKE_SHELL=/bin/sh
585 AC_SUBST(MAKE_SHELL)
586 AC_HEADER_STAT
587 AC_HEADER_DIRENT
588 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
589 AC_CHECK_FUNCS(nanosleep nl_langinfo)
590 AC_CHECK_HEADERS(varargs.h)
591
592 # End of readline/conio stuff
593 # -----------------------------------------------------------------------
594
595 # -----------------------------------------------------------------------
596 #  Check for Python support
597 #
598 AC_MSG_CHECKING(for Python support)
599 AC_ARG_WITH(python,
600 [
601   --with-python[=DIR]     Include Python support.  DIR is the Python base
602                           install directory, default is to search through
603                           a number of common places for the Python files.],
604 [
605   PYTHON_INCDIR= 
606   PYTHON_LIBS=
607   if test "$withval" != "no"; then
608      if test "$withval" = "yes"; then
609         for python_root in /usr /usr/local /usr/sfw; do
610           if test -f $python_root/include/python2.2/Python.h; then
611              PYTHON_INCDIR=-I$python_root/include/python2.2
612              PYTHON_LIBS="-L$python_root/lib/python2.2/config -lpython2.2"
613              break
614           elif test -f $python_root/include/python2.3/Python.h; then
615              PYTHON_INCDIR=-I$python_root/include/python2.3
616              PYTHON_LIBS="-L$python_root/lib/python2.3/config -lpython2.3"
617              break
618           elif test -f $python_root/include/python2.4/Python.h; then
619              PYTHON_INCDIR=-I$python_root/include/python2.4
620              PYTHON_LIBS="-L$python_root/lib/python2.4/config -lpython2.4"
621              break
622           fi
623         done
624         if test x$PYTHON_INCDIR = x; then
625           if test -f $prefix/include/Python.h; then
626              PYTHON_INCDIR=-I$prefix/include
627              PYTHON_LIBS="-L$prefix/lib/config -lpython"
628           else
629            AC_MSG_RESULT(no)
630            AC_MSG_ERROR(Unable to find Python.h in standard locations)
631           fi
632         fi
633      else
634         if test -f $withval/Python.h; then
635            PYTHON_INCDIR=-I$withval
636            PYTHON_LIBS="-L$withval/config -lpython"
637         elif test -f $withval/include/Python.h; then
638            PYTHON_INCDIR=-I$withval/include
639            PYTHON_LIBS="-L$withval/lib/config -lpython"
640         elif test -f $withval/include/python/Python.h; then
641            PYTHON_INCDIR=-I$withval/include/python
642            PYTHON_LIBS="-L$withval/lib/python/config -lpython"
643         else
644            AC_MSG_RESULT(no)
645            AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
646         fi
647      fi
648      AC_DEFINE([HAVE_PYTHON], 1)
649      AC_MSG_RESULT(yes)
650      support_python=yes
651      AC_MSG_NOTICE(checking for more Python libs)
652      saved_LIBS="$LIBS"; LIBS=
653      AC_SEARCH_LIBS(shm_open, [rt])
654      AC_CHECK_LIB(util, openpty)
655      PYTHON_LIBS="$PYTHON_LIBS $LIBS"
656      LIBS="$saved_LIBS"
657   else
658      AC_MSG_RESULT(no)
659   fi
660 ],[
661   AC_MSG_RESULT(no)
662 ])
663 AC_SUBST(PYTHON_LIBS)
664 AC_SUBST(PYTHON_INCDIR)
665   
666
667 #
668 # Find where sockets are (especially for Solaris)
669 # Do this before the TCP Wrappers test since tcp wrappers
670 # uses the socket library and some linkers are stupid.
671 #
672 AC_CHECK_FUNC(socket,
673     AC_MSG_RESULT(using libc's socket),
674     AC_CHECK_LIB(xnet,socket)
675     AC_CHECK_LIB(socket,socket)
676     AC_CHECK_LIB(inet,socket))
677
678
679 # -----------------------------------------------------------
680 # Check whether user wants TCP wrappers support (default off)
681 # -----------------------------------------------------------
682 TCPW_MSG="no" 
683 WRAPLIBS=""
684 AC_ARG_WITH(tcp-wrappers,
685   [  --with-tcp-wrappers=DIR     enable tcpwrappers support],
686   [
687     if test "x$withval" != "xno" ; then
688        saved_LIBS="$LIBS"
689        LIBS="$saved_LIBS -lwrap"
690        AC_MSG_CHECKING(for libwrap)
691        AC_SEARCH_LIBS(nanosleep, [rt])
692        AC_TRY_LINK(
693           [ #include <sys/types.h>
694             #include <tcpd.h>
695              int deny_severity = 0;
696              int allow_severity = 0;
697              struct request_info *req; ],
698           [ hosts_access(req); ],
699           [
700             AC_MSG_RESULT(yes)
701             AC_DEFINE(HAVE_LIBWRAP)
702             TCPW_MSG="yes" 
703             LIBS="$saved_LIBS"
704             WRAPLIBS="-lwrap"
705           ], [
706             LIBS="$saved_LIBS -lwrap -lnsl"
707             WRAPLIBS="$saved_LIBS -lwrap -lnsl"
708             AC_TRY_LINK(
709               [ #include <sys/types.h>
710                  #include <tcpd.h>
711                  int deny_severity = 0;
712                  int allow_severity = 0;
713                  struct request_info *req; ],
714               [ hosts_access(req); ],
715               [
716                  AC_MSG_RESULT(yes)
717                  AC_DEFINE(HAVE_LIBWRAP)
718                  TCPW_MSG="yes" 
719                  LIBS="$saved_LIBS"
720                  WRAPLIBS="-lwrap"
721               ],
722               [AC_MSG_ERROR([*** libwrap missing]) ] ]
723             )
724        )
725     fi
726   ]
727 )
728
729 # -----------------------------------------------------------
730 # Check whether OpenSSL is available
731 # -----------------------------------------------------------
732 AC_MSG_CHECKING([for OpenSSL])
733 dnl The following uses quadrigraphs:
734 dnl '@<:@' = '['
735 dnl '@:>@' = ']'
736 AC_ARG_WITH(openssl,
737         AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
738         [with_openssl_directory=${withval}])
739
740 if test "x$with_openssl_directory" != "x"; then
741         OPENSSL_LIBS="-lssl -lcrypto"
742         OPENSSL_INC=""
743
744         if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
745                 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
746                 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
747         fi
748
749         saved_LIBS="$LIBS"
750         saved_CFLAGS="$CFLAGS"
751         LIBS="$saved_LIBS $OPENSSL_LIBS"
752         CFLAGS="$saved_CFLAGS $OPENSSL_INC"
753
754         AC_TRY_LINK([ #include <openssl/ssl.h> ],
755                 [ CRYPTO_set_id_callback(NULL); ],
756                 [
757                         support_tls="yes"
758                         support_crypto="yes"
759                 ],
760                 [ support_tls="no" ]
761         )
762
763         AC_TRY_LINK([ #include <openssl/evp.h> ],
764                 [ EVP_sha512(); ],
765                 [ ac_cv_openssl_sha2="yes" ],
766                 [ ac_cv_openssl_sha2="no" ]
767         )
768
769         LIBS="$saved_LIBS"
770         CFLAGS="$saved_CFLAGS"
771
772         if test "$support_tls" = "yes"; then
773                 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
774                 AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
775                 AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
776         fi
777
778         if test "$ac_cv_openssl_sha2" = "yes"; then
779                 AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
780         fi
781 else
782         support_tls="no"
783         support_crypto="no"
784         OPENSSL_LIBS=""
785         OPENSSL_INC=""
786 fi
787
788 AC_MSG_RESULT([$support_tls])
789 AC_SUBST(OPENSSL_LIBS)
790 AC_SUBST(OPENSSL_INC)
791
792
793 # -----------------------------------------------------------
794 # Python and OpenSSL are using dlopen
795 # -----------------------------------------------------------
796
797 if test "$support_python" = "yes" -o "$support_tls" = "yes"; then
798    AC_SEARCH_LIBS(dlopen, [dl])
799 fi
800
801 # ------------------------------------------
802 # Where to place working dir
803 # ------------------------------------------
804 working_dir=`eval echo ${prefix}/var/bacula/working`
805 AC_ARG_WITH(working-dir,
806    [  --with-working-dir=PATH    specify path of Bacula working directory],
807    [
808        if test "x$withval" != "xno" ; then     
809               working_dir=$withval
810        fi
811    ]
812 )
813
814 AC_SUBST(working_dir)
815
816
817 # ------------------------------------------
818 # Where to place scriptdir (script files)
819 # ------------------------------------------
820 scriptdir=`eval echo ${sysconfdir}`
821 AC_ARG_WITH(scriptdir,
822    [  --with-scriptdir=PATH    specify path of Bacula scripts directory],
823    [
824        if test "x$withval" != "xno" ; then     
825               scriptdir=$withval
826        fi
827    ]
828 )
829
830 AC_SUBST(scriptdir)
831
832
833 # ------------------------------------------
834 # Where to send dump email
835 # ------------------------------------------
836 dump_email=root@localhost
837 AC_ARG_WITH(dump-email,
838    [  --with-dump-email=EMAIL    dump email address],
839    [
840        if test "x$withval" != "xno" ; then     
841               dump_email=$withval
842        fi
843    ]
844 )
845
846 AC_SUBST(dump_email)
847
848 # ------------------------------------------
849 # Where to send job email
850 # ------------------------------------------
851 job_email=root@localhost
852 AC_ARG_WITH(job-email,
853    [  --with-job-email=EMAIL     job output email address],
854    [
855        if test "x$withval" != "xno" ; then     
856               job_email=$withval
857        fi
858    ]
859 )
860
861 AC_SUBST(job_email)
862
863 # ------------------------------------------
864 # Where to find smtp host
865 # ------------------------------------------
866 smtp_host=localhost
867 AC_ARG_WITH(smtp_host,
868    [  --with-smtp-host=HOST              SMTP mail host address],
869    [
870        if test "x$withval" != "xno" ; then     
871               smtp_host=$withval
872        fi
873    ]
874 )
875
876 AC_SUBST(smtp_host)
877
878
879 # ------------------------------------
880 # Where to place pid files
881 # ------------------------------------
882 piddir=/var/run
883 AC_ARG_WITH(pid-dir,
884     [  --with-pid-dir=PATH               specify location of Bacula pid files],
885     [
886         if test "x$withval" != "xno" ; then     
887             piddir=$withval
888         fi
889     ]
890 )
891
892 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
893 AC_SUBST(piddir)
894
895
896 # ------------------------------------
897 # Where to place subsys "lock file"
898 # ------------------------------------
899 subsysdir=/var/run/subsys
900 AC_ARG_WITH(subsys-dir,
901     [  --with-subsys-dir=PATH    specify location of Bacula subsys file],
902     [
903         if test "x$withval" != "xno" ; then     
904             subsysdir=$withval
905         fi
906     ]
907 )
908
909 AC_SUBST(subsysdir)
910
911
912
913 # ------------------------------------
914 # Where to start assigning ports
915 # ------------------------------------
916 baseport=9101
917 AC_ARG_WITH(baseport,
918     [  --with-baseport=PORT              specify base port address for daemons],
919     [
920         if test "x$withval" != "xno" ; then     
921              baseport=$withval
922         fi
923     ]
924 )
925
926 AC_SUBST(baseport)
927 dir_port=`expr $baseport`
928 fd_port=`expr $baseport + 1`
929 sd_port=`expr $fd_port + 1`
930
931 AC_SUBST(dir_port)
932 AC_SUBST(fd_port)
933 AC_SUBST(sd_port)
934
935
936 # ------------------------------------------
937 # Generate passwords
938 # ------------------------------------------
939 dir_password=
940 AC_ARG_WITH(dir-password,
941    [  --with-dir-password=PASSWORD   specify Director's password],
942    [
943        if test "x$withval" != "xno" ; then     
944            dir_password=$withval
945        fi
946    ]
947 )
948
949 if test "x$dir_password" = "x" ; then
950    if test "x$OPENSSL" = "xnone" ; then
951       key=`autoconf/randpass 33`
952    else
953       key=`openssl rand -base64 33`
954    fi
955    dir_password=$key
956 fi
957
958 fd_password=
959 AC_ARG_WITH(fd-password,
960    [  --with-fd-password=PASSWORD    specify Client's password],
961    [
962        if test "x$withval" != "xno" ; then     
963            fd_password=$withval
964        fi
965    ]
966 )
967
968 if test "x$fd_password" = "x" ; then
969    if test "x$OPENSSL" = "xnone" ; then
970       key=`autoconf/randpass 37`
971    else
972       key=`openssl rand -base64 33`
973    fi
974    fd_password=$key
975 fi
976
977 sd_password=
978 AC_ARG_WITH(sd-password,
979    [  --with-sd-password=PASSWORD    specify Storage daemon's password],
980    [
981        if test "x$withval" != "xno" ; then     
982            sd_password=$withval
983        fi
984    ]
985 )
986
987 if test "x$sd_password" = "x" ; then
988    if test "x$OPENSSL" = "xnone" ; then
989       key=`autoconf/randpass 41`
990    else
991       key=`openssl rand -base64 33`
992    fi
993    sd_password=$key
994 fi
995
996 mon_dir_password=
997 AC_ARG_WITH(mon-dir-password,
998    [  --with-mon-dir-password=PASSWORD   specify Director's password used by the monitor],
999    [
1000        if test "x$withval" != "xno" ; then     
1001            mon_dir_password=$withval
1002        fi
1003    ]
1004 )
1005
1006 if test "x$mon_dir_password" = "x" ; then
1007    if test "x$OPENSSL" = "xnone" ; then
1008       key=`autoconf/randpass 33`
1009    else
1010       key=`openssl rand -base64 33`
1011    fi
1012    mon_dir_password=$key
1013 fi
1014
1015 mon_fd_password=
1016 AC_ARG_WITH(mon-fd-password,
1017    [  --with-mon-fd-password=PASSWORD    specify Client's password used by the monitor],
1018    [
1019        if test "x$withval" != "xno" ; then     
1020            mon_fd_password=$withval
1021        fi
1022    ]
1023 )
1024
1025 if test "x$mon_fd_password" = "x" ; then
1026    if test "x$OPENSSL" = "xnone" ; then
1027       key=`autoconf/randpass 37`
1028    else
1029       key=`openssl rand -base64 33`
1030    fi
1031    mon_fd_password=$key
1032 fi
1033
1034 mon_sd_password=
1035 AC_ARG_WITH(mon-sd-password,
1036    [  --with-mon-sd-password=PASSWORD    specify Storage daemon's password used by the monitor],
1037    [
1038        if test "x$withval" != "xno" ; then     
1039            mon_sd_password=$withval
1040        fi
1041    ]
1042 )
1043
1044 if test "x$mon_sd_password" = "x" ; then
1045    if test "x$OPENSSL" = "xnone" ; then
1046       key=`autoconf/randpass 41`
1047    else
1048       key=`openssl rand -base64 33`
1049    fi
1050    mon_sd_password=$key
1051 fi
1052
1053 AC_SUBST(dir_password)
1054 AC_SUBST(fd_password)
1055 AC_SUBST(sd_password)
1056 AC_SUBST(mon_dir_password)
1057 AC_SUBST(mon_fd_password)
1058 AC_SUBST(mon_sd_password)
1059
1060
1061 #
1062 # Handle users and groups for each daemon
1063 #
1064 dir_user=
1065 AC_ARG_WITH(dir_user,
1066     [  --with-dir-user=USER              specify user for Director daemon],
1067     [
1068         if test "x$withval" != "x" ; then       
1069              dir_user=$withval
1070         fi
1071     ]
1072 )
1073
1074 dir_group=
1075 AC_ARG_WITH(dir_group,
1076     [  --with-dir-group=GROUP            specify group for Director daemon],
1077     [
1078         if test "x$withval" != "x" ; then       
1079              dir_group=$withval
1080         fi
1081     ]
1082 )
1083
1084 sd_user=
1085 AC_ARG_WITH(sd_user,
1086     [  --with-sd-user=USER               specify user for Storage daemon],
1087     [
1088         if test "x$withval" != "x" ; then       
1089              sd_user=$withval
1090         fi
1091     ]
1092 )
1093
1094 sd_group=
1095 AC_ARG_WITH(sd_group,
1096     [  --with-sd-group=GROUP             specify group for Storage daemon],
1097     [
1098         if test "x$withval" != "x" ; then       
1099              sd_group=$withval
1100         fi
1101     ]
1102 )
1103
1104 fd_user=
1105 AC_ARG_WITH(fd_user,
1106     [  --with-fd-user=USER               specify user for File daemon],
1107     [
1108         if test "x$withval" != "x" ; then       
1109              fd_user=$withval
1110         fi
1111     ]
1112 )
1113
1114 fd_group=
1115 AC_ARG_WITH(fd_group,
1116     [  --with-fd-group=GROUP             specify group for File daemon],
1117     [
1118         if test "x$withval" != "x" ; then       
1119              fd_group=$withval
1120         fi
1121     ]
1122 )
1123
1124
1125
1126
1127 AC_SUBST(dir_user)
1128 AC_SUBST(dir_group)
1129 AC_SUBST(sd_user)
1130 AC_SUBST(sd_group)
1131 AC_SUBST(fd_user)
1132 AC_SUBST(fd_group)
1133
1134 #
1135 # allow setting default executable permissions
1136 #
1137 SBINPERM=0754
1138 AC_ARG_WITH(sbin-perm,
1139     [  --with-sbin-perm=MODE             specify permissions for sbin binaries (0754)],
1140     [
1141         if test "x$withval" != "x" ; then       
1142             SBINPERM=$withval
1143         fi
1144     ]
1145 )
1146
1147 AC_SUBST(SBINPERM)
1148
1149 # ------------------------------------------------
1150 # Bacula check for various SQL database engines
1151 # ------------------------------------------------
1152 BA_CHECK_POSTGRESQL_DB
1153
1154 BA_CHECK_MYSQL_DB
1155
1156 BA_CHECK_SQLITE3_DB
1157
1158 BA_CHECK_SQLITE_DB
1159
1160 AC_SUBST(cats)
1161 AC_SUBST(DB_NAME)
1162
1163 AC_DEFINE(PROTOTYPES)
1164
1165 dnl# --------------------------------------------------------------------------
1166 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
1167 dnl#
1168 if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
1169     if test -z "$CCOPTS"; then
1170         CCOPTS='-g -O2 -Wall'
1171     fi
1172     CFLAGS="$CCOPTS"
1173 fi
1174
1175
1176 dnl A few others 
1177 AC_EXEEXT
1178
1179 dnl See if we can use 64 bit file addresses
1180 largefile_support="no"
1181 AC_BAC_LARGEFILE
1182
1183
1184 AC_PATH_XTRA
1185
1186 dnl# --------------------------------------------------------------------------
1187 dnl# CHECKING FOR HEADER FILES
1188 dnl# --------------------------------------------------------------------------
1189 AC_CHECK_HEADERS( \
1190         assert.h \
1191         fcntl.h \
1192         grp.h \
1193         pwd.h \
1194         libc.h \
1195         limits.h \
1196         stdarg.h \
1197         stdlib.h \
1198         stdint.h \
1199         string.h \
1200         termios.h \
1201         termcap.h \
1202         term.h \
1203         unistd.h \
1204         sys/bitypes.h \
1205         sys/byteorder.h \
1206         sys/ioctl.h \
1207         sys/select.h \
1208         sys/sockio.h \
1209         sys/time.h \
1210         sys/socket.h \
1211         arpa/nameser.h \
1212         resolv.h \
1213         mtio.h \
1214         sys/mtio.h \
1215         sys/tape.h \
1216         regex.h \
1217 )
1218 AC_HEADER_STDC
1219 AC_HEADER_MAJOR
1220 AC_HEADER_DIRENT
1221 AC_HEADER_STAT
1222 AC_HEADER_SYS_WAIT
1223 AC_HEADER_TIME
1224 AC_STRUCT_ST_BLKSIZE
1225 AC_STRUCT_ST_BLOCKS
1226 AC_STRUCT_TIMEZONE
1227
1228 dnl# --------------------------------------------------------------------------
1229 dnl# Check for utime.h structure 
1230 dnl# --------------------------------------------------------------------------
1231 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
1232   [AC_TRY_COMPILE([
1233 #include <sys/types.h>
1234 #include <utime.h>], [struct utimbuf foo],
1235   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
1236 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
1237
1238 dnl# --------------------------------------------------------------------------
1239 dnl# Check for socklen_t
1240 dnl# --------------------------------------------------------------------------
1241 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
1242   [AC_TRY_COMPILE([
1243 #include <sys/types.h>
1244 #include <sys/socket.h>],
1245   [socklen_t x],
1246   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
1247 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
1248
1249 dnl# --------------------------------------------------------------------------
1250 dnl# Check for bigendian
1251 dnl# --------------------------------------------------------------------------
1252 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
1253   [AC_TRY_RUN(
1254     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
1255     [ba_cv_bigendian=yes], 
1256     [ba_cv_bigendian=no], 
1257     [ba_cv_bigendian=no])])
1258 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
1259
1260
1261 AC_C_CONST
1262
1263
1264 dnl# --------------------------------------------------------------------------
1265 dnl# CHECKING FOR FILESYSTEM TYPE
1266 dnl# --------------------------------------------------------------------------
1267 AC_MSG_CHECKING(how to get filesystem type)
1268 fstype=no
1269 # The order of these tests is important.
1270 AC_TRY_CPP([#include <sys/statvfs.h>
1271 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
1272 if test $fstype = no; then
1273 AC_TRY_CPP([#include <sys/statfs.h>
1274 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
1275 fi
1276 if test $fstype = no; then
1277 AC_TRY_CPP([#include <sys/statfs.h>
1278 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
1279 fi
1280 if test $fstype = no; then  
1281 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
1282 fi
1283 if test $fstype = no; then  
1284 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
1285 fi
1286 if test $fstype = no; then  
1287 AC_TRY_CPP([#include <sys/mount.h>
1288 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
1289 fi
1290 AC_MSG_RESULT($fstype)
1291
1292 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
1293
1294 dnl# --------------------------------------------------------------------------
1295 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
1296 dnl# --------------------------------------------------------------------------
1297 AC_TYPE_SIGNAL
1298 SIGNAL_CHECK
1299 AC_TYPE_MODE_T
1300 AC_TYPE_UID_T
1301 AC_TYPE_SIZE_T
1302 AC_TYPE_PID_T
1303 AC_TYPE_OFF_T
1304 AC_CHECK_TYPE(ino_t, unsigned long)
1305 AC_CHECK_TYPE(dev_t, unsigned long)
1306 AC_CHECK_TYPE(daddr_t, long)
1307 AC_CHECK_TYPE(major_t, int)
1308 AC_CHECK_TYPE(minor_t, int)
1309 AC_CHECK_TYPE(ssize_t, int)
1310 AC_STRUCT_ST_BLOCKS
1311 AC_STRUCT_ST_RDEV
1312 AC_STRUCT_TM
1313 AC_C_CONST
1314
1315
1316 AC_CHECK_SIZEOF(char, 1)
1317 AC_CHECK_SIZEOF(short int, 2)
1318 AC_CHECK_SIZEOF(int, 4)
1319 AC_CHECK_SIZEOF(long int, 4)
1320 AC_CHECK_SIZEOF(long long int, 8)
1321 AC_CHECK_SIZEOF(int *, 4)
1322
1323 # Check for sys/types.h types
1324 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1325     AC_TRY_COMPILE(
1326         [ #include <sys/types.h> ], 
1327         [ u_int a; a = 1;], 
1328         [ ac_cv_have_u_int="yes" ],
1329         [ ac_cv_have_u_int="no" ]
1330     )
1331 ])
1332 if test "x$ac_cv_have_u_int" = "xyes" ; then
1333    AC_DEFINE(HAVE_U_INT)
1334    have_u_int=1
1335 fi
1336
1337 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
1338    AC_TRY_COMPILE(
1339       [ #include <sys/types.h> ], 
1340       [ intmax_t a; a = 1;], 
1341       [ ac_cv_have_intmax_t="yes" ],
1342       [ 
1343          AC_TRY_COMPILE(
1344             [ #include <stdint.h> ], 
1345             [ intmax_t a; a = 1;], 
1346             [ ac_cv_have_intmax_t="yes" ],
1347             [ ac_cv_have_intmax_t="no" ]
1348          )
1349       ]
1350    )        
1351
1352 ])
1353 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
1354    AC_DEFINE(HAVE_INTMAX_T)
1355    have_intmax_t=1
1356 fi
1357
1358
1359 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
1360    AC_TRY_COMPILE(
1361       [ #include <sys/types.h> ], 
1362       [ u_intmax_t a; a = 1;], 
1363       [ ac_cv_have_u_intmax_t="yes" ],
1364       [ 
1365          AC_TRY_COMPILE(
1366             [ #include <stdint.h> ], 
1367             [ u_intmax_t a; a = 1;], 
1368             [ ac_cv_have_u_intmax_t="yes" ],
1369             [ ac_cv_have_u_intmax_t="no" ]
1370          )
1371       ]
1372    )
1373 ])
1374 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
1375    AC_DEFINE(HAVE_U_INTMAX_T)
1376    have_u_intmax_t=1
1377 fi
1378
1379
1380 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1381    AC_TRY_COMPILE(
1382       [ #include <sys/types.h> ], 
1383       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
1384       [ ac_cv_have_intxx_t="yes" ],
1385       [ ac_cv_have_intxx_t="no" ]
1386    )
1387 ])
1388 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1389    AC_DEFINE(HAVE_INTXX_T)
1390    have_intxx_t=1
1391 fi
1392         
1393 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1394    AC_TRY_COMPILE(
1395       [ #include <sys/types.h> ], 
1396       [ int64_t a; a = 1;], 
1397       [ ac_cv_have_int64_t="yes" ],
1398       [ ac_cv_have_int64_t="no" ]
1399    )
1400 ])
1401 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1402    AC_DEFINE(HAVE_INT64_T)
1403    have_int64_t=1
1404 fi
1405         
1406 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1407    AC_TRY_COMPILE(
1408       [ #include <sys/types.h> ], 
1409       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
1410       [ ac_cv_have_u_intxx_t="yes" ],
1411       [ ac_cv_have_u_intxx_t="no" ]
1412    )
1413 ])
1414 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1415    AC_DEFINE(HAVE_U_INTXX_T)
1416    have_u_intxx_t=1
1417 fi
1418
1419 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1420    AC_TRY_COMPILE(
1421       [ #include <sys/types.h> ], 
1422       [ u_int64_t a; a = 1;], 
1423       [ ac_cv_have_u_int64_t="yes" ],
1424       [ ac_cv_have_u_int64_t="no" ]
1425    )
1426 ])
1427 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1428    AC_DEFINE(HAVE_U_INT64_T)
1429    have_u_int64_t=1
1430 fi
1431
1432 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1433            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1434 then
1435    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1436    AC_TRY_COMPILE(
1437       [ #include <sys/bitypes.h>  ], 
1438       [ int8_t a; int16_t b; int32_t c;
1439         u_int8_t e; u_int16_t f; u_int32_t g;
1440         a = b = c = e = f = g = 1;  ], 
1441       [ AC_DEFINE(HAVE_U_INTXX_T)
1442         AC_DEFINE(HAVE_INTXX_T)
1443         AC_DEFINE(HAVE_SYS_BITYPES_H)
1444         AC_MSG_RESULT(yes) ],
1445       [ AC_MSG_RESULT(no)]
1446    ) 
1447 fi
1448
1449 if test -z "$have_u_intxx_t" ; then
1450    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1451       AC_TRY_COMPILE(
1452          [ #include <sys/types.h> ], 
1453          [ uint8_t a; uint16_t b; 
1454            uint32_t c; a = b = c = 1; ], 
1455          [ ac_cv_have_uintxx_t="yes" ],
1456          [ ac_cv_have_uintxx_t="no" ]
1457       )
1458    ])
1459    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1460       AC_DEFINE(HAVE_UINTXX_T)
1461    fi
1462 fi
1463
1464 if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
1465           test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1466 then
1467    AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
1468    AC_TRY_COMPILE(
1469       [ #include <sys/bitypes.h>  ], 
1470       [ int64_t a; u_int64_t b; 
1471        a = b = 1;  ], 
1472       [ AC_DEFINE(HAVE_U_INT64_T)
1473        AC_DEFINE(HAVE_INT64_T)
1474        AC_MSG_RESULT(yes) ],
1475       [ AC_MSG_RESULT(no)]
1476    ) 
1477 fi
1478
1479 if (test -z "$have_uintxx_t" && \
1480           test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1481 then
1482    AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
1483    AC_TRY_COMPILE(
1484       [ #include <sys/bitypes.h>  ], 
1485         [ uint8_t a; uint16_t b; 
1486           uint32_t c; a = b = c = 1; ], 
1487       [ AC_DEFINE(HAVE_UINTXX_T)
1488        AC_MSG_RESULT(yes) ],
1489       [ AC_MSG_RESULT(no)]
1490    ) 
1491
1492 fi
1493
1494
1495
1496
1497 dnl# --------------------------------------------------------------------------
1498 dnl# CHECKING FOR REQUIRED LIBRARY FUNCTIONS
1499 dnl# --------------------------------------------------------------------------
1500 AC_CHECK_FUNCS( \
1501         fork \
1502         getcwd \
1503         gethostname \
1504         getpid \
1505         gettimeofday \
1506         setpgid \
1507         setpgrp \
1508         setsid \
1509         signal \
1510         strerror \
1511         strncmp \
1512         strncpy \
1513         vfprintf \
1514         ,,
1515         [echo 'configure: cannot find needed function.'; exit 1]
1516 )
1517
1518 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1519 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1520
1521 AC_CHECK_FUNCS(chflags) 
1522
1523 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
1524
1525 dnl# --------------------------------------------------------------------------
1526 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1527 dnl# --------------------------------------------------------------------------
1528 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1529
1530 # If resolver functions are not in libc check for -lnsl or -lresolv.
1531 AC_CHECK_FUNC(gethostbyname_r,
1532     AC_MSG_RESULT(using libc's resolver),
1533     AC_CHECK_LIB(nsl,gethostbyname_r)
1534     AC_CHECK_LIB(resolv,gethostbyname_r))
1535
1536
1537
1538 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1539 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
1540 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
1541
1542 dnl ----------------------------
1543 dnl check sa_len of sockaddr
1544 dnl ----------------------------
1545 AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
1546   [AC_TRY_COMPILE([#include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
1547   ac_cv_struct_sockaddr_sa_len=yes, ac_cv_struct_sockaddr_sa_len=no)])
1548
1549  if test $ac_cv_struct_sockaddr_sa_len = yes; then
1550   AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
1551  fi
1552
1553
1554 dnl Check for IPv6 support
1555 AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
1556 [AC_TRY_LINK([ #include <sys/types.h>
1557 #include <sys/socket.h>
1558 #include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] =
1559  0;],
1560   [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
1561
1562 if test "$ac_cv_ipv6_support" = yes; then
1563   AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
1564 fi
1565
1566
1567
1568 AC_FUNC_STRFTIME
1569 AC_FUNC_VPRINTF
1570 AC_FUNC_ALLOCA
1571 AC_FUNC_GETMNTENT
1572 AC_FUNC_CLOSEDIR_VOID
1573 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
1574 # AC_FUNC_FNMATCH    dnl use local version
1575
1576
1577 dnl# FreeBSD needs to link libxpg4
1578 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
1579 AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
1580
1581
1582 AC_CHECK_LIB(sun, getpwnam)
1583
1584 AC_CHECK_HEADERS(zlib.h)
1585 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1586 have_zlib=no
1587 if test x$FDLIBS = x-lz; then
1588   AC_DEFINE(HAVE_LIBZ)
1589   have_zlib=yes
1590 fi
1591
1592 #
1593 # Check for ACL libraries
1594 #
1595 have_acl=no
1596 AC_CHECK_HEADER(sys/acl.h)
1597 AC_CHECK_FUNC(acl_get_file, [have_acl=yes],
1598    [AC_CHECK_LIB(acl, acl_get_file, [have_acl=yes; FDLIBS="-lacl $FDLIBS"], 
1599       [AC_CHECK_LIB(sec, acltotext, [have_acl=yes; FDLIBS="-lsec $FDLIBS"])]
1600     )]
1601 )
1602 if test $have_acl = yes; then
1603    AC_DEFINE(HAVE_ACL)
1604 fi
1605
1606 dnl Check for pthread libraries
1607 PTHREAD_LIB=""
1608 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1609    [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1610       [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1611             [AC_CHECK_FUNC(pthread_create)]
1612        )]
1613     )]
1614 )
1615
1616 AC_SUBST(FDLIBS)
1617 AC_DEFINE(FDLIBS)
1618
1619
1620 CFLAGS=${CFLAGS--O}
1621 LDFLAGS=${LDFLAGS--O}
1622 DB_LIBS="${SQL_LFLAGS}"
1623
1624 CPPFLAGS="$CPPFLAGS"
1625 AC_SUBST(DEBUG)
1626 AC_SUBST(DINCLUDE)
1627 AC_SUBST(CFLAGS)
1628 AC_SUBST(CPPFLAGS)
1629 AC_SUBST(LDFLAGS)
1630 AC_SUBST(X_CFLAGS)
1631 AC_SUBST(DEFS)
1632 AC_SUBST(LIBS)
1633 AC_SUBST(DLIB)
1634 AC_SUBST(DB_LIBS)
1635 AC_SUBST(X_LIBS)
1636 AC_SUBST(X_EXTRA_LIBS)
1637 AC_SUBST(WCFLAGS)
1638 AC_SUBST(WLDFLAGS)
1639 AC_SUBST(WRAPLIBS)
1640
1641 dnl# extra configurable objects
1642 OBJLIST=
1643 AC_SUBST(OBJLIST)
1644
1645 lld="lld"
1646 llu="llu"
1647
1648 WCFLAGS=
1649 WLDFLAGS=
1650
1651 #
1652 # Finally we set appropriate distribution specific
1653 #  variables and defaults
1654 #
1655 # PFILES are platform specific files
1656 PFILES="platforms/Makefile"
1657 PSCMD="ps -e"
1658 WIN32=
1659 MACOSX=
1660 hostname=`uname -n | cut -d '.' -f 1`
1661 if test x${hostname} = x ; then
1662   hostname="localhost"
1663 fi
1664 case "$DISTNAME" in
1665 aix)
1666         DISTVER=`uname -r`
1667         PSCMD="ps -e -o pid,comm"
1668         PFILES="${PFILES} \
1669            platforms/aix/Makefile"
1670         TAPEDRIVE="/dev/rmt0.1" 
1671   ;;      
1672 alpha)
1673         DISTVER=`uname -r`
1674         PTHREAD_LIB="-lpthread -lexc"
1675         if test "${CC}" = "gcc" ; then
1676            lld="lld"
1677            llu="llu"
1678         else
1679            lld="ld"
1680            llu="lu"
1681         fi
1682         TAPEDRIVE="/dev/nrmt0"
1683   ;;
1684 bsdi)
1685         DISTVER=`uname -a |awk '{print $3}'`
1686         TAPEDRIVE="/dev/nrmt0"
1687         PTHREAD_LIB="-pthread"
1688         CFLAGS="${CFLAGS} -pthread"
1689         PSCMD="ps -ax -o pid,command"
1690         lld="qd"
1691         llu="qu"
1692         PFILES="${PFILES} \
1693             platforms/bsdi/Makefile \
1694             platforms/bsdi/bacula-fd \
1695             platforms/bsdi/bacula-sd \
1696             platforms/bsdi/bacula-dir"
1697         largefile_support="yes"
1698   ;;
1699 cygwin)
1700         DISTVER=`uname -a |awk '{print $3}'`
1701         TAPEDRIVE="/dev/nrst0"
1702         WIN32=win32
1703         WCFLAGS="-mwindows"
1704         WLDFLAGS="-mwindows"
1705   ;;
1706 darwin)
1707         DISTVER=`uname -r`
1708         TAPEDRIVE="/dev/nst0"
1709         PSCMD="ps -e -o pid,command"
1710         MACOSX=macosx
1711         PFILES="${PFILES} \
1712            platforms/darwin/Makefile"
1713   ;;
1714 debian)
1715         DISTVER=`cat /etc/debian_version`
1716         TAPEDRIVE="/dev/nrst0"
1717         PSCMD="ps -e -o pid,command"
1718   ;;
1719 freebsd)
1720         DISTVER=`uname -a |awk '{print $3}'`
1721         VER=`echo $DISTVER | cut -c 1`
1722         if test x$VER = x4 ; then
1723            PTHREAD_LIB="-pthread"
1724            CFLAGS="${CFLAGS} -pthread"
1725         fi
1726         lld="qd"
1727         llu="qu"
1728         TAPEDRIVE="/dev/nrsa0"
1729         PSCMD="ps -ax -o pid,command"
1730         PFILES="${PFILES} \
1731             platforms/freebsd/Makefile \
1732             platforms/freebsd/bacula-fd \
1733             platforms/freebsd/bacula-sd \
1734             platforms/freebsd/bacula-dir"
1735         largefile_support="yes"
1736   ;;
1737 hpux)
1738         PSCMD="UNIX95=1 ps -e -o pid,comm"
1739         CFLAGS="$(CFLAGS) -D_XOPEN_SOURCE_EXTENDED=1"
1740         DISTVER=`uname -r`
1741         TAPEDRIVE="/dev/rmt/0hnb"
1742         PTHREAD_LIB="-lpthread"
1743         AC_DEFINE([_INCLUDE_LONGLONG])
1744   ;;
1745 irix)
1746         DISTVER=`uname -r`
1747         TAPEDRIVE="/dev/rmt/0cbn"
1748         PSCMD="ps -e -o pid,comm"
1749         PFILES="${PFILES} \
1750             platforms/irix/Makefile \
1751             platforms/irix/bacula-fd \
1752             platforms/irix/bacula-sd \
1753             platforms/irix/bacula-dir"
1754   ;;
1755 netbsd)
1756         DISTVER=`uname -a |awk '{print $3}'`
1757         lld="qd"
1758         llu="qu"
1759         TAPEDRIVE="/dev/nrst0"
1760         PSCMD="ps -ax -o pid,command"
1761         PTHREAD_LIB="-pthread"
1762         CFLAGS="${CFLAGS} -pthread"
1763   ;;
1764 openbsd)
1765         DISTVER=`uname -a |awk '{print $3}'`
1766         lld="qd"
1767         llu="qu"
1768         TAPEDRIVE="/dev/nrst0"
1769         PSCMD="ps -ax -o pid,command"
1770         PTHREAD_LIB="-pthread"
1771         CFLAGS="${CFLAGS} -pthread"
1772         PFILES="${PFILES} \
1773             platforms/openbsd/Makefile \
1774             platforms/openbsd/bacula-fd \
1775             platforms/openbsd/bacula-sd \
1776             platforms/openbsd/bacula-dir"
1777   ;;
1778 redhat)
1779         if test -f /etc/whitebox-release ; then
1780            f=/etc/whitebox-release
1781         else
1782            f=/etc/redhat-release
1783         fi
1784         if test `cat $f | grep release |\
1785                    cut -f 3 -d ' '`x = "Enterprise"x ; then
1786            DISTVER="Enterprise "`cat $f | grep release |\
1787                     cut -f 6 -d ' '`
1788         else
1789             DISTVER=`cat /etc/redhat-release | grep release |\
1790                      cut -f 5 -d ' '`
1791         fi
1792         TAPEDRIVE="/dev/nst0"
1793         PSCMD="ps -e -o pid,command"
1794         PFILES="${PFILES} \
1795             platforms/redhat/Makefile \
1796             platforms/redhat/bacula-fd \
1797             platforms/redhat/bacula-sd \
1798             platforms/redhat/bacula-dir \
1799             platforms/redhat/bacula.spec \
1800             "
1801   ;;
1802 mandrake)
1803         DISTVER=`cat /etc/mandrake-release | grep release |\
1804            cut -f 5 -d ' '`
1805         TAPEDRIVE="/dev/nst0"
1806         PSCMD="ps -e -o pid,command"
1807         PFILES="${PFILES} \
1808             platforms/mandrake/Makefile \
1809             platforms/mandrake/bacula-fd \
1810             platforms/mandrake/bacula-sd \
1811             platforms/mandrake/bacula-dir \
1812             platforms/mandrake/bacula.spec \
1813             "
1814   ;;
1815 gentoo)
1816         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
1817         TAPEDRIVE="/dev/nst0"
1818         PSCMD="ps -e -o pid,command"
1819         PFILES="${PFILES} \
1820             platforms/gentoo/Makefile \
1821          platforms/gentoo/bacula-init \
1822             platforms/gentoo/bacula-fd \
1823             platforms/gentoo/bacula-sd \
1824             platforms/gentoo/bacula-dir"
1825   ;;
1826 slackware)
1827         DISTVER=`cat /etc/slackware-version`
1828         TAPEDRIVE="/dev/nst0"
1829         PSCMD="ps -e -o pid,command"
1830         PFILES="${PFILES} \
1831             platforms/slackware/Makefile \
1832             platforms/slackware/rc.bacula-fd \
1833             platforms/slackware/rc.bacula-sd \
1834             platforms/slackware/rc.bacula-dir\
1835             platforms/slackware/functions.bacula"
1836   ;;
1837 solaris)
1838         DISTVER=`uname -r`
1839         TAPEDRIVE="/dev/rmt/0cbn"
1840         PSCMD="ps -e -o pid,comm"
1841         PFILES="${PFILES} \
1842             platforms/solaris/Makefile \
1843             platforms/solaris/bacula-fd \
1844             platforms/solaris/bacula-sd \
1845             platforms/solaris/bacula-dir"
1846         if test x$DISTVER = x5.6 ; then
1847             AC_DEFINE(HAVE_OLD_SOCKOPT)
1848         fi
1849         LIBS="$LIBS -lresolv"
1850   ;;
1851 suse)
1852         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1853             cut -f 3 -d ' '`
1854         TAPEDRIVE="/dev/nst0"
1855         PSCMD="ps -e -o pid,command"
1856         PFILES="${PFILES} \
1857             platforms/suse/Makefile \
1858             platforms/suse/bacula-fd \
1859             platforms/suse/bacula-sd \
1860             platforms/suse/bacula-dir \
1861             platforms/suse/bacula \
1862             platforms/suse/bacula.spec"
1863   ;;
1864 suse5)
1865         DISTNAME=suse
1866         DISTVER=5.x
1867         TAPEDRIVE="/dev/nst0"
1868         PSCMD="ps -e -o pid,command"
1869         PFILES="${PFILES} \
1870             platforms/suse/Makefile \
1871             platforms/suse/bacula-fd \
1872             platforms/suse/bacula-sd \
1873             platforms/suse/bacula-dir"
1874   ;;
1875 unknown)
1876         DISTVER=unknown
1877         TAPEDRIVE="/dev/nst0"
1878   ;;
1879 *)
1880   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1881   ;;
1882 esac  
1883
1884 AC_SUBST(hostname)
1885
1886 LIBS="$PTHREAD_LIB $LIBS"
1887
1888 AC_DEFINE_UNQUOTED(lld, "$lld")
1889 AC_DEFINE_UNQUOTED(llu, "$llu")
1890 AC_SUBST(TAPEDRIVE)
1891 AC_SUBST(PSCMD)
1892 AC_SUBST(WIN32)
1893 AC_SUBST(MACOSX)
1894 AC_SUBST(DISTNAME)
1895 AC_SUBST(DISTVER)
1896
1897 dnl# common parts of the Makefile
1898 MCOMMON=./autoconf/Make.common
1899 AC_SUBST_FILE(MCOMMON)
1900
1901 dnl# Insanity check
1902 if test "x${subsysdir}" = "x${sbindir}" ; then
1903    echo " "
1904    echo " "
1905    echo "You have set both --sbindir and --with-subsys-dir"
1906    echo "  equal to: ${subsysdir} "
1907    echo "This is not permitted. Please reconfigure."
1908    echo " "
1909    echo "Aborting configuration ..."
1910    echo " "
1911    echo " "
1912    exit 1
1913 fi 
1914
1915 AC_OUTPUT([autoconf/Make.common \
1916            Makefile \
1917            scripts/startmysql \
1918            scripts/stopmysql \
1919            scripts/btraceback \
1920            scripts/startit \
1921            scripts/stopit \
1922            scripts/bconsole \
1923            scripts/gconsole \
1924            scripts/bacula \
1925            scripts/bacula-ctl-dir \
1926            scripts/bacula-ctl-fd \
1927            scripts/bacula-ctl-sd \
1928            scripts/devel_bacula \
1929            scripts/Makefile \
1930            scripts/logrotate \
1931            scripts/bacula.desktop.gnome1 \
1932            scripts/bacula.desktop.gnome2 \
1933            scripts/bacula.desktop.gnome1.consolehelper \
1934            scripts/bacula.desktop.gnome2.consolehelper \
1935            scripts/bacula.desktop.gnome1.xsu \
1936            scripts/bacula.desktop.gnome2.xsu \
1937            scripts/gnome-console.console_apps \
1938            scripts/mtx-changer \
1939            scripts/disk-changer \
1940            scripts/dvd-handler \
1941            scripts/bacula-tray-monitor.desktop \
1942            scripts/logwatch/Makefile \
1943            scripts/logwatch/logfile.bacula.conf \
1944            scripts/wxconsole.console_apps \
1945            scripts/wxconsole.desktop.consolehelper \
1946            scripts/wxconsole.desktop.xsu \
1947            src/Makefile \
1948            src/host.h \
1949            src/console/Makefile \
1950            src/console/bconsole.conf \
1951            src/gnome2-console/Makefile \
1952            src/gnome2-console/gnome-console.conf \
1953            src/wx-console/Makefile \
1954            src/wx-console/wx-console.conf \
1955            src/tray-monitor/Makefile \
1956            src/tray-monitor/tray-monitor.conf \
1957            src/dird/Makefile \
1958            src/dird/bacula-dir.conf \
1959            src/lib/Makefile \
1960            src/stored/Makefile \
1961            src/stored/bacula-sd.conf \
1962            src/filed/Makefile \
1963            src/filed/bacula-fd.conf \
1964            src/filed/win32/Makefile \
1965            src/cats/Makefile \
1966            src/cats/make_catalog_backup \
1967            src/cats/delete_catalog_backup \
1968            src/cats/create_postgresql_database \
1969            src/cats/update_postgresql_tables \
1970            src/cats/make_postgresql_tables \
1971            src/cats/grant_postgresql_privileges \
1972            src/cats/drop_postgresql_tables \
1973            src/cats/drop_postgresql_database \
1974            src/cats/create_mysql_database \
1975            src/cats/update_mysql_tables \
1976            src/cats/make_mysql_tables \
1977            src/cats/grant_mysql_privileges \
1978            src/cats/drop_mysql_tables \
1979            src/cats/drop_mysql_database \
1980            src/cats/create_sqlite_database \
1981            src/cats/update_sqlite_tables \
1982            src/cats/make_sqlite_tables \
1983            src/cats/grant_sqlite_privileges \
1984            src/cats/drop_sqlite_tables \
1985            src/cats/drop_sqlite_database \
1986            src/cats/create_sqlite3_database \
1987            src/cats/update_sqlite3_tables \
1988            src/cats/make_sqlite3_tables \
1989            src/cats/grant_sqlite3_privileges \
1990            src/cats/drop_sqlite3_tables \
1991            src/cats/drop_sqlite3_database \
1992            src/cats/sqlite \
1993            src/cats/mysql \
1994            src/cats/create_bdb_database \
1995            src/cats/update_bdb_tables \
1996            src/cats/make_bdb_tables \
1997            src/cats/grant_bdb_privileges \
1998            src/cats/drop_bdb_tables \
1999            src/cats/drop_bdb_database \
2000            src/cats/create_bacula_database \
2001            src/cats/update_bacula_tables \
2002            src/cats/grant_bacula_privileges \
2003            src/cats/make_bacula_tables \
2004            src/cats/drop_bacula_tables \
2005            src/cats/drop_bacula_database \
2006            src/findlib/Makefile \
2007            src/pygtk-console/Makefile \
2008            src/tools/Makefile \
2009            src/win32/winbacula.nsi \
2010            src/win32/baculafd/bacula-fd.conf \
2011            src/win32/Makefile \
2012            src/win32/Makefile.vcpp \
2013            src/win32/console/bconsole.conf \
2014            src/win32/wx-console/wx-console.conf \
2015            src/win32/pebuilder/Makefile \
2016            po/Makefile.in \
2017            $PFILES ],  
2018           [(echo "Doing make of dependencies"; ${MAKE:-make} depend;) ]
2019 )
2020
2021 cd scripts
2022 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
2023 chmod 755 dvd-handler
2024 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
2025 cd ..
2026
2027 c=src/cats
2028
2029 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
2030 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
2031
2032 chmod 755 $c/create_bdb_database      $c/update_bdb_tables     $c/make_bdb_tables
2033 chmod 755 $c/grant_bdb_privileges     $c/drop_bdb_tables       $c/drop_bdb_database
2034
2035 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
2036 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
2037
2038 chmod 755 $c/create_sqlite_database   $c/update_sqlite_tables  $c/make_sqlite_tables
2039 chmod 755 $c/grant_sqlite_privileges  $c/drop_sqlite_tables    $c/drop_sqlite_database
2040
2041 chmod 755 $c/create_sqlite3_database   $c/update_sqlite3_tables  $c/make_sqlite3_tables
2042 chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables    $c/drop_sqlite3_database
2043
2044 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
2045 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
2046
2047 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup
2048 chmod 755 $c/sqlite
2049 chmod 755 $c/mysql
2050
2051 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
2052    largefile_support="yes"
2053 fi
2054
2055 #
2056 # A whole lot of hand springs to get the compiler version.
2057 #  This is because gcc changed the output in version 3.0
2058 #
2059 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2060 if test "x${CCVERSION}" = "x" ; then
2061   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2062 fi
2063 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
2064 if test x"${CXXVERSION}" = x ; then
2065   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
2066 fi
2067
2068 if test "x${subsysdir}" = "x${sbindir}" ; then
2069    echo " "
2070    echo " "
2071    echo "You have set --sbindir and --with-subsys-dir"
2072    echo "  both equal to: ${subsysdir} "
2073    echo "  This is not permitted. Please reconfigure."
2074    echo " "
2075    echo "Aborting configuration ..."
2076    echo " "
2077    echo " "
2078    exit 1
2079 fi 
2080
2081 if test "x${db_name}" = "xInternal" ; then
2082    echo " "
2083    echo " "
2084    echo "You have not specified either --enable-client-only or one of the"
2085    echo "  supported databases: MySQL, PostgreSQL, SQLite3 or SQLite."
2086    echo "  This is not permitted. Please reconfigure."
2087    echo " "
2088    echo "Aborting the configuration ..."
2089    echo " "
2090    echo " "
2091    exit 1
2092 fi
2093
2094 echo "
2095 Configuration on `date`:
2096
2097   Host:                       $host -- ${DISTNAME} ${DISTVER}
2098   Bacula version:             ${VERSION} (${DATE})
2099   Source code location:       ${srcdir}
2100   Install binaries:           ${sbindir}
2101   Install config files:       ${sysconfdir}
2102   Scripts directory:          ${scriptdir}
2103   Working directory:          ${working_dir}
2104   PID directory:              ${piddir}
2105   Subsys directory:           ${subsysdir}
2106   Man directory:              ${mandir}
2107   Data directory:             ${datadir}
2108   C Compiler:                 ${CC} ${CCVERSION}
2109   C++ Compiler:               ${CXX} ${CXXVERSION}
2110   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
2111   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
2112   Libraries:                  ${LIBS}
2113   Statically Linked Tools:    ${support_static_tools}
2114   Statically Linked FD:       ${support_static_fd}
2115   Statically Linked SD:       ${support_static_sd}
2116   Statically Linked DIR:      ${support_static_dir}
2117   Statically Linked CONS:     ${support_static_cons}
2118   Database type:              ${db_name}
2119   Database lib:               ${DB_LIBS}
2120
2121   Job Output Email:           ${job_email}
2122   Traceback Email:            ${dump_email}
2123   SMTP Host Address:          ${smtp_host}
2124
2125   Director Port:              ${dir_port}
2126   File daemon Port:           ${fd_port}
2127   Storage daemon Port:        ${sd_port}
2128
2129   Director User:              ${dir_user}
2130   Director Group:             ${dir_group}
2131   Storage Daemon User:        ${sd_user}
2132   Storage DaemonGroup:        ${sd_group}
2133   File Daemon User:           ${fd_user}
2134   File Daemon Group:          ${fd_group}
2135
2136   SQL binaries Directory      ${SQL_BINDIR}
2137
2138   Large file support:         $largefile_support
2139   Bacula conio support:       ${got_conio} ${CONS_LIBS}
2140   readline support:           ${got_readline} ${PRTREADLINE_SRC}
2141   TCP Wrappers support:       ${TCPW_MSG} ${WRAPLIBS}
2142   TLS support:                ${support_tls}
2143   Encryption support:         ${support_crypto} 
2144   ZLIB support:               ${have_zlib}
2145   enable-smartalloc:          ${support_smartalloc} 
2146   enable-gnome:               ${support_gnome} ${gnome_version}
2147   enable-wx-console:          ${support_wx_console} ${wx_version}
2148   enable-tray-monitor:        ${support_tray_monitor}
2149   client-only:                ${build_client_only}
2150   build-dird:                 ${build_dird}
2151   build-stored:               ${build_stored}
2152   ACL support:                ${have_acl}
2153   Python support:             ${support_python} ${PYTHON_LIBS}
2154
2155   " > config.out
2156
2157 cat config.out