]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/configure.in
Update to cygwin 1.5.5+add slots=1,3... code
[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-l 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/gnome2-console
183   else
184 dnl do 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-bconsole"
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 # Handle users and groups for each daemon
746 #
747 dir_user=
748 AC_ARG_WITH(dir_user,
749     [  --with-dir-user=USER              specify user for Director daemon],
750     [
751         if test "x$withval" != "x" ; then       
752              dir_user=$withval
753         fi
754     ]
755 )
756
757 dir_group=
758 AC_ARG_WITH(dir_group,
759     [  --with-dir-group=GROUP            specify group for Director daemon],
760     [
761         if test "x$withval" != "x" ; then       
762              dir_group=$withval
763         fi
764     ]
765 )
766
767 sd_user=
768 AC_ARG_WITH(sd_user,
769     [  --with-sd-user=USER               specify user for Storage daemon],
770     [
771         if test "x$withval" != "x" ; then       
772              sd_user=$withval
773         fi
774     ]
775 )
776
777 sd_group=
778 AC_ARG_WITH(sd_group,
779     [  --with-sd-group=GROUP             specify group for Storage daemon],
780     [
781         if test "x$withval" != "x" ; then       
782              sd_group=$withval
783         fi
784     ]
785 )
786
787 fd_user=
788 AC_ARG_WITH(fd_user,
789     [  --with-fd-user=USER               specify user for File daemon],
790     [
791         if test "x$withval" != "x" ; then       
792              fd_user=$withval
793         fi
794     ]
795 )
796
797 fd_group=
798 AC_ARG_WITH(fd_group,
799     [  --with-fd-group=GROUP             specify group for File daemon],
800     [
801         if test "x$withval" != "x" ; then       
802              fd_group=$withval
803         fi
804     ]
805 )
806
807
808
809
810 AC_SUBST(dir_user)
811 AC_SUBST(dir_group)
812 AC_SUBST(sd_user)
813 AC_SUBST(sd_group)
814 AC_SUBST(fd_user)
815 AC_SUBST(fd_group)
816
817 # ------------------------------------------------
818 # Bacula check for various SQL database engines
819 # ------------------------------------------------
820 BA_CHECK_MYSQL_DB
821
822
823 # ------------------------------------------------
824 # Bacula check for various SQL database engines
825 # ------------------------------------------------
826 BA_CHECK_SQLITE_DB
827
828 AC_SUBST(cats)
829 AC_SUBST(DB_NAME)
830
831 AC_DEFINE(PROTOTYPES)
832
833 dnl# --------------------------------------------------------------------------
834 dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
835 dnl#
836 if test -z "$CFLAGS"; then
837     if test -z "$CCOPTS"; then
838         CCOPTS='-g -O2'
839 dnl>    if test "x$GCC" = xyes; then
840 dnl>        if test x$system = xLinux; then
841 dnl>            CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
842 dnl>        fi
843 dnl>    fi
844     fi
845     CFLAGS="$CCOPTS"
846 fi
847
848
849 dnl A few others 
850 AC_EXEEXT
851
852 dnl See if we can use 64 bit file addresses
853 largefile_support="no"
854 AC_BAC_LARGEFILE
855
856
857 AC_PATH_XTRA
858
859 dnl# --------------------------------------------------------------------------
860 dnl# CHECKING FOR HEADER FILES
861 dnl# --------------------------------------------------------------------------
862 AC_CHECK_HEADERS( \
863         assert.h \
864         fcntl.h \
865         grp.h \
866         pwd.h \
867         libc.h \
868         limits.h \
869         stdarg.h \
870         stdlib.h \
871         stdint.h \
872         string.h \
873         termios.h \
874         unistd.h \
875         sys/byteorder.h \
876         sys/ioctl.h \
877         sys/select.h \
878         sys/sockio.h \
879         sys/time.h \
880         sys/socket.h \
881         arpa/nameser.h \
882         resolv.h \
883         mtio.h \
884         sys/mtio.h \
885 )
886 AC_HEADER_STDC
887 AC_HEADER_MAJOR
888 AC_HEADER_DIRENT
889 AC_HEADER_STAT
890 AC_HEADER_SYS_WAIT
891 AC_HEADER_TIME
892 AC_STRUCT_ST_BLKSIZE
893 AC_STRUCT_ST_BLOCKS
894 AC_STRUCT_TIMEZONE
895
896 dnl# --------------------------------------------------------------------------
897 dnl# Check for utime.h structure 
898 dnl# --------------------------------------------------------------------------
899 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
900   [AC_TRY_COMPILE([
901 #include <sys/types.h>
902 #include <utime.h>], [struct utimbuf foo],
903   ba_cv_header_utime_h=yes, ba_cv_header_utime_h=no)])
904 test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
905
906 dnl# --------------------------------------------------------------------------
907 dnl# Check for socklen_t
908 dnl# --------------------------------------------------------------------------
909 AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
910   [AC_TRY_COMPILE([
911 #include <sys/types.h>
912 #include <sys/socket.h>],
913   [socklen_t x],
914   ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)])
915 test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T)
916
917 dnl# --------------------------------------------------------------------------
918 dnl# Check for bigendian
919 dnl# --------------------------------------------------------------------------
920 AC_CACHE_CHECK([for bigendian], ba_cv_bigendian,
921   [AC_TRY_RUN(
922     [main(){long a=1L; char *p=(char *)&a; exit(*p);}],
923     [ba_cv_bigendian=yes], 
924     [ba_cv_bigendian=no], 
925     [ba_cv_bigendian=no])])
926 test $ba_cv_bigendian = yes && AC_DEFINE(HAVE_BIGENDIAN)
927
928
929 AC_C_CONST
930
931
932 dnl# --------------------------------------------------------------------------
933 dnl# CHECKING FOR FILESYSTEM TYPE
934 dnl# --------------------------------------------------------------------------
935 AC_MSG_CHECKING(how to get filesystem type)
936 fstype=no
937 # The order of these tests is important.
938 AC_TRY_CPP([#include <sys/statvfs.h>
939 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
940 if test $fstype = no; then
941 AC_TRY_CPP([#include <sys/statfs.h>
942 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
943 fi
944 if test $fstype = no; then
945 AC_TRY_CPP([#include <sys/statfs.h>
946 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
947 fi
948 if test $fstype = no; then  
949 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
950 fi
951 if test $fstype = no; then  
952 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
953 fi
954 if test $fstype = no; then  
955 AC_TRY_CPP([#include <sys/mount.h>
956 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
957 fi
958 AC_MSG_RESULT($fstype)
959
960 dnl# --------------------------------------------------------------------------
961 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
962 dnl# --------------------------------------------------------------------------
963 AC_TYPE_SIGNAL
964 SIGNAL_CHECK
965 AC_TYPE_MODE_T
966 AC_TYPE_UID_T
967 AC_TYPE_SIZE_T
968 AC_TYPE_PID_T
969 AC_TYPE_OFF_T
970 AC_CHECK_TYPE(ino_t, unsigned long)
971 AC_CHECK_TYPE(dev_t, unsigned long)
972 AC_CHECK_TYPE(daddr_t, long)
973 AC_CHECK_TYPE(major_t, int)
974 AC_CHECK_TYPE(minor_t, int)
975 AC_CHECK_TYPE(ssize_t, int)
976 AC_STRUCT_ST_BLOCKS
977 AC_STRUCT_ST_RDEV
978 AC_STRUCT_TM
979 AC_C_CONST
980
981
982 AC_CHECK_SIZEOF(char, 1)
983 AC_CHECK_SIZEOF(short int, 2)
984 AC_CHECK_SIZEOF(int, 4)
985 AC_CHECK_SIZEOF(long int, 4)
986 AC_CHECK_SIZEOF(long long int, 8)
987 AC_CHECK_SIZEOF(int *, 4)
988
989 # Check for sys/types.h types
990 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
991     AC_TRY_COMPILE(
992         [ #include <sys/types.h> ], 
993         [ u_int a; a = 1;], 
994         [ ac_cv_have_u_int="yes" ],
995         [ ac_cv_have_u_int="no" ]
996     )
997 ])
998 if test "x$ac_cv_have_u_int" = "xyes" ; then
999    AC_DEFINE(HAVE_U_INT)
1000    have_u_int=1
1001 fi
1002
1003 AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t, [
1004    AC_TRY_COMPILE(
1005       [ #include <sys/types.h> ], 
1006       [ intmax_t a; a = 1;], 
1007       [ ac_cv_have_intmax_t="yes" ],
1008       [ 
1009          AC_TRY_COMPILE(
1010             [ #include <stdint.h> ], 
1011             [ intmax_t a; a = 1;], 
1012             [ ac_cv_have_intmax_t="yes" ],
1013             [ ac_cv_have_intmax_t="no" ]
1014          )
1015       ]
1016    )        
1017
1018 ])
1019 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
1020    AC_DEFINE(HAVE_INTMAX_T)
1021    have_intmax_t=1
1022 fi
1023
1024
1025 AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t, [
1026    AC_TRY_COMPILE(
1027       [ #include <sys/types.h> ], 
1028       [ u_intmax_t a; a = 1;], 
1029       [ ac_cv_have_u_intmax_t="yes" ],
1030       [ 
1031          AC_TRY_COMPILE(
1032             [ #include <stdint.h> ], 
1033             [ u_intmax_t a; a = 1;], 
1034             [ ac_cv_have_u_intmax_t="yes" ],
1035             [ ac_cv_have_u_intmax_t="no" ]
1036          )
1037       ]
1038    )
1039 ])
1040 if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
1041    AC_DEFINE(HAVE_U_INTMAX_T)
1042    have_u_intmax_t=1
1043 fi
1044
1045
1046 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1047    AC_TRY_COMPILE(
1048       [ #include <sys/types.h> ], 
1049       [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], 
1050       [ ac_cv_have_intxx_t="yes" ],
1051       [ ac_cv_have_intxx_t="no" ]
1052    )
1053 ])
1054 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1055    AC_DEFINE(HAVE_INTXX_T)
1056    have_intxx_t=1
1057 fi
1058         
1059 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1060    AC_TRY_COMPILE(
1061       [ #include <sys/types.h> ], 
1062       [ int64_t a; a = 1;], 
1063       [ ac_cv_have_int64_t="yes" ],
1064       [ ac_cv_have_int64_t="no" ]
1065    )
1066 ])
1067 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1068    AC_DEFINE(HAVE_INT64_T)
1069    have_int64_t=1
1070 fi
1071         
1072 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1073    AC_TRY_COMPILE(
1074       [ #include <sys/types.h> ], 
1075       [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], 
1076       [ ac_cv_have_u_intxx_t="yes" ],
1077       [ ac_cv_have_u_intxx_t="no" ]
1078    )
1079 ])
1080 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1081    AC_DEFINE(HAVE_U_INTXX_T)
1082    have_u_intxx_t=1
1083 fi
1084
1085 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1086    AC_TRY_COMPILE(
1087       [ #include <sys/types.h> ], 
1088       [ u_int64_t a; a = 1;], 
1089       [ ac_cv_have_u_int64_t="yes" ],
1090       [ ac_cv_have_u_int64_t="no" ]
1091    )
1092 ])
1093 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1094    AC_DEFINE(HAVE_U_INT64_T)
1095    have_u_int64_t=1
1096 fi
1097
1098 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1099            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1100 then
1101    AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1102    AC_TRY_COMPILE(
1103       [ #include <sys/bitypes.h>  ], 
1104       [ int8_t a; int16_t b; int32_t c;
1105         u_int8_t e; u_int16_t f; u_int32_t g;
1106         a = b = c = e = f = g = 1;  ], 
1107       [ AC_DEFINE(HAVE_U_INTXX_T)
1108         AC_DEFINE(HAVE_INTXX_T)
1109         AC_DEFINE(HAVE_SYS_BITYPES_H)
1110         AC_MSG_RESULT(yes) ],
1111       [ AC_MSG_RESULT(no)]
1112    ) 
1113 fi
1114
1115 if test -z "$have_u_intxx_t" ; then
1116    AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1117       AC_TRY_COMPILE(
1118          [ #include <sys/types.h> ], 
1119          [ uint8_t a; uint16_t b; 
1120            uint32_t c; a = b = c = 1; ], 
1121          [ ac_cv_have_uintxx_t="yes" ],
1122          [ ac_cv_have_uintxx_t="no" ]
1123       )
1124    ])
1125    if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1126       AC_DEFINE(HAVE_UINTXX_T)
1127    fi
1128 fi
1129
1130
1131 dnl# --------------------------------------------------------------------------
1132 dnl# CHECKING FOR LIBRARY FUNCTIONS
1133 dnl# --------------------------------------------------------------------------
1134 AC_CHECK_FUNCS( \
1135         fork \
1136         getcwd \
1137         gethostname \
1138         getpid \
1139         gettimeofday \
1140         setpgid \
1141         setpgrp \
1142         setsid \
1143         signal \
1144         strerror \
1145         strncmp \
1146         strncpy \
1147         vfprintf \
1148         ,,
1149         [echo 'configure: cannot find needed function.'; exit 1]
1150 )
1151
1152 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
1153 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
1154
1155 AC_CHECK_FUNCS(chflags) 
1156
1157 AC_CHECK_FUNCS(snprintf vsnprintf gethostid getdomainname)
1158
1159 dnl# --------------------------------------------------------------------------
1160 dnl# CHECKING FOR THREAD SAFE FUNCTIONS
1161 dnl# --------------------------------------------------------------------------
1162 AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)
1163
1164 # If resolver functions are not in libc check for -lnsl or -lresolv.
1165 AC_CHECK_FUNC(gethostbyname_r,
1166     AC_MSG_RESULT(using libc's resolver),
1167     AC_CHECK_LIB(nsl,gethostbyname_r)
1168     AC_CHECK_LIB(resolv,gethostbyname_r))
1169
1170
1171 # Find where sockets are (especially for Solaris)
1172 AC_CHECK_FUNC(socket,
1173     AC_MSG_RESULT(using libc's socket),
1174     AC_CHECK_LIB(xnet,socket)
1175     AC_CHECK_LIB(socket,socket)
1176     AC_CHECK_LIB(inet,socket))
1177
1178 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
1179
1180 AC_FUNC_STRFTIME
1181 AC_FUNC_VPRINTF
1182 AC_FUNC_ALLOCA
1183 AC_FUNC_GETMNTENT
1184 AC_FUNC_CLOSEDIR_VOID
1185 AC_FUNC_SETPGRP                       dnl check for BSD setpgrp.
1186 AC_FUNC_FNMATCH
1187
1188
1189 dnl# FreeBSD needs to link libxpg4
1190 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
1191
1192
1193 AC_CHECK_LIB(sun, getpwnam)
1194
1195 AC_CHECK_HEADERS(zlib.h)
1196 AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
1197 have_zlib=no
1198 if test x$FDLIBS = x-lz; then
1199   AC_DEFINE(HAVE_LIBZ)
1200   have_zlib=yes
1201 fi
1202
1203 dnl Check for pthread libraries
1204 PTHREAD_LIB=""
1205 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
1206         [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
1207             [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
1208                 [AC_CHECK_FUNC(pthread_create)]
1209             )]
1210         )]
1211 )
1212
1213 AC_SUBST(FDLIBS)
1214 AC_DEFINE(FDLIBS)
1215
1216
1217 CFLAGS=${CFLAGS--O}
1218 LDFLAGS=${LDFLAGS--O}
1219 DB_LIBS="${SQL_LFLAGS}"
1220
1221 CPPFLAGS="$CPPFLAGS"
1222 AC_SUBST(DEBUG)
1223 AC_SUBST(DINCLUDE)
1224 AC_SUBST(CFLAGS)
1225 AC_SUBST(CPPFLAGS)
1226 AC_SUBST(LDFLAGS)
1227 AC_SUBST(X_CFLAGS)
1228 AC_SUBST(LIBS)
1229 AC_SUBST(DLIB)
1230 AC_SUBST(DB_LIBS)
1231 AC_SUBST(X_LIBS)
1232 AC_SUBST(X_EXTRA_LIBS)
1233 AC_SUBST(WCFLAGS)
1234 AC_SUBST(WLDFLAGS)
1235
1236 dnl# extra configurable objects
1237 OBJLIST=
1238 AC_SUBST(OBJLIST)
1239
1240 lld="lld"
1241 llu="llu"
1242
1243 WCFLAGS=
1244 WLDFLAGS=
1245
1246 #
1247 # Finally we set appropriate distribution specific
1248 #  variables and defaults
1249 #
1250 # PFILES are platform specific files
1251 PFILES="platforms/Makefile"
1252 PSCMD="ps -e"
1253 WIN32=
1254 hostname=`uname -n`
1255 case "$DISTNAME" in
1256 aix)
1257         DISTVER=`uname -r`
1258         PSCMD="ps -e -o pid,comm"
1259         PFILES="${PFILES} \
1260            platforms/aix/Makefile"
1261         TAPEDRIVE="/dev/rmt0.1" 
1262   ;;      
1263 alpha)
1264         DISTVER=`uname -r`
1265         PTHREAD_LIB="-lpthread -lexc"
1266         if test "${CC}" = "gcc" ; then
1267            lld="lld"
1268            llu="llu"
1269         else
1270            lld="ld"
1271            llu="lu"
1272         fi
1273         TAPEDRIVE="/dev/nrmt0"
1274   ;;
1275 bsdi)
1276         DISTVER=`uname -a |awk '{print $3}'`
1277         TAPEDRIVE="/dev/nrmt0"
1278         PTHREAD_LIB="-pthread"
1279         CFLAGS="${CFLAGS} -pthread"
1280         PSCMD="ps -x -o pid,command"
1281         lld="qd"
1282         llu="qu"
1283         PFILES="${PFILES} \
1284             platforms/bsdi/Makefile \
1285             platforms/bsdi/bacula-fd \
1286             platforms/bsdi/bacula-sd \
1287             platforms/bsdi/bacula-dir"
1288         hostname=`hostname -s`
1289         largefile_support="yes"
1290   ;;
1291 cygwin)
1292         DISTVER=`uname -a |awk '{print $3}'`
1293         TAPEDRIVE="/dev/nrst0"
1294         WIN32=win32
1295         WCFLAGS="-mwindows"
1296         WLDFLAGS="-mwindows"
1297   ;;
1298 darwin)
1299         DISTVER=`uname -r`
1300         TAPEDRIVE="/dev/nst0"
1301         PSCMD="ps -e -o pid,command"
1302         hostname=`hostname -s`
1303         PFILES="${PFILES} \
1304            platforms/darwin/Makefile"
1305   ;;
1306 debian)
1307         DISTVER=`cat /etc/debian_version`
1308         TAPEDRIVE="/dev/nrst0"
1309         PSCMD="ps -e -o pid,command"
1310         hostname=`hostname -s`
1311   ;;
1312 freebsd)
1313         DISTVER=`uname -a |awk '{print $3}'`
1314         VER=`echo $DISTVER | cut -c 1`
1315         if test x$VER = x4 ; then
1316            PTHREAD_LIB="-pthread"
1317            CFLAGS="${CFLAGS} -pthread"
1318         fi
1319         lld="qd"
1320         llu="qu"
1321         TAPEDRIVE="/dev/nrsa0"
1322         PSCMD="ps -x -o pid,command"
1323         PFILES="${PFILES} \
1324             platforms/freebsd/Makefile \
1325             platforms/freebsd/bacula-fd \
1326             platforms/freebsd/bacula-sd \
1327             platforms/freebsd/bacula-dir"
1328         hostname=`hostname -s`
1329         largefile_support="yes"
1330   ;;
1331 hpux)
1332         DISTVER=`uname -r`
1333         TAPEDRIVE="/dev/rmt/0hnb"
1334   ;;
1335 irix)
1336         DISTVER=`uname -r`
1337         TAPEDRIVE="/dev/rmt/0cbn"
1338         PSCMD="ps -e -o pid,comm"
1339         PFILES="${PFILES} \
1340             platforms/irix/Makefile \
1341             platforms/irix/bacula-fd \
1342             platforms/irix/bacula-sd \
1343             platforms/irix/bacula-dir"
1344   ;;
1345 netbsd)
1346         DISTVER=`uname -a |awk '{print $3}'`
1347         lld="qd"
1348         llu="qu"
1349         TAPEDRIVE="/dev/nrst0"
1350         PSCMD="ps -a -o pid,command"
1351         PTHREAD_LIB="-pthread"
1352         CFLAGS="${CFLAGS} -pthread"
1353   ;;
1354 openbsd)
1355         DISTVER=`uname -a |awk '{print $3}'`
1356         lld="qd"
1357         llu="qu"
1358         TAPEDRIVE="/dev/nrst0"
1359         PSCMD="ps -a -o pid,command"
1360         PTHREAD_LIB="-pthread"
1361         CFLAGS="${CFLAGS} -pthread"
1362         PFILES="${PFILES} \
1363             platforms/openbsd/Makefile \
1364             platforms/openbsd/bacula-fd \
1365             platforms/openbsd/bacula-sd \
1366             platforms/openbsd/bacula-dir"
1367   ;;
1368 redhat)
1369         DISTVER=`cat /etc/redhat-release | grep release |\
1370            cut -f 5 -d ' '`
1371         TAPEDRIVE="/dev/nst0"
1372         PSCMD="ps -e -o pid,command"
1373         PFILES="${PFILES} \
1374             platforms/redhat/Makefile \
1375             platforms/redhat/bacula-fd \
1376             platforms/redhat/bacula-sd \
1377             platforms/redhat/bacula-dir \
1378             platforms/redhat/bacula.spec \
1379             "
1380         hostname=`hostname -s`
1381   ;;
1382 mandrake)
1383         DISTVER=`cat /etc/mandrake-release | grep release |\
1384            cut -f 5 -d ' '`
1385         TAPEDRIVE="/dev/nst0"
1386         PSCMD="ps -e -o pid,command"
1387         PFILES="${PFILES} \
1388             platforms/mandrake/Makefile \
1389             platforms/mandrake/bacula-fd \
1390             platforms/mandrake/bacula-sd \
1391             platforms/mandrake/bacula-dir \
1392             platforms/mandrake/bacula.spec \
1393             "
1394         hostname=`hostname -s`
1395   ;;
1396 gentoo)
1397         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
1398         TAPEDRIVE="/dev/nst0"
1399         PSCMD="ps -e -o pid,command"
1400         PFILES="${PFILES} \
1401             platforms/gentoo/Makefile \
1402             platforms/gentoo/bacula-fd \
1403             platforms/gentoo/bacula-sd \
1404             platforms/gentoo/bacula-dir"
1405         hostname=`hostname -s`
1406   ;;
1407
1408 slackware)
1409         DISTVER=`cat /etc/slackware-version`
1410         TAPEDRIVE="/dev/nst0"
1411         PSCMD="ps -e -o pid,command"
1412         hostname=`hostname -s`
1413   ;;
1414 solaris)
1415         DISTVER=`uname -r`
1416         TAPEDRIVE="/dev/rmt/0cbn"
1417         PSCMD="ps -e -o pid,comm"
1418         PFILES="${PFILES} \
1419             platforms/solaris/Makefile \
1420             platforms/solaris/bacula-fd \
1421             platforms/solaris/bacula-sd \
1422             platforms/solaris/bacula-dir"
1423         if test x$DISTVER = x5.6 ; then
1424             AC_DEFINE(HAVE_OLD_SOCKOPT)
1425         fi
1426   ;;
1427 suse)
1428         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
1429             cut -f 3 -d ' '`
1430         TAPEDRIVE="/dev/nst0"
1431         PSCMD="ps -e -o pid,command"
1432         hostname=`hostname -s`
1433   ;;
1434 suse5)
1435         DISTNAME=suse
1436         DISTVER=5.x
1437         TAPEDRIVE="/dev/nst0"
1438         PSCMD="ps -e -o pid,command"
1439         hostname=`hostname -s`
1440   ;;
1441 unknown)
1442         DISTVER=unknown
1443         TAPEDRIVE="/dev/nst0"
1444   ;;
1445 *)
1446   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
1447   ;;
1448 esac  
1449
1450 AC_SUBST(hostname)
1451
1452 LIBS="$PTHREAD_LIB $LIBS"
1453
1454 AC_DEFINE_UNQUOTED(lld, "$lld")
1455 AC_DEFINE_UNQUOTED(llu, "$llu")
1456 AC_SUBST(TAPEDRIVE)
1457 AC_SUBST(PSCMD)
1458 AC_SUBST(WIN32)
1459 AC_SUBST(DISTNAME)
1460 AC_SUBST(DISTVER)
1461
1462 dnl# common parts of the Makefile
1463 MCOMMON=./autoconf/Make.common
1464 AC_SUBST_FILE(MCOMMON)
1465
1466 dnl# Insanity check
1467 if test "x${subsysdir}" = "x${sbindir}" ; then
1468    echo " "
1469    echo " "
1470    echo "You have set both --sbindir and --with-subsys-dir"
1471    echo "  equal to: ${subsysdir} "
1472    echo "This is not permitted. Please reconfigure."
1473    echo " "
1474    echo "Aborting configuration ..."
1475    echo " "
1476    echo " "
1477    exit 1
1478 fi 
1479
1480 AC_OUTPUT([autoconf/Make.common \
1481            Makefile \
1482            rescue/Makefile \
1483            rescue/linux/Makefile \
1484            rescue/freebsd/Makefile \
1485            rescue/solaris/Makefile \
1486            scripts/startmysql \
1487            scripts/stopmysql \
1488            scripts/btraceback \
1489            scripts/startit \
1490            scripts/stopit \
1491            scripts/bconsole \
1492            scripts/gconsole \
1493            scripts/bacula \
1494            scripts/fd \
1495            scripts/Makefile \
1496            scripts/logrotate \
1497            scripts/bacula.desktop.gnome1 \
1498            scripts/bacula.desktop.gnome2 \
1499            scripts/mtx-changer \
1500            doc/Makefile \
1501            src/Makefile \
1502            src/host.h \
1503            src/console/Makefile \
1504            src/console/bconsole.conf \
1505            src/gnome-console/Makefile \
1506            src/gnome-console/gnome-console.conf \
1507            src/gnome2-console/Makefile \
1508            src/gnome2-console/gnome-console.conf \
1509            src/tconsole/Makefile \
1510            src/dird/Makefile \
1511            src/dird/bacula-dir.conf \
1512            src/lib/Makefile \
1513            src/stored/Makefile \
1514            src/stored/bacula-sd.conf \
1515            src/filed/Makefile \
1516            src/filed/bacula-fd.conf \
1517            src/filed/win32/Makefile \
1518            src/cats/Makefile \
1519            src/cats/make_catalog_backup \
1520            src/cats/delete_catalog_backup \
1521            src/cats/make_mysql_tables \
1522            src/cats/drop_mysql_tables \
1523            src/cats/update_mysql_tables \
1524            src/cats/create_mysql_database \
1525            src/cats/grant_mysql_privileges \
1526            src/cats/make_sqlite_tables \
1527            src/cats/drop_sqlite_tables \
1528            src/cats/update_sqlite_tables \
1529            src/cats/create_sqlite_database \
1530            src/cats/sqlite \
1531            src/cats/mysql \
1532            src/cats/create_bdb_database \
1533            src/cats/make_bdb_tables \
1534            src/cats/drop_bdb_tables \
1535            src/cats/make_bacula_tables \
1536            src/cats/drop_bacula_tables \
1537            src/cats/update_bacula_tables \
1538            src/findlib/Makefile \
1539            src/tools/Makefile \
1540            $PFILES ],  
1541           [(echo "Doing make of dependencies"; make depend;) ]
1542 )
1543
1544 cd scripts
1545 chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
1546 chmod 755 bconsole gconsole mtx-changer
1547 cd ..
1548 chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables
1549 chmod 755 src/cats/make_test_tables src/cats/drop_test_tables
1550 chmod 755 src/cats/create_mysql_database 
1551 chmod 755 src/cats/make_catalog_backup src/cats/delete_catalog_backup
1552 chmod 755 src/cats/grant_mysql_privileges
1553 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
1554 chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
1555 chmod 755 src/cats/update_bacula_tables src/cats/update_mysql_tables
1556 chmod 755 src/cats/update/mysql_tables
1557 chmod 755 src/cats/create_sqlite_database
1558 chmod 755 src/cats/sqlite
1559 chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables 
1560 chmod 755 src/cats/create_bdb_database
1561
1562 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
1563    largefile_support="yes"
1564 fi
1565
1566 #
1567 # A whole lot of hand springs to get the compiler version.
1568 #  This is because gcc changed the output in version 3.0
1569 #
1570 CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
1571 if test "x${CCVERSION}" = "x" ; then
1572   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
1573 fi
1574 CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
1575 if test x"${CXXVERSION}" = x ; then
1576   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
1577 fi
1578
1579 if test "x${subsysdir}" = "x${sbindir}" ; then
1580    echo " "
1581    echo " "
1582    echo "You have set --sbindir and --with-subsys-dir"
1583    echo "  both equal to: ${subsysdir} "
1584    echo "  This is not permitted. Please reconfigure."
1585    echo "Aborting configuration ..."
1586    echo " "
1587    echo " "
1588    exit 1
1589 fi 
1590
1591 echo "
1592 Configuration on `date`:
1593
1594   Host:                       $host -- ${DISTNAME} ${DISTVER}
1595   Bacula version:             ${VERSION} (${DATE})
1596   Source code location:       ${srcdir}
1597   Install binaries:           ${sbindir}
1598   Install config files:       ${sysconfdir}
1599   Scripts directory:          ${scriptdir}
1600   Working directory:          ${working_dir}
1601   PID directory:              ${piddir}
1602   Subsys directory:           ${subsysdir}
1603   C Compiler:                 ${CC} ${CCVERSION}
1604   C++ Compiler:               ${CXX} ${CXXVERSION}
1605   Compiler flags:             ${WCFLAGS} ${CFLAGS} 
1606   Linker flags:               ${WLDFLAGS} ${LDFLAGS}
1607   Libraries:                  ${LIBS}
1608   Statically Linked Tools:    ${support_static_tools}
1609   Statically Linked FD:       ${support_static_fd}
1610   Statically Linked SD:       ${support_static_sd}
1611   Statically Linked DIR:      ${support_static_dir}
1612   Statically Linked CONS:     ${support_static_cons}
1613   Database type:              ${db_name}
1614   Database lib:               ${DB_LIBS}
1615
1616   Job Output Email:           ${job_email}
1617   Traceback Email:            ${dump_email}
1618   SMTP Host Address:          ${smtp_host}
1619
1620   Director Port:              ${dir_port}
1621   File daemon Port:           ${fd_port}
1622   Storage daemon Port:        ${sd_port}
1623
1624   Director User:            ${dir_user}
1625   Director Group:           ${dir_group}
1626   Storage Daemon User:      ${dir_user}
1627   Storage DaemonGroup:      ${dir_group}
1628   File Daemon User:         ${dir_user}
1629   File Daemon Group:        ${dir_group}
1630
1631   SQL binaries Directory      ${SQL_BINDIR}
1632
1633   Large file support:         $largefile_support
1634   readline support:           ${got_readline} ${PRTREADLINE_SRC}
1635   TCP Wrappers support:       ${TCPW_MSG}
1636   ZLIB support:               ${have_zlib}
1637   enable-smartalloc:          ${support_smartalloc} 
1638   enable-gnome:               ${support_gnome}
1639   client-only:                ${build_client_only}
1640
1641   " > config.out
1642
1643 cat config.out
1644
1645 # old stuff
1646 # cweb support:               ${got_cweb} ${CWEB_SRC}
1647 # gmp support:                ${got_gmp} ${GMP_SRC}