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