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

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