]> andersk Git - moira.git/blame - configure.in
Convert v4 principals to v5 principals the right way.
[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)
7f7f279f 105 MR_INCLUDE(`pwd`/util/et)
106 MR_LIBS(`pwd`/util/et)
107 COMPILE_ET=`pwd`/util/et/compile_et
00274452 108 AC_CONFIG_SUBDIRS(util/et)])
7f7f279f 109AC_SUBST(COM_ERR_SUBDIR)
110AC_SUBST(COMPILE_ET)
111
112# Kerberos (Kerberos 4 required, Kerberos 5 optional for reg_svr)
ea0caf4a 113AC_MSG_CHECKING(for Kerberos 4)
114AC_ARG_WITH(krb4,
115 [ --with-krb4=PREFIX Specify location of krb4],
116 [krb4="$withval"], [krb4=no])
117AC_MSG_RESULT($krb4)
118if test $krb4 = "no"; then
119 AC_MSG_ERROR(Kerberos is required for Moira)
120fi
121if test "$krb4" != yes; then
122 MR_INCLUDE($krb4/include)
123 if test -d "$krb4/include/kerberosIV"; then
124 MR_INCLUDE($krb4/include/kerberosIV)
125 fi
126 MR_LIBS($krb4/lib)
127elif test -d /usr/include/kerberosIV; then
128 MR_INCLUDE(/usr/include/kerberosIV)
129fi
88c52873 130AC_CHECK_LIB(k5crypto, main, crypto="k5crypto",
131 [AC_CHECK_LIB(crypto, main, crypto="crypto")])
ea0caf4a 132AC_CHECK_LIB(krb4, krb_rd_req,
2dd418e4 133 [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"],
ea0caf4a 134 [AC_CHECK_LIB(krb, krb_rd_req,
135 [KRB4_LIBS="-lkrb -ldes"],
136 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
137 $LIBPATH -ldes)],
2dd418e4 138 $LIBPATH -ldes425 -lkrb5 -l${crypto} -lcom_err -lresolv)
ea0caf4a 139
7f7f279f 140AC_MSG_CHECKING(for Kerberos 5)
141AC_ARG_WITH(krb5,
142 [ --with-krb5=PREFIX Specify location of krb5 (for reg_svr)],
143 [krb5="$withval"], [krb5=no])
144AC_MSG_RESULT($krb5)
145if test "$krb5" != no; then
146 REG_SVR_DEFS=-DKRB5
147 if test "$krb5" != yes; then
148 REG_SVR_INCLUDES=-I$krb5/include
149 REG_SVR_LIBS=-L$krb5/lib
150 fi
00274452 151 REG_SVR_LIBS="$REG_SVR_LIBS -lkadm5clnt -lgssapi_krb5 -lgssrpc -lkrb4 -ldes425 -lkrb5 -l${crypto} -lresolv"
7f7f279f 152else
153 REG_SVR_DEFS=-DKRB4
154 REG_SVR_LIBS=-lkadm
155fi
156AC_SUBST(REG_SVR_DEFS)
157AC_SUBST(REG_SVR_INCLUDES)
158AC_SUBST(REG_SVR_LIBS)
33567bea 159
ea0caf4a 160# Hesiod support
161AC_MSG_CHECKING(for Hesiod)
162AC_ARG_WITH(hesiod,
163 [ --with-hesiod=PREFIX Specify location of Hesiod],
164 [hesiod="$withval"], [hesiod=no])
165AC_MSG_RESULT($hesiod)
166if test "$hesiod" != no; then
167 if test "$hesiod" != yes; then
168 MR_INCLUDE($hesiod/include)
169 MR_LIBS($hesiod/lib)
170 fi
171 AC_CHECK_FUNC(res_send, :,
172 AC_CHECK_LIB(resolv, res_send))
173 AC_CHECK_LIB(hesiod, hes_resolve, :,
174 [AC_MSG_ERROR(Hesiod library not found)],
175 $LIBPATH $LIBS)
176 MR_DEFINE(HAVE_HESIOD)
177fi
178
179# Zephyr support
180AC_MSG_CHECKING(for Zephyr)
181AC_ARG_WITH(zephyr,
182 [ --with-zephyr=PREFIX Specify location of Zephyr],
183 [zephyr="$withval"], [zephyr=no])
184AC_MSG_RESULT($zephyr)
185if test "$zephyr" != no; then
186 if test "$zephyr" != yes; then
187 MR_INCLUDE($zephyr/include)
188 MR_LIBS($zephyr/lib)
189 fi
190 AC_CHECK_LIB(zephyr, ZInitialize, :,
191 [AC_MSG_ERROR(Zephyr library not found)],
192 $LIBPATH $KRB4_LIBS -lcom_err)
193 MR_DEFINE(HAVE_ZEPHYR)
194fi
195
33567bea 196# RSAREF support (default: build util/rsaref if present)
197AC_MSG_CHECKING(for RSAREF)
198AC_ARG_WITH(rsaref,
199 [ --with-rsaref=PREFIX Specify location of RSAREF],
200 [rsaref="$withval"
201 RSAREF_CPPFLAGS="-I$rsaref/include"
202 RSAREF_LIBS="$rsaref/lib/rsaref.a"],
203 RSAREF_SUBDIRS=reg_svr
204 [if test -d $srcdir/util/rsaref; then
205 rsaref=$srcdir/util/rsaref
206 RSAREF_SUBDIRS="util/rsaref reg_svr"
207 RSAREF_OUTPUT_FILES="util/rsaref/Makefile"
208 # autoconf can't deal with creating util/rsaref if util doesn't exist
209 if test ! -d util; then
210 mkdir util
211 fi
46fa38eb 212 RSAREF_CPPFLAGS='-I$(SRCTOP)/util/rsaref'
33567bea 213 RSAREF_LIBS='$(BUILDTOP)/util/rsaref/rsaref.a'
3fb6166b 214 RSAREF_LIBDEP='$(BUILDTOP)/util/rsaref/rsaref.a'
33567bea 215 else
216 rsaref=no
217 fi])
218AC_MSG_RESULT($rsaref)
219if test "$rsaref" != no; then
220 MR_DEFINE(HAVE_RSAREF)
221fi
222AC_SUBST(RSAREF_CPPFLAGS)
223AC_SUBST(RSAREF_LIBS)
224AC_SUBST(RSAREF_SUBDIRS)
3fb6166b 225AC_SUBST(RSAREF_LIBDEP)
33567bea 226
ea0caf4a 227# Oracle (default: yes, if $ORACLE_HOME is set)
228AC_MSG_CHECKING(for Oracle)
229AC_ARG_WITH(oracle,
230 [ --with-oracle=PREFIX Specify location of Oracle (for server)],
231 [oracle="$withval"],
232 [if test -n "$ORACLE_HOME" -a -d "$ORACLE_HOME"; then
233 oracle=$ORACLE_HOME
234 else
235 oracle=no
236 fi])
237AC_MSG_RESULT($oracle)
238if test "$oracle" != no; then
cd357ef5 239 AC_MSG_CHECKING(Pro*C version)
240 ORACLE_HOME=$oracle release=`$ORACLE_HOME/bin/proc | awk '/Release/ {print $3;}'`
241 AC_MSG_RESULT($release)
242 case $release in
243 2.0.6.0.0)
244 SQL_LIBS="-L$oracle/lib -lsql $oracle/lib/osntab.o -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcore -lm"
245 ;;
7e38e77c 246 2.2.4.0.0)
cd357ef5 247 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"
248 ;;
00274452 249 8.1.7.4.0)
dc02aea5 250 SQL_LIBS="-L$oracle/lib -lclntsh `cat $oracle/lib/sysliblist` -R$oracle/lib -laio -lm -lthread"
7e38e77c 251 ;;
00274452 252 10.2.0.2.0)
253 SQL_LIBS="-L$oracle/lib32 -lclntsh `cat $oracle/lib32/ldflags` `cat $oracle/lib32/sysliblist` -R$oracle/lib32 -laio -lposix4 -lm -lthread"
254 ;;
255 *)
256 AC_MSG_ERROR(Unsupported Oracle release)
257 ;;
cd357ef5 258 esac
ea0caf4a 259 SVRSUBDIRS='$(SVRDIRS)'
ac1784ed 260 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 261 PRO_C=$oracle/bin/proc
262 PRO_C_OPTS=CODE=ANSI_C
00274452 263 PRO_C_DEFS="DEFINE=_PROC_ DEFINE=__sparc $PRO_C_DEFS"
ea0caf4a 264fi
265AC_SUBST(PRO_C)
266AC_SUBST(PRO_C_DEFS)
267AC_SUBST(PRO_C_INCLUDES)
268AC_SUBST(PRO_C_OPTS)
269AC_SUBST(SQL_LIBS)
270AC_SUBST(SVRSUBDIRS)
271
3595c6c0 272# Java support, for webmoira
273AC_MSG_CHECKING(for Java)
274AC_ARG_WITH(java,
275 [ --with-java=PREFIX Specify location of Java libs and headers],
276 [ java="$withval"],
277 [if test -n "$JAVA_HOME" -a -d "$JAVA_HOME"; then
278 java=$JAVA_HOME
279 else
280 java=no
281 fi])
282AC_MSG_RESULT($java)
283if test "$java" != no; then
284 if test "$java" != yes; then
285 JAVA_CPPFLAGS="-I$java/include -I$java/include/$short_os"
286 fi
287 MR_DEFINE(HAVE_JAVA)
288
289 WEBMOIRA_SUBDIRS="webmoira"
290 WEBMOIRA_OUTPUT_FILES="webmoira/Makefile"
291fi
292AC_SUBST(JAVA_CPPFLAGS)
a5a4b554 293AC_SUBST(WEBMOIRA_SUBDIRS)
3595c6c0 294
9b1f5e48 295# LDAP support
296AC_MSG_CHECKING(for LDAP)
297AC_ARG_WITH(ldap,
298 [ --with-ldap=PREFIX Specify location of LDAP libs (for server)],
299 [ ldap="$withval"],
300 [if test -n "$LDAP_HOME" -a -d "$LDAP_HOME"; then
301 ldap=$LDAP_HOME
302 else
303 ldap=no
304 fi])
305AC_MSG_RESULT($ldap)
306if test "$ldap" != no -a "$oracle" != no; then
307 if test "$ldap" != yes; then
308 LDAP_CPPFLAGS="-I$ldap/include"
309 LDAP_LIBS="-L$ldap/lib"
310 fi
311 MR_DEFINE(HAVE_LDAP)
312
313 WINAD_SUBDIRS="winad"
314 WINAD_OUTPUT_FILES="incremental/winad/Makefile"
315fi
316AC_SUBST(LDAP_CPPFLAGS)
317AC_SUBST(LDAP_LIBS)
318AC_SUBST(WINAD_SUBDIRS)
319
ea0caf4a 320# AFS support
321AC_MSG_CHECKING(for AFS)
322AC_ARG_WITH(afs,
323 [ --with-afs=PREFIX Specify location of AFS libs (for server)],
324 [afs="$withval"], [afs=no])
325AC_MSG_RESULT($afs)
326if test "$afs" != no -a "$oracle" != no; then
327 if test "$afs" != yes; then
328 AFS_CPPFLAGS="-I$afs/include -I$afs/include/afs -I$afs/include/rx"
329 AFS_PRO_C_INCLUDES="INCLUDE=$afs/include INCLUDE=$afs/include/afs INCLUDE=$afs/include/rx"
330 AFS_LIBS="-L$afs/lib -L$afs/lib/afs"
331 AFS_DIR=$afs
332 fi
ea0caf4a 333 AC_CHECK_LIB(sys, pioctl, :,
334 [AC_MSG_ERROR(AFS libraries not found)],
00274452 335 $AFS_LIBS -lrx -llwp -lsys -lafsutil)
ea0caf4a 336 MR_DEFINE(HAVE_AFS)
9ed720ef 337
9b1f5e48 338 AFS_SUBDIRS="afs"
339 AFS_OUTPUT_FILES="incremental/afs/Makefile"
9ed720ef 340 if test -d $srcdir/afssync; then
9b1f5e48 341 AFS_SYNCDIR="afssync"
9ed720ef 342 AFS_OUTPUT_FILES="$AFS_OUTPUT_FILES afssync/Makefile"
343 fi
ea0caf4a 344fi
345AC_SUBST(AFS_CPPFLAGS)
346AC_SUBST(AFS_PRO_C_INCLUDES)
347AC_SUBST(AFS_LIBS)
ea0caf4a 348AC_SUBST(AFS_DIR)
9ed720ef 349AC_SUBST(AFS_SUBDIRS)
9b1f5e48 350AC_SUBST(AFS_SYNCDIR)
ea0caf4a 351
352# GNU readline
353AC_CHECKING(for GNU readline...)
354AC_ARG_WITH(readline,
355 [ --with-readline=PREFIX Specify location of GNU readline],
ee85084d 356 [readline="$withval"; AC_MSG_RESULT($withval)],
357 [AC_CHECK_LIB(readline, readline, [readline=yes],
358 [if test "$athena" = true; then
359 unset ac_cv_lib_readline_readline
360 AC_CHECK_LIB(readline, readline, [readline=/mit/gnu], :,
361 -L/mit/gnu/lib -ltermcap)
362 fi],
363 -ltermcap)])
ea0caf4a 364if test "$readline" != no; then
365 if test "$readline" != yes; then
c5c5a18d 366 READLINE_CPPFLAGS="-I$readline/include"
ee85084d 367 READLINE_LIBS="-L$readline/lib"
ea0caf4a 368 fi
ee85084d 369 READLINE_CPPFLAGS="$READLINE_CPPFLAGS -DHAVE_READLINE"
370 READLINE_LIBS="$READLINE_LIBS -lreadline -ltermcap"
ea0caf4a 371fi
372AC_SUBST(READLINE_CPPFLAGS)
373AC_SUBST(READLINE_LIBS)
374
375# Curses
376curses=curses
377AC_CHECKING(for curses)
378AC_CHECK_LIB(curses, main, :, AC_CHECK_LIB(ncurses, main, curses=ncurses))
379if test -n "$curses"; then
380 OLDLIBS=$LIBS
381 LIBS=-l$curses
382 AC_CHECKING(if curses needs termcap)
383 dnl we need to use AC_TRY_RUN because under NetBSD, the program will
384 dnl link with just -lcurses, but then fail with a runtime linker error
385 dnl because you didn't use -ltermcap
386 AC_TRY_RUN([#include <curses.h>
387 main(int argc, char **argv)
388 {
389 initscr();
390 endwin();
391 return 0;
392 }], [CURSES_LIBS="-l$curses"],
393 LIBS="-l$curses -ltermcap"
394 AC_TRY_RUN([#include <curses.h>
395 main(int argc, char **argv)
396 {
397 initscr();
398 endwin();
399 return 0;
400 }], [CURSES_LIBS="-l$curses -ltermcap"],
401 :, :),
402 :)
403 LIBS=$OLDLIBS
404fi
405if test -n "$CURSES_LIBS"; then
406 OLDLIBS=$LIBS
407 LIBS=$CURSES_LIBS
408 AC_TRY_LINK([#include <curses.h>],[WINDOW *w; getmaxx(w);],
409 :,
410 AC_TRY_COMPILE([#include <curses.h>],[WINDOW *w; w->_maxx;],
411 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->_maxx'"],
412 [CURSES_CPPFLAGS="-D'getmaxx(w)=w->maxx'"]))
4753fa79 413 AC_TRY_LINK([#include <curses.h>],[newterm(NULL, NULL, NULL);],
414 [CURSES_CPPFLAGS="$CURSES_CPPFLAGS -DCURSES_HAS_NEWTERM"])
ea0caf4a 415 LIBS=$OLDLIBS
416 CURSES_CPPFLAGS="-DHAVE_CURSES $CURSES_CPPFLAGS"
417 CURSES_SUBDIRS='$(CURSES_SUBDIRS)'
418else
419 AC_MSG_WARN(Couldn't find -lcurses)
420fi
421AC_SUBST(CURSES_CPPFLAGS)
422AC_SUBST(CURSES_LIBS)
423AC_SUBST(CURSES_SUBDIRS)
424
425
83a0db38 426AC_CHECK_FUNCS(getusershell strlcpy strlcat uname strvis)
533bacb3 427
428AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
429
7674bbe4 430AC_CHECK_HEADERS(unistd.h getopt.h)
431
432AC_CHECK_HEADER(netinet/in.h, AC_DEFINE(HAVE_NETINET_IN_H), no_netinet_in=yes)
433
434if test "$no_netinet_in" != "yes"; then
435 AC_MSG_CHECKING(for in_addr_t defined in netinet/in.h)
436 AC_EGREP_HEADER(in_addr_t, netinet/in.h,
437 ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)
438 AC_MSG_RESULT($ac_cv_type_in_addr_t)
439fi
440
441if test "$ac_cv_type_in_addr_t" != "yes"; then
442 AC_DEFINE(in_addr_t, uint32_t)
443fi
ea0caf4a 444
25f58600 445MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
ea0caf4a 446MR_INCLUDE('$(SRCTOP)/include')
25f58600 447MR_INCLUDE('$(SRCTOP)/lib')
ea0caf4a 448MR_INCLUDE('$(BUILDTOP)/lib')
449MR_INCLUDE('$(BUILDTOP)/db')
f4036eed 450MR_INCLUDE('$(srcdir)')
ea0caf4a 451LDFLAGS="$LDFLAGS -L\$(BUILDTOP)/lib $LIBPATH"
452KLIBS="-lzephyr $KRB4_LIBS -lcom_err -lhesiod $LIBS"
453LIBS="-lmoira $KLIBS"
454AC_SUBST(KLIBS)
455
3fb6166b 456MR_LIBDEP='$(BUILDTOP)/lib/libmoira.a'
457AC_SUBST(MR_LIBDEP)
458
ea0caf4a 459AC_OUTPUT(Makefile lib/Makefile include/Makefile clients/Makefile \
ee85084d 460 clients/lib/Makefile clients/addusr/Makefile \
f62cd5c0 461 clients/blanche/Makefile clients/chfn/Makefile \
462 clients/chpobox/Makefile clients/chsh/Makefile \
463 clients/mailmaint/Makefile clients/mitch/Makefile \
7cc696ad 464 clients/moira/Makefile clients/mrcheck/Makefile \
465 clients/mrtest/Makefile clients/stanley/Makefile \
466 clients/stella/Makefile update/Makefile man/Makefile \
467 $WEBMOIRA_OUTPUT_FILES $SERVER_OUTPUT_FILES $WINAD_OUTPUT_FILES \
468 $AFS_OUTPUT_FILES $RSAREF_OUTPUT_FILES)
This page took 0.1322 seconds and 5 git commands to generate.