]> andersk Git - moira.git/blame - configure.in
deal with the possibility that readline is in /usr, or that it's
[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)
178AC_ARG_WITH(gdss,
179 [ --with-gdss=PREFIX Specify location of GDSS],
180 [gdss="$withval"
71b838ed 181 if test "$gdss" != no; then
182 MR_INCLUDE("$gdss/include")
183 GDSS_LIBS="-L$gdss/lib -lgdss"
184 fi],
ea0caf4a 185 [if test -d $srcdir/util/gdss; then
186 gdss=$srcdir/util/gdss
187 GDSS_SUBDIR=util/gdss
188 GDSS_OUTPUT_FILES="util/gdss/Makefile util/gdss/lib/Makefile \
189 util/gdss/lib/crypto/Makefile util/gdss/lib/crypto/bignum/Makefile \
190 util/gdss/lib/crypto/algorithm/Makefile"
191 # autoconf can't deal with creating util/gdss if util doesn't exist
192 if test ! -d util; then
193 mkdir util
194 fi
cd357ef5 195 MR_INCLUDE('$(SRCTOP)/util/gdss/include')
ea0caf4a 196 GDSS_LIBS='-L$(BUILDTOP)/util/gdss/lib -lgdss'
3fb6166b 197 GDSS_LIBDEP='$(BUILDTOP)/util/gdss/lib/libgdss.a'
ea0caf4a 198 else
199 gdss=no
200 fi])
201AC_MSG_RESULT($gdss)
202if test "$gdss" != no; then
203 GDSS_OBJS='$(GDSS_OBJS)'
204 GDSS_CFILES='$(GDSS_CFILES)'
205 GDSS_TARGET='$(GDSS_TARGET)'
206 MR_DEFINE(HAVE_GDSS)
207fi
208AC_SUBST(GDSS_CPPFLAGS)
209AC_SUBST(GDSS_LIBS)
210AC_SUBST(GDSS_SUBDIR)
211AC_SUBST(GDSS_OBJS)
212AC_SUBST(GDSS_CFILES)
213AC_SUBST(GDSS_TARGET)
3fb6166b 214AC_SUBST(GDSS_LIBDEP)
ea0caf4a 215
33567bea 216# RSAREF support (default: build util/rsaref if present)
217AC_MSG_CHECKING(for RSAREF)
218AC_ARG_WITH(rsaref,
219 [ --with-rsaref=PREFIX Specify location of RSAREF],
220 [rsaref="$withval"
221 RSAREF_CPPFLAGS="-I$rsaref/include"
222 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
223 RSAREF_SUBDIRS=reg_svr
224 [if test -d $srcdir/util/rsaref; then
225 rsaref=$srcdir/util/rsaref
226 RSAREF_SUBDIRS="util/rsaref reg_svr"
227 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
228 # autoconf can't deal with creating util/rsaref if util doesn't exist
229 if test ! -d util; then
230 mkdir util
231 fi
46fa38eb 232 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
33567bea 233 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
3fb6166b 234 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
33567bea 235 else
236 rsaref=no
237 fi])
238AC_MSG_RESULT($rsaref)
239if test "$rsaref" != no; then
240 MR_DEFINE(HAVE_RSAREF)
241fi
242AC_SUBST(RSAREF_CPPFLAGS)
243AC_SUBST(RSAREF_LIBS)
244AC_SUBST(RSAREF_SUBDIRS)
3fb6166b 245AC_SUBST(RSAREF_LIBDEP)
33567bea 246
ea0caf4a 247# Oracle (default: yes, if $ORACLE_HOME is set)
248AC_MSG_CHECKING(for Oracle)
249AC_ARG_WITH(oracle,
250 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
251 [oracle="$withval"],
252 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
253 oracle=$ORACLE_HOME
254 else
255 oracle=no
256 fi])
257AC_MSG_RESULT($oracle)
258if test "$oracle" != no; then
cd357ef5 259 AC_MSG_CHECKING(Pro*C version)
260 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
261 AC_MSG_RESULT($release)
262 case $release in
263 2.0.6.0.0)
264 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
265 ;;
266 *)
267 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"
268 ;;
269 esac
ea0caf4a 270 SVRSUBDIRS='$(SVRDIRS)'
9ed720ef 271 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile reg_svr/Makefile regtape/Makefile"
ea0caf4a 272 PRO_C=$oracle/bin/proc
273 PRO_C_OPTS=CODE=ANSI_C
cd357ef5 274 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
ea0caf4a 275fi
276AC_SUBST(PRO_C)
277AC_SUBST(PRO_C_DEFS)
278AC_SUBST(PRO_C_INCLUDES)
279AC_SUBST(PRO_C_OPTS)
280AC_SUBST(SQL_LIBS)
281AC_SUBST(SVRSUBDIRS)
282
283# AFS support
284AC_MSG_CHECKING(for AFS)
285AC_ARG_WITH(afs,
286 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
287 [afs="$withval"], [afs=no])
288AC_MSG_RESULT($afs)
289if test "$afs" != no -a "$oracle" != no; then
290 if test "$afs" != yes; then
291 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
292 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
293 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
294 AFS_DIR=$afs
295 fi
296 AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque,
297 AFS_EXTRA_LIBS="-lcompat",
298 AC_MSG_ERROR(insque not found)))
299 AC_CHECK_FUNC(sigvec, :, AC_CHECK_LIB(ucb, sigvec,
300 AFS_EXTRA_LIBS="$AFS_EXTRA_LIBS -L/usr/ucblib -lc -lucb",
301 :, -L/usr/ucblib))
302 AC_CHECK_LIB(sys, pioctl, :,
303 [AC_MSG_ERROR(AFS libraries not found)],
304 $AFS_LIBS -lrx -llwp -lsys $AFS_EXTRA_LIBS)
305 MR_DEFINE(HAVE_AFS)
9ed720ef 306
307 AFS_SUBDIRS="incremental"
308 AFS_OUTPUT_FILES="incremental/Makefile"
309 if test -d $srcdir/afssync; then
310 AFS_SUBDIRS="$AFS_SUBDIRS afssync"
311 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
312 fi
ea0caf4a 313fi
314AC_SUBST(AFS_CPPFLAGS)
315AC_SUBST(AFS_PRO_C_INCLUDES)
316AC_SUBST(AFS_LIBS)
317AC_SUBST(AFS_EXTRA_LIBS)
318AC_SUBST(AFS_DIR)
9ed720ef 319AC_SUBST(AFS_SUBDIRS)
ea0caf4a 320
321# GNU readline
322AC_CHECKING(for GNU readline...)
323AC_ARG_WITH(readline,
324 [ --with-readline=PREFIX Specify location of GNU readline],
ee85084d 325 [readline="$withval"; AC_MSG_RESULT($withval)],
326 [AC_CHECK_LIB(readline, readline, [readline=yes],
327 [if test "$athena" = true; then
328 unset ac_cv_lib_readline_readline
329 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
330 -L/mit/gnu/lib -ltermcap)
331 fi],
332 -ltermcap)])
ea0caf4a 333if test "$readline" != no; then
334 if test "$readline" != yes; then
ee85084d 335 READLINE_CPPFLAGS="-I$readline/include -I$readline/include/readline"
336 READLINE_LIBS="-L$readline/lib"
337 else
338 READLINE_CPPFLAGS="-I/usr/include/readline"
ea0caf4a 339 fi
ee85084d 340 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
341 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
ea0caf4a 342fi
343AC_SUBST(READLINE_CPPFLAGS)
344AC_SUBST(READLINE_LIBS)
345
346# Curses
347curses=curses
348AC_CHECKING(for curses)
349AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
350if test -n "$curses"; then
351 OLDLIBS=$LIBS
352 LIBS=-l$curses
353 AC_CHECKING(if curses needs termcap)
354 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
355 dnl link with just -lcurses, but then fail with a runtime linker error
356 dnl because you didn't use -ltermcap
357 AC_TRY_RUN([#include <curses.h>
358 main(int argc, char **argv)
359 {
360 initscr();
361 endwin();
362 return 0;
363 }], [CURSES_LIBS="-l$curses"],
364 LIBS="-l$curses -ltermcap"
365 AC_TRY_RUN([#include <curses.h>
366 main(int argc, char **argv)
367 {
368 initscr();
369 endwin();
370 return 0;
371 }], [CURSES_LIBS="-l$curses -ltermcap"],
372 :, :),
373 :)
374 LIBS=$OLDLIBS
375fi
376if test -n "$CURSES_LIBS"; then
377 OLDLIBS=$LIBS
378 LIBS=$CURSES_LIBS
379 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
380 :,
381 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
382 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
383 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
4753fa79 384 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
385 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
ea0caf4a 386 LIBS=$OLDLIBS
387 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
388 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
389else
390 AC_MSG_WARN(Couldn't find -lcurses)
391fi
392AC_SUBST(CURSES_CPPFLAGS)
393AC_SUBST(CURSES_LIBS)
394AC_SUBST(CURSES_SUBDIRS)
395
396
397AC_CHECK_FUNCS(getusershell)
398
25f58600 399MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
ea0caf4a 400MR_INCLUDE('$(SRCTOP)/include')
25f58600 401MR_INCLUDE('$(SRCTOP)/lib')
ea0caf4a 402MR_INCLUDE('$(BUILDTOP)/lib')
403MR_INCLUDE('$(BUILDTOP)/db')
f4036eed 404MR_INCLUDE('$(srcdir)')
ea0caf4a 405LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
406KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
407LIBS="-lmoira $KLIBS"
408AC_SUBST(KLIBS)
409
3fb6166b 410MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
411AC_SUBST(MR_LIBDEP)
412
ea0caf4a 413AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
ee85084d 414 clients/lib/Makefile clients/addusr/Makefile \
415 clients/blanche/Makefile clients/mailmaint/Makefile
416 clients/moira/Makefile clients/mrcheck/Makefile
417 clients/mrtest/Makefile clients/passwd/Makefile
418 update/Makefile man/Makefile \
9ed720ef 419 $SERVER_OUTPUT_FILES $AFS_OUTPUT_FILES \
420 $GDSS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)
This page took 0.168744 seconds and 5 git commands to generate.