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