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_LIBS(/usr/athena/lib)
61 # We currently just don't support changing this
65 # Athena-local policy decisions
66 AC_MSG_CHECKING(for Athena)
68 [ --enable-athena Enable Athena-specific policy decisions],
69 , [if test "$athena" = true; then
74 AC_MSG_RESULT($enableval)
75 if test "$enableval" = yes; then
79 # Networking libraries
80 AC_CHECKING(network libraries...)
81 AC_CHECK_FUNC(gethostbyname, :,
82 AC_CHECK_LIB(nsl, gethostbyname, ,
83 AC_CHECK_LIB(resolv, gethostbyname)))
84 AC_CHECK_FUNC(socket, :,
85 AC_CHECK_LIB(socket, socket, ,
86 AC_CHECK_LIB(socket, socket,
87 LIBS="-lsocket -lnsl $LIBS", :,
90 # com_err (required, but can be built)
91 AC_MSG_CHECKING(for com_err)
93 [ --with-com_err=PREFIX Specify location of com_err],
94 [AC_MSG_RESULT($withval)
95 if test $withval = "no"; then
96 AC_MSG_ERROR(com_err is required for Moira)
98 if test $withval != "yes"; then
99 MR_INCLUDE($withval/include)
100 MR_LIBS($withval/lib)
102 COMPILE_ET=compile_et],
103 [AC_MSG_RESULT(util/et)
104 MR_INCLUDE(`pwd`/util/et)
105 MR_LIBS(`pwd`/util/et)
106 COMPILE_ET=`pwd`/util/et/compile_et
107 AC_CONFIG_SUBDIRS(util/et)])
108 AC_SUBST(COM_ERR_SUBDIR)
111 AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
112 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
114 # Kerberos (Kerberos 4 optional, Kerberos 5 required)
115 AC_MSG_CHECKING(for Kerberos 4)
117 [ --with-krb4=PREFIX Specify location of krb4],
118 [krb4="$withval"], [krb4=no])
120 if test "$krb4" != no; then
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)
131 AC_CHECK_LIB(krb4, krb_rd_req,
132 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
133 [AC_CHECK_LIB(krb, krb_rd_req,
134 [KRB4_LIBS="-lkrb -ldes"],
135 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
137 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
140 AC_MSG_CHECKING(for Kerberos 5)
142 [ --with-krb5=PREFIX Specify location of krb5],
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
150 MR_INCLUDE($krb5/include)
154 KRB5_LIBS="-lkrb5 -l${crypto} -lcom_err -lresolv"
155 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb5 -l${crypto} -lresolv"
160 AC_SUBST(REG_SVR_DEFS)
161 AC_SUBST(REG_SVR_INCLUDES)
162 AC_SUBST(REG_SVR_LIBS)
165 AC_MSG_CHECKING(for Hesiod)
167 [ --with-hesiod=PREFIX Specify location of Hesiod],
168 [hesiod="$withval"], [hesiod=no])
169 AC_MSG_RESULT($hesiod)
170 if test "$hesiod" != no; then
171 if test "$hesiod" != yes; then
172 MR_INCLUDE($hesiod/include)
175 AC_CHECK_FUNC(res_send, :,
176 AC_CHECK_LIB(resolv, res_send))
177 AC_CHECK_LIB(hesiod, hes_resolve, :,
178 [AC_MSG_ERROR(Hesiod library not found)],
180 MR_DEFINE(HAVE_HESIOD)
184 AC_MSG_CHECKING(for Zephyr)
186 [ --with-zephyr=PREFIX Specify location of Zephyr],
187 [zephyr="$withval"], [zephyr=no])
188 AC_MSG_RESULT($zephyr)
189 if test "$zephyr" != no; then
190 if test "$zephyr" != yes; then
191 MR_INCLUDE($zephyr/include)
194 AC_CHECK_LIB(zephyr, ZInitialize, :,
195 [AC_MSG_ERROR(Zephyr library not found)],
196 $LIBPATH $KRB4_LIBS $KRB5_LIBS -lcom_err)
197 MR_DEFINE(HAVE_ZEPHYR)
200 # RSAREF support (default: build util/rsaref if present)
201 AC_MSG_CHECKING(for RSAREF)
203 [ --with-rsaref=PREFIX Specify location of RSAREF],
205 RSAREF_CPPFLAGS="-I$rsaref/include"
206 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
207 RSAREF_SUBDIRS=reg_svr
208 [if test -d $srcdir/util/rsaref; then
209 rsaref=$srcdir/util/rsaref
210 RSAREF_SUBDIRS="util/rsaref reg_svr"
211 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
212 # autoconf can't deal with creating util/rsaref if util doesn't exist
213 if test ! -d util; then
216 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
217 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
218 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
222 AC_MSG_RESULT($rsaref)
223 if test "$rsaref" != no; then
224 MR_DEFINE(HAVE_RSAREF)
226 AC_SUBST(RSAREF_CPPFLAGS)
227 AC_SUBST(RSAREF_LIBS)
228 AC_SUBST(RSAREF_SUBDIRS)
229 AC_SUBST(RSAREF_LIBDEP)
231 # Oracle (default: yes, if $ORACLE_HOME is set)
232 AC_MSG_CHECKING(for Oracle)
234 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
236 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
241 AC_MSG_RESULT($oracle)
242 if test "$oracle" != no; then
243 AC_MSG_CHECKING(Pro*C version)
244 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
245 AC_MSG_RESULT($release)
248 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
251 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"
254 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
257 SQL_LIBS="-L$oracle/lib32 -lclntsh `cat $oracle/lib32/ldflags` `cat $oracle/lib32/sysliblist` -R$oracle/lib32 -laio -lposix4 -lm -lthread"
260 AC_MSG_ERROR(Unsupported Oracle release)
263 SVRSUBDIRS='$(SVRDIRS)'
264 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"
265 PRO_C=$oracle/bin/proc
266 PRO_C_OPTS=CODE=ANSI_C
267 PRO_C_DEFS="DEFINE=_PROC_ DEFINE=__sparc $PRO_C_DEFS"
271 AC_SUBST(PRO_C_INCLUDES)
276 # Java support, for webmoira
277 AC_MSG_CHECKING(for Java)
279 [ --with-java=PREFIX Specify location of Java libs and headers],
281 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
287 if test "$java" != no; then
288 if test "$java" != yes; then
289 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
293 WEBMOIRA_SUBDIRS="webmoira"
294 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
296 AC_SUBST(JAVA_CPPFLAGS)
297 AC_SUBST(WEBMOIRA_SUBDIRS)
300 AC_MSG_CHECKING(for LDAP)
302 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
304 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
310 if test "$ldap" != no -a "$oracle" != no; then
311 if test "$ldap" != yes; then
312 LDAP_CPPFLAGS="-I$ldap/include"
313 LDAP_LIBS="-L$ldap/lib"
317 WINAD_SUBDIRS="winad ldap"
318 WINAD_OUTPUT_FILES="incremental/winad/Makefile incremental/ldap/Makefile"
320 AC_SUBST(LDAP_CPPFLAGS)
322 AC_SUBST(WINAD_SUBDIRS)
325 AC_MSG_CHECKING(for AFS)
327 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
328 [afs="$withval"], [afs=no])
330 if test "$afs" != no -a "$oracle" != no; then
331 if test "$afs" != yes; then
332 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
333 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
334 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
337 AC_CHECK_LIB(sys, pioctl, :,
338 [AC_MSG_ERROR(AFS libraries not found)],
339 $AFS_LIBS -lrx -llwp -lsys -lafsutil)
343 AFS_OUTPUT_FILES="incremental/afs/Makefile"
344 if test -d $srcdir/afssync; then
345 AFS_SYNCDIR="afssync"
346 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
349 AC_SUBST(AFS_CPPFLAGS)
350 AC_SUBST(AFS_PRO_C_INCLUDES)
353 AC_SUBST(AFS_SUBDIRS)
354 AC_SUBST(AFS_SYNCDIR)
357 AC_CHECKING(for GNU readline...)
358 AC_ARG_WITH(readline,
359 [ --with-readline=PREFIX Specify location of GNU readline],
360 [readline="$withval"; AC_MSG_RESULT($withval)],
361 [AC_CHECK_LIB(readline, readline, [readline=yes],
362 [if test "$athena" = true; then
363 unset ac_cv_lib_readline_readline
364 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
365 -L/mit/gnu/lib -ltermcap)
368 if test "$readline" != no; then
369 if test "$readline" != yes; then
370 READLINE_CPPFLAGS="-I$readline/include"
371 READLINE_LIBS="-L$readline/lib"
373 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
374 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
376 AC_SUBST(READLINE_CPPFLAGS)
377 AC_SUBST(READLINE_LIBS)
381 AC_CHECKING(for curses)
382 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
383 if test -n "$curses"; then
386 AC_CHECKING(if curses needs termcap)
387 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
388 dnl link with just -lcurses, but then fail with a runtime linker error
389 dnl because you didn't use -ltermcap
390 AC_TRY_RUN([#include <curses.h>
391 main(int argc, char **argv)
396 }], [CURSES_LIBS="-l$curses"],
397 LIBS="-l$curses -ltermcap"
398 AC_TRY_RUN([#include <curses.h>
399 main(int argc, char **argv)
404 }], [CURSES_LIBS="-l$curses -ltermcap"],
409 if test -n "$CURSES_LIBS"; then
412 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
414 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
415 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
416 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
417 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
418 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
420 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
421 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
423 AC_MSG_WARN(Couldn't find -lcurses)
425 AC_SUBST(CURSES_CPPFLAGS)
426 AC_SUBST(CURSES_LIBS)
427 AC_SUBST(CURSES_SUBDIRS)
430 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
432 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
434 AC_CHECK_HEADERS(unistd.h getopt.h)
436 AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
438 if test "$no_netinet_in" != "yes"; then
439 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
440 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
441 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
442 AC_MSG_RESULT($ac_cv_type_in_addr_t)
445 if test "$ac_cv_type_in_addr_t" != "yes"; then
446 AC_DEFINE(in_addr_t, uint32_t)
449 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
450 MR_INCLUDE('$(SRCTOP)/include')
451 MR_INCLUDE('$(SRCTOP)/lib')
452 MR_INCLUDE('$(BUILDTOP)/lib')
453 MR_INCLUDE('$(BUILDTOP)/db')
454 MR_INCLUDE('$(srcdir)')
455 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
456 KLIBS="$KRB4_LIBS $KRB5_LIBS -lcom_err $LIBS"
458 if test "$hesiod" != no; then
459 KLIBS="-lhesiod $KLIBS"
461 KLIBS="$KRB4_LIBS $KRB5_LIBS -lcom_err $KLIBS"
462 if test "$zephyr" != no; then
463 KLIBS="-lzephyr $KLIBS"
465 LIBS="-lmoira $KLIBS"
468 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
471 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
472 clients/lib/Makefile clients/addusr/Makefile \
473 clients/blanche/Makefile clients/chfn/Makefile \
474 clients/chpobox/Makefile clients/chsh/Makefile \
475 clients/mailmaint/Makefile clients/mitch/Makefile \
476 clients/moira/Makefile clients/mrcheck/Makefile \
477 clients/mrtest/Makefile clients/stanley/Makefile \
478 clients/stella/Makefile update/Makefile man/Makefile \
479 $WEBMOIRA_OUTPUT_FILES $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES \
480 $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)