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 COM_ERR_SUBDIR=util/et;
106 MR_INCLUDE(`pwd`/util/et)
107 MR_LIBS(`pwd`/util/et)
108 COMPILE_ET=`pwd`/util/et/compile_et
109 AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)])
110 AC_SUBST(COM_ERR_SUBDIR)
113 # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
114 AC_MSG_CHECKING(for Kerberos 4)
116 [ --with-krb4=PREFIX Specify location of krb4],
117 [krb4="$withval"], [krb4=no])
119 if test $krb4 = "no"; then
120 AC_MSG_ERROR(Kerberos is required for Moira)
122 if test "$krb4" != yes; then
123 MR_INCLUDE($krb4/include)
124 if test -d "$krb4/include/kerberosIV"; then
125 MR_INCLUDE($krb4/include/kerberosIV)
128 elif test -d /usr/include/kerberosIV; then
129 MR_INCLUDE(/usr/include/kerberosIV)
131 AC_CHECK_LIB(crypto, main, crypto="crypto",
132 [AC_CHECK_LIB(k5crypto, main, crypto="k5crypto")])
133 AC_CHECK_LIB(krb4, krb_rd_req,
134 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto}"],
135 [AC_CHECK_LIB(krb, krb_rd_req,
136 [KRB4_LIBS="-lkrb -ldes"],
137 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
139 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err)
141 AC_MSG_CHECKING(for Kerberos 5)
143 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
144 [krb5="$withval"], [krb5=no])
146 if test "$krb5" != no; then
148 if test "$krb5" != yes; then
149 REG_SVR_INCLUDES=-I$krb5/include
150 REG_SVR_LIBS=-L$krb5/lib
152 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -l${crypto}"
157 AC_SUBST(REG_SVR_DEFS)
158 AC_SUBST(REG_SVR_INCLUDES)
159 AC_SUBST(REG_SVR_LIBS)
162 AC_MSG_CHECKING(for Hesiod)
164 [ --with-hesiod=PREFIX Specify location of Hesiod],
165 [hesiod="$withval"], [hesiod=no])
166 AC_MSG_RESULT($hesiod)
167 if test "$hesiod" != no; then
168 if test "$hesiod" != yes; then
169 MR_INCLUDE($hesiod/include)
172 AC_CHECK_FUNC(res_send, :,
173 AC_CHECK_LIB(resolv, res_send))
174 AC_CHECK_LIB(hesiod, hes_resolve, :,
175 [AC_MSG_ERROR(Hesiod library not found)],
177 MR_DEFINE(HAVE_HESIOD)
181 AC_MSG_CHECKING(for Zephyr)
183 [ --with-zephyr=PREFIX Specify location of Zephyr],
184 [zephyr="$withval"], [zephyr=no])
185 AC_MSG_RESULT($zephyr)
186 if test "$zephyr" != no; then
187 if test "$zephyr" != yes; then
188 MR_INCLUDE($zephyr/include)
191 AC_CHECK_LIB(zephyr, ZInitialize, :,
192 [AC_MSG_ERROR(Zephyr library not found)],
193 $LIBPATH $KRB4_LIBS -lcom_err)
194 MR_DEFINE(HAVE_ZEPHYR)
197 # RSAREF support (default: build util/rsaref if present)
198 AC_MSG_CHECKING(for RSAREF)
200 [ --with-rsaref=PREFIX Specify location of RSAREF],
202 RSAREF_CPPFLAGS="-I$rsaref/include"
203 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
204 RSAREF_SUBDIRS=reg_svr
205 [if test -d $srcdir/util/rsaref; then
206 rsaref=$srcdir/util/rsaref
207 RSAREF_SUBDIRS="util/rsaref reg_svr"
208 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
209 # autoconf can't deal with creating util/rsaref if util doesn't exist
210 if test ! -d util; then
213 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
214 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
215 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
219 AC_MSG_RESULT($rsaref)
220 if test "$rsaref" != no; then
221 MR_DEFINE(HAVE_RSAREF)
223 AC_SUBST(RSAREF_CPPFLAGS)
224 AC_SUBST(RSAREF_LIBS)
225 AC_SUBST(RSAREF_SUBDIRS)
226 AC_SUBST(RSAREF_LIBDEP)
228 # Oracle (default: yes, if $ORACLE_HOME is set)
229 AC_MSG_CHECKING(for Oracle)
231 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
233 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
238 AC_MSG_RESULT($oracle)
239 if test "$oracle" != no; then
240 AC_MSG_CHECKING(Pro*C version)
241 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
242 AC_MSG_RESULT($release)
245 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
248 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"
251 SVRSUBDIRS='$(SVRDIRS)'
252 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile reg_svr/Makefile regtape/Makefile"
253 PRO_C=$oracle/bin/proc
254 PRO_C_OPTS=CODE=ANSI_C
255 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
259 AC_SUBST(PRO_C_INCLUDES)
264 # Java support, for webmoira
265 AC_MSG_CHECKING(for Java)
267 [ --with-java=PREFIX Specify location of Java libs and headers],
269 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
275 if test "$java" != no; then
276 if test "$java" != yes; then
277 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
281 WEBMOIRA_SUBDIRS="webmoira"
282 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
284 AC_SUBST(JAVA_CPPFLAGS)
285 AC_SUBST(WEBMOIRA_SUBDIRS)
288 AC_MSG_CHECKING(for LDAP)
290 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
292 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
298 if test "$ldap" != no -a "$oracle" != no; then
299 if test "$ldap" != yes; then
300 LDAP_CPPFLAGS="-I$ldap/include"
301 LDAP_LIBS="-L$ldap/lib"
305 WINAD_SUBDIRS="winad"
306 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
308 AC_SUBST(LDAP_CPPFLAGS)
310 AC_SUBST(WINAD_SUBDIRS)
313 AC_MSG_CHECKING(for AFS)
315 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
316 [afs="$withval"], [afs=no])
318 if test "$afs" != no -a "$oracle" != no; then
319 if test "$afs" != yes; then
320 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
321 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
322 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
325 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
326 AFS_EXTRA_LIBS="-lcompat",
327 AC_MSG_ERROR(insque not found)))
328 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
329 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
331 AC_CHECK_LIB(sys, pioctl, :,
332 [AC_MSG_ERROR(AFS libraries not found)],
333 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
337 AFS_OUTPUT_FILES="incremental/afs/Makefile"
338 if test -d $srcdir/afssync; then
339 AFS_SYNCDIR="afssync"
340 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
343 AC_SUBST(AFS_CPPFLAGS)
344 AC_SUBST(AFS_PRO_C_INCLUDES)
346 AC_SUBST(AFS_EXTRA_LIBS)
348 AC_SUBST(AFS_SUBDIRS)
349 AC_SUBST(AFS_SYNCDIR)
352 AC_CHECKING(for GNU readline...)
353 AC_ARG_WITH(readline,
354 [ --with-readline=PREFIX Specify location of GNU readline],
355 [readline="$withval"; AC_MSG_RESULT($withval)],
356 [AC_CHECK_LIB(readline, readline, [readline=yes],
357 [if test "$athena" = true; then
358 unset ac_cv_lib_readline_readline
359 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
360 -L/mit/gnu/lib -ltermcap)
363 if test "$readline" != no; then
364 if test "$readline" != yes; then
365 READLINE_CPPFLAGS="-I$readline/include"
366 READLINE_LIBS="-L$readline/lib"
368 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
369 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
371 AC_SUBST(READLINE_CPPFLAGS)
372 AC_SUBST(READLINE_LIBS)
376 AC_CHECKING(for curses)
377 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
378 if test -n "$curses"; then
381 AC_CHECKING(if curses needs termcap)
382 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
383 dnl link with just -lcurses, but then fail with a runtime linker error
384 dnl because you didn't use -ltermcap
385 AC_TRY_RUN([#include <curses.h>
386 main(int argc, char **argv)
391 }], [CURSES_LIBS="-l$curses"],
392 LIBS="-l$curses -ltermcap"
393 AC_TRY_RUN([#include <curses.h>
394 main(int argc, char **argv)
399 }], [CURSES_LIBS="-l$curses -ltermcap"],
404 if test -n "$CURSES_LIBS"; then
407 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
409 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
410 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
411 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
412 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
413 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
415 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
416 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
418 AC_MSG_WARN(Couldn't find -lcurses)
420 AC_SUBST(CURSES_CPPFLAGS)
421 AC_SUBST(CURSES_LIBS)
422 AC_SUBST(CURSES_SUBDIRS)
425 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
427 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
429 AC_CHECK_HEADERS(unistd.h getopt.h)
431 AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
433 if test "$no_netinet_in" != "yes"; then
434 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
435 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
436 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
437 AC_MSG_RESULT($ac_cv_type_in_addr_t)
440 if test "$ac_cv_type_in_addr_t" != "yes"; then
441 AC_DEFINE(in_addr_t, uint32_t)
444 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
445 MR_INCLUDE('$(SRCTOP)/include')
446 MR_INCLUDE('$(SRCTOP)/lib')
447 MR_INCLUDE('$(BUILDTOP)/lib')
448 MR_INCLUDE('$(BUILDTOP)/db')
449 MR_INCLUDE('$(srcdir)')
450 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
451 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
452 LIBS="-lmoira $KLIBS"
455 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
458 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
459 clients/lib/Makefile clients/addusr/Makefile \
460 clients/blanche/Makefile clients/chfn/Makefile \
461 clients/chpobox/Makefile clients/chsh/Makefile \
462 clients/mailmaint/Makefile clients/moira/Makefile \
463 clients/mrcheck/Makefile clients/mrtest/Makefile \
464 clients/stanley/Makefile clients/stella/Makefile \
465 update/Makefile man/Makefile $WEBMOIRA_OUTPUT_FILES \
466 $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES $AFS_OUTPUT_FILES \
467 $RSAREF_OUTPUT_FILES)