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