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