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