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
36 prefix=/afs/athena.mit.edu/system/moira
37 bindir=$prefix/arch/$ATHENA_SYS/bin
41 # We currently just don't support changing this
45 # Athena-local policy decisions
46 AC_MSG_CHECKING(for Athena)
48 [ --enable-athena Enable Athena-specific policy decisions],
49 , [if test "$athena" = true; then
54 AC_MSG_RESULT($enableval)
55 if test "$enableval" = yes; then
59 # Networking libraries
60 AC_CHECKING(network libraries...)
61 AC_CHECK_FUNC(gethostbyname, :,
62 AC_CHECK_LIB(nsl, gethostbyname, ,
63 AC_CHECK_LIB(resolv, gethostbyname)))
64 AC_CHECK_FUNC(socket, :,
65 AC_CHECK_LIB(socket, socket, ,
66 AC_CHECK_LIB(socket, socket,
67 LIBS="-lsocket -lnsl $LIBS", :,
70 # com_err (required, but can be built)
71 AC_MSG_CHECKING(for com_err)
73 [ --with-com_err=PREFIX Specify location of com_err],
74 [AC_MSG_RESULT($withval)
75 if test $withval = "no"; then
76 AC_MSG_ERROR(com_err is required for Moira)
78 if test $withval != "yes"; then
79 MR_INCLUDE($withval/include)
82 COMPILE_ET=compile_et],
83 [AC_MSG_RESULT(util/et)
84 COM_ERR_SUBDIR=util/et;
85 MR_INCLUDE(`pwd`/util/et)
86 MR_LIBS(`pwd`/util/et)
87 COMPILE_ET=`pwd`/util/et/compile_et
88 AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)])
89 AC_SUBST(COM_ERR_SUBDIR)
93 AC_MSG_CHECKING(for Kerberos 4)
95 [ --with-krb4=PREFIX Specify location of krb4],
96 [krb4="$withval"], [krb4=no])
98 if test $krb4 = "no"; then
99 AC_MSG_ERROR(Kerberos is required for Moira)
101 if test "$krb4" != yes; then
102 MR_INCLUDE($krb4/include)
103 if test -d "$krb4/include/kerberosIV"; then
104 MR_INCLUDE($krb4/include/kerberosIV)
107 elif test -d /usr/include/kerberosIV; then
108 MR_INCLUDE(/usr/include/kerberosIV)
110 AC_CHECK_LIB(krb4, krb_rd_req,
111 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto"],
112 [AC_CHECK_LIB(krb, krb_rd_req,
113 [KRB4_LIBS="-lkrb -ldes"],
114 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
116 $LIBPATH -ldes425 -lkrb5 -lcrypto)
119 AC_MSG_CHECKING(for Hesiod)
121 [ --with-hesiod=PREFIX Specify location of Hesiod],
122 [hesiod="$withval"], [hesiod=no])
123 AC_MSG_RESULT($hesiod)
124 if test "$hesiod" != no; then
125 if test "$hesiod" != yes; then
126 MR_INCLUDE($hesiod/include)
129 AC_CHECK_FUNC(res_send, :,
130 AC_CHECK_LIB(resolv, res_send))
131 AC_CHECK_LIB(hesiod, hes_resolve, :,
132 [AC_MSG_ERROR(Hesiod library not found)],
134 MR_DEFINE(HAVE_HESIOD)
138 AC_MSG_CHECKING(for Zephyr)
140 [ --with-zephyr=PREFIX Specify location of Zephyr],
141 [zephyr="$withval"], [zephyr=no])
142 AC_MSG_RESULT($zephyr)
143 if test "$zephyr" != no; then
144 if test "$zephyr" != yes; then
145 MR_INCLUDE($zephyr/include)
148 AC_CHECK_LIB(zephyr, ZInitialize, :,
149 [AC_MSG_ERROR(Zephyr library not found)],
150 $LIBPATH $KRB4_LIBS -lcom_err)
151 MR_DEFINE(HAVE_ZEPHYR)
154 # GDSS support (default: build util/gdss if present)
155 AC_MSG_CHECKING(for GDSS)
157 [ --with-gdss=PREFIX Specify location of GDSS],
159 GDSS_CPPFLAGS="-I$gdss/include"
160 GDSS_LIBS="-L$gdss/lib -lgdss"],
161 [if test -d $srcdir/util/gdss; then
162 gdss=$srcdir/util/gdss
163 GDSS_SUBDIR=util/gdss
164 GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \
165 util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \
166 util/gdss/lib/crypto/algorithm/Makefile"
167 # autoconf can't deal with creating util/gdss if util doesn't exist
168 if test ! -d util; then
171 GDSS_CPPFLGAS="-I$gdss/include"
172 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
177 if test "$gdss" != no; then
178 GDSS_OBJS='$(GDSS_OBJS)'
179 GDSS_CFILES='$(GDSS_CFILES)'
180 GDSS_TARGET='$(GDSS_TARGET)'
183 AC_SUBST(GDSS_CPPFLAGS)
185 AC_SUBST(GDSS_SUBDIR)
187 AC_SUBST(GDSS_CFILES)
188 AC_SUBST(GDSS_TARGET)
190 # Oracle (default: yes, if $ORACLE_HOME is set)
191 AC_MSG_CHECKING(for Oracle)
193 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
195 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
200 AC_MSG_RESULT($oracle)
201 if test "$oracle" != no; then
202 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
203 SVRSUBDIRS='$(SVRDIRS)'
204 SERVER_OUTPUT_FILES="db/Makefile server/Makefile afssync/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile reg_svr/Makefile regtape/Makefile"
205 PRO_C=$oracle/bin/proc
206 PRO_C_OPTS=CODE=ANSI_C
210 AC_SUBST(PRO_C_INCLUDES)
216 AC_MSG_CHECKING(for AFS)
218 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
219 [afs="$withval"], [afs=no])
221 if test "$afs" != no -a "$oracle" != no; then
222 if test "$afs" != yes; then
223 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
224 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
225 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
228 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
229 AFS_EXTRA_LIBS="-lcompat",
230 AC_MSG_ERROR(insque not found)))
231 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
232 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
234 AC_CHECK_LIB(sys, pioctl, :,
235 [AC_MSG_ERROR(AFS libraries not found)],
236 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
239 AC_SUBST(AFS_CPPFLAGS)
240 AC_SUBST(AFS_PRO_C_INCLUDES)
242 AC_SUBST(AFS_EXTRA_LIBS)
246 AC_CHECKING(for GNU readline...)
247 AC_ARG_WITH(readline,
248 [ --with-readline=PREFIX Specify location of GNU readline],
249 [readline="$withval"],
250 [AC_CHECK_LIB(readline, readline, [readline=yes], :, -ltermcap)])
251 if test "$readline" != no; then
252 if test "$readline" != yes; then
253 READLINE_CPPFLAGS="-I$readline/include/readline -DHAVE_READLINE"
254 READLINE_LIBS="-L$readline/lib -lreadline -ltermcap"
257 AC_SUBST(READLINE_CPPFLAGS)
258 AC_SUBST(READLINE_LIBS)
262 AC_CHECKING(for curses)
263 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
264 if test -n "$curses"; then
267 AC_CHECKING(if curses needs termcap)
268 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
269 dnl link with just -lcurses, but then fail with a runtime linker error
270 dnl because you didn't use -ltermcap
271 AC_TRY_RUN([#include <curses.h>
272 main(int argc, char **argv)
277 }], [CURSES_LIBS="-l$curses"],
278 LIBS="-l$curses -ltermcap"
279 AC_TRY_RUN([#include <curses.h>
280 main(int argc, char **argv)
285 }], [CURSES_LIBS="-l$curses -ltermcap"],
290 if test -n "$CURSES_LIBS"; then
293 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
295 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
296 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
297 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
299 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
300 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
302 AC_MSG_WARN(Couldn't find -lcurses)
304 AC_SUBST(CURSES_CPPFLAGS)
305 AC_SUBST(CURSES_LIBS)
306 AC_SUBST(CURSES_SUBDIRS)
309 AC_CHECK_FUNCS(getusershell)
311 AC_CHECK_HEADER(crypt.h, CRYPT_CPPFLAGS=-DHAVE_CRYPT_H)
312 AC_CHECK_FUNC(crypt, :, AC_CHECK_LIB(crypt, crypt, CRYPT_LIBS=-lcrypt))
313 AC_SUBST(CRYPT_CPPFLAGS)
316 MR_INCLUDE('$(SRCTOP)/include')
317 MR_INCLUDE('$(BUILDTOP)/lib')
318 MR_INCLUDE('$(BUILDTOP)/db')
319 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
320 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
321 LIBS="-lmoira $KLIBS"
324 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
325 clients/addusr/Makefile clients/blanche/Makefile \
326 clients/mailmaint/Makefile clients/moira/Makefile \
327 clients/mrcheck/Makefile clients/mrtest/Makefile \
328 clients/passwd/Makefile clients/userreg/Makefile \
329 update/Makefile man/Makefile \
330 $SERVER_OUTPUT_FILES $GDSS_OUTPUT_FILES)