fixes for build headers
[heimdal.git] / configure.in
blobf7ebd5fb0a6acc505740612b3feb396fee22162f
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
3 AC_INIT(lib/krb5/send_to_kdc.c)
4 AM_CONFIG_HEADER(include/config.h)
6 AM_INIT_AUTOMAKE(heimdal,0.0f)
8 AC_PREFIX_DEFAULT(/usr/heimdal)
10 AC_CANONICAL_HOST
11 CANONICAL_HOST=$host
12 AC_SUBST(CANONICAL_HOST)
14 case "$host" in 
15 *-*-sunos4*)
16         AC_DEFINE(SunOS, 4)
17         ;;
18 esac
20 dnl Checks for programs.
21 AC_PROG_CC
23 dnl AC_KRB_PROG_YACC
24 AC_PROG_YACC
25 AC_PROG_LEX
26 AC_PROG_RANLIB
27 AC_PROG_AWK
28 AC_KRB_PROG_LN_S
30 if test "$GCC" = "yes"; then
31   WFLAGS="-Wall -Wno-unused -Wmissing-prototypes"
33 AC_SUBST(WFLAGS)
34 CFLAGS="-g"
36 berkeley_db=db
37 AC_ARG_WITH(berkeley-db,
38 [  --without-berkeley-db   if you don't want berkeley db],[
39 if test "$withval" = no; then
40         berkeley_db=""
44 AC_TEST_PACKAGE(krb4,krb.h,libkrb.a,-lkrb)
46 if test "$with_krb4"; then
47         AC_DEFINE(KRB4, 1)
48         LIB_krb4="$KRB4LIB -ldes"
49         INCLUDE_krb4="$KRB4INCLUDE"
50         EXTRA_LIB45=lib45.a
51         AC_SUBST(EXTRA_LIB45)
53 AM_CONDITIONAL(KRB4, test "$with_krb4")
54 AC_SUBST(LIB_krb4)
55 AC_SUBST(INCLUDE_krb4)
57 AC_ARG_ENABLE(kaserver,
58 [  --enable-kaserver       if you want the KDC to try to emulate a kaserver],
60 if test "$enableval" != no; then
61         AC_DEFINE(KASERVER, 1)
62         if test "x$with_krb4" = "x"; then
63                 AC_MSG_ERROR(kaserver requires krb4)
64                 exit 1
65         fi
69 AC_TEST_PACKAGE(readline,readline.h,libreadline.a,-lreadline)
71 AC_C_BIGENDIAN
72 AC_C_INLINE
74 dnl AM_C_PROTOTYPES
76 dnl Checks for typedefs, structures, and compiler characteristics.
77 AC_C_CONST
78 AC_TYPE_OFF_T
79 AC_TYPE_SIZE_T
80 AC_TYPE_MODE_T
81 AC_HEADER_TIME
82 AC_STRUCT_TM
83 AC_DECL_YYTEXT
85 dnl Checks for header files.
86 AC_HEADER_STDC
88 AC_CHECK_HEADERS(arpa/inet.h arpa/telnet.h bsdsetjmp.h crypt.h)
89 AC_CHECK_HEADERS(curses.h db.h dbm.h dirent.h err.h errno.h)
90 AC_CHECK_HEADERS(fcntl.h grp.h limits.h ndbm.h net/if.h netdb.h)
91 AC_CHECK_HEADERS(netinet/in.h netinet/in6.h)
92 AC_CHECK_HEADERS(netinet/in6_machtypes.h netinet/in_systm.h)
93 AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinfo/ni.h paths.h pty.h pwd.h)
94 AC_CHECK_HEADERS(rpcsvc/dbm.h sac.h shadow.h signal.h stropts.h)
95 AC_CHECK_HEADERS(sys/bitypes.h sys/file.h sys/filio.h sys/ioctl.h)
96 AC_CHECK_HEADERS(sys/param.h sys/proc.h sys/pty.h sys/ptyio.h)
97 AC_CHECK_HEADERS(sys/ptyvar.h sys/resource.h sys/select.h)
98 AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/stat.h sys/stream.h)
99 AC_CHECK_HEADERS(sys/stropts.h sys/sysctl.h sys/time.h sys/timeb.h)
100 AC_CHECK_HEADERS(sys/times.h sys/tty.h sys/types.h sys/uio.h)
101 AC_CHECK_HEADERS(sys/utsname.h sys/wait.h syslog.h termio.h)
102 AC_CHECK_HEADERS(termios.h tmpdir.h unistd.h util.h utmp.h utmpx.h)
104 if test "$ac_cv_header_err_h" = no; then
105         EXTRA_HDRS="$EXTRA_HDRS err.h"
106         AC_SUBST(EXTRA_HDRS)
109 dnl Checks for libraries.
111 AC_FIND_FUNC(socket, socket)
112 AC_FIND_FUNC(gethostbyname, nsl)
113 AC_FIND_FUNC(dbopen, $berkeley_db)
114 AC_FIND_FUNC(dbm_firstkey, $berkeley_db gdbm ndbm)
115 AC_FIND_FUNC(syslog, syslog)
117 AC_FIND_FUNC(logwtmp, util)
118 AC_FIND_FUNC_NO_LIBS(tgetent, termcap)
120 dnl Checks for library functions.
122 AC_BROKEN_SNPRINTF
123 AC_BROKEN_VSNPRINTF
125 AC_CHECK_FUNCS(_getpty asnprintf asprintf fcntl gethostname)
126 AC_CHECK_FUNCS(getmsg grantpt logwtmp mktime ptsname rand random)
127 AC_CHECK_FUNCS(revoke select setitimer setlogin setpcred setpgid)
128 AC_CHECK_FUNCS(setsid setsockopt strstr timegm ttyname umask)
129 AC_CHECK_FUNCS(unlockpt vasnprintf vasprintf vhangup)
131 AC_TYPE_SIGNAL
132 if test "$ac_cv_type_signal" = "void" ; then
133         AC_DEFINE(VOID_RETSIGTYPE, 1)
135 AC_SUBST(VOID_RETSIGTYPE)
137 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
138 [#ifdef HAVE_NETDB_H
139 #include <netdb.h>
140 #endif],
143 AC_BROKEN(chown daemon err errx fchown flock getcwd)
144 AC_BROKEN(getdtablesize getusershell inet_aton initgroups)
145 AC_BROKEN(lstat memmove mkstemp putenv rcmd setegid setenv)
146 AC_BROKEN(seteuid strcasecmp strdup strerror strftime)
147 AC_BROKEN(strlwr strnlen strsep strtok_r strupr unsetenv)
148 AC_BROKEN(verr verrx vsyslog vwarn vwarnx warn warnx)
150 AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
151 ac_cv_func_realloc_broken=no
152 AC_TRY_RUN([
153 #include <stddef.h>
154 #include <stdlib.h>
156 int main()
158         return realloc(NULL, 17) == NULL;
160 ],:, ac_cv_func_realloc_broken=yes, :)
162 if test "$ac_cv_func_realloc_broken" = yes ; then
163         AC_DEFINE(BROKEN_REALLOC)
166 dnl AC_KRB_FUNC_GETCWD_BROKEN
169 dnl Checks for prototypes and declarations
172 AC_NEED_PROTO([
173 #ifdef HAVE_CRYPT_H
174 #include <crypt.h>
175 #endif
176 #ifdef HAVE_UNISTD_H
177 #include <unistd.h>
178 #endif
180 crypt)
182 AC_NEED_PROTO([
183 #include <string.h>
185 strtok_r)
187 AC_CHECK_VAR([#ifdef HAVE_SYS_TYPES_H
188 #include <sys/types.h>
189 #endif
190 #ifdef HAVE_NETDB_H
191 #include <netdb.h>
192 #endif],
193 h_errno)
195 AC_CHECK_VAR([#ifdef HAVE_NETDB_H
196 #include <netdb.h>
197 #endif],
198 h_errlist)
200 AC_CHECK_VAR([#ifdef HAVE_NETDB_H
201 #include <netdb.h>
202 #endif],
203 h_nerr)
205 AC_CHECK_VAR([#ifdef HAVE_ERR_H
206 #include <err.h>
207 #endif],[__progname])
209 AC_CHECK_DECLARATION([#include <stdlib.h>], optarg)
210 AC_CHECK_DECLARATION([#include <stdlib.h>], optind)
211 AC_CHECK_DECLARATION([#include <stdlib.h>], opterr)
212 AC_CHECK_DECLARATION([#include <stdlib.h>], optopt)
215 dnl Check for fields in struct utmp
217 AC_EGREP_HEADER(ut_user, utmp.h, AC_DEFINE(HAVE_UT_USER))
218 AC_EGREP_HEADER(ut_host, utmp.h, AC_DEFINE(HAVE_UT_HOST))
219 AC_EGREP_HEADER(ut_addr, utmp.h, AC_DEFINE(HAVE_UT_ADDR))
220 AC_EGREP_HEADER(ut_type, utmp.h, AC_DEFINE(HAVE_UT_TYPE))
221 AC_EGREP_HEADER(ut_pid, utmp.h, AC_DEFINE(HAVE_UT_PID))
222 AC_EGREP_HEADER(ut_id, utmp.h, AC_DEFINE(HAVE_UT_ID))
223 AC_EGREP_HEADER(ut_syslen, utmpx.h, AC_DEFINE(HAVE_UT_SYSLEN))
226 dnl Check for struct winsize
229 AC_KRB_STRUCT_WINSIZE
232 dnl Check for sa_len in struct sockaddr
235 AC_KRB_STRUCT_SOCKADDR_SA_LEN
238 dnl Check for some common types
241 AC_TYPE_PID_T
242 AC_TYPE_UID_T
243 AC_TYPE_OFF_T
244 AC_TYPE_SIZE_T
245 AC_CHECK_TYPE(ssize_t, int)
246 AC_TYPE_SIG_ATOMIC_T
248 dnl AC_SUBST(LIBOBJS)
250 AC_GROK_TYPES(int8_t int16_t int32_t int64_t)
251 AC_GROK_TYPES(u_int8_t u_int16_t u_int32_t u_int64_t)
254 dnl Tests for editline
257 AC_FIND_FUNC_NO_LIBS(el_init, edit)
258 AC_FIND_FUNC_NO_LIBS(readline, readline)
260 if test "$with_readline"; then
261         AC_DEFINE(HAVE_READLINE, 1)
262         editline_OBJS=
263         LIB_readline="$READLINELIB "'$(LIB_tgetent)'
264         INCLUDE_readline="$READLINEINCLUDE"
265 elif test "$ac_cv_func_el_init" = yes; then
266         AC_DEFINE(HAVE_READLINE, 1)
268         editline_OBJS=edit_compat.o
269         LIB_readline='-L$(top_builddir)/lib/editline -leditline '"$LIB_el_init"' $(LIB_tgetent)'
271         INCLUDE_readline='-I$(top_builddir)/lib/editline -I$(top_srcdir)/lib/editline'
272 elif test "$ac_cv_func_readline" = yes; then
273         AC_DEFINE(HAVE_READLINE, 1)
274         editline_OBJS=
275         LIB_readline='-lreadline $(LIB_tgetent)'
276         INCLUDE_readline=
277 else
278         AC_DEFINE(HAVE_READLINE, 1)
279         editline_OBJS="editline.o complete.o sysunix.o"
280         LIB_readline='-L$(top_builddir)/lib/editline -leditline $(LIB_tgetent)'
281         INCLUDE_readline='-I$(top_builddir)/lib/editline -I$(top_srcdir)/lib/editline'
283 AC_SUBST(LIB_tgetent)
284 AC_SUBST(LIB_readline)
285 AC_SUBST(INCLUDE_readline)
286 AC_SUBST(editline_OBJS)
288 dnl telnet muck --------------------------------------------------
290 AC_DEFINE(AUTHENTICATION)dnl
291 AC_DEFINE(KRB5)dnl
292 AC_DEFINE(ENCRYPTION)dnl
293 AC_DEFINE(DES_ENCRYPTION)dnl
294 AC_DEFINE(DIAGNOSTICS)dnl
295 AC_DEFINE(OLD_ENVIRON)dnl
297 # Simple test for streamspty, based on the existance of getmsg(), alas
298 # this breaks on SunOS4 which have streams but BSD-like ptys
300 # And also something wierd has happend with dec-osf1, fallback to bsd-ptys
302 AC_MSG_CHECKING(for streamspty)
303 case "`uname -sr`" in
304 SunOS\ 4*|OSF1*|IRIX\ 4*|HP-UX\ ?.10.*)
305         krb_cv_sys_streamspty=no
306         ;;
307 AIX*)
308         os_rel=`uname -v`.`uname -r`
309         if expr "$os_rel" : "3*" >/dev/null 2>&1; then
310                 krb_cv_sys_streamspty=no
311         else
312                 krb_cv_sys_streamspty="$ac_cv_func_getmsg"
313         fi
314         ;;
316         krb_cv_sys_streamspty="$ac_cv_func_getmsg"
317         ;;
318 esac
319 if test "$krb_cv_sys_streamspty" = yes; then
320         AC_DEFINE(STREAMSPTY)
322 dnl AC_SUBST(STREAMSPTY)
323 AC_MSG_RESULT($krb_cv_sys_streamspty)
325 AC_OUTPUT(Makefile                      \
326         include/Makefile                \
327         lib/Makefile                    \
328         lib/roken/Makefile              \
329         lib/editline/Makefile           \
330         lib/sl/Makefile                 \
331         lib/error/Makefile              \
332         lib/error/compile_et            \
333         lib/asn1/Makefile               \
334         lib/des/Makefile                \
335         lib/krb5/Makefile               \
336         lib/hdb/Makefile                \
337         lib/gssapi/Makefile             \
338         lib/45/Makefile                 \
339         lib/otp/Makefile                \
340         lib/kafs/Makefile               \
341         kuser/Makefile                  \
342         kpasswd/Makefile                \
343         admin/Makefile                  \
344         kdc/Makefile                    \
345         appl/Makefile                   \
346         appl/test/Makefile              \
347         appl/rsh/Makefile               \
348         appl/popper/Makefile            \
349         appl/push/Makefile              \
350         appl/telnet/Makefile            \
351         appl/telnet/libtelnet/Makefile  \
352         appl/telnet/telnet/Makefile     \
353         appl/telnet/telnetd/Makefile    \
354         appl/afsutil/Makefile           \
355         doc/Makefile                    \
359 dnl This is the release version name-number[beta]
361 HEIMDALVERSION="$PACKAGE-$VERSION"
363 cat > include/newversion.h.in <<EOF
364 char *heimdal_long_version = "@(#)\$Version: $HEIMDALVERSION by @USER@ on @HOST@ ($host) @DATE@ \$";
365 char *heimdal_version = "$HEIMDALVERSION";
368 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
369         echo "include/version.h is unchanged"
370         rm -f include/newversion.h.in
371 else
372         echo "creating include/version.h"
373         User=${USER-${LOGNAME}}
374         Host=`(hostname || uname -n) 2>/dev/null | sed 1q`
375         Date=`date`
376         mv -f include/newversion.h.in include/version.h.in
377         sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h