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)])
53 if test "$athena" = true; then
55 prefix=/afs/.athena.mit.edu/system/moira
56 bindir=$prefix/arch/$ATHENA_SYS/bin
57 libdir=$prefix/arch/$ATHENA_SYS/lib
59 MR_INCLUDE(/usr/athena/include)
60 MR_LIBS(/usr/athena/lib)
63 # We currently just don't support changing this
67 # Athena-local policy decisions
68 AC_MSG_CHECKING(for Athena)
70 [ --enable-athena Enable Athena-specific policy decisions],
71 , [if test "$athena" = true; then
76 AC_MSG_RESULT($enableval)
77 if test "$enableval" = yes; then
81 # Networking libraries
82 AC_CHECKING(network libraries...)
83 AC_CHECK_FUNC(gethostbyname, :,
84 AC_CHECK_LIB(nsl, gethostbyname, ,
85 AC_CHECK_LIB(resolv, gethostbyname)))
86 AC_CHECK_FUNC(socket, :,
87 AC_CHECK_LIB(socket, socket, ,
88 AC_CHECK_LIB(socket, socket,
89 LIBS="-lsocket -lnsl $LIBS", :,
92 # com_err (required, but can be built)
93 AC_MSG_CHECKING(for com_err)
95 [ --with-com_err=PREFIX Specify location of com_err],
96 [AC_MSG_RESULT($withval)
97 if test $withval = "no"; then
98 AC_MSG_ERROR(com_err is required for Moira)
100 if test $withval != "yes"; then
101 MR_INCLUDE($withval/include)
102 MR_LIBS($withval/lib)
104 COMPILE_ET=compile_et],
105 [AC_MSG_RESULT(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(util/et)])
110 AC_SUBST(COM_ERR_SUBDIR)
113 AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
114 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
116 # Kerberos (Kerberos 4 optional, Kerberos 5 required)
117 AC_MSG_CHECKING(for Kerberos 4)
119 [ --with-krb4=PREFIX Specify location of krb4],
120 [krb4="$withval"], [krb4=no])
122 if test "$krb4" != no; then
123 if test "$krb4" != yes; then
124 MR_INCLUDE($krb4/include)
125 if test -d "$krb4/include/kerberosIV"; then
126 MR_INCLUDE($krb4/include/kerberosIV)
129 elif test -d /usr/include/kerberosIV; then
130 MR_INCLUDE(/usr/include/kerberosIV)
133 AC_CHECK_LIB(krb4, krb_rd_req,
134 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
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 -lresolv)
142 AC_MSG_CHECKING(for Kerberos 5)
144 [ --with-krb5=PREFIX Specify location of krb5],
145 [krb5="$withval"], [krb5=no])
147 if test "$krb5" != no; then
149 if test "$krb5" != yes; then
150 REG_SVR_INCLUDES=-I$krb5/include
151 REG_SVR_LIBS=-L$krb5/lib
152 MR_INCLUDE($krb5/include)
156 KRB5_LIBS="-lkrb5 -l${crypto} -lcom_err -lresolv"
157 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb5 -l${crypto} -lresolv"
162 AC_SUBST(REG_SVR_DEFS)
163 AC_SUBST(REG_SVR_INCLUDES)
164 AC_SUBST(REG_SVR_LIBS)
167 AC_MSG_CHECKING(for Hesiod)
169 [ --with-hesiod=PREFIX Specify location of Hesiod],
170 [hesiod="$withval"], [hesiod=no])
171 AC_MSG_RESULT($hesiod)
172 if test "$hesiod" != no; then
173 if test "$hesiod" != yes; then
174 MR_INCLUDE($hesiod/include)
177 AC_CHECK_FUNC(res_send, :,
178 AC_CHECK_LIB(resolv, res_send))
179 AC_CHECK_LIB(hesiod, hes_resolve, :,
180 [AC_MSG_ERROR(Hesiod library not found)],
182 MR_DEFINE(HAVE_HESIOD)
186 AC_MSG_CHECKING(for Zephyr)
188 [ --with-zephyr=PREFIX Specify location of Zephyr],
189 [zephyr="$withval"], [zephyr=no])
190 AC_MSG_RESULT($zephyr)
191 if test "$zephyr" != no; then
192 if test "$zephyr" != yes; then
193 MR_INCLUDE($zephyr/include)
196 AC_CHECK_LIB(zephyr, ZInitialize, :,
197 [AC_MSG_ERROR(Zephyr library not found)],
198 $LIBPATH $KRB4_LIBS $KRB5_LIBS -lcom_err)
199 MR_DEFINE(HAVE_ZEPHYR)
202 # RSAREF support (default: build util/rsaref if present)
203 AC_MSG_CHECKING(for RSAREF)
205 [ --with-rsaref=PREFIX Specify location of RSAREF],
207 RSAREF_CPPFLAGS="-I$rsaref/include"
208 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
209 RSAREF_SUBDIRS=reg_svr
210 [if test -d $srcdir/util/rsaref; then
211 rsaref=$srcdir/util/rsaref
212 RSAREF_SUBDIRS="util/rsaref reg_svr"
213 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
214 # autoconf can't deal with creating util/rsaref if util doesn't exist
215 if test ! -d util; then
218 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
219 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
220 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
224 AC_MSG_RESULT($rsaref)
225 if test "$rsaref" != no; then
226 MR_DEFINE(HAVE_RSAREF)
228 AC_SUBST(RSAREF_CPPFLAGS)
229 AC_SUBST(RSAREF_LIBS)
230 AC_SUBST(RSAREF_SUBDIRS)
231 AC_SUBST(RSAREF_LIBDEP)
233 # Oracle (default: yes, if $ORACLE_HOME is set)
234 AC_MSG_CHECKING(for Oracle)
236 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
238 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
243 AC_MSG_RESULT($oracle)
244 if test "$oracle" != no; then
245 AC_MSG_CHECKING(Pro*C version)
246 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
247 AC_MSG_RESULT($release)
250 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
253 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"
256 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
259 SQL_LIBS="-L$oracle/lib32 -lclntsh `cat $oracle/lib32/ldflags` `cat $oracle/lib32/sysliblist` -R$oracle/lib32 -laio -lposix4 -lm -lthread"
262 AC_MSG_ERROR(Unsupported Oracle release)
265 SVRSUBDIRS='$(SVRDIRS)'
266 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"
267 PRO_C=$oracle/bin/proc
268 PRO_C_OPTS=CODE=ANSI_C
269 PRO_C_DEFS="DEFINE=_PROC_ DEFINE=__sparc $PRO_C_DEFS"
273 AC_SUBST(PRO_C_INCLUDES)
278 # Java support, for webmoira
279 AC_MSG_CHECKING(for Java)
281 [ --with-java=PREFIX Specify location of Java libs and headers],
283 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
289 if test "$java" != no; then
290 if test "$java" != yes; then
291 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
295 WEBMOIRA_SUBDIRS="webmoira"
296 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
298 AC_SUBST(JAVA_CPPFLAGS)
299 AC_SUBST(WEBMOIRA_SUBDIRS)
302 AC_MSG_CHECKING(for LDAP)
304 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
306 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
312 if test "$ldap" != no -a "$oracle" != no; then
313 if test "$ldap" != yes; then
314 LDAP_CPPFLAGS="-I$ldap/include"
315 LDAP_LIBS="-L$ldap/lib"
319 WINAD_SUBDIRS="winad ldap"
320 WINAD_OUTPUT_FILES="incremental/winad/Makefile incremental/ldap/Makefile"
322 AC_SUBST(LDAP_CPPFLAGS)
324 AC_SUBST(WINAD_SUBDIRS)
327 AC_MSG_CHECKING(for AFS)
329 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
330 [afs="$withval"], [afs=no])
332 if test "$afs" != no -a "$oracle" != no; then
333 if test "$afs" != yes; then
334 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
335 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
336 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
339 AC_CHECK_LIB(sys, pioctl, :,
340 [AC_MSG_ERROR(AFS libraries not found)],
341 $AFS_LIBS -lrx -llwp -lsys -lafsutil)
345 AFS_OUTPUT_FILES="incremental/afs/Makefile"
346 if test -d $srcdir/afssync; then
347 AFS_SYNCDIR="afssync"
348 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
351 AC_SUBST(AFS_CPPFLAGS)
352 AC_SUBST(AFS_PRO_C_INCLUDES)
355 AC_SUBST(AFS_SUBDIRS)
356 AC_SUBST(AFS_SYNCDIR)
359 AC_CHECKING(for GNU readline...)
360 AC_ARG_WITH(readline,
361 [ --with-readline=PREFIX Specify location of GNU readline],
362 [readline="$withval"; AC_MSG_RESULT($withval)],
363 [AC_CHECK_LIB(readline, readline, [readline=yes],
364 [if test "$athena" = true; then
365 unset ac_cv_lib_readline_readline
366 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
367 -L/mit/gnu/lib -ltermcap)
370 if test "$readline" != no; then
371 if test "$readline" != yes; then
372 READLINE_CPPFLAGS="-I$readline/include"
373 READLINE_LIBS="-L$readline/lib"
375 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
376 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
378 AC_SUBST(READLINE_CPPFLAGS)
379 AC_SUBST(READLINE_LIBS)
383 AC_CHECKING(for curses)
384 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
385 if test -n "$curses"; then
388 AC_CHECKING(if curses needs termcap)
389 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
390 dnl link with just -lcurses, but then fail with a runtime linker error
391 dnl because you didn't use -ltermcap
392 AC_TRY_RUN([#include <curses.h>
393 main(int argc, char **argv)
398 }], [CURSES_LIBS="-l$curses"],
399 LIBS="-l$curses -ltermcap"
400 AC_TRY_RUN([#include <curses.h>
401 main(int argc, char **argv)
406 }], [CURSES_LIBS="-l$curses -ltermcap"],
411 if test -n "$CURSES_LIBS"; then
414 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
416 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
417 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
418 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
419 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
420 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
422 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
423 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
425 AC_MSG_WARN(Couldn't find -lcurses)
427 AC_SUBST(CURSES_CPPFLAGS)
428 AC_SUBST(CURSES_LIBS)
429 AC_SUBST(CURSES_SUBDIRS)
432 AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
434 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
436 AC_CHECK_HEADERS(unistd.h getopt.h)
438 AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
440 if test "$no_netinet_in" != "yes"; then
441 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
442 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
443 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
444 AC_MSG_RESULT($ac_cv_type_in_addr_t)
447 if test "$ac_cv_type_in_addr_t" != "yes"; then
448 AC_DEFINE(in_addr_t, uint32_t)
451 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
452 MR_INCLUDE('$(SRCTOP)/include')
453 MR_INCLUDE('$(SRCTOP)/lib')
454 MR_INCLUDE('$(BUILDTOP)/lib')
455 MR_INCLUDE('$(BUILDTOP)/db')
456 MR_INCLUDE('$(srcdir)')
457 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
458 KLIBS="$KRB4_LIBS $KRB5_LIBS -lcom_err $LIBS"
460 if test "$hesiod" != no; then
461 KLIBS="-lhesiod $KLIBS"
463 KLIBS="$KRB4_LIBS $KRB5_LIBS -lcom_err $KLIBS"
464 if test "$zephyr" != no; then
465 KLIBS="-lzephyr $KLIBS"
467 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.la'
470 LIBS="$MR_LIBDEP $KLIBS"
473 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
474 clients/lib/Makefile clients/addusr/Makefile \
475 clients/blanche/Makefile clients/chfn/Makefile \
476 clients/chpobox/Makefile clients/chsh/Makefile \
477 clients/mailmaint/Makefile clients/mitch/Makefile \
478 clients/moira/Makefile clients/mrcheck/Makefile \
479 clients/mrtest/Makefile clients/stanley/Makefile \
480 clients/stella/Makefile update/Makefile man/Makefile \
481 $WEBMOIRA_OUTPUT_FILES $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES \
482 $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)