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