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(k5crypto, main, crypto="k5crypto",
132 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
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 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
254 SVRSUBDIRS='$(SVRDIRS)'
255 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile reg_svr/Makefile regtape/Makefile"
256 PRO_C=$oracle/bin/proc
257 PRO_C_OPTS=CODE=ANSI_C
258 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
262 AC_SUBST(PRO_C_INCLUDES)
267 # Java support, for webmoira
268 AC_MSG_CHECKING(for Java)
270 [ --with-java=PREFIX Specify location of Java libs and headers],
272 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
278 if test "$java" != no; then
279 if test "$java" != yes; then
280 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
284 WEBMOIRA_SUBDIRS="webmoira"
285 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
287 AC_SUBST(JAVA_CPPFLAGS)
288 AC_SUBST(WEBMOIRA_SUBDIRS)
291 AC_MSG_CHECKING(for LDAP)
293 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
295 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
301 if test "$ldap" != no -a "$oracle" != no; then
302 if test "$ldap" != yes; then
303 LDAP_CPPFLAGS="-I$ldap/include"
304 LDAP_LIBS="-L$ldap/lib"
308 WINAD_SUBDIRS="winad"
309 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
311 AC_SUBST(LDAP_CPPFLAGS)
313 AC_SUBST(WINAD_SUBDIRS)
316 AC_MSG_CHECKING(for AFS)
318 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
319 [afs="$withval"], [afs=no])
321 if test "$afs" != no -a "$oracle" != no; then
322 if test "$afs" != yes; then
323 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
324 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
325 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
328 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
329 AFS_EXTRA_LIBS="-lcompat",
330 AC_MSG_ERROR(insque not found)))
331 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
332 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
334 AC_CHECK_LIB(sys, pioctl, :,
335 [AC_MSG_ERROR(AFS libraries not found)],
336 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
340 AFS_OUTPUT_FILES="incremental/afs/Makefile"
341 if test -d $srcdir/afssync; then
342 AFS_SYNCDIR="afssync"
343 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
346 AC_SUBST(AFS_CPPFLAGS)
347 AC_SUBST(AFS_PRO_C_INCLUDES)
349 AC_SUBST(AFS_EXTRA_LIBS)
351 AC_SUBST(AFS_SUBDIRS)
352 AC_SUBST(AFS_SYNCDIR)
355 AC_CHECKING(for GNU readline...)
356 AC_ARG_WITH(readline,
357 [ --with-readline=PREFIX Specify location of GNU readline],
358 [readline="$withval"; AC_MSG_RESULT($withval)],
359 [AC_CHECK_LIB(readline, readline, [readline=yes],
360 [if test "$athena" = true; then
361 unset ac_cv_lib_readline_readline
362 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
363 -L/mit/gnu/lib -ltermcap)
366 if test "$readline" != no; then
367 if test "$readline" != yes; then
368 READLINE_CPPFLAGS="-I$readline/include"
369 READLINE_LIBS="-L$readline/lib"
371 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
372 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
374 AC_SUBST(READLINE_CPPFLAGS)
375 AC_SUBST(READLINE_LIBS)
379 AC_CHECKING(for curses)
380 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
381 if test -n "$curses"; then
384 AC_CHECKING(if curses needs termcap)
385 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
386 dnl link with just -lcurses, but then fail with a runtime linker error
387 dnl because you didn't use -ltermcap
388 AC_TRY_RUN([#include <curses.h>
389 main(int argc, char **argv)
394 }], [CURSES_LIBS="-l$curses"],
395 LIBS="-l$curses -ltermcap"
396 AC_TRY_RUN([#include <curses.h>
397 main(int argc, char **argv)
402 }], [CURSES_LIBS="-l$curses -ltermcap"],
407 if test -n "$CURSES_LIBS"; then
410 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
412 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
413 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
414 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
415 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
416 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
418 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
419 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
421 AC_MSG_WARN(Couldn't find -lcurses)
423 AC_SUBST(CURSES_CPPFLAGS)
424 AC_SUBST(CURSES_LIBS)
425 AC_SUBST(CURSES_SUBDIRS)
428 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
430 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
432 AC_CHECK_HEADERS(unistd.h getopt.h)
434 AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
436 if test "$no_netinet_in" != "yes"; then
437 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
438 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
439 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
440 AC_MSG_RESULT($ac_cv_type_in_addr_t)
443 if test "$ac_cv_type_in_addr_t" != "yes"; then
444 AC_DEFINE(in_addr_t, uint32_t)
447 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
448 MR_INCLUDE('$(SRCTOP)/include')
449 MR_INCLUDE('$(SRCTOP)/lib')
450 MR_INCLUDE('$(BUILDTOP)/lib')
451 MR_INCLUDE('$(BUILDTOP)/db')
452 MR_INCLUDE('$(srcdir)')
453 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
454 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
455 LIBS="-lmoira $KLIBS"
458 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
461 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
462 clients/lib/Makefile clients/addusr/Makefile \
463 clients/blanche/Makefile clients/chfn/Makefile \
464 clients/chpobox/Makefile clients/chsh/Makefile \
465 clients/mailmaint/Makefile clients/moira/Makefile \
466 clients/mrcheck/Makefile clients/mrtest/Makefile \
467 clients/stanley/Makefile clients/stella/Makefile \
468 update/Makefile man/Makefile $WEBMOIRA_OUTPUT_FILES \
469 $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES $AFS_OUTPUT_FILES \
470 $RSAREF_OUTPUT_FILES)