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

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