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" != yes; then
119 MR_INCLUDE($krb4/include)
120 if test -d "$krb4/include/kerberosIV"; then
121 MR_INCLUDE($krb4/include/kerberosIV)
124 elif test -d /usr/include/kerberosIV; then
125 MR_INCLUDE(/usr/include/kerberosIV)
127 AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
128 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
129 AC_CHECK_LIB(krb4, krb_rd_req,
130 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
131 [AC_CHECK_LIB(krb, krb_rd_req,
132 [KRB4_LIBS="-lkrb -ldes"],
133 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
135 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
137 AC_MSG_CHECKING(for Kerberos 5)
139 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
140 [krb5="$withval"], [krb5=no])
142 if test "$krb5" != no; then
144 if test "$krb5" != yes; then
145 REG_SVR_INCLUDES=-I$krb5/include
146 REG_SVR_LIBS=-L$krb5/lib
148 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"
153 AC_SUBST(REG_SVR_DEFS)
154 AC_SUBST(REG_SVR_INCLUDES)
155 AC_SUBST(REG_SVR_LIBS)
158 AC_MSG_CHECKING(for Hesiod)
160 [ --with-hesiod=PREFIX Specify location of Hesiod],
161 [hesiod="$withval"], [hesiod=no])
162 AC_MSG_RESULT($hesiod)
163 if test "$hesiod" != no; then
164 if test "$hesiod" != yes; then
165 MR_INCLUDE($hesiod/include)
168 AC_CHECK_FUNC(res_send, :,
169 AC_CHECK_LIB(resolv, res_send))
170 AC_CHECK_LIB(hesiod, hes_resolve, :,
171 [AC_MSG_ERROR(Hesiod library not found)],
173 MR_DEFINE(HAVE_HESIOD)
177 AC_MSG_CHECKING(for Zephyr)
179 [ --with-zephyr=PREFIX Specify location of Zephyr],
180 [zephyr="$withval"], [zephyr=no])
181 AC_MSG_RESULT($zephyr)
182 if test "$zephyr" != no; then
183 if test "$zephyr" != yes; then
184 MR_INCLUDE($zephyr/include)
187 AC_CHECK_LIB(zephyr, ZInitialize, :,
188 [AC_MSG_ERROR(Zephyr library not found)],
189 $LIBPATH $KRB4_LIBS -lcom_err)
190 MR_DEFINE(HAVE_ZEPHYR)
193 # RSAREF support (default: build util/rsaref if present)
194 AC_MSG_CHECKING(for RSAREF)
196 [ --with-rsaref=PREFIX Specify location of RSAREF],
198 RSAREF_CPPFLAGS="-I$rsaref/include"
199 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
200 RSAREF_SUBDIRS=reg_svr
201 [if test -d $srcdir/util/rsaref; then
202 rsaref=$srcdir/util/rsaref
203 RSAREF_SUBDIRS="util/rsaref reg_svr"
204 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
205 # autoconf can't deal with creating util/rsaref if util doesn't exist
206 if test ! -d util; then
209 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
210 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
211 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
215 AC_MSG_RESULT($rsaref)
216 if test "$rsaref" != no; then
217 MR_DEFINE(HAVE_RSAREF)
219 AC_SUBST(RSAREF_CPPFLAGS)
220 AC_SUBST(RSAREF_LIBS)
221 AC_SUBST(RSAREF_SUBDIRS)
222 AC_SUBST(RSAREF_LIBDEP)
224 # Oracle (default: yes, if $ORACLE_HOME is set)
225 AC_MSG_CHECKING(for Oracle)
227 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
229 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
234 AC_MSG_RESULT($oracle)
235 if test "$oracle" != no; then
236 AC_MSG_CHECKING(Pro*C version)
237 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
238 AC_MSG_RESULT($release)
241 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
244 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"
247 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
250 SQL_LIBS="-L$oracle/lib32 -lclntsh `cat $oracle/lib32/ldflags` `cat $oracle/lib32/sysliblist` -R$oracle/lib32 -laio -lposix4 -lm -lthread"
253 AC_MSG_ERROR(Unsupported Oracle release)
256 SVRSUBDIRS='$(SVRDIRS)'
257 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"
258 PRO_C=$oracle/bin/proc
259 PRO_C_OPTS=CODE=ANSI_C
260 PRO_C_DEFS="DEFINE=_PROC_ DEFINE=__sparc $PRO_C_DEFS"
264 AC_SUBST(PRO_C_INCLUDES)
269 # Java support, for webmoira
270 AC_MSG_CHECKING(for Java)
272 [ --with-java=PREFIX Specify location of Java libs and headers],
274 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
280 if test "$java" != no; then
281 if test "$java" != yes; then
282 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
286 WEBMOIRA_SUBDIRS="webmoira"
287 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
289 AC_SUBST(JAVA_CPPFLAGS)
290 AC_SUBST(WEBMOIRA_SUBDIRS)
293 AC_MSG_CHECKING(for LDAP)
295 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
297 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
303 if test "$ldap" != no -a "$oracle" != no; then
304 if test "$ldap" != yes; then
305 LDAP_CPPFLAGS="-I$ldap/include"
306 LDAP_LIBS="-L$ldap/lib"
310 WINAD_SUBDIRS="winad"
311 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
313 AC_SUBST(LDAP_CPPFLAGS)
315 AC_SUBST(WINAD_SUBDIRS)
318 AC_MSG_CHECKING(for AFS)
320 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
321 [afs="$withval"], [afs=no])
323 if test "$afs" != no -a "$oracle" != no; then
324 if test "$afs" != yes; then
325 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
326 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
327 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
330 AC_CHECK_LIB(sys, pioctl, :,
331 [AC_MSG_ERROR(AFS libraries not found)],
332 $AFS_LIBS -lrx -llwp -lsys -lafsutil)
336 AFS_OUTPUT_FILES="incremental/afs/Makefile"
337 if test -d $srcdir/afssync; then
338 AFS_SYNCDIR="afssync"
339 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
342 AC_SUBST(AFS_CPPFLAGS)
343 AC_SUBST(AFS_PRO_C_INCLUDES)
346 AC_SUBST(AFS_SUBDIRS)
347 AC_SUBST(AFS_SYNCDIR)
350 AC_CHECKING(for GNU readline...)
351 AC_ARG_WITH(readline,
352 [ --with-readline=PREFIX Specify location of GNU readline],
353 [readline="$withval"; AC_MSG_RESULT($withval)],
354 [AC_CHECK_LIB(readline, readline, [readline=yes],
355 [if test "$athena" = true; then
356 unset ac_cv_lib_readline_readline
357 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
358 -L/mit/gnu/lib -ltermcap)
361 if test "$readline" != no; then
362 if test "$readline" != yes; then
363 READLINE_CPPFLAGS="-I$readline/include"
364 READLINE_LIBS="-L$readline/lib"
366 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
367 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
369 AC_SUBST(READLINE_CPPFLAGS)
370 AC_SUBST(READLINE_LIBS)
374 AC_CHECKING(for curses)
375 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
376 if test -n "$curses"; then
379 AC_CHECKING(if curses needs termcap)
380 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
381 dnl link with just -lcurses, but then fail with a runtime linker error
382 dnl because you didn't use -ltermcap
383 AC_TRY_RUN([#include <curses.h>
384 main(int argc, char **argv)
389 }], [CURSES_LIBS="-l$curses"],
390 LIBS="-l$curses -ltermcap"
391 AC_TRY_RUN([#include <curses.h>
392 main(int argc, char **argv)
397 }], [CURSES_LIBS="-l$curses -ltermcap"],
402 if test -n "$CURSES_LIBS"; then
405 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
407 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
408 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
409 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
410 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
411 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
413 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
414 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
416 AC_MSG_WARN(Couldn't find -lcurses)
418 AC_SUBST(CURSES_CPPFLAGS)
419 AC_SUBST(CURSES_LIBS)
420 AC_SUBST(CURSES_SUBDIRS)
423 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
425 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
427 AC_CHECK_HEADERS(unistd.h getopt.h)
429 AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
431 if test "$no_netinet_in" != "yes"; then
432 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
433 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
434 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
435 AC_MSG_RESULT($ac_cv_type_in_addr_t)
438 if test "$ac_cv_type_in_addr_t" != "yes"; then
439 AC_DEFINE(in_addr_t, uint32_t)
442 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
443 MR_INCLUDE('$(SRCTOP)/include')
444 MR_INCLUDE('$(SRCTOP)/lib')
445 MR_INCLUDE('$(BUILDTOP)/lib')
446 MR_INCLUDE('$(BUILDTOP)/db')
447 MR_INCLUDE('$(srcdir)')
448 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
449 KLIBS="$KRB4_LIBS -lcom_err $LIBS"
451 if test "$hesiod" != no; then
452 KLIBS="-lhesiod $KLIBS"
454 KLIBS="$KRB4_LIBS -lcom_err $KLIBS"
455 if test "$zephyr" != no; then
456 KLIBS="-lzephyr $KLIBS"
458 LIBS="-lmoira $KLIBS"
461 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
464 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
465 clients/lib/Makefile clients/addusr/Makefile \
466 clients/blanche/Makefile clients/chfn/Makefile \
467 clients/chpobox/Makefile clients/chsh/Makefile \
468 clients/mailmaint/Makefile clients/mitch/Makefile \
469 clients/moira/Makefile clients/mrcheck/Makefile \
470 clients/mrtest/Makefile clients/stanley/Makefile \
471 clients/stella/Makefile update/Makefile man/Makefile \
472 $WEBMOIRA_OUTPUT_FILES $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES \
473 $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)