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