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
13 dnl Define for both C and Pro*C
16 MR_EXTEND(PRO_C_DEFS, DEFINE=$1)
19 dnl Add to include path for both C and Pro*C
20 AC_DEFUN(MR_INCLUDE, [
21 MR_EXTEND(CPPFLAGS, -I$1)
22 MR_EXTEND(PRO_C_INCLUDES, INCLUDE=$1)
26 AC_DEFUN(MR_LIBS, [MR_EXTEND(LIBPATH, -L$1)])
33 if test "$athena" = true; then
35 with_readline=/mit/gnu
37 prefix=/afs/athena.mit.edu/system/moira
38 bindir=$prefix/arch/$ATHENA_SYS/bin
40 MR_INCLUDE(/usr/athena/include)
41 MR_INCLUDE(/usr/athena/include/kerberosIV)
42 MR_LIBS(/usr/athena/lib)
45 # We currently just don't support changing this
49 # Athena-local policy decisions
50 AC_MSG_CHECKING(for Athena)
52 [ --enable-athena Enable Athena-specific policy decisions],
53 , [if test "$athena" = true; then
58 AC_MSG_RESULT($enableval)
59 if test "$enableval" = yes; then
63 # Networking libraries
64 AC_CHECKING(network libraries...)
65 AC_CHECK_FUNC(gethostbyname, :,
66 AC_CHECK_LIB(nsl, gethostbyname, ,
67 AC_CHECK_LIB(resolv, gethostbyname)))
68 AC_CHECK_FUNC(socket, :,
69 AC_CHECK_LIB(socket, socket, ,
70 AC_CHECK_LIB(socket, socket,
71 LIBS="-lsocket -lnsl $LIBS", :,
74 # com_err (required, but can be built)
75 AC_MSG_CHECKING(for com_err)
77 [ --with-com_err=PREFIX Specify location of com_err],
78 [AC_MSG_RESULT($withval)
79 if test $withval = "no"; then
80 AC_MSG_ERROR(com_err is required for Moira)
82 if test $withval != "yes"; then
83 MR_INCLUDE($withval/include)
86 COMPILE_ET=compile_et],
87 [AC_MSG_RESULT(util/et)
88 COM_ERR_SUBDIR=util/et;
89 MR_INCLUDE(`pwd`/util/et)
90 MR_LIBS(`pwd`/util/et)
91 COMPILE_ET=`pwd`/util/et/compile_et
92 AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)])
93 AC_SUBST(COM_ERR_SUBDIR)
96 # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
97 AC_MSG_CHECKING(for Kerberos 4)
99 [ --with-krb4=PREFIX Specify location of krb4],
100 [krb4="$withval"], [krb4=no])
102 if test $krb4 = "no"; then
103 AC_MSG_ERROR(Kerberos is required for Moira)
105 if test "$krb4" != yes; then
106 MR_INCLUDE($krb4/include)
107 if test -d "$krb4/include/kerberosIV"; then
108 MR_INCLUDE($krb4/include/kerberosIV)
111 elif test -d /usr/include/kerberosIV; then
112 MR_INCLUDE(/usr/include/kerberosIV)
114 AC_CHECK_LIB(krb4, krb_rd_req,
115 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto"],
116 [AC_CHECK_LIB(krb, krb_rd_req,
117 [KRB4_LIBS="-lkrb -ldes"],
118 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
120 $LIBPATH -ldes425 -lkrb5 -lcrypto -lcom_err)
122 AC_MSG_CHECKING(for Kerberos 5)
124 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
125 [krb5="$withval"], [krb5=no])
127 if test "$krb5" != no; then
129 if test "$krb5" != yes; then
130 REG_SVR_INCLUDES=-I$krb5/include
131 REG_SVR_LIBS=-L$krb5/lib
133 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -lcrypto"
138 AC_SUBST(REG_SVR_DEFS)
139 AC_SUBST(REG_SVR_INCLUDES)
140 AC_SUBST(REG_SVR_LIBS)
143 AC_MSG_CHECKING(for Hesiod)
145 [ --with-hesiod=PREFIX Specify location of Hesiod],
146 [hesiod="$withval"], [hesiod=no])
147 AC_MSG_RESULT($hesiod)
148 if test "$hesiod" != no; then
149 if test "$hesiod" != yes; then
150 MR_INCLUDE($hesiod/include)
153 AC_CHECK_FUNC(res_send, :,
154 AC_CHECK_LIB(resolv, res_send))
155 AC_CHECK_LIB(hesiod, hes_resolve, :,
156 [AC_MSG_ERROR(Hesiod library not found)],
158 MR_DEFINE(HAVE_HESIOD)
162 AC_MSG_CHECKING(for Zephyr)
164 [ --with-zephyr=PREFIX Specify location of Zephyr],
165 [zephyr="$withval"], [zephyr=no])
166 AC_MSG_RESULT($zephyr)
167 if test "$zephyr" != no; then
168 if test "$zephyr" != yes; then
169 MR_INCLUDE($zephyr/include)
172 AC_CHECK_LIB(zephyr, ZInitialize, :,
173 [AC_MSG_ERROR(Zephyr library not found)],
174 $LIBPATH $KRB4_LIBS -lcom_err)
175 MR_DEFINE(HAVE_ZEPHYR)
178 # GDSS support (default: build util/gdss if present)
179 AC_MSG_CHECKING(for GDSS)
181 [ --with-gdss=PREFIX Specify location of GDSS],
183 if test "$gdss" != no; then
184 MR_INCLUDE("$gdss/include")
185 GDSS_LIBS="-L$gdss/lib -lgdss"
187 [if test -d $srcdir/util/gdss; then
188 gdss=$srcdir/util/gdss
189 GDSS_SUBDIR=util/gdss
190 GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \
191 util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \
192 util/gdss/lib/crypto/algorithm/Makefile"
193 # autoconf can't deal with creating util/gdss if util doesn't exist
194 if test ! -d util; then
197 MR_INCLUDE('$(SRCTOP)/util/gdss/include')
198 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
199 GDSS_LIBDEP='$(BUILDTOP)/util/gdss/lib/libgdss.a'
204 if test "$gdss" != no; then
205 GDSS_OBJS='$(GDSS_OBJS)'
206 GDSS_CFILES='$(GDSS_CFILES)'
207 GDSS_TARGET='$(GDSS_TARGET)'
210 AC_SUBST(GDSS_CPPFLAGS)
212 AC_SUBST(GDSS_SUBDIR)
214 AC_SUBST(GDSS_CFILES)
215 AC_SUBST(GDSS_TARGET)
216 AC_SUBST(GDSS_LIBDEP)
218 # RSAREF support (default: build util/rsaref if present)
219 AC_MSG_CHECKING(for RSAREF)
221 [ --with-rsaref=PREFIX Specify location of RSAREF],
223 RSAREF_CPPFLAGS="-I$rsaref/include"
224 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
225 RSAREF_SUBDIRS=reg_svr
226 [if test -d $srcdir/util/rsaref; then
227 rsaref=$srcdir/util/rsaref
228 RSAREF_SUBDIRS="util/rsaref reg_svr"
229 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
230 # autoconf can't deal with creating util/rsaref if util doesn't exist
231 if test ! -d util; then
234 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
235 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
236 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
240 AC_MSG_RESULT($rsaref)
241 if test "$rsaref" != no; then
242 MR_DEFINE(HAVE_RSAREF)
244 AC_SUBST(RSAREF_CPPFLAGS)
245 AC_SUBST(RSAREF_LIBS)
246 AC_SUBST(RSAREF_SUBDIRS)
247 AC_SUBST(RSAREF_LIBDEP)
249 # Oracle (default: yes, if $ORACLE_HOME is set)
250 AC_MSG_CHECKING(for Oracle)
252 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
254 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
259 AC_MSG_RESULT($oracle)
260 if test "$oracle" != no; then
261 AC_MSG_CHECKING(Pro*C version)
262 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
263 AC_MSG_RESULT($release)
266 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
269 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"
272 SVRSUBDIRS='$(SVRDIRS)'
273 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile reg_svr/Makefile regtape/Makefile"
274 PRO_C=$oracle/bin/proc
275 PRO_C_OPTS=CODE=ANSI_C
276 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
280 AC_SUBST(PRO_C_INCLUDES)
286 AC_MSG_CHECKING(for AFS)
288 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
289 [afs="$withval"], [afs=no])
291 if test "$afs" != no -a "$oracle" != no; then
292 if test "$afs" != yes; then
293 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
294 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
295 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
298 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
299 AFS_EXTRA_LIBS="-lcompat",
300 AC_MSG_ERROR(insque not found)))
301 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
302 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
304 AC_CHECK_LIB(sys, pioctl, :,
305 [AC_MSG_ERROR(AFS libraries not found)],
306 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
309 AFS_SUBDIRS="incremental"
310 AFS_OUTPUT_FILES="incremental/Makefile"
311 if test -d $srcdir/afssync; then
312 AFS_SUBDIRS="$AFS_SUBDIRS afssync"
313 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
316 AC_SUBST(AFS_CPPFLAGS)
317 AC_SUBST(AFS_PRO_C_INCLUDES)
319 AC_SUBST(AFS_EXTRA_LIBS)
321 AC_SUBST(AFS_SUBDIRS)
324 AC_CHECKING(for GNU readline...)
325 AC_ARG_WITH(readline,
326 [ --with-readline=PREFIX Specify location of GNU readline],
327 [readline="$withval"],
328 [AC_CHECK_LIB(readline, readline, [readline=yes], :, -ltermcap)])
329 if test "$readline" != no; then
330 if test "$readline" != yes; then
331 READLINE_CPPFLAGS="-I$readline/include -I$readline/include/readline -DHAVE_READLINE"
332 READLINE_LIBS="-L$readline/lib -lreadline -ltermcap"
335 AC_SUBST(READLINE_CPPFLAGS)
336 AC_SUBST(READLINE_LIBS)
340 AC_CHECKING(for curses)
341 AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
342 if test -n "$curses"; then
345 AC_CHECKING(if curses needs termcap)
346 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
347 dnl link with just -lcurses, but then fail with a runtime linker error
348 dnl because you didn't use -ltermcap
349 AC_TRY_RUN([#include <curses.h>
350 main(int argc, char **argv)
355 }], [CURSES_LIBS="-l$curses"],
356 LIBS="-l$curses -ltermcap"
357 AC_TRY_RUN([#include <curses.h>
358 main(int argc, char **argv)
363 }], [CURSES_LIBS="-l$curses -ltermcap"],
368 if test -n "$CURSES_LIBS"; then
371 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
373 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
374 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
375 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
377 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
378 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
380 AC_MSG_WARN(Couldn't find -lcurses)
382 AC_SUBST(CURSES_CPPFLAGS)
383 AC_SUBST(CURSES_LIBS)
384 AC_SUBST(CURSES_SUBDIRS)
387 AC_CHECK_FUNCS(getusershell)
389 MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
390 MR_INCLUDE('$(SRCTOP)/include')
391 MR_INCLUDE('$(SRCTOP)/lib')
392 MR_INCLUDE('$(BUILDTOP)/lib')
393 MR_INCLUDE('$(BUILDTOP)/db')
394 MR_INCLUDE('$(srcdir)')
395 LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
396 KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
397 LIBS="-lmoira $KLIBS"
400 MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
403 AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
404 clients/addusr/Makefile clients/blanche/Makefile \
405 clients/mailmaint/Makefile clients/moira/Makefile \
406 clients/mrcheck/Makefile clients/mrtest/Makefile \
407 clients/passwd/Makefile update/Makefile man/Makefile \
408 $SERVER_OUTPUT_FILES $AFS_OUTPUT_FILES \
409 $GDSS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)