]> git.sur5r.net Git - bacula/rescue/blob - rescue/autoconf/configure.in
Update
[bacula/rescue] / rescue / autoconf / configure.in
1 lal#
2 dnl#
3 dnl# Process this file with autoconf to produce a configure script.
4 dnl#
5 AC_INIT(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
13 dnl require a recent autoconf
14 AC_PREREQ(2.13)
15
16
17 dnl search for true and false programs.
18 AC_PATH_PROGS(TRUEPRG, true, :)
19 AC_PATH_PROGS(FALSEPRG, false, :)
20
21 AC_PROG_AWK
22 # Some AWK programs fail, so test it and warn the user
23 if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 } 
24       { if ((prog == $2) || (("(" prog ")") == $2) ||
25            (("[" prog "]") == $2) ||
26            ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
27 else
28   AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
29    The regex engine of $AWK is too broken to be used you 
30    might want to install GNU AWK.
31    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
32 fi
33 THE_AWK=$AWK
34 AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
35
36
37 dnl Rescue version
38 VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/version.h`
39 DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/version.h`
40 AC_SUBST(VERSION)dnl 
41 AC_SUBST(DATE)dnl 
42 echo "configuring for Rescue $VERSION ($DATE)"
43
44
45 dnl -------------------------------------------------------
46 dnl# Check for programs.
47 dnl ------------------------------------------------------
48 AC_PROG_INSTALL
49 AC_PATH_PROG(MV, mv, mv)
50 AC_PATH_PROG(RM, rm, rm)
51 AC_PATH_PROG(CP, cp, cp)
52 AC_PATH_PROG(ECHO, echo, echo)
53 AC_PATH_PROG(AR, ar, ar)
54 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
55
56 dnl --------------------------------------------------
57 dnl OP Sys determination (see aclocal.m4)
58 dnl --------------------------------------------------
59 BA_CHECK_OPSYS
60
61 # -----------------------------------------------------------
62 dnl OPSys Distribution determination (see aclocal.m4)
63 # ----------------------------------------------------------
64 BA_CHECK_OPSYS_DISTNAME
65
66 # -------------------------------------------------------------------------
67 #  If the user has not set --exec-prefix, we default to ${prefix}
68 # -------------------------------------------------------------------------
69 if test x${exec_prefix} = xNONE ; then
70     exec_prefix=${prefix}
71 fi
72
73 # -------------------------------------------
74 # check for cdrecord writer location
75 # get scsibus,target,lun
76 # -------------------------------------------
77 CDSTL="3,0,0"
78 if test ! x$CDRECORD = x ; then
79    CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD-RW | ${AWK} '{print $1}'`
80    if test x${CDSTL} = x ; then
81       CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD+RW | ${AWK} '{print $1}'`
82    fi
83    if test x${CDSTL} = x ; then
84       CDSTL="3,0,0"
85    fi
86 fi
87 AC_SUBST(CDSTL)
88
89 dnl# --------------------------------------------------------------------------
90 dnl# CHECKING COMMAND LINE OPTIONS
91 dnl# --------------------------------------------------------------------------
92
93 # -------------------------------------------
94 # static-fd    (default off)
95 # -------------------------------------------
96 AC_ARG_ENABLE(static-fd,
97    [  --enable-static-fd      enable static File daemon [disabled]],
98    [if test x$enableval = xyes; then
99      support_static_fd=yes
100    fi])
101
102 STATIC_FD=
103 if test x$support_static_fd = xyes; then
104    STATIC_FD="static-bacula-fd"
105 fi
106 AC_SUBST(STATIC_FD)
107
108 where=
109 # ------------------------------------------
110 # Where to get iso
111 # ------------------------------------------
112 AC_ARG_WITH(iso,
113    [  --with-iso=PATH    specify path to iso],
114    [
115        if test "x$withval" != "xno" ; then     
116            where=$withval
117            type=iso
118        fi
119    ]
120 )
121 AC_SUBST(iso)
122
123 # ------------------------------------------
124 # Where to get cdrom
125 # ------------------------------------------
126 AC_ARG_WITH(cdrom,
127    [  --with-cdrom=PATH    specify path to cdrom],
128    [
129        if test "x$withval" != "xno" ; then     
130           where=$withval
131           type=cdrom
132        fi
133    ]
134 )
135
136 AC_SUBST(where)
137 AC_SUBST(type)
138
139 # ------------------------------------------
140 # Where to get Bacula source
141 # ------------------------------------------
142 AC_ARG_WITH(bacula,
143    [  --with-bacula=PATH    specify path to Bacula source],
144    [
145        if test "x$withval" != "xno" ; then     
146           bacula=$withval
147        fi
148    ]
149 )
150
151 if test x${bacula} = x; then
152    AC_MSG_ERROR(Missing --with-bacula=PATH)
153 fi
154
155 AC_SUBST(bacula)
156
157
158 #
159 # Finally we set appropriate distribution specific
160 #  variables and defaults
161 #
162 # PFILES are platform specific files
163 PFILES=""
164 WIN32=
165 MACOSX=
166 hostname=`uname -n | cut -d '.' -f 1`
167 case "$DISTNAME" in
168 aix)
169         DISTVER=`uname -r`
170   ;;      
171 alpha)
172         DISTVER=`uname -r`
173   ;;
174 bsdi)
175         DISTVER=`uname -a |awk '{print $3}'`
176   ;;
177 cygwin)
178         DISTVER=`uname -a |awk '{print $3}'`
179         WIN32=win32
180   ;;
181 darwin)
182         DISTVER=`uname -r`
183   ;;
184 debian)
185         DISTVER=`cat /etc/debian_version`
186   ;;
187 freebsd)
188         DISTVER=`uname -a |awk '{print $3}'`
189   ;;
190 hpux)
191         DISTVER=`uname -r`
192   ;;
193 irix)
194         DISTVER=`uname -r`
195   ;;
196 netbsd)
197         DISTVER=`uname -a |awk '{print $3}'`
198   ;;
199 openbsd)
200         DISTVER=`uname -a |awk '{print $3}'`
201   ;;
202 redhat)
203         if test -f /etc/whitebox-release ; then
204            f=/etc/whitebox-release
205         else
206            f=/etc/redhat-release
207         fi
208         if test `cat $f | grep release |\
209                    cut -f 3 -d ' '`x = "Enterprise"x ; then
210            DISTVER="Enterprise "`cat $f | grep release |\
211                     cut -f 6 -d ' '`
212         else
213             DISTVER=`cat /etc/redhat-release | grep release |\
214                      cut -f 5 -d ' '`
215         fi
216         hostname=`hostname -s`
217   ;;
218 mandrake)
219         DISTVER=`cat /etc/mandrake-release | grep release |\
220            cut -f 5 -d ' '`
221   ;;
222 gentoo)
223         DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
224   ;;
225 slackware)
226         DISTVER=`cat /etc/slackware-version`
227   ;;
228 solaris)
229         DISTVER=`uname -r`
230   ;;
231 suse)
232         DISTVER=`cat /etc/SuSE-release |grep VERSION|\
233             cut -f 3 -d ' '`
234   ;;
235 suse5)
236         DISTNAME=suse
237         DISTVER=5.x
238   ;;
239 unknown)
240         DISTVER=unknown
241   ;;
242 *)
243   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
244   ;;
245 esac  
246
247 AC_SUBST(hostname)
248
249 AC_SUBST(DISTNAME)
250 AC_SUBST(DISTVER)
251
252 dnl# common parts of the Makefile
253 MCOMMON=./autoconf/Make.common
254 AC_SUBST_FILE(MCOMMON)
255
256
257 AC_OUTPUT([    \
258            autoconf/Make.common \
259            Makefile \
260            linux/Makefile \
261            linux/cdrom/Makefile \
262            linux/cdrom/bacula/Makefile \
263            linux/cdrom/cdtree/boot/isolinux/boot.msg \
264            freebsd/Makefile \
265            solaris/Makefile \
266            $PFILES ],  
267           [ ]
268 )
269
270
271 echo "
272 Configuration on `date`:
273
274   Host:                       $host -- ${DISTNAME} ${DISTVER}
275   Rescue version:             ${VERSION} (${DATE})
276   Source code location:       ${bacula}
277   Rescue disk image type:     ${type}
278   Rescue disk image location: ${where}
279
280
281   " > config.out
282
283 cat config.out