source: branches/samba-3.5.x/source4/heimdal_build/internal.m4

Last change on this file was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 7.3 KB
Line 
1m4_define([upcase],`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
2
3m4_ifndef([AC_WARNING_ENABLE],[AC_DEFUN([AC_WARNING_ENABLE],[])])
4
5dnl love_FIND_FUNC(func, includes, arguments)
6dnl kind of like AC_CHECK_FUNC, but with headerfiles
7AC_DEFUN([love_FIND_FUNC], [
8
9AC_MSG_CHECKING([for $1])
10AC_CACHE_VAL(ac_cv_love_func_$1,
11[
12AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[$1($3)]])],
13[eval "ac_cv_love_func_$1=yes"],[eval "ac_cv_love_func_$1=no"])])
14
15eval "ac_res=\$ac_cv_love_func_$1"
16
17if false; then
18 AC_CHECK_FUNCS($1)
19fi
20# $1
21eval "ac_tr_func=HAVE_[]upcase($1)"
22
23case "$ac_res" in
24 yes)
25 AC_DEFINE_UNQUOTED($ac_tr_func)
26 AC_MSG_RESULT([yes])
27 ;;
28 no)
29 AC_MSG_RESULT([no])
30 ;;
31esac
32
33
34])
35
36AC_CHECK_TYPE(u_char, uint8_t)
37AC_CHECK_TYPE(u_int32_t, uint32_t)
38
39dnl Not all systems have err.h, so we provide a replacement. Heimdal
40dnl unconditionally #includes <err.h>, so we need to create an err.h,
41dnl but we can't just have a static one because we don't want to use
42dnl it on systems that have a real err.h. If the system has a real
43dnl err.h, we should use that (eg. on Darwin, the declarations get
44dnl linker attributes added, so we can't guarantee that our local
45dnl declarations will be correct). Phew!
46AC_CHECK_HEADERS([err.h], [],
47 [ cp heimdal/lib/roken/err.hin heimdal_build/err.h ])
48
49dnl Not all systems have ifaddrs.h, so we provide a replacement. Heimdal
50dnl unconditionally #includes <ifaddrs.h>, so we need to create an ifaddrs.h,
51dnl but we can't just have a static one because we don't want to use
52dnl it on systems that have a real ifaddrs.h. If the system has a real
53dnl ifaddrs.h. We don't use heimdal's lib/roken/ifaddrs.hin because
54dnl our libreplace would conflict with it.
55AC_CHECK_HEADERS([ifaddrs.h], [],
56 [ cp heimdal_build/ifaddrs.hin heimdal_build/ifaddrs.h ])
57
58AC_CHECK_HEADERS([ \
59 crypt.h \
60 curses.h \
61 errno.h \
62 inttypes.h \
63 netdb.h \
64 signal.h \
65 sys/bswap.h \
66 sys/file.h \
67 sys/stropts.h \
68 sys/timeb.h \
69 sys/times.h \
70 sys/uio.h \
71 sys/un.h \
72 sys/utsname.h \
73 term.h \
74 termcap.h \
75 time.h \
76 timezone.h \
77 ttyname.h \
78 netinet/in.h \
79 netinet/in6.h \
80 netinet6/in6.h \
81 libintl.h
82])
83
84AC_CHECK_FUNCS([ \
85 atexit \
86 cgetent \
87 getprogname \
88 setprogname \
89 inet_aton \
90 gethostname \
91 getnameinfo \
92 iruserok \
93 putenv \
94 rcmd \
95 readv \
96 sendmsg \
97 setitimer \
98 socket \
99 strlwr \
100 strncasecmp \
101 strptime \
102 strsep \
103 strsep_copy \
104 strtok_r \
105 strupr \
106 swab \
107 umask \
108 uname \
109 unsetenv \
110 closefrom \
111 hstrerror \
112 err \
113 warn \
114 errx \
115 warnx \
116 flock \
117 getipnodebyname \
118 getipnodebyaddr \
119 freehostent \
120 writev
121])
122
123love_FIND_FUNC(bswap16, [#ifdef HAVE_SYS_BSWAP_H
124#include <sys/bswap.h>
125#endif], 0)
126
127love_FIND_FUNC(bswap32, [#ifdef HAVE_SYS_BSWAP_H
128#include <sys/bswap.h>
129#endif], 0)
130
131AC_DEFUN([AC_KRB_STRUCT_WINSIZE], [
132AC_MSG_CHECKING(for struct winsize)
133AC_CACHE_VAL(ac_cv_struct_winsize, [
134ac_cv_struct_winsize=no
135for i in sys/termios.h sys/ioctl.h; do
136AC_EGREP_HEADER(
137struct[[ ]]*winsize,dnl
138$i, ac_cv_struct_winsize=yes; break)dnl
139done
140])
141if test "$ac_cv_struct_winsize" = "yes"; then
142 AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
143fi
144AC_MSG_RESULT($ac_cv_struct_winsize)
145AC_EGREP_HEADER(ws_xpixel, termios.h,
146 AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
147AC_EGREP_HEADER(ws_ypixel, termios.h,
148 AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
149])
150
151AC_KRB_STRUCT_WINSIZE
152
153AC_TYPE_SIGNAL
154if test "$ac_cv_type_signal" = "void" ; then
155 AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
156fi
157AC_SUBST(VOID_RETSIGTYPE)
158
159
160m4_include(heimdal/cf/check-var.m4)
161
162rk_CHECK_VAR(h_errno,
163[#ifdef HAVE_SYS_TYPES_H
164#include <sys/types.h>
165#endif
166#ifdef HAVE_NETDB_H
167#include <netdb.h>
168#endif])
169
170m4_include(heimdal/cf/find-func.m4)
171m4_include(heimdal/cf/find-func-no-libs.m4)
172m4_include(heimdal/cf/find-func-no-libs2.m4)
173m4_include(heimdal/cf/resolv.m4)
174
175AC_CHECK_HEADERS([pty.h util.h libutil.h])
176
177AC_CHECK_LIB_EXT(util, OPENPTY_LIBS, openpty)
178
179SMB_ENABLE(OPENPTY,YES)
180
181SMB_EXT_LIB(OPENPTY,[${OPENPTY_LIBS}],[${OPENPTY_CFLAGS}],[${OPENPTY_CPPFLAGS}],[${OPENPTY_LDFLAGS}])
182
183AC_CHECK_LIB_EXT(intl, INTL_LIBS, gettext)
184
185SMB_ENABLE(INTL,YES)
186
187SMB_EXT_LIB(INTL, $INTL_LIBS)
188
189smb_save_LIBS=$LIBS
190RESOLV_LIBS=""
191LIBS=""
192
193dnl This fills in the global LIBS...
194rk_RESOLV
195
196dnl AC_CHECK_LIB_EXT(resolv, RESOLV_LIBS, res_search)
197 SMB_ENABLE(RESOLV,YES)
198
199if test x"$LIBS" != "x"; then
200 RESOLV_LIBS=$LIBS
201fi
202
203LIBS=$smb_save_LIBS
204
205SMB_EXT_LIB(RESOLV,[${RESOLV_LIBS}],[${RESOLV_CFLAGS}],[${RESOLV_CPPFLAGS}],[${RESOLV_LDFLAGS}])
206
207
208# these are disabled unless heimdal is found below
209SMB_ENABLE(KERBEROS_LIB, NO)
210SMB_ENABLE(asn1_compile, NO)
211SMB_ENABLE(compile_et, NO)
212
213#
214# We need bison -y and flex in new versions
215# Otherwise we get random runtime failures
216#
217LEX_YACC_COMBINATIONS=""
218LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.33:bison-2.3"
219LEX_YACC_COMBINATIONS="$LEX_YACC_COMBINATIONS flex-2.5.34:bison-2.3"
220
221AC_PROG_LEX
222LEX_BASENAME=`basename "$LEX"`
223if test x"$LEX_BASENAME" = x"flex"; then
224 # "flex 2.5.33"
225 FLEX_VERSION=`$LEX --version | cut -d ' ' -f2`
226 AC_MSG_CHECKING(flex version)
227 AC_MSG_RESULT($FLEX_VERSION)
228 FLEX_MAJOR=`echo $FLEX_VERSION | cut -d '.' -f1`
229 FLEX_MINOR=`echo $FLEX_VERSION | cut -d '.' -f2`
230 FLEX_RELEASE=`echo $FLEX_VERSION | cut -d '.' -f3`
231
232 LEX_VERSION="flex-$FLEX_MAJOR.$FLEX_MINOR.$FLEX_RELEASE"
233fi
234
235AC_PROG_YACC
236YACC_BASENAME=`basename "$YACC"`
237if test x"$YACC_BASENAME" = x"bison -y"; then
238 # bison (GNU Bison) 2.3
239 BISON_VERSION=`$YACC --version | head -1 | cut -d ' ' -f4`
240 AC_MSG_CHECKING(bison version)
241 AC_MSG_RESULT($BISON_VERSION)
242 BISON_MAJOR=`echo $BISON_VERSION | cut -d '.' -f1`
243 BISON_MINOR=`echo $BISON_VERSION | cut -d '.' -f2`
244
245 YACC_VERSION="bison-$BISON_MAJOR.$BISON_MINOR"
246fi
247
248AC_MSG_CHECKING(working LEX YACC combination)
249LEX_YACC="no"
250if test x"$LEX_VERSION" != x"" -a x"$YACC_VERSION" != x""; then
251 V="$LEX_VERSION:$YACC_VERSION"
252 for C in $LEX_YACC_COMBINATIONS; do
253 if test x"$V" = x"$C"; then
254 LEX_YACC=$V
255 break;
256 fi
257 done
258fi
259if test x"$LEX_YACC" = x"no"; then
260 LEX=false
261 YACC=false
262fi
263AC_MSG_RESULT($LEX_YACC)
264
265# Portions of heimdal kerberos are unpacked into source/heimdal
266# of the samba source tree.
267
268# if we ever get to using a host kerberos, we might add conditionals here
269AC_DEFINE(HAVE_COM_ERR,1,[Whether com_err is available])
270HAVE_COM_ERR=YES
271AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available])
272HAVE_KRB5=YES
273AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])
274HAVE_GSSAPI=YES
275SMB_ENABLE(KERBEROS_LIB, YES)
276SMB_ENABLE(asn1_compile, YES)
277SMB_ENABLE(compile_et, YES)
278
279# only add closefrom if needed
280SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, NO)
281SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM_H, NO)
282if test t$ac_cv_func_closefrom != tyes; then
283 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, YES)
284 SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM_H, YES)
285fi
286
287# only add getprogname if needed
288SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME, NO)
289SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME_H, NO)
290if test t$ac_cv_func_getprogname != tyes; then
291 SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME, YES)
292 SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME_H, YES)
293fi
294
295VPATH="$VPATH:\$(HEIMDAL_VPATH)"
296
297AC_DEFINE(SAMBA4_INTERNAL_HEIMDAL,1,[Whether we use in internal heimdal build])
298
299SMB_INCLUDE_MK(heimdal_build/internal.mk)
Note: See TracBrowser for help on using the repository browser.