]>
Commit | Line | Data |
---|---|---|
1 | AC_INIT(patchlevel.h) | |
2 | ||
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 | |
6 | AC_DEFUN(MR_EXTEND, [ | |
7 | case $$1 in | |
8 | *$2*) ;; | |
9 | *) $1=$2\ $$1 ;; | |
10 | esac | |
11 | ]) | |
12 | ||
13 | dnl Define for both C and Pro*C | |
14 | AC_DEFUN(MR_DEFINE, [ | |
15 | AC_DEFINE($1) | |
16 | MR_EXTEND(PRO_C_DEFS, DEFINE=$1) | |
17 | ]) | |
18 | ||
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) | |
23 | ]) | |
24 | ||
25 | dnl Add to lib path | |
26 | AC_DEFUN(MR_LIBS, [MR_EXTEND(LIBPATH, -L$1)]) | |
27 | ||
28 | AC_PROG_CC | |
29 | AC_PROG_INSTALL | |
30 | AC_PROG_RANLIB | |
31 | AC_PROG_MAKE_SET | |
32 | ||
33 | if test "$athena" = true; then | |
34 | enable_athena=yes | |
35 | prefix=/afs/.athena.mit.edu/system/moira | |
36 | bindir=$prefix/arch/$ATHENA_SYS/bin | |
37 | sbindir=$bindir | |
38 | MR_INCLUDE(/usr/athena/include) | |
39 | MR_INCLUDE(/usr/athena/include/kerberosIV) | |
40 | MR_LIBS(/usr/athena/lib) | |
41 | fi | |
42 | ||
43 | # We currently just don't support changing this | |
44 | mrbindir=/moira/bin | |
45 | AC_SUBST(mrbindir) | |
46 | ||
47 | # Athena-local policy decisions | |
48 | AC_MSG_CHECKING(for Athena) | |
49 | AC_ARG_ENABLE(athena, | |
50 | [ --enable-athena Enable Athena-specific policy decisions], | |
51 | , [if test "$athena" = true; then | |
52 | enableval=yes | |
53 | else | |
54 | enableval=no | |
55 | fi]) | |
56 | AC_MSG_RESULT($enableval) | |
57 | if test "$enableval" = yes; then | |
58 | MR_DEFINE(ATHENA) | |
59 | fi | |
60 | ||
61 | # Networking libraries | |
62 | AC_CHECKING(network libraries...) | |
63 | AC_CHECK_FUNC(gethostbyname, :, | |
64 | AC_CHECK_LIB(nsl, gethostbyname, , | |
65 | AC_CHECK_LIB(resolv, gethostbyname))) | |
66 | AC_CHECK_FUNC(socket, :, | |
67 | AC_CHECK_LIB(socket, socket, , | |
68 | AC_CHECK_LIB(socket, socket, | |
69 | LIBS="-lsocket -lnsl $LIBS", :, | |
70 | -lnsl))) | |
71 | ||
72 | # com_err (required, but can be built) | |
73 | AC_MSG_CHECKING(for com_err) | |
74 | AC_ARG_WITH(com_err, | |
75 | [ --with-com_err=PREFIX Specify location of com_err], | |
76 | [AC_MSG_RESULT($withval) | |
77 | if test $withval = "no"; then | |
78 | AC_MSG_ERROR(com_err is required for Moira) | |
79 | fi | |
80 | if test $withval != "yes"; then | |
81 | MR_INCLUDE($withval/include) | |
82 | MR_LIBS($withval/lib) | |
83 | fi | |
84 | COMPILE_ET=compile_et], | |
85 | [AC_MSG_RESULT(util/et) | |
86 | COM_ERR_SUBDIR=util/et; | |
87 | MR_INCLUDE(`pwd`/util/et) | |
88 | MR_LIBS(`pwd`/util/et) | |
89 | COMPILE_ET=`pwd`/util/et/compile_et | |
90 | AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)]) | |
91 | AC_SUBST(COM_ERR_SUBDIR) | |
92 | AC_SUBST(COMPILE_ET) | |
93 | ||
94 | # Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr) | |
95 | AC_MSG_CHECKING(for Kerberos 4) | |
96 | AC_ARG_WITH(krb4, | |
97 | [ --with-krb4=PREFIX Specify location of krb4], | |
98 | [krb4="$withval"], [krb4=no]) | |
99 | AC_MSG_RESULT($krb4) | |
100 | if test $krb4 = "no"; then | |
101 | AC_MSG_ERROR(Kerberos is required for Moira) | |
102 | fi | |
103 | if test "$krb4" != yes; then | |
104 | MR_INCLUDE($krb4/include) | |
105 | if test -d "$krb4/include/kerberosIV"; then | |
106 | MR_INCLUDE($krb4/include/kerberosIV) | |
107 | fi | |
108 | MR_LIBS($krb4/lib) | |
109 | elif test -d /usr/include/kerberosIV; then | |
110 | MR_INCLUDE(/usr/include/kerberosIV) | |
111 | fi | |
112 | AC_CHECK_LIB(krb4, krb_rd_req, | |
113 | [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto"], | |
114 | [AC_CHECK_LIB(krb, krb_rd_req, | |
115 | [KRB4_LIBS="-lkrb -ldes"], | |
116 | [AC_MSG_ERROR(Kerberos 4 libraries not found)], | |
117 | $LIBPATH -ldes)], | |
118 | $LIBPATH -ldes425 -lkrb5 -lcrypto -lcom_err) | |
119 | ||
120 | AC_MSG_CHECKING(for Kerberos 5) | |
121 | AC_ARG_WITH(krb5, | |
122 | [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)], | |
123 | [krb5="$withval"], [krb5=no]) | |
124 | AC_MSG_RESULT($krb5) | |
125 | if test "$krb5" != no; then | |
126 | REG_SVR_DEFS=-DKRB5 | |
127 | if test "$krb5" != yes; then | |
128 | REG_SVR_INCLUDES=-I$krb5/include | |
129 | REG_SVR_LIBS=-L$krb5/lib | |
130 | fi | |
131 | REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -lcrypto" | |
132 | else | |
133 | REG_SVR_DEFS=-DKRB4 | |
134 | REG_SVR_LIBS=-lkadm | |
135 | fi | |
136 | AC_SUBST(REG_SVR_DEFS) | |
137 | AC_SUBST(REG_SVR_INCLUDES) | |
138 | AC_SUBST(REG_SVR_LIBS) | |
139 | ||
140 | # Hesiod support | |
141 | AC_MSG_CHECKING(for Hesiod) | |
142 | AC_ARG_WITH(hesiod, | |
143 | [ --with-hesiod=PREFIX Specify location of Hesiod], | |
144 | [hesiod="$withval"], [hesiod=no]) | |
145 | AC_MSG_RESULT($hesiod) | |
146 | if test "$hesiod" != no; then | |
147 | if test "$hesiod" != yes; then | |
148 | MR_INCLUDE($hesiod/include) | |
149 | MR_LIBS($hesiod/lib) | |
150 | fi | |
151 | AC_CHECK_FUNC(res_send, :, | |
152 | AC_CHECK_LIB(resolv, res_send)) | |
153 | AC_CHECK_LIB(hesiod, hes_resolve, :, | |
154 | [AC_MSG_ERROR(Hesiod library not found)], | |
155 | $LIBPATH $LIBS) | |
156 | MR_DEFINE(HAVE_HESIOD) | |
157 | fi | |
158 | ||
159 | # Zephyr support | |
160 | AC_MSG_CHECKING(for Zephyr) | |
161 | AC_ARG_WITH(zephyr, | |
162 | [ --with-zephyr=PREFIX Specify location of Zephyr], | |
163 | [zephyr="$withval"], [zephyr=no]) | |
164 | AC_MSG_RESULT($zephyr) | |
165 | if test "$zephyr" != no; then | |
166 | if test "$zephyr" != yes; then | |
167 | MR_INCLUDE($zephyr/include) | |
168 | MR_LIBS($zephyr/lib) | |
169 | fi | |
170 | AC_CHECK_LIB(zephyr, ZInitialize, :, | |
171 | [AC_MSG_ERROR(Zephyr library not found)], | |
172 | $LIBPATH $KRB4_LIBS -lcom_err) | |
173 | MR_DEFINE(HAVE_ZEPHYR) | |
174 | fi | |
175 | ||
176 | # RSAREF support (default: build util/rsaref if present) | |
177 | AC_MSG_CHECKING(for RSAREF) | |
178 | AC_ARG_WITH(rsaref, | |
179 | [ --with-rsaref=PREFIX Specify location of RSAREF], | |
180 | [rsaref="$withval" | |
181 | RSAREF_CPPFLAGS="-I$rsaref/include" | |
182 | RSAREF_LIBS="$rsaref/lib/rsaref.a"], | |
183 | RSAREF_SUBDIRS=reg_svr | |
184 | [if test -d $srcdir/util/rsaref; then | |
185 | rsaref=$srcdir/util/rsaref | |
186 | RSAREF_SUBDIRS="util/rsaref reg_svr" | |
187 | RSAREF_OUTPUT_FILES="util/rsaref/Makefile" | |
188 | # autoconf can't deal with creating util/rsaref if util doesn't exist | |
189 | if test ! -d util; then | |
190 | mkdir util | |
191 | fi | |
192 | RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref' | |
193 | RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a' | |
194 | RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a' | |
195 | else | |
196 | rsaref=no | |
197 | fi]) | |
198 | AC_MSG_RESULT($rsaref) | |
199 | if test "$rsaref" != no; then | |
200 | MR_DEFINE(HAVE_RSAREF) | |
201 | fi | |
202 | AC_SUBST(RSAREF_CPPFLAGS) | |
203 | AC_SUBST(RSAREF_LIBS) | |
204 | AC_SUBST(RSAREF_SUBDIRS) | |
205 | AC_SUBST(RSAREF_LIBDEP) | |
206 | ||
207 | # Oracle (default: yes, if $ORACLE_HOME is set) | |
208 | AC_MSG_CHECKING(for Oracle) | |
209 | AC_ARG_WITH(oracle, | |
210 | [ --with-oracle=PREFIX Specify location of Oracle (for server)], | |
211 | [oracle="$withval"], | |
212 | [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then | |
213 | oracle=$ORACLE_HOME | |
214 | else | |
215 | oracle=no | |
216 | fi]) | |
217 | AC_MSG_RESULT($oracle) | |
218 | if test "$oracle" != no; then | |
219 | AC_MSG_CHECKING(Pro*C version) | |
220 | ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'` | |
221 | AC_MSG_RESULT($release) | |
222 | case $release in | |
223 | 2.0.6.0.0) | |
224 | SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm" | |
225 | ;; | |
226 | *) | |
227 | 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" | |
228 | ;; | |
229 | esac | |
230 | SVRSUBDIRS='$(SVRDIRS)' | |
231 | SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile reg_svr/Makefile regtape/Makefile" | |
232 | PRO_C=$oracle/bin/proc | |
233 | PRO_C_OPTS=CODE=ANSI_C | |
234 | PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS" | |
235 | fi | |
236 | AC_SUBST(PRO_C) | |
237 | AC_SUBST(PRO_C_DEFS) | |
238 | AC_SUBST(PRO_C_INCLUDES) | |
239 | AC_SUBST(PRO_C_OPTS) | |
240 | AC_SUBST(SQL_LIBS) | |
241 | AC_SUBST(SVRSUBDIRS) | |
242 | ||
243 | # AFS support | |
244 | AC_MSG_CHECKING(for AFS) | |
245 | AC_ARG_WITH(afs, | |
246 | [ --with-afs=PREFIX Specify location of AFS libs (for server)], | |
247 | [afs="$withval"], [afs=no]) | |
248 | AC_MSG_RESULT($afs) | |
249 | if test "$afs" != no -a "$oracle" != no; then | |
250 | if test "$afs" != yes; then | |
251 | AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx" | |
252 | AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx" | |
253 | AFS_LIBS="-L$afs/lib -L$afs/lib/afs" | |
254 | AFS_DIR=$afs | |
255 | fi | |
256 | AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque, | |
257 | AFS_EXTRA_LIBS="-lcompat", | |
258 | AC_MSG_ERROR(insque not found))) | |
259 | AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec, | |
260 | AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb", | |
261 | :, -L/usr/ucblib)) | |
262 | AC_CHECK_LIB(sys, pioctl, :, | |
263 | [AC_MSG_ERROR(AFS libraries not found)], | |
264 | $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS) | |
265 | MR_DEFINE(HAVE_AFS) | |
266 | ||
267 | AFS_SUBDIRS="incremental" | |
268 | AFS_OUTPUT_FILES="incremental/Makefile" | |
269 | if test -d $srcdir/afssync; then | |
270 | AFS_SUBDIRS="$AFS_SUBDIRS afssync" | |
271 | AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile" | |
272 | fi | |
273 | fi | |
274 | AC_SUBST(AFS_CPPFLAGS) | |
275 | AC_SUBST(AFS_PRO_C_INCLUDES) | |
276 | AC_SUBST(AFS_LIBS) | |
277 | AC_SUBST(AFS_EXTRA_LIBS) | |
278 | AC_SUBST(AFS_DIR) | |
279 | AC_SUBST(AFS_SUBDIRS) | |
280 | ||
281 | # GNU readline | |
282 | AC_CHECKING(for GNU readline...) | |
283 | AC_ARG_WITH(readline, | |
284 | [ --with-readline=PREFIX Specify location of GNU readline], | |
285 | [readline="$withval"; AC_MSG_RESULT($withval)], | |
286 | [AC_CHECK_LIB(readline, readline, [readline=yes], | |
287 | [if test "$athena" = true; then | |
288 | unset ac_cv_lib_readline_readline | |
289 | AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :, | |
290 | -L/mit/gnu/lib -ltermcap) | |
291 | fi], | |
292 | -ltermcap)]) | |
293 | if test "$readline" != no; then | |
294 | if test "$readline" != yes; then | |
295 | READLINE_CPPFLAGS="-I$readline/include" | |
296 | READLINE_LIBS="-L$readline/lib" | |
297 | fi | |
298 | READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE" | |
299 | READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap" | |
300 | fi | |
301 | AC_SUBST(READLINE_CPPFLAGS) | |
302 | AC_SUBST(READLINE_LIBS) | |
303 | ||
304 | # Curses | |
305 | curses=curses | |
306 | AC_CHECKING(for curses) | |
307 | AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses)) | |
308 | if test -n "$curses"; then | |
309 | OLDLIBS=$LIBS | |
310 | LIBS=-l$curses | |
311 | AC_CHECKING(if curses needs termcap) | |
312 | dnl we need to use AC_TRY_RUN because under NetBSD, the program will | |
313 | dnl link with just -lcurses, but then fail with a runtime linker error | |
314 | dnl because you didn't use -ltermcap | |
315 | AC_TRY_RUN([#include <curses.h> | |
316 | main(int argc, char **argv) | |
317 | { | |
318 | initscr(); | |
319 | endwin(); | |
320 | return 0; | |
321 | }], [CURSES_LIBS="-l$curses"], | |
322 | LIBS="-l$curses -ltermcap" | |
323 | AC_TRY_RUN([#include <curses.h> | |
324 | main(int argc, char **argv) | |
325 | { | |
326 | initscr(); | |
327 | endwin(); | |
328 | return 0; | |
329 | }], [CURSES_LIBS="-l$curses -ltermcap"], | |
330 | :, :), | |
331 | :) | |
332 | LIBS=$OLDLIBS | |
333 | fi | |
334 | if test -n "$CURSES_LIBS"; then | |
335 | OLDLIBS=$LIBS | |
336 | LIBS=$CURSES_LIBS | |
337 | AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);], | |
338 | :, | |
339 | AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;], | |
340 | [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"], | |
341 | [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"])) | |
342 | AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);], | |
343 | [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"]) | |
344 | LIBS=$OLDLIBS | |
345 | CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS" | |
346 | CURSES_SUBDIRS='$(CURSES_SUBDIRS)' | |
347 | else | |
348 | AC_MSG_WARN(Couldn't find -lcurses) | |
349 | fi | |
350 | AC_SUBST(CURSES_CPPFLAGS) | |
351 | AC_SUBST(CURSES_LIBS) | |
352 | AC_SUBST(CURSES_SUBDIRS) | |
353 | ||
354 | ||
355 | AC_CHECK_FUNCS(getusershell strlcpy strlcat uname) | |
356 | ||
357 | AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS)) | |
358 | ||
359 | AC_CHECK_HEADERS(unistd.h getopt.h) | |
360 | ||
361 | MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)') | |
362 | MR_INCLUDE('$(SRCTOP)/include') | |
363 | MR_INCLUDE('$(SRCTOP)/lib') | |
364 | MR_INCLUDE('$(BUILDTOP)/lib') | |
365 | MR_INCLUDE('$(BUILDTOP)/db') | |
366 | MR_INCLUDE('$(srcdir)') | |
367 | LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH" | |
368 | KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS" | |
369 | LIBS="-lmoira $KLIBS" | |
370 | AC_SUBST(KLIBS) | |
371 | ||
372 | MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a' | |
373 | AC_SUBST(MR_LIBDEP) | |
374 | ||
375 | AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \ | |
376 | clients/lib/Makefile clients/addusr/Makefile \ | |
377 | clients/blanche/Makefile clients/chfn/Makefile \ | |
378 | clients/chpobox/Makefile clients/chsh/Makefile \ | |
379 | clients/mailmaint/Makefile clients/moira/Makefile \ | |
380 | clients/mrcheck/Makefile clients/mrtest/Makefile \ | |
381 | clients/stella/Makefile update/Makefile man/Makefile \ | |
382 | $SERVER_OUTPUT_FILES $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES) |