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