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