source: trunk/third/moira/configure.in @ 23178

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