]> andersk Git - moira.git/blame - configure.in
oops. don't rely on stack garbage to initialize our pointers
[moira.git] / configure.in
CommitLineData
ea0caf4a 1AC_INIT(patchlevel.h)
2
3dnl On Athena at least, many of the packages (krb, zephyr, hesiod, etc)
4dnl will all be in /usr/athena... this hack lets us not end up with 10
5dnl copies of -I/usr/athena/include -L/usr/athena/lib in our command lines
6AC_DEFUN(MR_EXTEND, [
7 case $$1 in
8 *$2*) ;;
9 *) $1=$2\ $$1 ;;
10 esac
11])
12
13dnl Define for both C and Pro*C
14AC_DEFUN(MR_DEFINE, [
15 AC_DEFINE($1)
16 MR_EXTEND(PRO_C_DEFS, DEFINE=$1)
17])
18
19dnl Add to include path for both C and Pro*C
20AC_DEFUN(MR_INCLUDE, [
21 MR_EXTEND(CPPFLAGS, -I$1)
22 MR_EXTEND(PRO_C_INCLUDES, INCLUDE=$1)
23])
24
25dnl Add to lib path
26AC_DEFUN(MR_LIBS, [MR_EXTEND(LIBPATH, -L$1)])
27
28AC_PROG_CC
29AC_PROG_INSTALL
30AC_PROG_RANLIB
31AC_PROG_MAKE_SET
32
33if test "$athena" = true; then
34 enable_athena=yes
35 with_readline=/mit/gnu
25f58600 36 unset with_com_err
ea0caf4a 37 prefix=/afs/athena.mit.edu/system/moira
38 bindir=$prefix/arch/$ATHENA_SYS/bin
39 sbindir=$bindir
40fi
41
42# We currently just don't support changing this
43mrbindir=/moira/bin
44AC_SUBST(mrbindir)
45
46# Athena-local policy decisions
47AC_MSG_CHECKING(for Athena)
48AC_ARG_ENABLE(athena,
49 [ --enable-athena Enable Athena-specific policy decisions],
50 , [if test "$athena" = true; then
51 enableval=yes
52 else
53 enableval=no
54 fi])
55AC_MSG_RESULT($enableval)
56if test "$enableval" = yes; then
57 MR_DEFINE(ATHENA)
58fi
59
60# Networking libraries
61AC_CHECKING(network libraries...)
62AC_CHECK_FUNC(gethostbyname, :,
63 AC_CHECK_LIB(nsl, gethostbyname, ,
64 AC_CHECK_LIB(resolv, gethostbyname)))
65AC_CHECK_FUNC(socket, :,
66 AC_CHECK_LIB(socket, socket, ,
67 AC_CHECK_LIB(socket, socket,
68 LIBS="-lsocket -lnsl $LIBS", :,
69 -lnsl)))
70
7f7f279f 71# com_err (required, but can be built)
72AC_MSG_CHECKING(for com_err)
73AC_ARG_WITH(com_err,
74 [ --with-com_err=PREFIX Specify location of com_err],
75 [AC_MSG_RESULT($withval)
76 if test $withval = "no"; then
77 AC_MSG_ERROR(com_err is required for Moira)
78 fi
79 if test $withval != "yes"; then
80 MR_INCLUDE($withval/include)
81 MR_LIBS($withval/lib)
82 fi
83 COMPILE_ET=compile_et],
84 [AC_MSG_RESULT(util/et)
85 COM_ERR_SUBDIR=util/et;
86 MR_INCLUDE(`pwd`/util/et)
87 MR_LIBS(`pwd`/util/et)
88 COMPILE_ET=`pwd`/util/et/compile_et
89 AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)])
90AC_SUBST(COM_ERR_SUBDIR)
91AC_SUBST(COMPILE_ET)
92
93# Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
ea0caf4a 94AC_MSG_CHECKING(for Kerberos 4)
95AC_ARG_WITH(krb4,
96 [ --with-krb4=PREFIX Specify location of krb4],
97 [krb4="$withval"], [krb4=no])
98AC_MSG_RESULT($krb4)
99if test $krb4 = "no"; then
100 AC_MSG_ERROR(Kerberos is required for Moira)
101fi
102if test "$krb4" != yes; then
103 MR_INCLUDE($krb4/include)
104 if test -d "$krb4/include/kerberosIV"; then
105 MR_INCLUDE($krb4/include/kerberosIV)
106 fi
107 MR_LIBS($krb4/lib)
108elif test -d /usr/include/kerberosIV; then
109 MR_INCLUDE(/usr/include/kerberosIV)
110fi
111AC_CHECK_LIB(krb4, krb_rd_req,
112 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto"],
113 [AC_CHECK_LIB(krb, krb_rd_req,
114 [KRB4_LIBS="-lkrb -ldes"],
115 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
116 $LIBPATH -ldes)],
7f7f279f 117 $LIBPATH -ldes425 -lkrb5 -lcrypto -lcom_err)
ea0caf4a 118
7f7f279f 119AC_MSG_CHECKING(for Kerberos 5)
120AC_ARG_WITH(krb5,
121 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
122 [krb5="$withval"], [krb5=no])
123AC_MSG_RESULT($krb5)
124if test "$krb5" != no; then
125 REG_SVR_DEFS=-DKRB5
126 if test "$krb5" != yes; then
127 REG_SVR_INCLUDES=-I$krb5/include
128 REG_SVR_LIBS=-L$krb5/lib
129 fi
130 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -lcrypto"
131else
132 REG_SVR_DEFS=-DKRB4
133 REG_SVR_LIBS=-lkadm
134fi
135AC_SUBST(REG_SVR_DEFS)
136AC_SUBST(REG_SVR_INCLUDES)
137AC_SUBST(REG_SVR_LIBS)
33567bea 138
ea0caf4a 139# Hesiod support
140AC_MSG_CHECKING(for Hesiod)
141AC_ARG_WITH(hesiod,
142 [ --with-hesiod=PREFIX Specify location of Hesiod],
143 [hesiod="$withval"], [hesiod=no])
144AC_MSG_RESULT($hesiod)
145if test "$hesiod" != no; then
146 if test "$hesiod" != yes; then
147 MR_INCLUDE($hesiod/include)
148 MR_LIBS($hesiod/lib)
149 fi
150 AC_CHECK_FUNC(res_send, :,
151 AC_CHECK_LIB(resolv, res_send))
152 AC_CHECK_LIB(hesiod, hes_resolve, :,
153 [AC_MSG_ERROR(Hesiod library not found)],
154 $LIBPATH $LIBS)
155 MR_DEFINE(HAVE_HESIOD)
156fi
157
158# Zephyr support
159AC_MSG_CHECKING(for Zephyr)
160AC_ARG_WITH(zephyr,
161 [ --with-zephyr=PREFIX Specify location of Zephyr],
162 [zephyr="$withval"], [zephyr=no])
163AC_MSG_RESULT($zephyr)
164if test "$zephyr" != no; then
165 if test "$zephyr" != yes; then
166 MR_INCLUDE($zephyr/include)
167 MR_LIBS($zephyr/lib)
168 fi
169 AC_CHECK_LIB(zephyr, ZInitialize, :,
170 [AC_MSG_ERROR(Zephyr library not found)],
171 $LIBPATH $KRB4_LIBS -lcom_err)
172 MR_DEFINE(HAVE_ZEPHYR)
173fi
174
175# GDSS support (default: build util/gdss if present)
176AC_MSG_CHECKING(for GDSS)
177AC_ARG_WITH(gdss,
178 [ --with-gdss=PREFIX Specify location of GDSS],
179 [gdss="$withval"
180 GDSS_CPPFLAGS="-I$gdss/include"
181 GDSS_LIBS="-L$gdss/lib -lgdss"],
182 [if test -d $srcdir/util/gdss; then
183 gdss=$srcdir/util/gdss
184 GDSS_SUBDIR=util/gdss
185 GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \
186 util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \
187 util/gdss/lib/crypto/algorithm/Makefile"
188 # autoconf can't deal with creating util/gdss if util doesn't exist
189 if test ! -d util; then
190 mkdir util
191 fi
46fa38eb 192 MR_INCLUDE('-I$(SRCTOP)/util/gdss/include')
ea0caf4a 193 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
194 else
195 gdss=no
196 fi])
197AC_MSG_RESULT($gdss)
198if test "$gdss" != no; then
199 GDSS_OBJS='$(GDSS_OBJS)'
200 GDSS_CFILES='$(GDSS_CFILES)'
201 GDSS_TARGET='$(GDSS_TARGET)'
202 MR_DEFINE(HAVE_GDSS)
203fi
204AC_SUBST(GDSS_CPPFLAGS)
205AC_SUBST(GDSS_LIBS)
206AC_SUBST(GDSS_SUBDIR)
207AC_SUBST(GDSS_OBJS)
208AC_SUBST(GDSS_CFILES)
209AC_SUBST(GDSS_TARGET)
210
33567bea 211# RSAREF support (default: build util/rsaref if present)
212AC_MSG_CHECKING(for RSAREF)
213AC_ARG_WITH(rsaref,
214 [ --with-rsaref=PREFIX Specify location of RSAREF],
215 [rsaref="$withval"
216 RSAREF_CPPFLAGS="-I$rsaref/include"
217 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
218 RSAREF_SUBDIRS=reg_svr
219 [if test -d $srcdir/util/rsaref; then
220 rsaref=$srcdir/util/rsaref
221 RSAREF_SUBDIRS="util/rsaref reg_svr"
222 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
223 # autoconf can't deal with creating util/rsaref if util doesn't exist
224 if test ! -d util; then
225 mkdir util
226 fi
46fa38eb 227 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
33567bea 228 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
229 else
230 rsaref=no
231 fi])
232AC_MSG_RESULT($rsaref)
233if test "$rsaref" != no; then
234 MR_DEFINE(HAVE_RSAREF)
235fi
236AC_SUBST(RSAREF_CPPFLAGS)
237AC_SUBST(RSAREF_LIBS)
238AC_SUBST(RSAREF_SUBDIRS)
239
ea0caf4a 240# Oracle (default: yes, if $ORACLE_HOME is set)
241AC_MSG_CHECKING(for Oracle)
242AC_ARG_WITH(oracle,
243 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
244 [oracle="$withval"],
245 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
246 oracle=$ORACLE_HOME
247 else
248 oracle=no
249 fi])
250AC_MSG_RESULT($oracle)
251if test "$oracle" != no; then
252 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
253 SVRSUBDIRS='$(SVRDIRS)'
254 SERVER_OUTPUT_FILES="db/Makefile server/Makefile afssync/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile reg_svr/Makefile regtape/Makefile"
255 PRO_C=$oracle/bin/proc
256 PRO_C_OPTS=CODE=ANSI_C
257fi
258AC_SUBST(PRO_C)
259AC_SUBST(PRO_C_DEFS)
260AC_SUBST(PRO_C_INCLUDES)
261AC_SUBST(PRO_C_OPTS)
262AC_SUBST(SQL_LIBS)
263AC_SUBST(SVRSUBDIRS)
264
265# AFS support
266AC_MSG_CHECKING(for AFS)
267AC_ARG_WITH(afs,
268 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
269 [afs="$withval"], [afs=no])
270AC_MSG_RESULT($afs)
271if test "$afs" != no -a "$oracle" != no; then
272 if test "$afs" != yes; then
273 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
274 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
275 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
276 AFS_DIR=$afs
277 fi
278 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
279 AFS_EXTRA_LIBS="-lcompat",
280 AC_MSG_ERROR(insque not found)))
281 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
282 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
283 :, -L/usr/ucblib))
284 AC_CHECK_LIB(sys, pioctl, :,
285 [AC_MSG_ERROR(AFS libraries not found)],
286 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
287 MR_DEFINE(HAVE_AFS)
288fi
289AC_SUBST(AFS_CPPFLAGS)
290AC_SUBST(AFS_PRO_C_INCLUDES)
291AC_SUBST(AFS_LIBS)
292AC_SUBST(AFS_EXTRA_LIBS)
293AC_SUBST(AFS_DIR)
294
295# GNU readline
296AC_CHECKING(for GNU readline...)
297AC_ARG_WITH(readline,
298 [ --with-readline=PREFIX Specify location of GNU readline],
299 [readline="$withval"],
300 [AC_CHECK_LIB(readline, readline, [readline=yes], :, -ltermcap)])
301if test "$readline" != no; then
302 if test "$readline" != yes; then
303 READLINE_CPPFLAGS="-I$readline/include/readline -DHAVE_READLINE"
304 READLINE_LIBS="-L$readline/lib -lreadline -ltermcap"
305 fi
306fi
307AC_SUBST(READLINE_CPPFLAGS)
308AC_SUBST(READLINE_LIBS)
309
310# Curses
311curses=curses
312AC_CHECKING(for curses)
313AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
314if test -n "$curses"; then
315 OLDLIBS=$LIBS
316 LIBS=-l$curses
317 AC_CHECKING(if curses needs termcap)
318 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
319 dnl link with just -lcurses, but then fail with a runtime linker error
320 dnl because you didn't use -ltermcap
321 AC_TRY_RUN([#include <curses.h>
322 main(int argc, char **argv)
323 {
324 initscr();
325 endwin();
326 return 0;
327 }], [CURSES_LIBS="-l$curses"],
328 LIBS="-l$curses -ltermcap"
329 AC_TRY_RUN([#include <curses.h>
330 main(int argc, char **argv)
331 {
332 initscr();
333 endwin();
334 return 0;
335 }], [CURSES_LIBS="-l$curses -ltermcap"],
336 :, :),
337 :)
338 LIBS=$OLDLIBS
339fi
340if test -n "$CURSES_LIBS"; then
341 OLDLIBS=$LIBS
342 LIBS=$CURSES_LIBS
343 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
344 :,
345 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
346 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
347 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
348 LIBS=$OLDLIBS
349 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
350 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
351else
352 AC_MSG_WARN(Couldn't find -lcurses)
353fi
354AC_SUBST(CURSES_CPPFLAGS)
355AC_SUBST(CURSES_LIBS)
356AC_SUBST(CURSES_SUBDIRS)
357
358
359AC_CHECK_FUNCS(getusershell)
360
25f58600 361MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
ea0caf4a 362MR_INCLUDE('$(SRCTOP)/include')
25f58600 363MR_INCLUDE('$(SRCTOP)/lib')
ea0caf4a 364MR_INCLUDE('$(BUILDTOP)/lib')
365MR_INCLUDE('$(BUILDTOP)/db')
f4036eed 366MR_INCLUDE('$(srcdir)')
ea0caf4a 367LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
368KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
369LIBS="-lmoira $KLIBS"
370AC_SUBST(KLIBS)
371
372AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
373 clients/addusr/Makefile clients/blanche/Makefile \
374 clients/mailmaint/Makefile clients/moira/Makefile \
375 clients/mrcheck/Makefile clients/mrtest/Makefile \
1c1c45eb 376 clients/passwd/Makefile update/Makefile man/Makefile \
33567bea 377 $SERVER_OUTPUT_FILES $GDSS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)
This page took 0.089245 seconds and 5 git commands to generate.