]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
BSDI port changes
[bacula/bacula] / bacula / autoconf / configure.in
1 dnl#
2 dnl#
3 dnl# Process this file with autoconf to produce a configure script.
4 dnl#
5 AC_INIT(src/version.h)
6 BUILD_DIR=`pwd`
7 cd ..
8 TOP_DIR=`pwd`
9 cd ${BUILD_DIR}
10 AC_SUBST(BUILD_DIR)
11 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
12 AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in)
13
14 dnl require a recent autoconf
15 AC_PREREQ(2.13)
16
17
18 dnl search for true and false programs.
19 AC_PATH_PROGS(TRUEPRG, true, :)
20 AC_PATH_PROGS(FALSEPRG, false, :)
21
22 AC_CANONICAL_HOST
23
24 dnl bacula version
25 VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
26 DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
27 LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
28 AC_SUBST(VERSION)dnl 
29 AC_SUBST(DATE)dnl 
30 AC_SUBST(LSMDATE)dnl 
31 echo "configuring for bacula $VERSION ($DATE)"
32
33
34 dnl -------------------------------------------------------
35 dnl# Check for compiler.
36 dnl ------------------------------------------------------
37
38 AC_PROG_CC
39 AC_PROG_CXX
40 AC_PROG_CC_C_O                  dnl Determine if C compiler support -c -o.
41 AC_PROG_GCC_TRADITIONAL         dnl Determine if ioctl() need -traditional.
42
43 if test x$CC = xgcc
44 then
45    AC_DEFINE(HAVE_GCC)
46 fi
47
48 dnl -------------------------------------------------------
49 dnl# Check for programs.
50 dnl ------------------------------------------------------
51 AC_PROG_INSTALL
52 AC_PROG_RANLIB
53 AC_PATH_PROG(MV, mv, mv)
54 AC_PATH_PROG(RM, rm, rm)
55 AC_PATH_PROG(CP, cp, cp)
56 AC_PATH_PROG(SED, sed, sed)
57 AC_PATH_PROG(AWK, awk, awk)
58 AC_PATH_PROG(ECHO, echo, echo)
59 AC_PATH_PROG(CMP, cmp, cmp)
60 AC_PATH_PROG(TBL, tbl, tbl)
61 AC_PATH_PROG(AR, ar, ar)
62 AC_PATH_PROG(RANLIB, ranlib, ranlib)
63 AC_PATH_PROG(OPENSSL, openssl, none)
64
65 test -n "$ARFLAG" || ARFLAGS="cr"
66 AC_SUBST(ARFLAGS)
67
68 MAKE_SHELL=/bin/sh
69 AC_SUBST(MAKE_SHELL)
70
71 AC_SUBST(LOCAL_LIBS)
72 AC_SUBST(LOCAL_CFLAGS)
73 AC_SUBST(LOCAL_LDFLAGS)
74 AC_SUBST(LOCAL_DEFS)
75
76
77
78 dnl --------------------------------------------------
79 dnl Bacula OP Sys determination (see aclocal.m4)
80 dnl --------------------------------------------------
81 BA_CHECK_OPSYS
82
83 # -----------------------------------------------------------
84 dnl Bacula OPSys Distribution determination (see aclocal.m4)
85 # ----------------------------------------------------------
86 BA_CHECK_OPSYS_DISTNAME
87
88 # -----------------------------------------------------------
89 dnl Check for gnome stuff for gnome-console
90 # ----------------------------------------------------------
91 AM_ACLOCAL_INCLUDE(gnome-macros)
92
93 # ------------------------------------------------------------------
94 #  If the user has not set --prefix, we set our default to nothing.
95 #  In this case, if the user has not set --sysconfdir, we set it
96 #  to the package default of /etc/bacula.  If either --prefix or
97 #  --sysconfdir is set, we leave sysconfdir alone except to eval it.
98 # ------------------------------------------------------------------
99 if test x${prefix} = xNONE ; then
100     if test `eval echo ${sysconfdir}` = NONE/etc ; then
101         sysconfdir=/etc/bacula
102     fi
103     prefix=
104 fi
105 sysconfdir=`eval echo ${sysconfdir}`
106
107 # -------------------------------------------------------------------------
108 #  If the user has not set --exec-prefix, we default to ${prefix}
109 # -------------------------------------------------------------------------
110 if test x${exec_prefix} = xNONE ; then
111     exec_prefix=${prefix}
112 fi
113
114 # ------------------------------------------------------------------
115 # If the user has not set --sbindir, we set our default as /sbin
116 # ------------------------------------------------------------------
117 if test x$sbindir = x'${exec_prefix}/sbin' ; then
118     sbindir=${exec_prefix}/sbin
119 fi
120 sbindir=`eval echo ${sbindir}`
121                       
122 # ------------------------------------------------------------------
123 # All list of languages for which a translation exist. Each
124 #  language is separated by a space.
125 # ------------------------------------------------------------------
126 ALL_LINGUAS=""
127
128 AC_PATH_PROGS(MSGFMT, msgfmt, no)
129 if test "$MSGFMT" = "no"
130 then
131    echo 'msgfmt program not found, disabling NLS !'
132    USE_NLS=no
133    USE_INCLUDED_LIBINTL=no
134 #else
135 #   AM_GNU_GETTEXT
136 fi
137
138
139 support_mysql=no
140 support_sqlite=no
141 support_smartalloc=yes
142 support_readline=yes
143 support_gnome=no
144 support_static_tools=no
145 support_static_fd=no
146 support_static_sd=no
147 support_static_dir=no
148 support_static_cons=no
149 build_client_only=no
150 cats=
151 db_name=Internal
152 DB_NAME=bdb
153
154 dnl# --------------------------------------------------------------------------
155 dnl# CHECKING COMMAND LINE OPTIONS
156 dnl# --------------------------------------------------------------------------
157
158 # -------------------------------------------
159 # gnome (default off)
160 # -------------------------------------------
161 AC_ARG_ENABLE(gnome,
162   [  --enable-gnome       enable build of gnome-console GUI [disabled]],
163   [if test x$enableval = xyes; then
164     support_gnome=yes
165   fi])
166
167 GNOME_DIR=
168 if test x$support_gnome = xyes; then
169     GNOME_INIT
170     GNOME_DIR=src/gnome-console
171 fi
172 AC_SUBST(GNOME_DIR)
173
174
175 # -------------------------------------------
176 # smartalloc (default off)
177 # -------------------------------------------
178 AC_ARG_ENABLE(smartalloc,
179   [  --enable-smartalloc     enable smartalloc debugging support [disabled]],
180   [if test x$enableval = xno; then
181     support_smartalloc=no
182   fi])
183
184 if test x$support_smartalloc = xyes; then
185    AC_DEFINE(SMARTALLOC)
186 fi
187
188 # -------------------------------------------
189 # static-tools (default off)
190 # -------------------------------------------
191 AC_ARG_ENABLE(static-tools,
192    [  --enable-static-tools   enable static tape tools [disabled]],
193    [if test x$enableval = xyes; then
194      support_static_tools=yes
195    fi])
196
197 TTOOL_LDFLAGS=
198 if test x$support_static_tools = xyes; then
199    TTOOL_LDFLAGS="-static"
200 fi
201 AC_SUBST(TTOOL_LDFLAGS)
202
203 # -------------------------------------------
204 # static-fd    (default off)
205 # -------------------------------------------
206 AC_ARG_ENABLE(static-fd,
207    [  --enable-static-fd      enable static File daemon [disabled]],
208    [if test x$enableval = xyes; then
209      support_static_fd=yes
210    fi])
211
212 STATIC_FD=
213 if test x$support_static_fd = xyes; then
214    STATIC_FD="static-bacula-fd"
215 fi
216 AC_SUBST(STATIC_FD)
217
218 # -------------------------------------------
219 # static-sd    (default off)
220 # -------------------------------------------
221 AC_ARG_ENABLE(static-sd,
222    [  --enable-static-sd      enable static Storage daemon [disabled]],
223    [if test x$enableval = xyes; then
224      support_static_sd=yes
225    fi])
226
227 STATIC_SD=
228 if test x$support_static_sd = xyes; then
229    STATIC_SD="static-bacula-sd"
230 fi
231 AC_SUBST(STATIC_SD)
232
233 # -------------------------------------------
234 # static-dir   (default off)
235 # -------------------------------------------
236 AC_ARG_ENABLE(static-dir,
237    [  --enable-static-dir     enable static Director [disabled]],
238    [if test x$enableval = xyes; then
239      support_static_dir=yes
240    fi])
241
242 STATIC_DIR=
243 if test x$support_static_dir = xyes; then
244    STATIC_DIR="static-bacula-dir"
245 fi
246 AC_SUBST(STATIC_DIR)
247
248 # -------------------------------------------
249 # static-cons  (default off)
250 # -------------------------------------------
251 AC_ARG_ENABLE(static-cons,
252    [  --enable-static-cons    enable static Console [disabled]],
253    [if test x$enableval = xyes; then
254      support_static_cons=yes
255    fi])
256
257 STATIC_CONS=
258 if test x$support_static_cons = xyes; then
259    STATIC_CONS="static-console"
260 fi
261 AC_SUBST(STATIC_CONS)
262
263 # -------------------------------------------
264 # client_only  (default off)
265 # -------------------------------------------
266 AC_ARG_ENABLE(client-only,
267    [  --enable-client-only    build client (File daemon) only [disabled]],
268    [if test x$enableval = xyes; then
269      build_client_only=yes
270    fi])
271 if test x$build_client_only = xno; then
272    ALL_DIRS="subdirs"
273 else
274    ALL_DIRS=""
275 fi
276 AC_SUBST(ALL_DIRS)
277
278 # ---------------------------------------------------
279 # Check for readline support/directory (default on)
280 # ---------------------------------------------------
281 # this allows you to turn it completely off
282 AC_ARG_ENABLE(readline,
283   [  --disable-readline      disable readline support [enabled]
284                                                       ],
285   [if test x$enableval = xno; then
286     support_readline=no
287   fi])
288
289 got_readline="no"
290 READLINE_SRC=
291 if test x$support_readline = xyes; then
292    AC_ARG_WITH(readline,
293      [ --with-readline=DIR               specify readline library directory],
294      [
295         case "$with_readline" in
296         no) : ;;
297         yes|*)
298           if test "$with_readline" != "yes"; then
299             CONS_INC="-I$with_readline"
300             CONS_LDFLAGS="-L$with_readline"
301           else
302              with_readline="/usr/include/readline" 
303           fi
304           AC_CHECK_HEADER($with_readline/readline.h, 
305              [ AC_MSG_RESULT(yes)
306                AC_DEFINE(HAVE_READLINE) 
307                CONS_LIBS="-lreadline -ltermcap"
308                got_readline="yes"   
309              ],
310              [ AC_MSG_ERROR([*** readline library missing]) 
311              ]
312           )
313           ;;
314         esac
315      ],[
316        # check for standard readline library
317        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
318        [ AC_MSG_RESULT(yes)
319          AC_DEFINE(HAVE_READLINE)
320          got_readline="yes"
321          CONS_INC="-I/usr/include/readline"
322          CONS_LIBS="-lreadline -ltermcap"
323        ], [
324          # Did not find starndard library, so user our own
325          AC_MSG_RESULT(yes)
326          AC_DEFINE(HAVE_READLINE)
327          got_readline="yes"
328          CONS_INC="-I${TOP_DIR}/depkgs"
329          CONS_LIBS="-lreadline -lhistory -ltermcap"
330          CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
331          PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
332        ])
333      ]   
334    )
335 fi
336 AC_SUBST(CONS_INC)
337 AC_SUBST(CONS_LIBS)
338 AC_SUBST(CONS_LDFLAGS)
339 AC_SUBST(READLINE_SRC)
340
341 # Minimal stuff for readline Makefile configuration
342 MAKE_SHELL=/bin/sh
343 AC_SUBST(MAKE_SHELL)
344
345 AC_HEADER_STAT
346 AC_HEADER_DIRENT
347
348 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat lchown)
349 AC_CHECK_FUNCS(nanosleep)
350
351 #AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG),
352 #   [LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o"
353 #    EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"])
354
355 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG))
356
357
358 AC_FUNC_STRCOLL
359
360 AC_CHECK_HEADERS(varargs.h \
361                 sys/ptem.h sys/pte.h sys/stream.h)      
362
363 # End of readline stuff
364 # -----------------------------------------------------------------------
365
366
367 # ---------------------------------------------------
368 # Check for GMP support/directory
369 # ---------------------------------------------------
370 #GMP_SRC=
371 #local_gmp="no"
372 #AC_ARG_WITH(gmp,
373 #  [  --with-gmp[=DIR]   Specify gmp library directory],
374 #  [
375 #     case "$with_gmp" in
376 #     no) : ;;
377 #     yes|*)
378 #       if test "$with_gmp" != "yes"; then
379 #         GMP_INC="-I$with_gmp"
380 #         GMP_LIBS="-lgmp"
381 #         GMP_LDFLAGS="-L$with_gmp"
382 #       else
383 #          with_gmp="/usr/include" 
384 #       fi
385 #       AC_CHECK_HEADER($with_gmp/gmp.h, 
386 #          [ AC_MSG_RESULT(yes)
387 #            AC_DEFINE(HAVE_GMP) 
388 #            GMP_LIBS="-lgmp"
389 #            got_gmp="yes"   
390 #          ],
391 #          [ AC_MSG_ERROR([*** gmp library missing]) 
392 #          ]
393 #       )
394 #       ;;
395 #     esac
396 #  ],[
397 #    # check for standard gmp library
398 #    AC_CHECK_HEADER(/usr/include/gmp.h,
399 #    [ AC_MSG_RESULT(yes)
400 #      AC_DEFINE(HAVE_GMP)
401 #      got_gmp="yes"
402 #      GMP_INC=
403 #      GMP_LIBS="-lgmp"
404 #    ], [
405 #      # Did not find standard library, so use our own
406 #      AC_MSG_RESULT(yes)
407 #      AC_DEFINE(HAVE_GMP)
408 #      got_gmp="yes"
409 #      local_gmp="yes"
410 #      GMP_INC="-I${TOP_DIR}/depkgs/gmp"
411 #      GMP_LIBS="-lgmp"
412 #      GMP_LDFLAGS="-L${TOP_DIR}/depkgs/gmp"
413 #      GMP_SRC="${TOP_DIR}/depkgs/gmp"
414 #    ])
415 #  ]   
416 #)
417 #AC_SUBST(GMP_INC)
418 #AC_SUBST(GMP_LIBS)
419 #AC_SUBST(GMP_LDFLAGS)
420 #AC_SUBST(GMP_SRC)
421
422 # End of GMP stuff
423 # -----------------------------------------------------------------------
424
425
426 # ---------------------------------------------------
427 # Check for CWEB support/directory
428 # ---------------------------------------------------
429 #CWEB_SRC=
430 #CWEB=/bin
431 #local_cweb="no"
432 #AC_ARG_WITH(cweb,
433 #  [  --with-cweb[=DIR]   Specify cweb library directory],
434 #  [
435 #     case "$with_cweb" in
436 #     no) : ;;
437 #     yes|*)
438 #       if test "$with_cweb" != "yes"; then
439 #         CWEB_INC="-I$with_cweb"
440 #         CWEB_LIBS="-lcweb"
441 #         CWEB_LDFLAGS="-L$with_cweb"
442 #       else
443 #          with_cweb="/usr/include" 
444 #       fi
445 #       AC_CHECK_HEADER($with_cweb/cweb.h, 
446 #          [ AC_MSG_RESULT(yes)
447 #            AC_DEFINE(HAVE_CWEB) 
448 #            CWEB_LIBS="-lcweb"
449 #            got_cweb="yes"   
450 #          ],
451 #          [ AC_MSG_ERROR([*** cweb library missing]) 
452 #          ]
453 #       )
454 #       ;;
455 #     esac
456 #  ],[
457 #    # check for standard cweb library
458 #    AC_CHECK_HEADER(/usr/include/cweb.h,
459 #    [ AC_MSG_RESULT(yes)
460 #      AC_DEFINE(HAVE_CWEB)
461 #      got_cweb="yes"
462 #      CWEB_INC=
463 #      CWEB_LIBS="-lcweb"
464 #    ], [
465 #      # Did not find starndard library, so use our own
466 #      AC_MSG_RESULT(yes)
467 #      AC_DEFINE(HAVE_CWEB)
468 #      got_cweb="yes"
469 #      local_cweb="yes"
470 #      CWEB=${TOP_DIR}/depkgs/cweb
471 #      CWEB_INC="-I${TOP_DIR}/depkgs/cweb"
472 #      CWEB_LIBS="-lcweb"
473 #      CWEB_LDFLAGS="-L${TOP_DIR}/depkgs/cweb"
474 #      CWEB_SRC="${TOP_DIR}/depkgs/cweb"
475 #    ])
476 #  ]   
477 #)
478 #AC_SUBST(CWEB)
479 #AC_SUBST(CWEB_INC)
480 #AC_SUBST(CWEB_LIBS)
481 #AC_SUBST(CWEB_LDFLAGS)
482 #AC_SUBST(CWEB_SRC)
483
484 # End of CWEB stuff
485 # -----------------------------------------------------------------------
486
487
488
489 # -----------------------------------------------------------
490 # Check whether user wants TCP wrappers support (default off)
491 # -----------------------------------------------------------
492 TCPW_MSG="no" 
493 AC_ARG_WITH(tcp-wrappers,
494   [  --with-tcp-wrappers=DIR     enable tcpwrappers support],
495   [
496     if test "x$withval" != "xno" ; then
497        saved_LIBS="$LIBS"
498        LIBS="$LIBS -lwrap -lnsl"
499        AC_MSG_CHECKING(for libwrap)
500        AC_TRY_LINK(
501           [ #include <tcpd.h>
502              int deny_severity = 0;
503              int allow_severity = 0;
504              struct request_info *req; ],
505           [ hosts_access(req); ],
506           [
507             AC_MSG_RESULT(yes)
508             AC_DEFINE(HAVE_LIBWRAP)
509             TCPW_MSG="yes" 
510           ],
511           [AC_MSG_ERROR([*** libwrap missing]) ]
512        )
513     fi
514   ]
515 )
516
517 # ------------------------------------------
518 # Where to place working dir
519 # ------------------------------------------
520 working_dir=`eval echo ${sysconfdir}/working`
521 AC_ARG_WITH(working-dir,
522    [  --with-working-dir=PATH    specify path of Bacula working directory],
523    [
524        if test "x$withval" != "xno" ; then     
525               working_dir=$withval
526        fi
527    ]
528 )
529
530 AC_SUBST(working_dir)
531
532
533 # ------------------------------------------
534 # Where to place scriptdir (script files)
535 # ------------------------------------------
536 scriptdir=`eval echo ${sysconfdir}`
537 AC_ARG_WITH(scriptdir,
538    [  --with-scriptdir=PATH    specify path of Bacula scripts directory],
539    [
540        if test "x$withval" != "xno" ; then     
541               scriptdir=$withval
542        fi
543    ]
544 )
545
546 AC_SUBST(scriptdir)
547
548
549 # ------------------------------------------
550 # Where to send dump email
551 # ------------------------------------------
552 dump_email=root@localhost
553 AC_ARG_WITH(dump-email,
554    [  --with-dump-email=EMAIL    dump email address],
555    [
556        if test "x$withval" != "xno" ; then     
557               dump_email=$withval
558        fi
559    ]
560 )
561
562 AC_SUBST(dump_email)
563
564 # ------------------------------------------
565 # Where to send job email
566 # ------------------------------------------
567 job_email=root@localhost
568 AC_ARG_WITH(job-email,
569    [  --with-job-email=EMAIL     job output email address],
570    [
571        if test "x$withval" != "xno" ; then     
572               job_email=$withval
573        fi
574    ]
575 )
576
577 AC_SUBST(job_email)
578
579 # ------------------------------------------
580 # Where to find smtp host
581 # ------------------------------------------
582 smtp_host=localhost
583 AC_ARG_WITH(smtp_host,
584    [  --with-smtp-host=HOST              SMTP mail host address],
585    [
586        if test "x$withval" != "xno" ; then     
587               smtp_host=$withval
588        fi
589    ]
590 )
591
592 AC_SUBST(smtp_host)
593
594
595 # ------------------------------------
596 # Where to place pid files
597 # ------------------------------------
598 piddir=/var/run
599 AC_ARG_WITH(pid-dir,
600     [  --with-pid-dir=PATH               specify location of Bacula pid files],
601     [
602         if test "x$withval" != "xno" ; then     
603             piddir=$withval
604         fi
605     ]
606 )
607
608 AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
609 AC_SUBST(piddir)
610
611
612 # ------------------------------------
613 # Where to place subsys "lock file"
614 # ------------------------------------
615 subsysdir=/var/run/subsys
616 AC_ARG_WITH(subsys-dir,
617     [  --with-subsys-dir=PATH    specify location of Bacula subsys file],
618     [
619         if test "x$withval" != "xno" ; then     
620             subsysdir=$withval
621         fi
622     ]
623 )
624
625 AC_SUBST(subsysdir)
626
627
628
629 # ------------------------------------
630 # Where to start assigning ports
631 # ------------------------------------
632 baseport=9101
633 AC_ARG_WITH(baseport,
634     [  --with-baseport=PORT              specify base port address for daemons],
635     [
636         if test "x$withval" != "xno" ; then     
637              baseport=$withval
638         fi
639     ]
640 )
641
642 AC_SUBST(baseport)
643 dir_port=`expr $baseport`
644 fd_port=`expr $baseport + 1`
645 sd_port=`expr $fd_port + 1`
646
647 AC_SUBST(dir_port)
648 AC_SUBST(fd_port)
649 AC_SUBST(sd_port)
650
651
652 # ------------------------------------------
653 # Generate passwords
654 # ------------------------------------------
655 dir_password=
656 AC_ARG_WITH(dir-password,
657    [  --with-dir-password=PASSWORD   specify Director's password],
658    [
659        if test "x$withval" != "xno" ; then     
660            dir_password=$withval
661        fi
662    ]
663 )
664
665 if test "x$dir_password" = "x" ; then
666    if test "x$OPENSSL" = "xnone" ; then
667 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'`
668       key=`autoconf/randpass 33`
669    else
670       key=`openssl rand -base64 33`
671    fi
672    dir_password=$key
673 fi
674
675 fd_password=
676 AC_ARG_WITH(fd-password,
677    [  --with-fd-password=PASSWORD    specify Client's password],
678    [
679        if test "x$withval" != "xno" ; then     
680            fd_password=$withval
681        fi
682    ]
683 )
684
685 if test "x$fd_password" = "x" ; then
686    if test "x$OPENSSL" = "xnone" ; then
687 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'`
688       key=`autoconf/randpass 37`
689    else
690       key=`openssl rand -base64 33`
691    fi
692    fd_password=$key
693 fi
694
695 sd_password=
696 AC_ARG_WITH(sd-password,
697    [  --with-sd-password=PASSWORD    specify Storage daemon's password],
698    [
699        if test "x$withval" != "xno" ; then     
700            sd_password=$withval
701        fi
702    ]
703 )
704
705 if test "x$sd_password" = "x" ; then
706    if test "x$OPENSSL" = "xnone" ; then
707 #     key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'`
708       key=`autocnf/randpass 41`
709    else
710       key=`openssl rand -base64 33`
711    fi
712    sd_password=$key
713 fi
714
715
716 AC_SUBST(dir_password)
717 AC_SUBST(fd_password)
718 AC_SUBST(sd_password)
719
720
721
722
723 # ------------------------------------------------
724 # Bacula check for various SQL database engines
725 # ------------------------------------------------
726 BA_CHECK_MYSQL_DB
727
728
729 # ------------------------------------------------
730 # Bacula check for various SQL database engines
731 # ------------------------------------------------
732 BA_CHECK_SQLITE_DB
733
734 AC_SUBST(cats)
735 AC_SUBST(DB_NAME)
736
737 AC_DEFINE(PROTOTYPES)
738
739 dnl# --------------------------------------------------------------------------
740 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
741 dnl#
742 if test -z "$CFLAGS"; then
743     if test -z "$CCOPTS"; then
744         CCOPTS='-g -O2'
745 dnl>    if test "x$GCC" = xyes; then
746 dnl>        if test x$system = xLinux; then
747 dnl>            CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
748 dnl>        fi
749 dnl>    fi
750     fi
751     CFLAGS="$CCOPTS"
752 fi
753
754
755 dnl A few others 
756 AC_EXEEXT
757
758 dnl See if we can use 64 bit file addresses
759 largefile_support="no"
760 AC_BAC_LARGEFILE
761
762
763 AC_PATH_XTRA
764
765 dnl# --------------------------------------------------------------------------
766 dnl# CHECKING FOR HEADER FILES
767 dnl# --------------------------------------------------------------------------
768 AC_CHECK_HEADERS( \
769         assert.h \
770         fcntl.h \
771         grp.h \
772         pwd.h \
773         libc.h \
774         limits.h \
775         stdarg.h \
776         stdlib.h \
777         stdint.h \
778         string.h \
779         termios.h \
780         unistd.h \
781         sys/byteorder.h \
782         sys/ioctl.h \
783         sys/select.h \
784         sys/sockio.h \
785         sys/time.h \
786         sys/socket.h \
787         arpa/nameser.h \
788         resolv.h \
789         mtio.h \
790         sys/mtio.h \
791 )
792 AC_HEADER_STDC
793 AC_HEADER_MAJOR
794 AC_HEADER_DIRENT
795 AC_HEADER_STAT
796 AC_HEADER_SYS_WAIT
797 AC_HEADER_TIME
798 AC_STRUCT_ST_BLKSIZE
799 AC_STRUCT_ST_BLOCKS
800 AC_STRUCT_TIMEZONE
801
802 dnl# --------------------------------------------------------------------------
803 dnl# Check for utime.h structure 
804 dnl# --------------------------------------------------------------------------
805 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
806   [AC_TRY_COMPILE([
807 #include <sys/types.h>
808 #include <utime.h>], [struct utimbuf foo],
809   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
810 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
811
812 dnl# --------------------------------------------------------------------------
813 dnl# Check for socklen_t
814 dnl# --------------------------------------------------------------------------
815 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
816   [AC_TRY_COMPILE([
817 #include <sys/types.h>
818 #include <sys/socket.h>],
819   [socklen_t x],
820   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
821 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
822
823 dnl# --------------------------------------------------------------------------
824 dnl# Check for bigendian
825 dnl# --------------------------------------------------------------------------
826 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
827   [AC_TRY_RUN(
828     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
829     [ba_cv_bigendian=yes], 
830     [ba_cv_bigendian=no], 
831     [ba_cv_bigendian=no])])
832 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
833
834
835 AC_C_CONST
836
837
838 dnl# --------------------------------------------------------------------------
839 dnl# CHECKING FOR FILESYSTEM TYPE
840 dnl# --------------------------------------------------------------------------
841 AC_MSG_CHECKING(how to get filesystem type)
842 fstype=no
843 # The order of these tests is important.
844 AC_TRY_CPP([#include <sys/statvfs.h>
845 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
846 if test $fstype = no; then
847 AC_TRY_CPP([#include <sys/statfs.h>
848 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
849 fi
850 if test $fstype = no; then
851 AC_TRY_CPP([#include <sys/statfs.h>
852 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
853 fi
854 if test $fstype = no; then  
855 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
856 fi
857 if test $fstype = no; then  
858 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
859 fi
860 if test $fstype = no; then  
861 AC_TRY_CPP([#include <sys/mount.h>
862 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
863 fi
864 AC_MSG_RESULT($fstype)
865
866 dnl# --------------------------------------------------------------------------
867 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
868 dnl# --------------------------------------------------------------------------
869 AC_TYPE_SIGNAL
870 SIGNAL_CHECK
871 AC_TYPE_MODE_T
872 AC_TYPE_UID_T
873 AC_TYPE_SIZE_T
874 AC_TYPE_PID_T
875 AC_TYPE_OFF_T
876 AC_CHECK_TYPE(ino_t, unsigned long)
877 AC_CHECK_TYPE(dev_t, unsigned long)
878 AC_CHECK_TYPE(daddr_t, long)
879 AC_CHECK_TYPE(major_t, int)
880 AC_CHECK_TYPE(minor_t, int)
881 AC_CHECK_TYPE(ssize_t, int)
882 AC_STRUCT_ST_BLOCKS
883 AC_STRUCT_ST_RDEV
884 AC_STRUCT_TM
885 AC_C_CONST
886
887
888 AC_CHECK_SIZEOF(char, 1)
889 AC_CHECK_SIZEOF(short int, 2)
890 AC_CHECK_SIZEOF(int, 4)
891 AC_CHECK_SIZEOF(long int, 4)
892 AC_CHECK_SIZEOF(long long int, 8)
893 AC_CHECK_SIZEOF(int *, 4)
894
895 # Check for sys/types.h types
896 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
897     AC_TRY_COMPILE(
898         [ #include <sys/types.h> ], 
899         [ u_int a; a = 1;], 
900         [ ac_cv_have_u_int="yes" ],
901         [ ac_cv_have_u_int="no" ]
902     )
903 ])
904 if test "x$ac_cv_have_u_int" = "xyes" ; then
905    AC_DEFINE(HAVE_U_INT)
906    have_u_int=1
907 fi
908
909 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
910    AC_TRY_COMPILE(
911       [ #include <sys/types.h> ], 
912       [ intmax_t a; a = 1;], 
913       [ ac_cv_have_intmax_t="yes" ],
914       [ 
915          AC_TRY_COMPILE(
916             [ #include <stdint.h> ], 
917             [ intmax_t a; a = 1;], 
918             [ ac_cv_have_intmax_t="yes" ],
919             [ ac_cv_have_intmax_t="no" ]
920          )
921       ]
922    )        
923
924 ])
925 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
926    AC_DEFINE(HAVE_INTMAX_T)
927    have_intmax_t=1
928 fi
929
930
931 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
932    AC_TRY_COMPILE(
933       [ #include <sys/types.h> ], 
934       [ u_intmax_t a; a = 1;], 
935       [ ac_cv_have_u_intmax_t="yes" ],
936       [ 
937          AC_TRY_COMPILE(
938             [ #include <stdint.h> ], 
939             [ u_intmax_t a; a = 1;], 
940             [ ac_cv_have_u_intmax_t="yes" ],
941             [ ac_cv_have_u_intmax_t="no" ]
942          )
943       ]
944    )
945 ])
946 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
947    AC_DEFINE(HAVE_U_INTMAX_T)
948    have_u_intmax_t=1
949 fi
950
951
952 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
953    AC_TRY_COMPILE(
954       [ #include <sys/types.h> ], 
955       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
956       [ ac_cv_have_intxx_t="yes" ],
957       [ ac_cv_have_intxx_t="no" ]
958    )
959 ])
960 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
961    AC_DEFINE(HAVE_INTXX_T)
962    have_intxx_t=1
963 fi
964         
965 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
966    AC_TRY_COMPILE(
967       [ #include <sys/types.h> ], 
968       [ int64_t a; a = 1;], 
969       [ ac_cv_have_int64_t="yes" ],
970       [ ac_cv_have_int64_t="no" ]
971    )
972 ])
973 if test "x$ac_cv_have_int64_t" = "xyes" ; then
974    AC_DEFINE(HAVE_INT64_T)
975    have_int64_t=1
976 fi
977         
978 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
979    AC_TRY_COMPILE(
980       [ #include <sys/types.h> ], 
981       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
982       [ ac_cv_have_u_intxx_t="yes" ],
983       [ ac_cv_have_u_intxx_t="no" ]
984    )
985 ])
986 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
987    AC_DEFINE(HAVE_U_INTXX_T)
988    have_u_intxx_t=1
989 fi
990
991 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
992    AC_TRY_COMPILE(
993       [ #include <sys/types.h> ], 
994       [ u_int64_t a; a = 1;], 
995       [ ac_cv_have_u_int64_t="yes" ],
996       [ ac_cv_have_u_int64_t="no" ]
997    )
998 ])
999 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1000    AC_DEFINE(HAVE_U_INT64_T)
1001    have_u_int64_t=1
1002 fi
1003
1004 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1005            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1006 then
1007    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1008    AC_TRY_COMPILE(
1009       [ #include <sys/bitypes.h>  ], 
1010       [ int8_t a; int16_t b; int32_t c;
1011         u_int8_t e; u_int16_t f; u_int32_t g;
1012         a = b = c = e = f = g = 1;  ], 
1013       [ AC_DEFINE(HAVE_U_INTXX_T)
1014         AC_DEFINE(HAVE_INTXX_T)
1015         AC_DEFINE(HAVE_SYS_BITYPES_H)
1016         AC_MSG_RESULT(yes) ],
1017       [ AC_MSG_RESULT(no)]
1018    ) 
1019 fi
1020
1021 if test -z "$have_u_intxx_t" ; then
1022    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1023       AC_TRY_COMPILE(
1024          [ #include <sys/types.h> ], 
1025          [ uint8_t a; uint16_t b; 
1026            uint32_t c; a = b = c = 1; ], 
1027          [ ac_cv_have_uintxx_t="yes" ],
1028          [ ac_cv_have_uintxx_t="no" ]
1029       )
1030    ])
1031    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1032       AC_DEFINE(HAVE_UINTXX_T)
1033    fi
1034 fi
1035
1036
1037 dnl# --------------------------------------------------------------------------
1038 dnl# CHECKING FOR LIBRARY FUNCTIONS
1039 dnl# --------------------------------------------------------------------------
1040 AC_CHECK_FUNCS( \
1041         fork \
1042         getcwd \
1043         gethostname \
1044         getpid \
1045         gettimeofday \
1046         setpgid \
1047         setpgrp \
1048         setsid \
1049         signal \
1050         strerror \
1051         strncmp \
1052         strncpy \
1053         vfprintf \
1054         strtoll \
1055         ,,
1056         [echo 'configure: cannot find needed function.'; exit 1]
1057 )
1058
1059 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1060
1061 AC_CHECK_FUNCS(chflags) 
1062
1063 AC_CHECK_FUNCS(snprintf vsnprintf gethostid getdomainname)
1064
1065 dnl# --------------------------------------------------------------------------
1066 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1067 dnl# --------------------------------------------------------------------------
1068 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1069
1070 # If resolver functions are not in libc check for -lnsl or -lresolv.
1071 AC_CHECK_FUNC(gethostbyname_r,
1072     AC_MSG_RESULT(using libc's resolver),
1073     AC_CHECK_LIB(nsl,gethostbyname_r)
1074     AC_CHECK_LIB(resolv,gethostbyname_r))
1075
1076
1077 # Find where sockets are (especially for Solaris)
1078 AC_CHECK_FUNC(socket,
1079     AC_MSG_RESULT(using libc's socket),
1080     AC_CHECK_LIB(xnet,socket)
1081     AC_CHECK_LIB(socket,socket)
1082     AC_CHECK_LIB(inet,socket))
1083
1084 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1085
1086 AC_FUNC_STRFTIME
1087 AC_FUNC_VPRINTF
1088 AC_FUNC_ALLOCA
1089 AC_FUNC_GETMNTENT
1090 AC_FUNC_CLOSEDIR_VOID
1091 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
1092 AC_FUNC_FNMATCH
1093
1094
1095 dnl# FreeBSD needs to link libxpg4
1096 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
1097
1098
1099 AC_CHECK_LIB(sun, getpwnam)
1100
1101 AC_CHECK_HEADERS(zlib.h)
1102 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1103 have_zlib=no
1104 if test x$FDLIBS = x-lz; then
1105   AC_DEFINE(HAVE_LIBZ)
1106   have_zlib=yes
1107 fi
1108
1109 dnl Check for pthread libraries
1110 PTHREAD_LIB=""
1111 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1112         [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1113             [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1114                 [AC_CHECK_FUNC(pthread_create)]
1115             )]
1116         )]
1117 )
1118
1119 AC_SUBST(FDLIBS)
1120 AC_DEFINE(FDLIBS)
1121
1122
1123 CFLAGS=${CFLAGS--O}
1124 LDFLAGS=${LDFLAGS--O}
1125 DB_LIBS="${SQL_LFLAGS}"
1126
1127 CPPFLAGS="$CPPFLAGS"
1128 AC_SUBST(DEBUG)
1129 AC_SUBST(DINCLUDE)
1130 AC_SUBST(CFLAGS)
1131 AC_SUBST(CPPFLAGS)
1132 AC_SUBST(LDFLAGS)
1133 AC_SUBST(X_CFLAGS)
1134 AC_SUBST(LIBS)
1135 AC_SUBST(DLIB)
1136 AC_SUBST(DB_LIBS)
1137 AC_SUBST(X_LIBS)
1138 AC_SUBST(X_EXTRA_LIBS)
1139 AC_SUBST(WCFLAGS)
1140 AC_SUBST(WLDFLAGS)
1141
1142 dnl# extra configurable objects
1143 OBJLIST=
1144 AC_SUBST(OBJLIST)
1145
1146 lld="lld"
1147 llu="llu"
1148
1149 WCFLAGS=
1150 WLDFLAGS=
1151
1152 #
1153 # Finally we set appropriate distribution specific
1154 #  variables and defaults
1155 #
1156 # PFILES are platform specific files
1157 PFILES="platforms/Makefile"
1158 PSCMD="ps -e"
1159 WIN32=
1160 hostname=`uname -n`
1161 case "$DISTNAME" in
1162 aix)
1163         DISTVER=`uname -r`
1164         PSCMD="ps -e -o pid,comm"
1165         PFILES="${PFILES} \
1166            platforms/aix/Makefile"
1167   ;;      
1168 alpha)
1169         DISTVER=`uname -r`
1170         PTHREAD_LIB="-lpthread -lexc"
1171         if test "${CC}" = "gcc" ; then
1172            lld="lld"
1173            llu="llu"
1174         else
1175            lld="ld"
1176            llu="lu"
1177         fi
1178         TAPEDRIVE="/dev/nrmt0"
1179   ;;
1180 bsdi)
1181         DISTVER=`uname -a |awk '{print $3}'`
1182         TAPEDRIVE="/dev/nrmt0"
1183         PTHREAD_LIB="-pthread"
1184         CFLAGS="${CFLAGS} -pthread"
1185         PSCMD="ps -x -o pid,command"
1186         lld="qd"
1187         llu="qu"
1188         PFILES="${PFILES} \
1189             platforms/bsdi/Makefile \
1190             platforms/bsdi/bacula-fd \
1191             platforms/bsdi/bacula-sd \
1192             platforms/bsdi/bacula-dir"
1193         hostname=`hostname -s`
1194         largefile_support="yes"
1195   ;;
1196 cygwin)
1197         DISTVER=`uname -a |awk '{print $3}'`
1198         TAPEDRIVE="/dev/nrst0"
1199         WIN32=win32
1200         WCFLAGS="-mwindows"
1201         WLDFLAGS="-mwindows"
1202   ;;
1203 darwin)
1204         DISTVER=`uname -r`
1205         TAPEDRIVE="/dev/nst0"
1206         PSCMD="ps -e -o pid,command"
1207         hostname=`hostname -s`
1208         PFILES="${PFILES} \
1209            platforms/darwin/Makefile"
1210   ;;
1211 debian)
1212         DISTVER=`cat /etc/debian_version`
1213         TAPEDRIVE="/dev/nrst0"
1214         PSCMD="ps -e -o pid,command"
1215         hostname=`hostname -s`
1216   ;;
1217 freebsd)
1218         DISTVER=`uname -a |awk '{print $3}'`
1219         PTHREAD_LIB="-pthread"
1220         CFLAGS="${CFLAGS} -pthread"
1221         lld="qd"
1222         llu="qu"
1223         TAPEDRIVE="/dev/nrsa0"
1224         PSCMD="ps -x -o pid,command"
1225         PFILES="${PFILES} \
1226             platforms/freebsd/Makefile \
1227             platforms/freebsd/bacula-fd \
1228             platforms/freebsd/bacula-sd \
1229             platforms/freebsd/bacula-dir"
1230         hostname=`hostname -s`
1231         largefile_support="yes"
1232   ;;
1233 hpux)
1234         DISTVER=`uname -r`
1235         TAPEDRIVE="/dev/rmt/0hnb"
1236   ;;
1237 irix)
1238         DISTVER=`uname -r`
1239         TAPEDRIVE="/dev/rmt/0cbn"
1240         PSCMD="ps -e -o pid,comm"
1241         PFILES="${PFILES} \
1242             platforms/irix/Makefile \
1243             platforms/irix/bacula-fd \
1244             platforms/irix/bacula-sd \
1245             platforms/irix/bacula-dir"
1246   ;;
1247 netbsd)
1248         DISTVER=`uname -a |awk '{print $3}'`
1249         lld="qd"
1250         llu="qu"
1251         TAPEDRIVE="/dev/nrst0"
1252         PSCMD="ps -a -o pid,command"
1253         PTHREAD_LIB="-pthread"
1254         CFLAGS="${CFLAGS} -pthread"
1255   ;;
1256 openbsd)
1257         DISTVER=`uname -a |awk '{print $3}'`
1258         lld="qd"
1259         llu="qu"
1260         TAPEDRIVE="/dev/nrst0"
1261         PSCMD="ps -a -o pid,command"
1262         PTHREAD_LIB="-pthread"
1263         CFLAGS="${CFLAGS} -pthread"
1264         PFILES="${PFILES} \
1265             platforms/openbsd/Makefile \
1266             platforms/openbsd/bacula-fd \
1267             platforms/openbsd/bacula-sd \
1268             platforms/openbsd/bacula-dir"
1269   ;;
1270 redhat)
1271         DISTVER=`cat /etc/redhat-release | grep release |\
1272                                 cut -f 5 -d ' '`
1273         TAPEDRIVE="/dev/nst0"
1274         PSCMD="ps -e -o pid,command"
1275         PFILES="${PFILES} \
1276             platforms/redhat/Makefile \
1277             platforms/redhat/bacula-fd \
1278             platforms/redhat/bacula-sd \
1279             platforms/redhat/bacula-dir \
1280             platforms/redhat/bacula.spec \
1281             "
1282         hostname=`hostname -s`
1283   ;;
1284 gentoo)
1285         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
1286         TAPEDRIVE="/dev/nst0"
1287         PSCMD="ps -e -o pid,command"
1288         PFILES="${PFILES} \
1289             platforms/gentoo/Makefile \
1290             platforms/gentoo/bacula-fd \
1291             platforms/gentoo/bacula-sd \
1292             platforms/gentoo/bacula-dir"
1293         hostname=`hostname -s`
1294   ;;
1295
1296 slackware)
1297         DISTVER=`cat /etc/slackware-version`
1298         TAPEDRIVE="/dev/nst0"
1299         PSCMD="ps -e -o pid,command"
1300         hostname=`hostname -s`
1301   ;;
1302 solaris)
1303         DISTVER=`uname -r`
1304         TAPEDRIVE="/dev/rmt/0cbn"
1305         PSCMD="ps -e -o pid,comm"
1306         PFILES="${PFILES} \
1307             platforms/solaris/Makefile \
1308             platforms/solaris/bacula-fd \
1309             platforms/solaris/bacula-sd \
1310             platforms/solaris/bacula-dir"
1311         if test x$DISTVER = x5.6 ; then
1312             AC_DEFINE(HAVE_OLD_SOCKOPT)
1313         fi
1314   ;;
1315 suse)
1316         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1317                                 cut -f 3 -d ' '`
1318         TAPEDRIVE="/dev/nst0"
1319         PSCMD="ps -e -o pid,command"
1320         hostname=`hostname -s`
1321   ;;
1322 suse5)
1323         DISTNAME=suse
1324         DISTVER=5.x
1325         TAPEDRIVE="/dev/nst0"
1326         PSCMD="ps -e -o pid,command"
1327         hostname=`hostname -s`
1328   ;;
1329 unknown)
1330         DISTVER=unknown
1331         TAPEDRIVE="/dev/nst0"
1332   ;;
1333 *)
1334   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1335   ;;
1336 esac  
1337
1338 AC_SUBST(hostname)
1339
1340 LIBS="$PTHREAD_LIB $LIBS"
1341
1342 AC_DEFINE_UNQUOTED(lld, "$lld")
1343 AC_DEFINE_UNQUOTED(llu, "$llu")
1344 AC_SUBST(TAPEDRIVE)
1345 AC_SUBST(PSCMD)
1346 AC_SUBST(WIN32)
1347 AC_SUBST(DISTNAME)
1348 AC_SUBST(DISTVER)
1349
1350 dnl# common parts of the Makefile
1351 MCOMMON=./autoconf/Make.common
1352 AC_SUBST_FILE(MCOMMON)
1353
1354 dnl# Insanity check
1355 if test "x${subsysdir}" = "x${sbindir}" ; then
1356    echo " "
1357    echo " "
1358    echo "You have set both --sbindir and --with-subsys-dir"
1359    echo "  equal to: ${subsysdir} "
1360    echo "This is not permitted. Please reconfigure."
1361    echo " "
1362    echo "Aborting configuration ..."
1363    echo " "
1364    echo " "
1365    exit 1
1366 fi 
1367
1368 AC_OUTPUT([autoconf/Make.common \
1369            Makefile \
1370            rescue/Makefile \
1371            rescue/linux/Makefile \
1372            rescue/freebsd/Makefile \
1373            rescue/solaris/Makefile \
1374            scripts/startmysql \
1375            scripts/stopmysql \
1376            scripts/btraceback \
1377            scripts/startit \
1378            scripts/stopit \
1379            scripts/console \
1380            scripts/gconsole \
1381            scripts/bacula \
1382            scripts/fd \
1383            scripts/Makefile \
1384            scripts/logrotate \
1385            scripts/bacula.desktop \
1386            scripts/bacula.desktop.gnome1 \
1387            scripts/bacula.desktop.gnome2 \
1388            doc/Makefile \
1389            src/Makefile \
1390            src/console/Makefile \
1391            src/console/console.conf \
1392            src/gnome-console/Makefile \
1393            src/gnome-console/gnome-console.conf \
1394            src/tconsole/Makefile \
1395            src/dird/Makefile \
1396            src/dird/bacula-dir.conf \
1397            src/lib/Makefile \
1398            src/stored/Makefile \
1399            src/stored/bacula-sd.conf \
1400            src/filed/Makefile \
1401            src/filed/host.h \
1402            src/filed/bacula-fd.conf \
1403            src/filed/win32/Makefile \
1404            src/cats/Makefile \
1405            src/cats/make_catalog_backup \
1406            src/cats/delete_catalog_backup \
1407            src/cats/alter_mysql_tables \
1408            src/cats/make_mysql_tables \
1409            src/cats/drop_mysql_tables \
1410            src/cats/create_mysql_database \
1411            src/cats/grant_mysql_privileges \
1412            src/cats/alter_sqlite_tables \
1413            src/cats/make_sqlite_tables \
1414            src/cats/drop_sqlite_tables \
1415            src/cats/create_sqlite_database \
1416            src/cats/sqlite \
1417            src/cats/mysql \
1418            src/cats/create_bdb_database \
1419            src/cats/make_bdb_tables \
1420            src/cats/drop_bdb_tables \
1421            src/cats/make_bacula_tables \
1422            src/cats/drop_bacula_tables \
1423            src/findlib/Makefile \
1424            src/tools/Makefile \
1425            $PFILES ],  
1426           [(echo "Doing make of dependencies"; make depend;) ]
1427 )
1428
1429 cd scripts
1430 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
1431 chmod 755 console gconsole
1432 cd ..
1433 chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables
1434 chmod 755 src/cats/make_test_tables src/cats/drop_test_tables
1435 chmod 755 src/cats/create_mysql_database 
1436 chmod 755 src/cats/make_catalog_backup src/cats/delete_catalog_backup
1437 chmod 755 src/cats/alter_mysql_tables
1438 chmod 755 src/cats/grant_mysql_privileges
1439 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
1440 chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
1441 chmod 755 src/cats/create_sqlite_database
1442 chmod 755 src/cats/alter_sqlite_tables
1443 chmod 755 src/cats/sqlite
1444 chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables 
1445 chmod 755 src/cats/create_bdb_database
1446
1447 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
1448    largefile_support="yes"
1449 fi
1450
1451 CCVERSION=`${CC} --version | cut -b-15`
1452 CXXVERSION=`${CXX} --version | cut -b-15`
1453
1454 if test "x${subsysdir}" = "x${sbindir}" ; then
1455    echo " "
1456    echo " "
1457    echo "You have set --sbindir and --with-subsys-dir"
1458    echo "  both equal to: ${subsysdir} "
1459    echo "  This is not permitted. Please reconfigure."
1460    echo "Aborting configuration ..."
1461    echo " "
1462    echo " "
1463    exit 1
1464 fi 
1465
1466 echo "
1467 Configuration on `date`:
1468
1469   Host:                       $host -- ${DISTNAME} ${DISTVER}
1470   Bacula version:             ${VERSION} (${DATE})
1471   Source code location:       ${srcdir}
1472   Install binaries:           ${sbindir}
1473   Install config files:       ${sysconfdir}
1474   Scripts directory:          ${scriptdir}
1475   Working directory:          ${working_dir}
1476   PID directory:              ${piddir}
1477   Subsys directory:           ${subsysdir}
1478   C Compiler:                 ${CC} ${CCVERSION}
1479   C++ Compiler:               ${CXX} ${CXXVERSION}
1480   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
1481   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
1482   Libraries:                  ${LIBS}
1483   Statically Linked Tools:    ${support_static_tools}
1484   Statically Linked FD:       ${support_static_fd}
1485   Statically Linked SD:       ${support_static_sd}
1486   Statically Linked DIR:      ${support_static_dir}
1487   Statically Linked CONS:     ${support_static_cons}
1488   Database type:              ${db_name}
1489   Database lib:               ${DB_LIBS}
1490
1491   Job Output Email:           ${job_email}
1492   Traceback Email:            ${dump_email}
1493   SMTP Host Address:          ${smtp_host}
1494   Director Port               ${dir_port}
1495   File daemon Port            ${fd_port}
1496   Storage daemon Port         ${sd_port}
1497   SQL binaries Directory      ${SQL_BINDIR}
1498
1499   Large file support:         $largefile_support
1500   readline support:           ${got_readline} ${PRTREADLINE_SRC}
1501   TCP Wrappers support:       ${TCPW_MSG}
1502   ZLIB support:               ${have_zlib}
1503   enable-smartalloc:          ${support_smartalloc} 
1504   enable-gnome:               ${support_gnome}
1505   client-only:                ${build_client_only}
1506
1507   " > config.out
1508
1509 cat config.out
1510
1511 # old stuff
1512 # cweb support:               ${got_cweb} ${CWEB_SRC}
1513 # gmp support:                ${got_gmp} ${GMP_SRC}