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(crypto, main, crypto="crypto",
113 [AC_CHECK_LIB(k5crypto, main, crypto="k5crypto")])
114 AC_CHECK_LIB(krb4, krb_rd_req,
115 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto}"],
116 [AC_CHECK_LIB(krb, krb_rd_req,
117 [KRB4_LIBS="-lkrb -ldes"],
118 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
120 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err)
122 AC_MSG_CHECKING(for Kerberos 5)
124 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
125 [krb5="$withval"], [krb5=no])
127 if test "$krb5" != no; then
129 if test "$krb5" != yes; then
130 REG_SVR_INCLUDES=-I$krb5/include
131 REG_SVR_LIBS=-L$krb5/lib
133 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -l${crypto}"
138 AC_SUBST(REG_SVR_DEFS)
139 AC_SUBST(REG_SVR_INCLUDES)
140 AC_SUBST(REG_SVR_LIBS)
143 AC_MSG_CHECKING(for Hesiod)
145 [ --with-hesiod=PREFIX Specify location of Hesiod],
146 [hesiod="$withval"], [hesiod=no])
147 AC_MSG_RESULT($hesiod)
148 if test "$hesiod" != no; then
149 if test "$hesiod" != yes; then
150 MR_INCLUDE($hesiod/include)
153 AC_CHECK_FUNC(res_send, :,
154 AC_CHECK_LIB(resolv, res_send))
155 AC_CHECK_LIB(hesiod, hes_resolve, :,
156 [AC_MSG_ERROR(Hesiod library not found)],
158 MR_DEFINE(HAVE_HESIOD)
162 AC_MSG_CHECKING(for Zephyr)
164 [ --with-zephyr=PREFIX Specify location of Zephyr],
165 [zephyr="$withval"], [zephyr=no])
166 AC_MSG_RESULT($zephyr)
167 if test "$zephyr" != no; then
168 if test "$zephyr" != yes; then
169 MR_INCLUDE($zephyr/include)
172 AC_CHECK_LIB(zephyr, ZInitialize, :,
173 [AC_MSG_ERROR(Zephyr library not found)],
174 $LIBPATH $KRB4_LIBS -lcom_err)
175 MR_DEFINE(HAVE_ZEPHYR)
178 # RSAREF support (default: build util/rsaref if present)
179 AC_MSG_CHECKING(for RSAREF)
181 [ --with-rsaref=PREFIX Specify location of RSAREF],
183 RSAREF_CPPFLAGS="-I$rsaref/include"
184 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
185 RSAREF_SUBDIRS=reg_svr
186 [if test -d $srcdir/util/rsaref; then
187 rsaref=$srcdir/util/rsaref
188 RSAREF_SUBDIRS="util/rsaref reg_svr"
189 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
190 # autoconf can't deal with creating util/rsaref if util doesn't exist
191 if test ! -d util; then
194 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
195 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
196 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
200 AC_MSG_RESULT($rsaref)
201 if test "$rsaref" != no; then
202 MR_DEFINE(HAVE_RSAREF)
204 AC_SUBST(RSAREF_CPPFLAGS)
205 AC_SUBST(RSAREF_LIBS)
206 AC_SUBST(RSAREF_SUBDIRS)
207 AC_SUBST(RSAREF_LIBDEP)
209 # Oracle (default: yes, if $ORACLE_HOME is set)
210 AC_MSG_CHECKING(for Oracle)
212 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
214 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
219 AC_MSG_RESULT($oracle)
220 if test "$oracle" != no; then
221 AC_MSG_CHECKING(Pro*C version)
222 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
223 AC_MSG_RESULT($release)
226 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
229 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"
232 SVRSUBDIRS='$(SVRDIRS)'
233 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile reg_svr/Makefile regtape/Makefile"
234 PRO_C=$oracle/bin/proc
235 PRO_C_OPTS=CODE=ANSI_C
236 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
240 AC_SUBST(PRO_C_INCLUDES)
246 AC_MSG_CHECKING(for LDAP)
248 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
250 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
256 if test "$ldap" != no -a "$oracle" != no; then
257 if test "$ldap" != yes; then
258 LDAP_CPPFLAGS="-I$ldap/include"
259 LDAP_LIBS="-L$ldap/lib"
263 WINAD_SUBDIRS="winad"
264 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
266 AC_SUBST(LDAP_CPPFLAGS)
268 AC_SUBST(WINAD_SUBDIRS)
271 AC_MSG_CHECKING(for AFS)
273 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
274 [afs="$withval"], [afs=no])
276 if test "$afs" != no -a "$oracle" != no; then
277 if test "$afs" != yes; then
278 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
279 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
280 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
283 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
284 AFS_EXTRA_LIBS="-lcompat",
285 AC_MSG_ERROR(insque not found)))
286 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
287 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
289 AC_CHECK_LIB(sys, pioctl, :,
290 [AC_MSG_ERROR(AFS libraries not found)],
291 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
295 AFS_OUTPUT_FILES="incremental/afs/Makefile"
296 if test -d $srcdir/afssync; then
297 AFS_SYNCDIR="afssync"
298 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
301 AC_SUBST(AFS_CPPFLAGS)
302 AC_SUBST(AFS_PRO_C_INCLUDES)
304 AC_SUBST(AFS_EXTRA_LIBS)
306 AC_SUBST(AFS_SUBDIRS)
307 AC_SUBST(AFS_SYNCDIR)
310 AC_CHECKING(for GNU readline...)
311 AC_ARG_WITH(readline,
312 [ --with-readline=PREFIX Specify location of GNU readline],
313 [readline="$withval"; AC_MSG_RESULT($withval)],
314 [AC_CHECK_LIB(readline, readline, [readline=yes],
315 [if test "$athena" = true; then
316 unset ac_cv_lib_readline_readline
317 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
318 -L/mit/gnu/lib -ltermcap)
321 if test "$readline" != no; then
322 if test "$readline" != yes; then
323 READLINE_CPPFLAGS="-I$readline/include"
324 READLINE_LIBS="-L$readline/lib"
326 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
327 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
329 AC_SUBST(READLINE_CPPFLAGS)
330 AC_SUBST(READLINE_LIBS)
334 AC_CHECKING(for curses)
335 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
336 if test -n "$curses"; then
339 AC_CHECKING(if curses needs termcap)
340 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
341 dnl link with just -lcurses, but then fail with a runtime linker error
342 dnl because you didn't use -ltermcap
343 AC_TRY_RUN([#include <curses.h>
344 main(int argc, char **argv)
349 }], [CURSES_LIBS="-l$curses"],
350 LIBS="-l$curses -ltermcap"
351 AC_TRY_RUN([#include <curses.h>
352 main(int argc, char **argv)
357 }], [CURSES_LIBS="-l$curses -ltermcap"],
362 if test -n "$CURSES_LIBS"; then
365 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
367 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
368 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
369 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
370 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
371 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
373 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
374 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
376 AC_MSG_WARN(Couldn't find -lcurses)
378 AC_SUBST(CURSES_CPPFLAGS)
379 AC_SUBST(CURSES_LIBS)
380 AC_SUBST(CURSES_SUBDIRS)
383 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname)
385 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
387 AC_CHECK_HEADERS(unistd.h getopt.h netinet/in.h)
389 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
390 MR_INCLUDE('$(SRCTOP)/include')
391 MR_INCLUDE('$(SRCTOP)/lib')
392 MR_INCLUDE('$(BUILDTOP)/lib')
393 MR_INCLUDE('$(BUILDTOP)/db')
394 MR_INCLUDE('$(srcdir)')
395 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
396 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
397 LIBS="-lmoira $KLIBS"
400 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
403 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
404 clients/lib/Makefile clients/addusr/Makefile \
405 clients/blanche/Makefile clients/chfn/Makefile \
406 clients/chpobox/Makefile clients/chsh/Makefile \
407 clients/mailmaint/Makefile clients/moira/Makefile \
408 clients/mrcheck/Makefile clients/mrtest/Makefile \
409 clients/stella/Makefile update/Makefile man/Makefile \
410 $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES $AFS_OUTPUT_FILES \
411 $RSAREF_OUTPUT_FILES)