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