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