]> andersk Git - moira.git/blame - configure.in
Make sure $last is initialized the first time we use it.
[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
3595c6c0 13AC_CANONICAL_HOST
0bec79fd 14# SO_LDFLAGS setting below is a great big ick.
15# But it beats sucking in libtool for one small part of the source tree.
3595c6c0 16case $host_os in
17solaris*)
18 short_os=solaris
0bec79fd 19 SO_LDFLAGS="-G"
3595c6c0 20 ;;
21irix*)
22 short_os=irix
0bec79fd 23 SO_LDFLAGS="-shared"
3595c6c0 24 ;;
25linux*)
26 short_os=linux
0bec79fd 27 SO_LDFLAGS="-shared"
3595c6c0 28 ;;
29esac
0bec79fd 30AC_SUBST(SO_LDFLAGS)
3595c6c0 31
ea0caf4a 32dnl Define for both C and Pro*C
33AC_DEFUN(MR_DEFINE, [
34 AC_DEFINE($1)
35 MR_EXTEND(PRO_C_DEFS, DEFINE=$1)
36])
37
38dnl Add to include path for both C and Pro*C
39AC_DEFUN(MR_INCLUDE, [
40 MR_EXTEND(CPPFLAGS, -I$1)
41 MR_EXTEND(PRO_C_INCLUDES, INCLUDE=$1)
42])
43
44dnl Add to lib path
45AC_DEFUN(MR_LIBS, [MR_EXTEND(LIBPATH, -L$1)])
46
47AC_PROG_CC
48AC_PROG_INSTALL
49AC_PROG_RANLIB
50AC_PROG_MAKE_SET
51
52if test "$athena" = true; then
53 enable_athena=yes
1944209a 54 prefix=/afs/.athena.mit.edu/system/moira
ea0caf4a 55 bindir=$prefix/arch/$ATHENA_SYS/bin
56 sbindir=$bindir
618b3834 57 MR_INCLUDE(/usr/athena/include)
58 MR_INCLUDE(/usr/athena/include/kerberosIV)
59 MR_LIBS(/usr/athena/lib)
ea0caf4a 60fi
61
62# We currently just don't support changing this
63mrbindir=/moira/bin
64AC_SUBST(mrbindir)
65
66# Athena-local policy decisions
67AC_MSG_CHECKING(for Athena)
68AC_ARG_ENABLE(athena,
69 [ --enable-athena Enable Athena-specific policy decisions],
70 , [if test "$athena" = true; then
71 enableval=yes
72 else
73 enableval=no
74 fi])
75AC_MSG_RESULT($enableval)
76if test "$enableval" = yes; then
77 MR_DEFINE(ATHENA)
78fi
79
80# Networking libraries
81AC_CHECKING(network libraries...)
82AC_CHECK_FUNC(gethostbyname, :,
83 AC_CHECK_LIB(nsl, gethostbyname, ,
84 AC_CHECK_LIB(resolv, gethostbyname)))
85AC_CHECK_FUNC(socket, :,
86 AC_CHECK_LIB(socket, socket, ,
87 AC_CHECK_LIB(socket, socket,
88 LIBS="-lsocket -lnsl $LIBS", :,
89 -lnsl)))
90
7f7f279f 91# com_err (required, but can be built)
92AC_MSG_CHECKING(for com_err)
93AC_ARG_WITH(com_err,
94 [ --with-com_err=PREFIX Specify location of com_err],
95 [AC_MSG_RESULT($withval)
96 if test $withval = "no"; then
97 AC_MSG_ERROR(com_err is required for Moira)
98 fi
99 if test $withval != "yes"; then
100 MR_INCLUDE($withval/include)
101 MR_LIBS($withval/lib)
102 fi
103 COMPILE_ET=compile_et],
104 [AC_MSG_RESULT(util/et)
105 COM_ERR_SUBDIR=util/et;
106 MR_INCLUDE(`pwd`/util/et)
107 MR_LIBS(`pwd`/util/et)
108 COMPILE_ET=`pwd`/util/et/compile_et
109 AC_CONFIG_SUBDIRS($COM_ERR_SUBDIR)])
110AC_SUBST(COM_ERR_SUBDIR)
111AC_SUBST(COMPILE_ET)
112
113# Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
ea0caf4a 114AC_MSG_CHECKING(for Kerberos 4)
115AC_ARG_WITH(krb4,
116 [ --with-krb4=PREFIX Specify location of krb4],
117 [krb4="$withval"], [krb4=no])
118AC_MSG_RESULT($krb4)
119if test $krb4 = "no"; then
120 AC_MSG_ERROR(Kerberos is required for Moira)
121fi
122if test "$krb4" != yes; then
123 MR_INCLUDE($krb4/include)
124 if test -d "$krb4/include/kerberosIV"; then
125 MR_INCLUDE($krb4/include/kerberosIV)
126 fi
127 MR_LIBS($krb4/lib)
128elif test -d /usr/include/kerberosIV; then
129 MR_INCLUDE(/usr/include/kerberosIV)
130fi
88c52873 131AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
132 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
ea0caf4a 133AC_CHECK_LIB(krb4, krb_rd_req,
2dd418e4 134 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
ea0caf4a 135 [AC_CHECK_LIB(krb, krb_rd_req,
136 [KRB4_LIBS="-lkrb -ldes"],
137 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
138 $LIBPATH -ldes)],
2dd418e4 139 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
ea0caf4a 140
7f7f279f 141AC_MSG_CHECKING(for Kerberos 5)
142AC_ARG_WITH(krb5,
143 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
144 [krb5="$withval"], [krb5=no])
145AC_MSG_RESULT($krb5)
146if test "$krb5" != no; then
147 REG_SVR_DEFS=-DKRB5
148 if test "$krb5" != yes; then
149 REG_SVR_INCLUDES=-I$krb5/include
150 REG_SVR_LIBS=-L$krb5/lib
151 fi
2dd418e4 152 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -ldyn -lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"
7f7f279f 153else
154 REG_SVR_DEFS=-DKRB4
155 REG_SVR_LIBS=-lkadm
156fi
157AC_SUBST(REG_SVR_DEFS)
158AC_SUBST(REG_SVR_INCLUDES)
159AC_SUBST(REG_SVR_LIBS)
33567bea 160
ea0caf4a 161# Hesiod support
162AC_MSG_CHECKING(for Hesiod)
163AC_ARG_WITH(hesiod,
164 [ --with-hesiod=PREFIX Specify location of Hesiod],
165 [hesiod="$withval"], [hesiod=no])
166AC_MSG_RESULT($hesiod)
167if test "$hesiod" != no; then
168 if test "$hesiod" != yes; then
169 MR_INCLUDE($hesiod/include)
170 MR_LIBS($hesiod/lib)
171 fi
172 AC_CHECK_FUNC(res_send, :,
173 AC_CHECK_LIB(resolv, res_send))
174 AC_CHECK_LIB(hesiod, hes_resolve, :,
175 [AC_MSG_ERROR(Hesiod library not found)],
176 $LIBPATH $LIBS)
177 MR_DEFINE(HAVE_HESIOD)
178fi
179
180# Zephyr support
181AC_MSG_CHECKING(for Zephyr)
182AC_ARG_WITH(zephyr,
183 [ --with-zephyr=PREFIX Specify location of Zephyr],
184 [zephyr="$withval"], [zephyr=no])
185AC_MSG_RESULT($zephyr)
186if test "$zephyr" != no; then
187 if test "$zephyr" != yes; then
188 MR_INCLUDE($zephyr/include)
189 MR_LIBS($zephyr/lib)
190 fi
191 AC_CHECK_LIB(zephyr, ZInitialize, :,
192 [AC_MSG_ERROR(Zephyr library not found)],
193 $LIBPATH $KRB4_LIBS -lcom_err)
194 MR_DEFINE(HAVE_ZEPHYR)
195fi
196
33567bea 197# RSAREF support (default: build util/rsaref if present)
198AC_MSG_CHECKING(for RSAREF)
199AC_ARG_WITH(rsaref,
200 [ --with-rsaref=PREFIX Specify location of RSAREF],
201 [rsaref="$withval"
202 RSAREF_CPPFLAGS="-I$rsaref/include"
203 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
204 RSAREF_SUBDIRS=reg_svr
205 [if test -d $srcdir/util/rsaref; then
206 rsaref=$srcdir/util/rsaref
207 RSAREF_SUBDIRS="util/rsaref reg_svr"
208 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
209 # autoconf can't deal with creating util/rsaref if util doesn't exist
210 if test ! -d util; then
211 mkdir util
212 fi
46fa38eb 213 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
33567bea 214 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
3fb6166b 215 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
33567bea 216 else
217 rsaref=no
218 fi])
219AC_MSG_RESULT($rsaref)
220if test "$rsaref" != no; then
221 MR_DEFINE(HAVE_RSAREF)
222fi
223AC_SUBST(RSAREF_CPPFLAGS)
224AC_SUBST(RSAREF_LIBS)
225AC_SUBST(RSAREF_SUBDIRS)
3fb6166b 226AC_SUBST(RSAREF_LIBDEP)
33567bea 227
ea0caf4a 228# Oracle (default: yes, if $ORACLE_HOME is set)
229AC_MSG_CHECKING(for Oracle)
230AC_ARG_WITH(oracle,
231 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
232 [oracle="$withval"],
233 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
234 oracle=$ORACLE_HOME
235 else
236 oracle=no
237 fi])
238AC_MSG_RESULT($oracle)
239if test "$oracle" != no; then
cd357ef5 240 AC_MSG_CHECKING(Pro*C version)
241 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
242 AC_MSG_RESULT($release)
243 case $release in
244 2.0.6.0.0)
245 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
246 ;;
7e38e77c 247 2.2.4.0.0)
cd357ef5 248 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"
249 ;;
7e38e77c 250 *)
dc02aea5 251 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
7e38e77c 252 ;;
cd357ef5 253 esac
ea0caf4a 254 SVRSUBDIRS='$(SVRDIRS)'
ac1784ed 255 SERVER_OUTPUT_FILES="db/Makefile server/Makefile backup/Makefile dbck/Makefile dcm/Makefile gen/Makefile incremental/Makefile incremental/mailman/Makefile reg_svr/Makefile regtape/Makefile"
ea0caf4a 256 PRO_C=$oracle/bin/proc
257 PRO_C_OPTS=CODE=ANSI_C
cd357ef5 258 PRO_C_DEFS="DEFINE=_PROC_ $PRO_C_DEFS"
ea0caf4a 259fi
260AC_SUBST(PRO_C)
261AC_SUBST(PRO_C_DEFS)
262AC_SUBST(PRO_C_INCLUDES)
263AC_SUBST(PRO_C_OPTS)
264AC_SUBST(SQL_LIBS)
265AC_SUBST(SVRSUBDIRS)
266
3595c6c0 267# Java support, for webmoira
268AC_MSG_CHECKING(for Java)
269AC_ARG_WITH(java,
270 [ --with-java=PREFIX Specify location of Java libs and headers],
271 [ java="$withval"],
272 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
273 java=$JAVA_HOME
274 else
275 java=no
276 fi])
277AC_MSG_RESULT($java)
278if test "$java" != no; then
279 if test "$java" != yes; then
280 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
281 fi
282 MR_DEFINE(HAVE_JAVA)
283
284 WEBMOIRA_SUBDIRS="webmoira"
285 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
286fi
287AC_SUBST(JAVA_CPPFLAGS)
a5a4b554 288AC_SUBST(WEBMOIRA_SUBDIRS)
3595c6c0 289
9b1f5e48 290# LDAP support
291AC_MSG_CHECKING(for LDAP)
292AC_ARG_WITH(ldap,
293 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
294 [ ldap="$withval"],
295 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
296 ldap=$LDAP_HOME
297 else
298 ldap=no
299 fi])
300AC_MSG_RESULT($ldap)
301if test "$ldap" != no -a "$oracle" != no; then
302 if test "$ldap" != yes; then
303 LDAP_CPPFLAGS="-I$ldap/include"
304 LDAP_LIBS="-L$ldap/lib"
305 fi
306 MR_DEFINE(HAVE_LDAP)
307
308 WINAD_SUBDIRS="winad"
309 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
310fi
311AC_SUBST(LDAP_CPPFLAGS)
312AC_SUBST(LDAP_LIBS)
313AC_SUBST(WINAD_SUBDIRS)
314
ea0caf4a 315# AFS support
316AC_MSG_CHECKING(for AFS)
317AC_ARG_WITH(afs,
318 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
319 [afs="$withval"], [afs=no])
320AC_MSG_RESULT($afs)
321if test "$afs" != no -a "$oracle" != no; then
322 if test "$afs" != yes; then
323 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
324 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
325 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
326 AFS_DIR=$afs
327 fi
ea0caf4a 328 AC_CHECK_LIB(sys, pioctl, :,
329 [AC_MSG_ERROR(AFS libraries not found)],
5b723b3d 330 $AFS_LIBS -lrx -llwp -lsys)
ea0caf4a 331 MR_DEFINE(HAVE_AFS)
9ed720ef 332
9b1f5e48 333 AFS_SUBDIRS="afs"
334 AFS_OUTPUT_FILES="incremental/afs/Makefile"
9ed720ef 335 if test -d $srcdir/afssync; then
9b1f5e48 336 AFS_SYNCDIR="afssync"
9ed720ef 337 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
338 fi
ea0caf4a 339fi
340AC_SUBST(AFS_CPPFLAGS)
341AC_SUBST(AFS_PRO_C_INCLUDES)
342AC_SUBST(AFS_LIBS)
ea0caf4a 343AC_SUBST(AFS_DIR)
9ed720ef 344AC_SUBST(AFS_SUBDIRS)
9b1f5e48 345AC_SUBST(AFS_SYNCDIR)
ea0caf4a 346
347# GNU readline
348AC_CHECKING(for GNU readline...)
349AC_ARG_WITH(readline,
350 [ --with-readline=PREFIX Specify location of GNU readline],
ee85084d 351 [readline="$withval"; AC_MSG_RESULT($withval)],
352 [AC_CHECK_LIB(readline, readline, [readline=yes],
353 [if test "$athena" = true; then
354 unset ac_cv_lib_readline_readline
355 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
356 -L/mit/gnu/lib -ltermcap)
357 fi],
358 -ltermcap)])
ea0caf4a 359if test "$readline" != no; then
360 if test "$readline" != yes; then
c5c5a18d 361 READLINE_CPPFLAGS="-I$readline/include"
ee85084d 362 READLINE_LIBS="-L$readline/lib"
ea0caf4a 363 fi
ee85084d 364 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
365 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
ea0caf4a 366fi
367AC_SUBST(READLINE_CPPFLAGS)
368AC_SUBST(READLINE_LIBS)
369
370# Curses
371curses=curses
372AC_CHECKING(for curses)
373AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
374if test -n "$curses"; then
375 OLDLIBS=$LIBS
376 LIBS=-l$curses
377 AC_CHECKING(if curses needs termcap)
378 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
379 dnl link with just -lcurses, but then fail with a runtime linker error
380 dnl because you didn't use -ltermcap
381 AC_TRY_RUN([#include <curses.h>
382 main(int argc, char **argv)
383 {
384 initscr();
385 endwin();
386 return 0;
387 }], [CURSES_LIBS="-l$curses"],
388 LIBS="-l$curses -ltermcap"
389 AC_TRY_RUN([#include <curses.h>
390 main(int argc, char **argv)
391 {
392 initscr();
393 endwin();
394 return 0;
395 }], [CURSES_LIBS="-l$curses -ltermcap"],
396 :, :),
397 :)
398 LIBS=$OLDLIBS
399fi
400if test -n "$CURSES_LIBS"; then
401 OLDLIBS=$LIBS
402 LIBS=$CURSES_LIBS
403 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
404 :,
405 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
406 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
407 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
4753fa79 408 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
409 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
ea0caf4a 410 LIBS=$OLDLIBS
411 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
412 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
413else
414 AC_MSG_WARN(Couldn't find -lcurses)
415fi
416AC_SUBST(CURSES_CPPFLAGS)
417AC_SUBST(CURSES_LIBS)
418AC_SUBST(CURSES_SUBDIRS)
419
420
83a0db38 421AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
533bacb3 422
423AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
424
7674bbe4 425AC_CHECK_HEADERS(unistd.h getopt.h)
426
427AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
428
429if test "$no_netinet_in" != "yes"; then
430 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
431 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
432 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
433 AC_MSG_RESULT($ac_cv_type_in_addr_t)
434fi
435
436if test "$ac_cv_type_in_addr_t" != "yes"; then
437 AC_DEFINE(in_addr_t, uint32_t)
438fi
ea0caf4a 439
25f58600 440MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
ea0caf4a 441MR_INCLUDE('$(SRCTOP)/include')
25f58600 442MR_INCLUDE('$(SRCTOP)/lib')
ea0caf4a 443MR_INCLUDE('$(BUILDTOP)/lib')
444MR_INCLUDE('$(BUILDTOP)/db')
f4036eed 445MR_INCLUDE('$(srcdir)')
ea0caf4a 446LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
447KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
448LIBS="-lmoira $KLIBS"
449AC_SUBST(KLIBS)
450
3fb6166b 451MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
452AC_SUBST(MR_LIBDEP)
453
ea0caf4a 454AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
ee85084d 455 clients/lib/Makefile clients/addusr/Makefile \
f62cd5c0 456 clients/blanche/Makefile clients/chfn/Makefile \
457 clients/chpobox/Makefile clients/chsh/Makefile \
458 clients/mailmaint/Makefile clients/mitch/Makefile \
7cc696ad 459 clients/moira/Makefile clients/mrcheck/Makefile \
460 clients/mrtest/Makefile clients/stanley/Makefile \
461 clients/stella/Makefile update/Makefile man/Makefile \
462 $WEBMOIRA_OUTPUT_FILES $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES \
463 $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)
This page took 0.33613 seconds and 5 git commands to generate.