]> andersk Git - moira.git/blame - configure.in
fix depend rule for case with no DEPDIRS
[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
36 prefix=/afs/athena.mit.edu/system/moira
37 bindir=$prefix/arch/$ATHENA_SYS/bin
38 sbindir=$bindir
39fi
40
41# We currently just don't support changing this
42mrbindir=/moira/bin
43AC_SUBST(mrbindir)
44
45# Athena-local policy decisions
46AC_MSG_CHECKING(for Athena)
47AC_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])
54AC_MSG_RESULT($enableval)
55if test "$enableval" = yes; then
56 MR_DEFINE(ATHENA)
57fi
58
59# Networking libraries
60AC_CHECKING(network libraries...)
61AC_CHECK_FUNC(gethostbyname, :,
62 AC_CHECK_LIB(nsl, gethostbyname, ,
63 AC_CHECK_LIB(resolv, gethostbyname)))
64AC_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)
71AC_MSG_CHECKING(for com_err)
72AC_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)])
89AC_SUBST(COM_ERR_SUBDIR)
90AC_SUBST(COMPILE_ET)
91
92# Kerberos (required)
93AC_MSG_CHECKING(for Kerberos 4)
94AC_ARG_WITH(krb4,
95 [ --with-krb4=PREFIX Specify location of krb4],
96 [krb4="$withval"], [krb4=no])
97AC_MSG_RESULT($krb4)
98if test $krb4 = "no"; then
99 AC_MSG_ERROR(Kerberos is required for Moira)
100fi
101if 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)
107elif test -d /usr/include/kerberosIV; then
108 MR_INCLUDE(/usr/include/kerberosIV)
109fi
110AC_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
119AC_MSG_CHECKING(for Hesiod)
120AC_ARG_WITH(hesiod,
121 [ --with-hesiod=PREFIX Specify location of Hesiod],
122 [hesiod="$withval"], [hesiod=no])
123AC_MSG_RESULT($hesiod)
124if 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)
135fi
136
137# Zephyr support
138AC_MSG_CHECKING(for Zephyr)
139AC_ARG_WITH(zephyr,
140 [ --with-zephyr=PREFIX Specify location of Zephyr],
141 [zephyr="$withval"], [zephyr=no])
142AC_MSG_RESULT($zephyr)
143if 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)
152fi
153
154# GDSS support (default: build util/gdss if present)
155AC_MSG_CHECKING(for GDSS)
156AC_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])
176AC_MSG_RESULT($gdss)
177if test "$gdss" != no; then
178 GDSS_OBJS='$(GDSS_OBJS)'
179 GDSS_CFILES='$(GDSS_CFILES)'
180 GDSS_TARGET='$(GDSS_TARGET)'
181 MR_DEFINE(HAVE_GDSS)
182fi
183AC_SUBST(GDSS_CPPFLAGS)
184AC_SUBST(GDSS_LIBS)
185AC_SUBST(GDSS_SUBDIR)
186AC_SUBST(GDSS_OBJS)
187AC_SUBST(GDSS_CFILES)
188AC_SUBST(GDSS_TARGET)
189
190# Oracle (default: yes, if $ORACLE_HOME is set)
191AC_MSG_CHECKING(for Oracle)
192AC_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])
200AC_MSG_RESULT($oracle)
201if 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
207fi
208AC_SUBST(PRO_C)
209AC_SUBST(PRO_C_DEFS)
210AC_SUBST(PRO_C_INCLUDES)
211AC_SUBST(PRO_C_OPTS)
212AC_SUBST(SQL_LIBS)
213AC_SUBST(SVRSUBDIRS)
214
215# AFS support
216AC_MSG_CHECKING(for AFS)
217AC_ARG_WITH(afs,
218 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
219 [afs="$withval"], [afs=no])
220AC_MSG_RESULT($afs)
221if 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)
238fi
239AC_SUBST(AFS_CPPFLAGS)
240AC_SUBST(AFS_PRO_C_INCLUDES)
241AC_SUBST(AFS_LIBS)
242AC_SUBST(AFS_EXTRA_LIBS)
243AC_SUBST(AFS_DIR)
244
245# GNU readline
246AC_CHECKING(for GNU readline...)
247AC_ARG_WITH(readline,
248 [ --with-readline=PREFIX Specify location of GNU readline],
249 [readline="$withval"],
250 [AC_CHECK_LIB(readline, readline, [readline=yes], :, -ltermcap)])
251if 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
256fi
257AC_SUBST(READLINE_CPPFLAGS)
258AC_SUBST(READLINE_LIBS)
259
260# Curses
261curses=curses
262AC_CHECKING(for curses)
263AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
264if 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
289fi
290if 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)'
301else
302 AC_MSG_WARN(Couldn't find -lcurses)
303fi
304AC_SUBST(CURSES_CPPFLAGS)
305AC_SUBST(CURSES_LIBS)
306AC_SUBST(CURSES_SUBDIRS)
307
308
309AC_CHECK_FUNCS(getusershell)
310
311AC_CHECK_HEADER(crypt.h, CRYPT_CPPFLAGS=-DHAVE_CRYPT_H)
312AC_CHECK_FUNC(crypt, :, AC_CHECK_LIB(crypt, crypt, CRYPT_LIBS=-lcrypt))
313AC_SUBST(CRYPT_CPPFLAGS)
314AC_SUBST(CRYPT_LIBS)
315
316MR_INCLUDE('$(SRCTOP)/include')
317MR_INCLUDE('$(BUILDTOP)/lib')
318MR_INCLUDE('$(BUILDTOP)/db')
319LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
320KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
321LIBS="-lmoira $KLIBS"
322AC_SUBST(KLIBS)
323
324AC_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)
This page took 0.815581 seconds and 5 git commands to generate.