]>
Commit | Line | Data |
---|---|---|
ea0caf4a | 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 | with_readline=/mit/gnu | |
36 | prefix=/afs/athena.mit.edu/system/moira | |
37 | bindir=$prefix/arch/$ATHENA_SYS/bin | |
38 | sbindir=$bindir | |
39 | fi | |
40 | ||
41 | # We currently just don't support changing this | |
42 | mrbindir=/moira/bin | |
43 | AC_SUBST(mrbindir) | |
44 | ||
45 | # Athena-local policy decisions | |
46 | AC_MSG_CHECKING(for Athena) | |
47 | AC_ARG_ENABLE(athena, | |
48 | [ --enable-athena Enable Athena-specific policy decisions], | |
49 | , [if test "$athena" = true; then | |
50 | enableval=yes | |
51 | else | |
52 | enableval=no | |
53 | fi]) | |
54 | AC_MSG_RESULT($enableval) | |
55 | if test "$enableval" = yes; then | |
56 | MR_DEFINE(ATHENA) | |
57 | fi | |
58 | ||
59 | # Networking libraries | |
60 | AC_CHECKING(network libraries...) | |
61 | AC_CHECK_FUNC(gethostbyname, :, | |
62 | AC_CHECK_LIB(nsl, gethostbyname, , | |
63 | AC_CHECK_LIB(resolv, gethostbyname))) | |
64 | AC_CHECK_FUNC(socket, :, | |
65 | AC_CHECK_LIB(socket, socket, , | |
66 | AC_CHECK_LIB(socket, socket, | |
67 | LIBS="-lsocket -lnsl $LIBS", :, | |
68 | -lnsl))) | |
69 | ||
70 | # com_err (required, but can be built) | |
71 | AC_MSG_CHECKING(for com_err) | |
72 | AC_ARG_WITH(com_err, | |
73 | [ --with-com_err=PREFIX Specify location of com_err], | |
74 | [AC_MSG_RESULT($withval) | |
75 | if test $withval = "no"; then | |
76 | AC_MSG_ERROR(com_err is required for Moira) | |
77 | fi | |
78 | if test $withval != "yes"; then | |
79 | MR_INCLUDE($withval/include) | |
80 | MR_LIBS($withval/lib) | |
81 | fi | |
82 | COMPILE_ET=compile_et], | |
83 | [AC_MSG_RESULT(util/et) | |
84 | COM_ERR_SUBDIR=util/et; | |
85 | MR_INCLUDE(`pwd`/util/et) | |
86 | MR_LIBS(`pwd`/util/et) | |
87 | COMPILE_ET=`pwd`/util/et/compile_et | |
88 | AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)]) | |
89 | AC_SUBST(COM_ERR_SUBDIR) | |
90 | AC_SUBST(COMPILE_ET) | |
91 | ||
92 | # Kerberos (required) | |
93 | AC_MSG_CHECKING(for Kerberos 4) | |
94 | AC_ARG_WITH(krb4, | |
95 | [ --with-krb4=PREFIX Specify location of krb4], | |
96 | [krb4="$withval"], [krb4=no]) | |
97 | AC_MSG_RESULT($krb4) | |
98 | if test $krb4 = "no"; then | |
99 | AC_MSG_ERROR(Kerberos is required for Moira) | |
100 | fi | |
101 | if test "$krb4" != yes; then | |
102 | MR_INCLUDE($krb4/include) | |
103 | if test -d "$krb4/include/kerberosIV"; then | |
104 | MR_INCLUDE($krb4/include/kerberosIV) | |
105 | fi | |
106 | MR_LIBS($krb4/lib) | |
107 | elif test -d /usr/include/kerberosIV; then | |
108 | MR_INCLUDE(/usr/include/kerberosIV) | |
109 | fi | |
110 | AC_CHECK_LIB(krb4, krb_rd_req, | |
111 | [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lcrypto"], | |
112 | [AC_CHECK_LIB(krb, krb_rd_req, | |
113 | [KRB4_LIBS="-lkrb -ldes"], | |
114 | [AC_MSG_ERROR(Kerberos 4 libraries not found)], | |
115 | $LIBPATH -ldes)], | |
116 | $LIBPATH -ldes425 -lkrb5 -lcrypto) | |
117 | ||
118 | # Hesiod support | |
119 | AC_MSG_CHECKING(for Hesiod) | |
120 | AC_ARG_WITH(hesiod, | |
121 | [ --with-hesiod=PREFIX Specify location of Hesiod], | |
122 | [hesiod="$withval"], [hesiod=no]) | |
123 | AC_MSG_RESULT($hesiod) | |
124 | if test "$hesiod" != no; then | |
125 | if test "$hesiod" != yes; then | |
126 | MR_INCLUDE($hesiod/include) | |
127 | MR_LIBS($hesiod/lib) | |
128 | fi | |
129 | AC_CHECK_FUNC(res_send, :, | |
130 | AC_CHECK_LIB(resolv, res_send)) | |
131 | AC_CHECK_LIB(hesiod, hes_resolve, :, | |
132 | [AC_MSG_ERROR(Hesiod library not found)], | |
133 | $LIBPATH $LIBS) | |
134 | MR_DEFINE(HAVE_HESIOD) | |
135 | fi | |
136 | ||
137 | # Zephyr support | |
138 | AC_MSG_CHECKING(for Zephyr) | |
139 | AC_ARG_WITH(zephyr, | |
140 | [ --with-zephyr=PREFIX Specify location of Zephyr], | |
141 | [zephyr="$withval"], [zephyr=no]) | |
142 | AC_MSG_RESULT($zephyr) | |
143 | if test "$zephyr" != no; then | |
144 | if test "$zephyr" != yes; then | |
145 | MR_INCLUDE($zephyr/include) | |
146 | MR_LIBS($zephyr/lib) | |
147 | fi | |
148 | AC_CHECK_LIB(zephyr, ZInitialize, :, | |
149 | [AC_MSG_ERROR(Zephyr library not found)], | |
150 | $LIBPATH $KRB4_LIBS -lcom_err) | |
151 | MR_DEFINE(HAVE_ZEPHYR) | |
152 | fi | |
153 | ||
154 | # GDSS support (default: build util/gdss if present) | |
155 | AC_MSG_CHECKING(for GDSS) | |
156 | AC_ARG_WITH(gdss, | |
157 | [ --with-gdss=PREFIX Specify location of GDSS], | |
158 | [gdss="$withval" | |
159 | GDSS_CPPFLAGS="-I$gdss/include" | |
160 | GDSS_LIBS="-L$gdss/lib -lgdss"], | |
161 | [if test -d $srcdir/util/gdss; then | |
162 | gdss=$srcdir/util/gdss | |
163 | GDSS_SUBDIR=util/gdss | |
164 | GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \ | |
165 | util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \ | |
166 | util/gdss/lib/crypto/algorithm/Makefile" | |
167 | # autoconf can't deal with creating util/gdss if util doesn't exist | |
168 | if test ! -d util; then | |
169 | mkdir util | |
170 | fi | |
171 | GDSS_CPPFLGAS="-I$gdss/include" | |
172 | GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss' | |
173 | else | |
174 | gdss=no | |
175 | fi]) | |
176 | AC_MSG_RESULT($gdss) | |
177 | if test "$gdss" != no; then | |
178 | GDSS_OBJS='$(GDSS_OBJS)' | |
179 | GDSS_CFILES='$(GDSS_CFILES)' | |
180 | GDSS_TARGET='$(GDSS_TARGET)' | |
181 | MR_DEFINE(HAVE_GDSS) | |
182 | fi | |
183 | AC_SUBST(GDSS_CPPFLAGS) | |
184 | AC_SUBST(GDSS_LIBS) | |
185 | AC_SUBST(GDSS_SUBDIR) | |
186 | AC_SUBST(GDSS_OBJS) | |
187 | AC_SUBST(GDSS_CFILES) | |
188 | AC_SUBST(GDSS_TARGET) | |
189 | ||
190 | # Oracle (default: yes, if $ORACLE_HOME is set) | |
191 | AC_MSG_CHECKING(for Oracle) | |
192 | AC_ARG_WITH(oracle, | |
193 | [ --with-oracle=PREFIX Specify location of Oracle (for server)], | |
194 | [oracle="$withval"], | |
195 | [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then | |
196 | oracle=$ORACLE_HOME | |
197 | else | |
198 | oracle=no | |
199 | fi]) | |
200 | AC_MSG_RESULT($oracle) | |
201 | if test "$oracle" != no; then | |
202 | SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm" | |
203 | SVRSUBDIRS='$(SVRDIRS)' | |
204 | SERVER_OUTPUT_FILES="db/Makefile server/Makefile afssync/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile reg_svr/Makefile regtape/Makefile" | |
205 | PRO_C=$oracle/bin/proc | |
206 | PRO_C_OPTS=CODE=ANSI_C | |
207 | fi | |
208 | AC_SUBST(PRO_C) | |
209 | AC_SUBST(PRO_C_DEFS) | |
210 | AC_SUBST(PRO_C_INCLUDES) | |
211 | AC_SUBST(PRO_C_OPTS) | |
212 | AC_SUBST(SQL_LIBS) | |
213 | AC_SUBST(SVRSUBDIRS) | |
214 | ||
215 | # AFS support | |
216 | AC_MSG_CHECKING(for AFS) | |
217 | AC_ARG_WITH(afs, | |
218 | [ --with-afs=PREFIX Specify location of AFS libs (for server)], | |
219 | [afs="$withval"], [afs=no]) | |
220 | AC_MSG_RESULT($afs) | |
221 | if test "$afs" != no -a "$oracle" != no; then | |
222 | if test "$afs" != yes; then | |
223 | AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx" | |
224 | AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx" | |
225 | AFS_LIBS="-L$afs/lib -L$afs/lib/afs" | |
226 | AFS_DIR=$afs | |
227 | fi | |
228 | AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque, | |
229 | AFS_EXTRA_LIBS="-lcompat", | |
230 | AC_MSG_ERROR(insque not found))) | |
231 | AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec, | |
232 | AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb", | |
233 | :, -L/usr/ucblib)) | |
234 | AC_CHECK_LIB(sys, pioctl, :, | |
235 | [AC_MSG_ERROR(AFS libraries not found)], | |
236 | $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS) | |
237 | MR_DEFINE(HAVE_AFS) | |
238 | fi | |
239 | AC_SUBST(AFS_CPPFLAGS) | |
240 | AC_SUBST(AFS_PRO_C_INCLUDES) | |
241 | AC_SUBST(AFS_LIBS) | |
242 | AC_SUBST(AFS_EXTRA_LIBS) | |
243 | AC_SUBST(AFS_DIR) | |
244 | ||
245 | # GNU readline | |
246 | AC_CHECKING(for GNU readline...) | |
247 | AC_ARG_WITH(readline, | |
248 | [ --with-readline=PREFIX Specify location of GNU readline], | |
249 | [readline="$withval"], | |
250 | [AC_CHECK_LIB(readline, readline, [readline=yes], :, -ltermcap)]) | |
251 | if test "$readline" != no; then | |
252 | if test "$readline" != yes; then | |
253 | READLINE_CPPFLAGS="-I$readline/include/readline -DHAVE_READLINE" | |
254 | READLINE_LIBS="-L$readline/lib -lreadline -ltermcap" | |
255 | fi | |
256 | fi | |
257 | AC_SUBST(READLINE_CPPFLAGS) | |
258 | AC_SUBST(READLINE_LIBS) | |
259 | ||
260 | # Curses | |
261 | curses=curses | |
262 | AC_CHECKING(for curses) | |
263 | AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses)) | |
264 | if test -n "$curses"; then | |
265 | OLDLIBS=$LIBS | |
266 | LIBS=-l$curses | |
267 | AC_CHECKING(if curses needs termcap) | |
268 | dnl we need to use AC_TRY_RUN because under NetBSD, the program will | |
269 | dnl link with just -lcurses, but then fail with a runtime linker error | |
270 | dnl because you didn't use -ltermcap | |
271 | AC_TRY_RUN([#include <curses.h> | |
272 | main(int argc, char **argv) | |
273 | { | |
274 | initscr(); | |
275 | endwin(); | |
276 | return 0; | |
277 | }], [CURSES_LIBS="-l$curses"], | |
278 | LIBS="-l$curses -ltermcap" | |
279 | AC_TRY_RUN([#include <curses.h> | |
280 | main(int argc, char **argv) | |
281 | { | |
282 | initscr(); | |
283 | endwin(); | |
284 | return 0; | |
285 | }], [CURSES_LIBS="-l$curses -ltermcap"], | |
286 | :, :), | |
287 | :) | |
288 | LIBS=$OLDLIBS | |
289 | fi | |
290 | if test -n "$CURSES_LIBS"; then | |
291 | OLDLIBS=$LIBS | |
292 | LIBS=$CURSES_LIBS | |
293 | AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);], | |
294 | :, | |
295 | AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;], | |
296 | [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"], | |
297 | [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"])) | |
298 | LIBS=$OLDLIBS | |
299 | CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS" | |
300 | CURSES_SUBDIRS='$(CURSES_SUBDIRS)' | |
301 | else | |
302 | AC_MSG_WARN(Couldn't find -lcurses) | |
303 | fi | |
304 | AC_SUBST(CURSES_CPPFLAGS) | |
305 | AC_SUBST(CURSES_LIBS) | |
306 | AC_SUBST(CURSES_SUBDIRS) | |
307 | ||
308 | ||
309 | AC_CHECK_FUNCS(getusershell) | |
310 | ||
311 | AC_CHECK_HEADER(crypt.h, CRYPT_CPPFLAGS=-DHAVE_CRYPT_H) | |
312 | AC_CHECK_FUNC(crypt, :, AC_CHECK_LIB(crypt, crypt, CRYPT_LIBS=-lcrypt)) | |
313 | AC_SUBST(CRYPT_CPPFLAGS) | |
314 | AC_SUBST(CRYPT_LIBS) | |
315 | ||
316 | MR_INCLUDE('$(SRCTOP)/include') | |
317 | MR_INCLUDE('$(BUILDTOP)/lib') | |
318 | MR_INCLUDE('$(BUILDTOP)/db') | |
319 | LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH" | |
320 | KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS" | |
321 | LIBS="-lmoira $KLIBS" | |
322 | AC_SUBST(KLIBS) | |
323 | ||
324 | AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \ | |
325 | clients/addusr/Makefile clients/blanche/Makefile \ | |
326 | clients/mailmaint/Makefile clients/moira/Makefile \ | |
327 | clients/mrcheck/Makefile clients/mrtest/Makefile \ | |
328 | clients/passwd/Makefile clients/userreg/Makefile \ | |
329 | update/Makefile man/Makefile \ | |
330 | $SERVER_OUTPUT_FILES $GDSS_OUTPUT_FILES) |