]> andersk Git - moira.git/blame - configure.in
rewrite the local getusershell to actually read /etc/shells rather
[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
ea0caf4a 35 prefix=/afs/athena.mit.edu/system/moira
36 bindir=$prefix/arch/$ATHENA_SYS/bin
37 sbindir=$bindir
618b3834 38 MR_INCLUDE(/usr/athena/include)
39 MR_INCLUDE(/usr/athena/include/kerberosIV)
40 MR_LIBS(/usr/athena/lib)
ea0caf4a 41fi
42
43# We currently just don't support changing this
44mrbindir=/moira/bin
45AC_SUBST(mrbindir)
46
47# Athena-local policy decisions
48AC_MSG_CHECKING(for Athena)
49AC_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])
56AC_MSG_RESULT($enableval)
57if test "$enableval" = yes; then
58 MR_DEFINE(ATHENA)
59fi
60
61# Networking libraries
62AC_CHECKING(network libraries...)
63AC_CHECK_FUNC(gethostbyname, :,
64 AC_CHECK_LIB(nsl, gethostbyname, ,
65 AC_CHECK_LIB(resolv, gethostbyname)))
66AC_CHECK_FUNC(socket, :,
67 AC_CHECK_LIB(socket, socket, ,
68 AC_CHECK_LIB(socket, socket,
69 LIBS="-lsocket -lnsl $LIBS", :,
70 -lnsl)))
71
7f7f279f 72# com_err (required, but can be built)
73AC_MSG_CHECKING(for com_err)
74AC_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)])
91AC_SUBST(COM_ERR_SUBDIR)
92AC_SUBST(COMPILE_ET)
93
94# Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
ea0caf4a 95AC_MSG_CHECKING(for Kerberos 4)
96AC_ARG_WITH(krb4,
97 [ --with-krb4=PREFIX Specify location of krb4],
98 [krb4="$withval"], [krb4=no])
99AC_MSG_RESULT($krb4)
100if test $krb4 = "no"; then
101 AC_MSG_ERROR(Kerberos is required for Moira)
102fi
103if 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)
109elif test -d /usr/include/kerberosIV; then
110 MR_INCLUDE(/usr/include/kerberosIV)
111fi
112AC_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)],
7f7f279f 118 $LIBPATH -ldes425 -lkrb5 -lcrypto -lcom_err)
ea0caf4a 119
7f7f279f 120AC_MSG_CHECKING(for Kerberos 5)
121AC_ARG_WITH(krb5,
122 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
123 [krb5="$withval"], [krb5=no])
124AC_MSG_RESULT($krb5)
125if 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"
132else
133 REG_SVR_DEFS=-DKRB4
134 REG_SVR_LIBS=-lkadm
135fi
136AC_SUBST(REG_SVR_DEFS)
137AC_SUBST(REG_SVR_INCLUDES)
138AC_SUBST(REG_SVR_LIBS)
33567bea 139
ea0caf4a 140# Hesiod support
141AC_MSG_CHECKING(for Hesiod)
142AC_ARG_WITH(hesiod,
143 [ --with-hesiod=PREFIX Specify location of Hesiod],
144 [hesiod="$withval"], [hesiod=no])
145AC_MSG_RESULT($hesiod)
146if 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)
157fi
158
159# Zephyr support
160AC_MSG_CHECKING(for Zephyr)
161AC_ARG_WITH(zephyr,
162 [ --with-zephyr=PREFIX Specify location of Zephyr],
163 [zephyr="$withval"], [zephyr=no])
164AC_MSG_RESULT($zephyr)
165if 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)
174fi
175
176# GDSS support (default: build util/gdss if present)
177AC_MSG_CHECKING(for GDSS)
d5611932 178AC_TRY_RUN([ int main() { return sizeof(long)!=4; } ], :, with_gdss=no, with_gdss=no)
ea0caf4a 179AC_ARG_WITH(gdss,
180 [ --with-gdss=PREFIX Specify location of GDSS],
181 [gdss="$withval"
71b838ed 182 if test "$gdss" != no; then
183 MR_INCLUDE("$gdss/include")
184 GDSS_LIBS="-L$gdss/lib -lgdss"
185 fi],
ea0caf4a 186 [if test -d $srcdir/util/gdss; then
187 gdss=$srcdir/util/gdss
188 GDSS_SUBDIR=util/gdss
189 GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \
190 util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \
191 util/gdss/lib/crypto/algorithm/Makefile"
192 # autoconf can't deal with creating util/gdss if util doesn't exist
193 if test ! -d util; then
194 mkdir util
195 fi
cd357ef5 196 MR_INCLUDE('$(SRCTOP)/util/gdss/include')
ea0caf4a 197 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
3fb6166b 198 GDSS_LIBDEP='$(BUILDTOP)/util/gdss/lib/libgdss.a'
ea0caf4a 199 else
200 gdss=no
201 fi])
202AC_MSG_RESULT($gdss)
203if test "$gdss" != no; then
204 GDSS_OBJS='$(GDSS_OBJS)'
205 GDSS_CFILES='$(GDSS_CFILES)'
206 GDSS_TARGET='$(GDSS_TARGET)'
207 MR_DEFINE(HAVE_GDSS)
208fi
209AC_SUBST(GDSS_CPPFLAGS)
210AC_SUBST(GDSS_LIBS)
211AC_SUBST(GDSS_SUBDIR)
212AC_SUBST(GDSS_OBJS)
213AC_SUBST(GDSS_CFILES)
214AC_SUBST(GDSS_TARGET)
3fb6166b 215AC_SUBST(GDSS_LIBDEP)
ea0caf4a 216
33567bea 217# RSAREF support (default: build util/rsaref if present)
218AC_MSG_CHECKING(for RSAREF)
219AC_ARG_WITH(rsaref,
220 [ --with-rsaref=PREFIX Specify location of RSAREF],
221 [rsaref="$withval"
222 RSAREF_CPPFLAGS="-I$rsaref/include"
223 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
224 RSAREF_SUBDIRS=reg_svr
225 [if test -d $srcdir/util/rsaref; then
226 rsaref=$srcdir/util/rsaref
227 RSAREF_SUBDIRS="util/rsaref reg_svr"
228 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
229 # autoconf can't deal with creating util/rsaref if util doesn't exist
230 if test ! -d util; then
231 mkdir util
232 fi
46fa38eb 233 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
33567bea 234 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
3fb6166b 235 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
33567bea 236 else
237 rsaref=no
238 fi])
239AC_MSG_RESULT($rsaref)
240if test "$rsaref" != no; then
241 MR_DEFINE(HAVE_RSAREF)
242fi
243AC_SUBST(RSAREF_CPPFLAGS)
244AC_SUBST(RSAREF_LIBS)
245AC_SUBST(RSAREF_SUBDIRS)
3fb6166b 246AC_SUBST(RSAREF_LIBDEP)
33567bea 247
ea0caf4a 248# Oracle (default: yes, if $ORACLE_HOME is set)
249AC_MSG_CHECKING(for Oracle)
250AC_ARG_WITH(oracle,
251 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
252 [oracle="$withval"],
253 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
254 oracle=$ORACLE_HOME
255 else
256 oracle=no
257 fi])
258AC_MSG_RESULT($oracle)
259if test "$oracle" != no; then
cd357ef5 260 AC_MSG_CHECKING(Pro*C version)
261 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
262 AC_MSG_RESULT($release)
263 case $release in
264 2.0.6.0.0)
265 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
266 ;;
267 *)
268 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"
269 ;;
270 esac
ea0caf4a 271 SVRSUBDIRS='$(SVRDIRS)'
9ed720ef 272 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile reg_svr/Makefile regtape/Makefile"
ea0caf4a 273 PRO_C=$oracle/bin/proc
274 PRO_C_OPTS=CODE=ANSI_C
cd357ef5 275 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
ea0caf4a 276fi
277AC_SUBST(PRO_C)
278AC_SUBST(PRO_C_DEFS)
279AC_SUBST(PRO_C_INCLUDES)
280AC_SUBST(PRO_C_OPTS)
281AC_SUBST(SQL_LIBS)
282AC_SUBST(SVRSUBDIRS)
283
284# AFS support
285AC_MSG_CHECKING(for AFS)
286AC_ARG_WITH(afs,
287 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
288 [afs="$withval"], [afs=no])
289AC_MSG_RESULT($afs)
290if test "$afs" != no -a "$oracle" != no; then
291 if test "$afs" != yes; then
292 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
293 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
294 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
295 AFS_DIR=$afs
296 fi
297 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
298 AFS_EXTRA_LIBS="-lcompat",
299 AC_MSG_ERROR(insque not found)))
300 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
301 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
302 :, -L/usr/ucblib))
303 AC_CHECK_LIB(sys, pioctl, :,
304 [AC_MSG_ERROR(AFS libraries not found)],
305 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
306 MR_DEFINE(HAVE_AFS)
9ed720ef 307
308 AFS_SUBDIRS="incremental"
309 AFS_OUTPUT_FILES="incremental/Makefile"
310 if test -d $srcdir/afssync; then
311 AFS_SUBDIRS="$AFS_SUBDIRS afssync"
312 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
313 fi
ea0caf4a 314fi
315AC_SUBST(AFS_CPPFLAGS)
316AC_SUBST(AFS_PRO_C_INCLUDES)
317AC_SUBST(AFS_LIBS)
318AC_SUBST(AFS_EXTRA_LIBS)
319AC_SUBST(AFS_DIR)
9ed720ef 320AC_SUBST(AFS_SUBDIRS)
ea0caf4a 321
322# GNU readline
323AC_CHECKING(for GNU readline...)
324AC_ARG_WITH(readline,
325 [ --with-readline=PREFIX Specify location of GNU readline],
ee85084d 326 [readline="$withval"; AC_MSG_RESULT($withval)],
327 [AC_CHECK_LIB(readline, readline, [readline=yes],
328 [if test "$athena" = true; then
329 unset ac_cv_lib_readline_readline
330 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
331 -L/mit/gnu/lib -ltermcap)
332 fi],
333 -ltermcap)])
ea0caf4a 334if test "$readline" != no; then
335 if test "$readline" != yes; then
c5c5a18d 336 READLINE_CPPFLAGS="-I$readline/include"
ee85084d 337 READLINE_LIBS="-L$readline/lib"
ea0caf4a 338 fi
ee85084d 339 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
340 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
ea0caf4a 341fi
342AC_SUBST(READLINE_CPPFLAGS)
343AC_SUBST(READLINE_LIBS)
344
345# Curses
346curses=curses
347AC_CHECKING(for curses)
348AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
349if test -n "$curses"; then
350 OLDLIBS=$LIBS
351 LIBS=-l$curses
352 AC_CHECKING(if curses needs termcap)
353 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
354 dnl link with just -lcurses, but then fail with a runtime linker error
355 dnl because you didn't use -ltermcap
356 AC_TRY_RUN([#include <curses.h>
357 main(int argc, char **argv)
358 {
359 initscr();
360 endwin();
361 return 0;
362 }], [CURSES_LIBS="-l$curses"],
363 LIBS="-l$curses -ltermcap"
364 AC_TRY_RUN([#include <curses.h>
365 main(int argc, char **argv)
366 {
367 initscr();
368 endwin();
369 return 0;
370 }], [CURSES_LIBS="-l$curses -ltermcap"],
371 :, :),
372 :)
373 LIBS=$OLDLIBS
374fi
375if test -n "$CURSES_LIBS"; then
376 OLDLIBS=$LIBS
377 LIBS=$CURSES_LIBS
378 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
379 :,
380 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
381 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
382 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
4753fa79 383 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
384 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
ea0caf4a 385 LIBS=$OLDLIBS
386 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
387 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
388else
389 AC_MSG_WARN(Couldn't find -lcurses)
390fi
391AC_SUBST(CURSES_CPPFLAGS)
392AC_SUBST(CURSES_LIBS)
393AC_SUBST(CURSES_SUBDIRS)
394
395
396AC_CHECK_FUNCS(getusershell)
397
25f58600 398MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
ea0caf4a 399MR_INCLUDE('$(SRCTOP)/include')
25f58600 400MR_INCLUDE('$(SRCTOP)/lib')
ea0caf4a 401MR_INCLUDE('$(BUILDTOP)/lib')
402MR_INCLUDE('$(BUILDTOP)/db')
f4036eed 403MR_INCLUDE('$(srcdir)')
ea0caf4a 404LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
405KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
406LIBS="-lmoira $KLIBS"
407AC_SUBST(KLIBS)
408
3fb6166b 409MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
410AC_SUBST(MR_LIBDEP)
411
ea0caf4a 412AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
ee85084d 413 clients/lib/Makefile clients/addusr/Makefile \
414 clients/blanche/Makefile clients/mailmaint/Makefile
415 clients/moira/Makefile clients/mrcheck/Makefile
416 clients/mrtest/Makefile clients/passwd/Makefile
417 update/Makefile man/Makefile \
9ed720ef 418 $SERVER_OUTPUT_FILES $AFS_OUTPUT_FILES \
419 $GDSS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)
This page took 0.116426 seconds and 5 git commands to generate.