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