summaryrefslogtreecommitdiff
path: root/configure.in
blob: 9b12934aabe6ad4474b249b9458fac24b1d71ea8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
dnl Process this file with autoconf to produce a configure script.
AC_INIT(server/server.c)

if test ! -d h; then mkdir h; fi
if test ! -d h/zephyr; then mkdir h/zephyr; fi

dnl Command-line option to enable Athena paths.
AC_ARG_ENABLE(athena,
	      [  --enable-athena         Use Athena defaults],
	      [hesiod=yes
	       kerberos=yes
	       if test "${prefix}" = "NONE"; then prefix=/usr/athena; fi
	       datadir=${datadir-'$(prefix)/lib/zephyr'}
	       confdir=${confdir-'/etc/athena/zephyr'}
	       sbindir=${sbindir-'$(exec_prefix)/etc'}
	       lsbindir=${lsbindir-'/etc/athena'}
	       COMPILE_ET=compile_et
	       MK_CMDS=mk_cmds
	       CPPFLAGS="${CPPFLAGS} -I/usr/athena/include"
	       LDFLAGS="${LDFLAGS} -L/usr/athena/lib"
	       INITPROGS=${lsbindir}/zinit],
	      [datadir=${datadir-'$(prefix)/share/zephyr'}
	       confdir=${confdir-'$(prefix)/etc/zephyr'}
	       sbindir=${sbindir-'$(exec_prefix)/sbin'}
	       lsbindir=${lsbindir-'$(exec_prefix)/sbin'}
	       SUPPORT_LIBS="et ss"
	       ET_LDFLAGS='-L$(BUILDTOP)/lib/et'
	       ETDEP='$(BUILDTOP)/lib/et/libcom_err.a'
	       SS_LDFLAGS='-L$(BUILDTOP)/lib/ss'
	       SSDEP='$(BUILDTOP)/lib/ss/libss.a'
	       COMPILE_ET='$(BUILDTOP)/lib/et/compile_et'
	       MK_CMDS='$(BUILDTOP)/lib/ss/mk_cmds'
	       INITPROGS=true
	       if test ! -d h/ss; then mkdir h/ss; fi
	       cp ${srcdir}/lib/et/com_err.h h
	       cp ${srcdir}/lib/ss/*.h h/ss])

AC_SUBST(confdir)
AC_SUBST(datadir)
AC_SUBST(sbindir)
AC_SUBST(lsbindir)
AC_SUBST(SUPPORT_LIBS)
AC_SUBST(ET_LDFLAGS)
AC_SUBST(ETDEP)
AC_SUBST(SS_LDFLAGS)
AC_SUBST(SSDEP)
AC_SUBST(COMPILE_ET)
AC_SUBST(MK_CMDS)
AC_SUBST(INITPROGS)

AC_CANONICAL_SYSTEM
AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$host")

dnl Command-line option to enable Hesiod support
AC_ARG_WITH(hesiod,
	    [  --with-hesiod=PREFIX    Compile with Hesiod support],
	    [hesiod="$withval"], [hesiod=${hesiod-no}])

dnl Command-line option to enable Kerberos support
AC_ARG_WITH(krb4,
	    [  --with-krb4=PREFIX      Compile with Kerberos 4 support],
	    [kerberos="$withval"], [kerberos=${kerberos-no}])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_YACC
AC_PROG_LEX
AC_PROG_INSTALL
AC_PROG_RANLIB

AC_MSG_CHECKING(location of temporary directory)
if test -d /var/tmp; then
	found_tmp=/var/tmp/
elif test -d /usr/tmp; then
	found_tmp=/usr/tmp/
else
	found_tmp=/tmp/
fi
AC_DEFINE_UNQUOTED(FOUND_TMP, "${found_tmp}")
AC_MSG_RESULT(${found_tmp})

dnl Checks for header files.
AC_PATH_XTRA
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h paths.h termios.h sgtty.h unistd.h libgen.h malloc.h)
AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h sys/time.h sys/file.h sys/utsname.h)
AC_CHECK_HEADERS(sys/select.h sys/msgbuf.h sys/cdefs.h)

if test "$no_x" != "yes"; then
	XCLIENTS=xzwrite
	ZWGC_LIBX11=-lX11
fi
AC_SUBST(XCLIENTS)
AC_SUBST(ZWGC_LIBX11)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_MSG_CHECKING(for 32-bit integer type)
if test "$ac_cv_sizeof_long" = 4; then
	int32=long
elif test "$ac_cv_sizeof_int" = 4; then
	int32=int
elif test "$ac_cv_sizeof_short" = 4; then
	int32=short
else
	AC_WARN([Can't find 32-bit type, using long])
	int32=long
fi
AC_DEFINE_UNQUOTED(ZEPHYR_INT32, ${int32})
AC_MSG_RESULT(${int32})

AC_CHECK_LIB(w, wslen)
AC_CHECK_LIB(dl, dlopen)

# If we can't find connect, try looking in -lsocket and -lnsl.  The
# Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
# libsocket.so which has a bad implementation of gethostbyname (it
# only looks in /etc/hosts), so we only look for -lsocket if we need
# it.
AC_CHECK_FUNC(connect, :, [AC_CHECK_LIB(socket, socket)
			   AC_CHECK_LIB(nsl, gethostbyname)])

# Hesiod needs -lresolv on Sun systems for res_send.
if test "$hesiod" != "no"; then
	AC_CHECK_LIB(44bsd, strerror)
	AC_CHECK_LIB(resolv, res_send)
fi

AC_CHECK_LIB(curses, tgetstr, [TLIB=-lcurses], [TLIB=-ltermcap])
AC_CHECK_LIB(gen, regcmp, [RLIB=-lgen])
AC_CHECK_LIB(src, srcsrpy, [SLIB=-lsrc; AC_DEFINE(HAVE_SRC)])
AC_SUBST(TLIB)
AC_SUBST(RLIB)
AC_SUBST(SLIB)

if test "$hesiod" != "no"; then
	if test "$hesiod" != "yes"; then
		CPPFLAGS="${CPPFLAGS} -I${hesiod}/include"
		LDFLAGS="${LDFLAGS} -L${hesiod}/lib"
	fi
	AC_DEFINE(ZEPHYR_USES_HESIOD)
	AC_CHECK_LIB(hesiod, hes_resolve, LIBS="-lhesiod ${LIBS}",
		     [AC_CHECK_FUNC(hes_resolve),,
		      AC_ERROR(Hesiod library not found)])
fi

if test "$kerberos" != "no"; then
	if test "$kerberos" != "yes"; then
		CPPFLAGS="${CPPFLAGS} -I${kerberos}/include"
		LDFLAGS="${LDFLAGS} -L${kerberos}/lib"
	fi
	AC_DEFINE(ZEPHYR_USES_KERBEROS)
	AC_CHECK_LIB(krb, krb_mk_req,,
		     [AC_ERROR(Kerberos library not found)], -ldes)
	LIBS="-lkrb -ldes ${LIBS}"
else
	AC_WARN(compiling without Kerberos support; Zephyr will be insecure.)
fi

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_VPRINTF
ZEPHYR_FUNC_REGCOMP
AC_CHECK_FUNCS(putenv re_comp strchr memcpy memmove waitpid getlogin)
AC_CHECK_FUNCS(strerror random lrand48 gethostid krb_get_err_text krb_log)

AC_CONFIG_HEADER(h/config.h h/zephyr/zephyr.h)
AC_OUTPUT(Makefile clients/Makefile clients/syslogd/Makefile
	  clients/xzwrite/Makefile clients/zaway/Makefile clients/zctl/Makefile
	  clients/zleave/Makefile clients/zlocate/Makefile
	  clients/zmailnotify/Makefile clients/znol/Makefile
	  clients/zpopnotify/Makefile clients/zshutdown_notify/Makefile
	  clients/zstat/Makefile clients/zwgc/Makefile clients/zwrite/Makefile
	  lib/Makefile lib/dyn/Makefile lib/et/Makefile lib/ss/Makefile
	  lib/zephyr/Makefile server/Makefile zhm/Makefile
	  clients/xzwrite/XZwrite clients/zwgc/zephyr.vars)