3 dnl On Athena at least, many of the packages (krb, zephyr, hesiod, etc)
4 dnl will all be in /usr/athena... this hack lets us not end up with 10
5 dnl copies of -I/usr/athena/include -L/usr/athena/lib in our command lines
13 dnl Define for both C and Pro*C
16 MR_EXTEND(PRO_C_DEFS, DEFINE=$1)
19 dnl Add to include path for both C and Pro*C
20 AC_DEFUN(MR_INCLUDE, [
21 MR_EXTEND(CPPFLAGS, -I$1)
22 MR_EXTEND(PRO_C_INCLUDES, INCLUDE=$1)
26 AC_DEFUN(MR_LIBS, [MR_EXTEND(LIBPATH, -L$1)])
33 if test "$athena" = true; then
35 with_readline=/mit/gnu
37 prefix=/afs/athena.mit.edu/system/moira
38 bindir=$prefix/arch/$ATHENA_SYS/bin
42 # We currently just don't support changing this
46 # Athena-local policy decisions
47 AC_MSG_CHECKING(for Athena)
49 [ --enable-athena Enable Athena-specific policy decisions],
50 , [if test "$athena" = true; then
55 AC_MSG_RESULT($enableval)
56 if test "$enableval" = yes; then
60 # Networking libraries
61 AC_CHECKING(network libraries...)
62 AC_CHECK_FUNC(gethostbyname, :,
63 AC_CHECK_LIB(nsl, gethostbyname, ,
64 AC_CHECK_LIB(resolv, gethostbyname)))
65 AC_CHECK_FUNC(socket, :,
66 AC_CHECK_LIB(socket, socket, ,
67 AC_CHECK_LIB(socket, socket,
68 LIBS="-lsocket -lnsl $LIBS", :,
71 # com_err (required, but can be built)
72 AC_MSG_CHECKING(for 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)
79 if test $withval != "yes"; then
80 MR_INCLUDE($withval/include)
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)])
90 AC_SUBST(COM_ERR_SUBDIR)
93 # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
94 AC_MSG_CHECKING(for Kerberos 4)
96 [ --with-krb4=PREFIX Specify location of krb4],
97 [krb4="$withval"], [krb4=no])
99 if test $krb4 = "no"; then
100 AC_MSG_ERROR(Kerberos is required for Moira)
102 if test "$krb4" != yes; then
103 MR_INCLUDE($krb4/include)
104 if test -d "$krb4/include/kerberosIV"; then
105 MR_INCLUDE($krb4/include/kerberosIV)
108 elif test -d /usr/include/kerberosIV; then
109 MR_INCLUDE(/usr/include/kerberosIV)
111 AC_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)],
117 $LIBPATH -ldes425 -lkrb5 -lcrypto -lcom_err)
119 AC_MSG_CHECKING(for Kerberos 5)
121 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
122 [krb5="$withval"], [krb5=no])
124 if test "$krb5" != no; then
126 if test "$krb5" != yes; then
127 REG_SVR_INCLUDES=-I$krb5/include
128 REG_SVR_LIBS=-L$krb5/lib
130 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -lcrypto"
135 AC_SUBST(REG_SVR_DEFS)
136 AC_SUBST(REG_SVR_INCLUDES)
137 AC_SUBST(REG_SVR_LIBS)
140 AC_MSG_CHECKING(for Hesiod)
142 [ --with-hesiod=PREFIX Specify location of Hesiod],
143 [hesiod="$withval"], [hesiod=no])
144 AC_MSG_RESULT($hesiod)
145 if test "$hesiod" != no; then
146 if test "$hesiod" != yes; then
147 MR_INCLUDE($hesiod/include)
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)],
155 MR_DEFINE(HAVE_HESIOD)
159 AC_MSG_CHECKING(for Zephyr)
161 [ --with-zephyr=PREFIX Specify location of Zephyr],
162 [zephyr="$withval"], [zephyr=no])
163 AC_MSG_RESULT($zephyr)
164 if test "$zephyr" != no; then
165 if test "$zephyr" != yes; then
166 MR_INCLUDE($zephyr/include)
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)
175 # GDSS support (default: build util/gdss if present)
176 AC_MSG_CHECKING(for GDSS)
178 [ --with-gdss=PREFIX Specify location of GDSS],
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
192 MR_INCLUDE('-I$(SRCTOP)/util/gdss/include')
193 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
198 if test "$gdss" != no; then
199 GDSS_OBJS='$(GDSS_OBJS)'
200 GDSS_CFILES='$(GDSS_CFILES)'
201 GDSS_TARGET='$(GDSS_TARGET)'
204 AC_SUBST(GDSS_CPPFLAGS)
206 AC_SUBST(GDSS_SUBDIR)
208 AC_SUBST(GDSS_CFILES)
209 AC_SUBST(GDSS_TARGET)
211 # RSAREF support (default: build util/rsaref if present)
212 AC_MSG_CHECKING(for RSAREF)
214 [ --with-rsaref=PREFIX Specify location of RSAREF],
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
227 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
228 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
232 AC_MSG_RESULT($rsaref)
233 if test "$rsaref" != no; then
234 MR_DEFINE(HAVE_RSAREF)
236 AC_SUBST(RSAREF_CPPFLAGS)
237 AC_SUBST(RSAREF_LIBS)
238 AC_SUBST(RSAREF_SUBDIRS)
240 # Oracle (default: yes, if $ORACLE_HOME is set)
241 AC_MSG_CHECKING(for Oracle)
243 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
245 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
250 AC_MSG_RESULT($oracle)
251 if 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
260 AC_SUBST(PRO_C_INCLUDES)
266 AC_MSG_CHECKING(for AFS)
268 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
269 [afs="$withval"], [afs=no])
271 if 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"
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",
284 AC_CHECK_LIB(sys, pioctl, :,
285 [AC_MSG_ERROR(AFS libraries not found)],
286 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
289 AC_SUBST(AFS_CPPFLAGS)
290 AC_SUBST(AFS_PRO_C_INCLUDES)
292 AC_SUBST(AFS_EXTRA_LIBS)
296 AC_CHECKING(for GNU readline...)
297 AC_ARG_WITH(readline,
298 [ --with-readline=PREFIX Specify location of GNU readline],
299 [readline="$withval"],
300 [AC_CHECK_LIB(readline, readline, [readline=yes], :, -ltermcap)])
301 if 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"
307 AC_SUBST(READLINE_CPPFLAGS)
308 AC_SUBST(READLINE_LIBS)
312 AC_CHECKING(for curses)
313 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
314 if test -n "$curses"; then
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)
327 }], [CURSES_LIBS="-l$curses"],
328 LIBS="-l$curses -ltermcap"
329 AC_TRY_RUN([#include <curses.h>
330 main(int argc, char **argv)
335 }], [CURSES_LIBS="-l$curses -ltermcap"],
340 if test -n "$CURSES_LIBS"; then
343 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
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'"]))
349 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
350 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
352 AC_MSG_WARN(Couldn't find -lcurses)
354 AC_SUBST(CURSES_CPPFLAGS)
355 AC_SUBST(CURSES_LIBS)
356 AC_SUBST(CURSES_SUBDIRS)
359 AC_CHECK_FUNCS(getusershell)
361 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
362 MR_INCLUDE('$(SRCTOP)/include')
363 MR_INCLUDE('$(SRCTOP)/lib')
364 MR_INCLUDE('$(BUILDTOP)/lib')
365 MR_INCLUDE('$(BUILDTOP)/db')
366 MR_INCLUDE('$(srcdir)')
367 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
368 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
369 LIBS="-lmoira $KLIBS"
372 AC_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 \
376 clients/passwd/Makefile update/Makefile man/Makefile \
377 $SERVER_OUTPUT_FILES $GDSS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)