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
14 # SO_LDFLAGS setting below is a great big ick.
15 # But it beats sucking in libtool for one small part of the source tree.
32 dnl Define for both C and Pro*C
35 MR_EXTEND(PRO_C_DEFS, DEFINE=$1)
38 dnl Add to include path for both C and Pro*C
39 AC_DEFUN(MR_INCLUDE, [
40 MR_EXTEND(CPPFLAGS, -I$1)
41 MR_EXTEND(PRO_C_INCLUDES, INCLUDE=$1)
45 AC_DEFUN(MR_LIBS, [MR_EXTEND(LIBPATH, -L$1)])
52 if test "$athena" = true; then
54 prefix=/afs/.athena.mit.edu/system/moira
55 bindir=$prefix/arch/$ATHENA_SYS/bin
57 MR_INCLUDE(/usr/athena/include)
58 MR_INCLUDE(/usr/athena/include/kerberosIV)
59 MR_LIBS(/usr/athena/lib)
62 # We currently just don't support changing this
66 # Athena-local policy decisions
67 AC_MSG_CHECKING(for Athena)
69 [ --enable-athena Enable Athena-specific policy decisions],
70 , [if test "$athena" = true; then
75 AC_MSG_RESULT($enableval)
76 if test "$enableval" = yes; then
80 # Networking libraries
81 AC_CHECKING(network libraries...)
82 AC_CHECK_FUNC(gethostbyname, :,
83 AC_CHECK_LIB(nsl, gethostbyname, ,
84 AC_CHECK_LIB(resolv, gethostbyname)))
85 AC_CHECK_FUNC(socket, :,
86 AC_CHECK_LIB(socket, socket, ,
87 AC_CHECK_LIB(socket, socket,
88 LIBS="-lsocket -lnsl $LIBS", :,
91 # com_err (required, but can be built)
92 AC_MSG_CHECKING(for com_err)
94 [ --with-com_err=PREFIX Specify location of com_err],
95 [AC_MSG_RESULT($withval)
96 if test $withval = "no"; then
97 AC_MSG_ERROR(com_err is required for Moira)
99 if test $withval != "yes"; then
100 MR_INCLUDE($withval/include)
101 MR_LIBS($withval/lib)
103 COMPILE_ET=compile_et],
104 [AC_MSG_RESULT(util/et)
105 MR_INCLUDE(`pwd`/util/et)
106 MR_LIBS(`pwd`/util/et)
107 COMPILE_ET=`pwd`/util/et/compile_et
108 AC_CONFIG_SUBDIRS(util/et)])
109 AC_SUBST(COM_ERR_SUBDIR)
112 # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
113 AC_MSG_CHECKING(for Kerberos 4)
115 [ --with-krb4=PREFIX Specify location of krb4],
116 [krb4="$withval"], [krb4=no])
118 if test $krb4 = "no"; then
119 AC_MSG_ERROR(Kerberos is required for Moira)
121 if test "$krb4" != yes; then
122 MR_INCLUDE($krb4/include)
123 if test -d "$krb4/include/kerberosIV"; then
124 MR_INCLUDE($krb4/include/kerberosIV)
127 elif test -d /usr/include/kerberosIV; then
128 MR_INCLUDE(/usr/include/kerberosIV)
130 AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
131 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
132 AC_CHECK_LIB(krb4, krb_rd_req,
133 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
134 [AC_CHECK_LIB(krb, krb_rd_req,
135 [KRB4_LIBS="-lkrb -ldes"],
136 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
138 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
140 AC_MSG_CHECKING(for Kerberos 5)
142 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
143 [krb5="$withval"], [krb5=no])
145 if test "$krb5" != no; then
147 if test "$krb5" != yes; then
148 REG_SVR_INCLUDES=-I$krb5/include
149 REG_SVR_LIBS=-L$krb5/lib
151 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"
156 AC_SUBST(REG_SVR_DEFS)
157 AC_SUBST(REG_SVR_INCLUDES)
158 AC_SUBST(REG_SVR_LIBS)
161 AC_MSG_CHECKING(for Hesiod)
163 [ --with-hesiod=PREFIX Specify location of Hesiod],
164 [hesiod="$withval"], [hesiod=no])
165 AC_MSG_RESULT($hesiod)
166 if test "$hesiod" != no; then
167 if test "$hesiod" != yes; then
168 MR_INCLUDE($hesiod/include)
171 AC_CHECK_FUNC(res_send, :,
172 AC_CHECK_LIB(resolv, res_send))
173 AC_CHECK_LIB(hesiod, hes_resolve, :,
174 [AC_MSG_ERROR(Hesiod library not found)],
176 MR_DEFINE(HAVE_HESIOD)
180 AC_MSG_CHECKING(for Zephyr)
182 [ --with-zephyr=PREFIX Specify location of Zephyr],
183 [zephyr="$withval"], [zephyr=no])
184 AC_MSG_RESULT($zephyr)
185 if test "$zephyr" != no; then
186 if test "$zephyr" != yes; then
187 MR_INCLUDE($zephyr/include)
190 AC_CHECK_LIB(zephyr, ZInitialize, :,
191 [AC_MSG_ERROR(Zephyr library not found)],
192 $LIBPATH $KRB4_LIBS -lcom_err)
193 MR_DEFINE(HAVE_ZEPHYR)
196 # RSAREF support (default: build util/rsaref if present)
197 AC_MSG_CHECKING(for RSAREF)
199 [ --with-rsaref=PREFIX Specify location of RSAREF],
201 RSAREF_CPPFLAGS="-I$rsaref/include"
202 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
203 RSAREF_SUBDIRS=reg_svr
204 [if test -d $srcdir/util/rsaref; then
205 rsaref=$srcdir/util/rsaref
206 RSAREF_SUBDIRS="util/rsaref reg_svr"
207 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
208 # autoconf can't deal with creating util/rsaref if util doesn't exist
209 if test ! -d util; then
212 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
213 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
214 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
218 AC_MSG_RESULT($rsaref)
219 if test "$rsaref" != no; then
220 MR_DEFINE(HAVE_RSAREF)
222 AC_SUBST(RSAREF_CPPFLAGS)
223 AC_SUBST(RSAREF_LIBS)
224 AC_SUBST(RSAREF_SUBDIRS)
225 AC_SUBST(RSAREF_LIBDEP)
227 # Oracle (default: yes, if $ORACLE_HOME is set)
228 AC_MSG_CHECKING(for Oracle)
230 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
232 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
237 AC_MSG_RESULT($oracle)
238 if test "$oracle" != no; then
239 AC_MSG_CHECKING(Pro*C version)
240 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
241 AC_MSG_RESULT($release)
244 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
247 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"
250 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
253 SQL_LIBS="-L$oracle/lib32 -lclntsh `cat $oracle/lib32/ldflags` `cat $oracle/lib32/sysliblist` -R$oracle/lib32 -laio -lposix4 -lm -lthread"
256 AC_MSG_ERROR(Unsupported Oracle release)
259 SVRSUBDIRS='$(SVRDIRS)'
260 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile incremental/mailman/Makefile reg_svr/Makefile regtape/Makefile"
261 PRO_C=$oracle/bin/proc
262 PRO_C_OPTS=CODE=ANSI_C
263 PRO_C_DEFS="DEFINE=_PROC_ DEFINE=__sparc $PRO_C_DEFS"
267 AC_SUBST(PRO_C_INCLUDES)
272 # Java support, for webmoira
273 AC_MSG_CHECKING(for Java)
275 [ --with-java=PREFIX Specify location of Java libs and headers],
277 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
283 if test "$java" != no; then
284 if test "$java" != yes; then
285 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
289 WEBMOIRA_SUBDIRS="webmoira"
290 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
292 AC_SUBST(JAVA_CPPFLAGS)
293 AC_SUBST(WEBMOIRA_SUBDIRS)
296 AC_MSG_CHECKING(for LDAP)
298 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
300 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
306 if test "$ldap" != no -a "$oracle" != no; then
307 if test "$ldap" != yes; then
308 LDAP_CPPFLAGS="-I$ldap/include"
309 LDAP_LIBS="-L$ldap/lib"
313 WINAD_SUBDIRS="winad"
314 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
316 AC_SUBST(LDAP_CPPFLAGS)
318 AC_SUBST(WINAD_SUBDIRS)
321 AC_MSG_CHECKING(for AFS)
323 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
324 [afs="$withval"], [afs=no])
326 if test "$afs" != no -a "$oracle" != no; then
327 if test "$afs" != yes; then
328 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
329 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
330 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
333 AC_CHECK_LIB(sys, pioctl, :,
334 [AC_MSG_ERROR(AFS libraries not found)],
335 $AFS_LIBS -lrx -llwp -lsys -lafsutil)
339 AFS_OUTPUT_FILES="incremental/afs/Makefile"
340 if test -d $srcdir/afssync; then
341 AFS_SYNCDIR="afssync"
342 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
345 AC_SUBST(AFS_CPPFLAGS)
346 AC_SUBST(AFS_PRO_C_INCLUDES)
349 AC_SUBST(AFS_SUBDIRS)
350 AC_SUBST(AFS_SYNCDIR)
353 AC_CHECKING(for GNU readline...)
354 AC_ARG_WITH(readline,
355 [ --with-readline=PREFIX Specify location of GNU readline],
356 [readline="$withval"; AC_MSG_RESULT($withval)],
357 [AC_CHECK_LIB(readline, readline, [readline=yes],
358 [if test "$athena" = true; then
359 unset ac_cv_lib_readline_readline
360 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
361 -L/mit/gnu/lib -ltermcap)
364 if test "$readline" != no; then
365 if test "$readline" != yes; then
366 READLINE_CPPFLAGS="-I$readline/include"
367 READLINE_LIBS="-L$readline/lib"
369 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
370 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
372 AC_SUBST(READLINE_CPPFLAGS)
373 AC_SUBST(READLINE_LIBS)
377 AC_CHECKING(for curses)
378 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
379 if test -n "$curses"; then
382 AC_CHECKING(if curses needs termcap)
383 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
384 dnl link with just -lcurses, but then fail with a runtime linker error
385 dnl because you didn't use -ltermcap
386 AC_TRY_RUN([#include <curses.h>
387 main(int argc, char **argv)
392 }], [CURSES_LIBS="-l$curses"],
393 LIBS="-l$curses -ltermcap"
394 AC_TRY_RUN([#include <curses.h>
395 main(int argc, char **argv)
400 }], [CURSES_LIBS="-l$curses -ltermcap"],
405 if test -n "$CURSES_LIBS"; then
408 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
410 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
411 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
412 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
413 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
414 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
416 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
417 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
419 AC_MSG_WARN(Couldn't find -lcurses)
421 AC_SUBST(CURSES_CPPFLAGS)
422 AC_SUBST(CURSES_LIBS)
423 AC_SUBST(CURSES_SUBDIRS)
426 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
428 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
430 AC_CHECK_HEADERS(unistd.h getopt.h)
432 AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
434 if test "$no_netinet_in" != "yes"; then
435 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
436 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
437 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
438 AC_MSG_RESULT($ac_cv_type_in_addr_t)
441 if test "$ac_cv_type_in_addr_t" != "yes"; then
442 AC_DEFINE(in_addr_t, uint32_t)
445 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
446 MR_INCLUDE('$(SRCTOP)/include')
447 MR_INCLUDE('$(SRCTOP)/lib')
448 MR_INCLUDE('$(BUILDTOP)/lib')
449 MR_INCLUDE('$(BUILDTOP)/db')
450 MR_INCLUDE('$(srcdir)')
451 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
452 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
453 LIBS="-lmoira $KLIBS"
456 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
459 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
460 clients/lib/Makefile clients/addusr/Makefile \
461 clients/blanche/Makefile clients/chfn/Makefile \
462 clients/chpobox/Makefile clients/chsh/Makefile \
463 clients/mailmaint/Makefile clients/mitch/Makefile \
464 clients/moira/Makefile clients/mrcheck/Makefile \
465 clients/mrtest/Makefile clients/stanley/Makefile \
466 clients/stella/Makefile update/Makefile man/Makefile \
467 $WEBMOIRA_OUTPUT_FILES $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES \
468 $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)