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