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 prefix=/afs/.athena.mit.edu/system/moira
36 bindir=$prefix/arch/$ATHENA_SYS/bin
38 MR_INCLUDE(/usr/athena/include)
39 MR_INCLUDE(/usr/athena/include/kerberosIV)
40 MR_LIBS(/usr/athena/lib)
43 # We currently just don't support changing this
47 # Athena-local policy decisions
48 AC_MSG_CHECKING(for Athena)
50 [ --enable-athena Enable Athena-specific policy decisions],
51 , [if test "$athena" = true; then
56 AC_MSG_RESULT($enableval)
57 if test "$enableval" = yes; then
61 # Networking libraries
62 AC_CHECKING(network libraries...)
63 AC_CHECK_FUNC(gethostbyname, :,
64 AC_CHECK_LIB(nsl, gethostbyname, ,
65 AC_CHECK_LIB(resolv, gethostbyname)))
66 AC_CHECK_FUNC(socket, :,
67 AC_CHECK_LIB(socket, socket, ,
68 AC_CHECK_LIB(socket, socket,
69 LIBS="-lsocket -lnsl $LIBS", :,
72 # com_err (required, but can be built)
73 AC_MSG_CHECKING(for com_err)
75 [ --with-com_err=PREFIX Specify location of com_err],
76 [AC_MSG_RESULT($withval)
77 if test $withval = "no"; then
78 AC_MSG_ERROR(com_err is required for Moira)
80 if test $withval != "yes"; then
81 MR_INCLUDE($withval/include)
84 COMPILE_ET=compile_et],
85 [AC_MSG_RESULT(util/et)
86 COM_ERR_SUBDIR=util/et;
87 MR_INCLUDE(`pwd`/util/et)
88 MR_LIBS(`pwd`/util/et)
89 COMPILE_ET=`pwd`/util/et/compile_et
90 AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)])
91 AC_SUBST(COM_ERR_SUBDIR)
94 # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
95 AC_MSG_CHECKING(for Kerberos 4)
97 [ --with-krb4=PREFIX Specify location of krb4],
98 [krb4="$withval"], [krb4=no])
100 if test $krb4 = "no"; then
101 AC_MSG_ERROR(Kerberos is required for Moira)
103 if test "$krb4" != yes; then
104 MR_INCLUDE($krb4/include)
105 if test -d "$krb4/include/kerberosIV"; then
106 MR_INCLUDE($krb4/include/kerberosIV)
109 elif test -d /usr/include/kerberosIV; then
110 MR_INCLUDE(/usr/include/kerberosIV)
112 AC_CHECK_LIB(krb4, krb_rd_req,
113 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto"],
114 [AC_CHECK_LIB(krb, krb_rd_req,
115 [KRB4_LIBS="-lkrb -ldes"],
116 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
118 $LIBPATH -ldes425 -lkrb5 -lcrypto -lcom_err)
120 AC_MSG_CHECKING(for Kerberos 5)
122 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
123 [krb5="$withval"], [krb5=no])
125 if test "$krb5" != no; then
127 if test "$krb5" != yes; then
128 REG_SVR_INCLUDES=-I$krb5/include
129 REG_SVR_LIBS=-L$krb5/lib
131 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -lcrypto"
136 AC_SUBST(REG_SVR_DEFS)
137 AC_SUBST(REG_SVR_INCLUDES)
138 AC_SUBST(REG_SVR_LIBS)
141 AC_MSG_CHECKING(for Hesiod)
143 [ --with-hesiod=PREFIX Specify location of Hesiod],
144 [hesiod="$withval"], [hesiod=no])
145 AC_MSG_RESULT($hesiod)
146 if test "$hesiod" != no; then
147 if test "$hesiod" != yes; then
148 MR_INCLUDE($hesiod/include)
151 AC_CHECK_FUNC(res_send, :,
152 AC_CHECK_LIB(resolv, res_send))
153 AC_CHECK_LIB(hesiod, hes_resolve, :,
154 [AC_MSG_ERROR(Hesiod library not found)],
156 MR_DEFINE(HAVE_HESIOD)
160 AC_MSG_CHECKING(for Zephyr)
162 [ --with-zephyr=PREFIX Specify location of Zephyr],
163 [zephyr="$withval"], [zephyr=no])
164 AC_MSG_RESULT($zephyr)
165 if test "$zephyr" != no; then
166 if test "$zephyr" != yes; then
167 MR_INCLUDE($zephyr/include)
170 AC_CHECK_LIB(zephyr, ZInitialize, :,
171 [AC_MSG_ERROR(Zephyr library not found)],
172 $LIBPATH $KRB4_LIBS -lcom_err)
173 MR_DEFINE(HAVE_ZEPHYR)
176 # GDSS support (default: build util/gdss if present)
177 AC_MSG_CHECKING(for GDSS)
178 AC_TRY_RUN([ int main() { return sizeof(long)!=4; } ], :, with_gdss=no, with_gdss=no)
180 [ --with-gdss=PREFIX Specify location of GDSS],
182 if test "$gdss" != no; then
183 MR_INCLUDE("$gdss/include")
184 GDSS_LIBS="-L$gdss/lib -lgdss"
186 [if test -d $srcdir/util/gdss; then
187 gdss=$srcdir/util/gdss
188 GDSS_SUBDIR=util/gdss
189 GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \
190 util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \
191 util/gdss/lib/crypto/algorithm/Makefile"
192 # autoconf can't deal with creating util/gdss if util doesn't exist
193 if test ! -d util; then
196 MR_INCLUDE('$(SRCTOP)/util/gdss/include')
197 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
198 GDSS_LIBDEP='$(BUILDTOP)/util/gdss/lib/libgdss.a'
203 if test "$gdss" != no; then
204 GDSS_OBJS='$(GDSS_OBJS)'
205 GDSS_CFILES='$(GDSS_CFILES)'
206 GDSS_TARGET='$(GDSS_TARGET)'
209 AC_SUBST(GDSS_CPPFLAGS)
211 AC_SUBST(GDSS_SUBDIR)
213 AC_SUBST(GDSS_CFILES)
214 AC_SUBST(GDSS_TARGET)
215 AC_SUBST(GDSS_LIBDEP)
217 # RSAREF support (default: build util/rsaref if present)
218 AC_MSG_CHECKING(for RSAREF)
220 [ --with-rsaref=PREFIX Specify location of RSAREF],
222 RSAREF_CPPFLAGS="-I$rsaref/include"
223 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
224 RSAREF_SUBDIRS=reg_svr
225 [if test -d $srcdir/util/rsaref; then
226 rsaref=$srcdir/util/rsaref
227 RSAREF_SUBDIRS="util/rsaref reg_svr"
228 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
229 # autoconf can't deal with creating util/rsaref if util doesn't exist
230 if test ! -d util; then
233 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
234 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
235 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
239 AC_MSG_RESULT($rsaref)
240 if test "$rsaref" != no; then
241 MR_DEFINE(HAVE_RSAREF)
243 AC_SUBST(RSAREF_CPPFLAGS)
244 AC_SUBST(RSAREF_LIBS)
245 AC_SUBST(RSAREF_SUBDIRS)
246 AC_SUBST(RSAREF_LIBDEP)
248 # Oracle (default: yes, if $ORACLE_HOME is set)
249 AC_MSG_CHECKING(for Oracle)
251 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
253 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
258 AC_MSG_RESULT($oracle)
259 if test "$oracle" != no; then
260 AC_MSG_CHECKING(Pro*C version)
261 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
262 AC_MSG_RESULT($release)
265 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
268 SQL_LIBS="-L$oracle/lib -lclntsh -lxa -lsql -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric -lepc -lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 -lnlsrtl3 `cat $oracle/rdbms/lib/sysliblist` -lm -lthread"
271 SVRSUBDIRS='$(SVRDIRS)'
272 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile reg_svr/Makefile regtape/Makefile"
273 PRO_C=$oracle/bin/proc
274 PRO_C_OPTS=CODE=ANSI_C
275 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
279 AC_SUBST(PRO_C_INCLUDES)
285 AC_MSG_CHECKING(for AFS)
287 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
288 [afs="$withval"], [afs=no])
290 if test "$afs" != no -a "$oracle" != no; then
291 if test "$afs" != yes; then
292 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
293 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
294 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
297 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
298 AFS_EXTRA_LIBS="-lcompat",
299 AC_MSG_ERROR(insque not found)))
300 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
301 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
303 AC_CHECK_LIB(sys, pioctl, :,
304 [AC_MSG_ERROR(AFS libraries not found)],
305 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
308 AFS_SUBDIRS="incremental"
309 AFS_OUTPUT_FILES="incremental/Makefile"
310 if test -d $srcdir/afssync; then
311 AFS_SUBDIRS="$AFS_SUBDIRS afssync"
312 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
315 AC_SUBST(AFS_CPPFLAGS)
316 AC_SUBST(AFS_PRO_C_INCLUDES)
318 AC_SUBST(AFS_EXTRA_LIBS)
320 AC_SUBST(AFS_SUBDIRS)
323 AC_CHECKING(for GNU readline...)
324 AC_ARG_WITH(readline,
325 [ --with-readline=PREFIX Specify location of GNU readline],
326 [readline="$withval"; AC_MSG_RESULT($withval)],
327 [AC_CHECK_LIB(readline, readline, [readline=yes],
328 [if test "$athena" = true; then
329 unset ac_cv_lib_readline_readline
330 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
331 -L/mit/gnu/lib -ltermcap)
334 if test "$readline" != no; then
335 if test "$readline" != yes; then
336 READLINE_CPPFLAGS="-I$readline/include"
337 READLINE_LIBS="-L$readline/lib"
339 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
340 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
342 AC_SUBST(READLINE_CPPFLAGS)
343 AC_SUBST(READLINE_LIBS)
347 AC_CHECKING(for curses)
348 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
349 if test -n "$curses"; then
352 AC_CHECKING(if curses needs termcap)
353 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
354 dnl link with just -lcurses, but then fail with a runtime linker error
355 dnl because you didn't use -ltermcap
356 AC_TRY_RUN([#include <curses.h>
357 main(int argc, char **argv)
362 }], [CURSES_LIBS="-l$curses"],
363 LIBS="-l$curses -ltermcap"
364 AC_TRY_RUN([#include <curses.h>
365 main(int argc, char **argv)
370 }], [CURSES_LIBS="-l$curses -ltermcap"],
375 if test -n "$CURSES_LIBS"; then
378 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
380 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
381 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
382 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
383 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
384 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
386 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
387 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
389 AC_MSG_WARN(Couldn't find -lcurses)
391 AC_SUBST(CURSES_CPPFLAGS)
392 AC_SUBST(CURSES_LIBS)
393 AC_SUBST(CURSES_SUBDIRS)
396 AC_CHECK_FUNCS(getusershell strlcpy strlcat)
398 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
399 MR_INCLUDE('$(SRCTOP)/include')
400 MR_INCLUDE('$(SRCTOP)/lib')
401 MR_INCLUDE('$(BUILDTOP)/lib')
402 MR_INCLUDE('$(BUILDTOP)/db')
403 MR_INCLUDE('$(srcdir)')
404 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
405 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
406 LIBS="-lmoira $KLIBS"
409 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
412 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
413 clients/lib/Makefile clients/addusr/Makefile \
414 clients/blanche/Makefile clients/mailmaint/Makefile
415 clients/moira/Makefile clients/mrcheck/Makefile
416 clients/mrtest/Makefile clients/passwd/Makefile
417 update/Makefile man/Makefile \
418 $SERVER_OUTPUT_FILES $AFS_OUTPUT_FILES \
419 $GDSS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)