/contrib/cvs/acinclude.m4

https://bitbucket.org/freebsd/freebsd-head/ · m4 · 361 lines · 201 code · 29 blank · 131 comment · 0 complexity · 927246dee6615362ab1e41a4d0bc6cbf MD5 · raw file

  1. /* This program is free software; you can redistribute it and/or modify
  2. it under the terms of the GNU General Public License as published by
  3. the Free Software Foundation; either version 2, or (at your option)
  4. any later version.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details. */
  9. AC_DEFUN([ACX_WITH_GSSAPI],[
  10. #
  11. # Use --with-gssapi[=DIR] to enable GSSAPI support.
  12. #
  13. # defaults to enabled with DIR in default list below
  14. #
  15. # Search for /SUNHEA/ and read the comments about this default below.
  16. #
  17. AC_ARG_WITH(
  18. [gssapi],
  19. AC_HELP_STRING(
  20. [--with-gssapi],
  21. [GSSAPI directory (default autoselects)]), ,
  22. [with_gssapi=yes])dnl
  23. dnl
  24. dnl FIXME - cache withval and obliterate later cache values when options change
  25. dnl
  26. #
  27. # Try to locate a GSSAPI installation if no location was specified, assuming
  28. # GSSAPI was enabled (the default).
  29. #
  30. if test -n "$acx_gssapi_cv_gssapi"; then
  31. # Granted, this is a slightly ugly way to print this info, but the
  32. # AC_CHECK_HEADER used in the search for a GSSAPI installation makes using
  33. # AC_CACHE_CHECK worse
  34. AC_MSG_CHECKING([for GSSAPI])
  35. else :; fi
  36. AC_CACHE_VAL([acx_gssapi_cv_gssapi], [
  37. if test x$with_gssapi = xyes; then
  38. # --with but no location specified
  39. # assume a gssapi.h or gssapi/gssapi.h locates our install.
  40. #
  41. # This isn't always strictly true. For instance Solaris 7's SUNHEA (header)
  42. # package installs gssapi.h whether or not the necessary libraries are
  43. # installed. I'm still not sure whether to consider this a bug. The long
  44. # way around is to not consider GSSPAI installed unless gss_import_name is
  45. # found, but that brings up a lot of other hassles, like continuing to let
  46. # gcc & ld generate the error messages when the user uses --with-gssapi=dir
  47. # as a debugging aid. The short way around is to disable GSSAPI by default,
  48. # but I think Sun users have been faced with this for awhile and I haven't
  49. # heard many complaints.
  50. acx_gssapi_save_CPPFLAGS=$CPPFLAGS
  51. for acx_gssapi_cv_gssapi in yes /usr/kerberos /usr/cygnus/kerbnet no; do
  52. if test x$acx_gssapi_cv_gssapi = xno; then
  53. break
  54. fi
  55. if test x$acx_gssapi_cv_gssapi = xyes; then
  56. AC_MSG_CHECKING([for GSSAPI])
  57. AC_MSG_RESULT([])
  58. else
  59. CPPFLAGS="$acx_gssapi_save_CPPFLAGS -I$acx_gssapi_cv_gssapi/include"
  60. AC_MSG_CHECKING([for GSSAPI in $acx_gssapi_cv_gssapi])
  61. AC_MSG_RESULT([])
  62. fi
  63. unset ac_cv_header_gssapi_h
  64. unset ac_cv_header_gssapi_gssapi_h
  65. unset ac_cv_header_krb5_h
  66. AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h krb5.h])
  67. if (test "$ac_cv_header_gssapi_h" = yes ||
  68. test "$ac_cv_header_gssapi_gssapi_h" = yes) &&
  69. test "$ac_cv_header_krb5_h" = yes; then
  70. break
  71. fi
  72. done
  73. CPPFLAGS=$acx_gssapi_save_CPPFLAGS
  74. else
  75. acx_gssapi_cv_gssapi=$with_gssapi
  76. fi
  77. AC_MSG_CHECKING([for GSSAPI])
  78. ])dnl
  79. AC_MSG_RESULT([$acx_gssapi_cv_gssapi])
  80. #
  81. # Set up GSSAPI includes for later use. We don't bother to check for
  82. # $acx_gssapi_cv_gssapi=no here since that will be caught later.
  83. #
  84. if test x$acx_gssapi_cv_gssapi = xyes; then
  85. # no special includes necessary
  86. GSSAPI_INCLUDES=""
  87. else
  88. # GSSAPI at $acx_gssapi_cv_gssapi (could be 'no')
  89. GSSAPI_INCLUDES=" -I$acx_gssapi_cv_gssapi/include"
  90. fi
  91. #
  92. # Get the rest of the information CVS needs to compile with GSSAPI support
  93. #
  94. if test x$acx_gssapi_cv_gssapi != xno; then
  95. # define HAVE_GSSAPI and set up the includes
  96. AC_DEFINE([HAVE_GSSAPI], ,
  97. [Define if you have GSSAPI with Kerberos version 5 available.])
  98. includeopt=$includeopt$GSSAPI_INCLUDES
  99. # locate any other headers
  100. acx_gssapi_save_CPPFLAGS=$CPPFLAGS
  101. CPPFLAGS=$CPPFLAGS$GSSAPI_INCLUDES
  102. dnl We don't use HAVE_KRB5_H anywhere, but including it here might make it
  103. dnl easier to spot errors by reading configure output
  104. AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h krb5.h])
  105. # And look through them for GSS_C_NT_HOSTBASED_SERVICE or its alternatives
  106. AC_CACHE_CHECK(
  107. [for GSS_C_NT_HOSTBASED_SERVICE],
  108. [acx_gssapi_cv_gss_c_nt_hostbased_service],
  109. [
  110. acx_gssapi_cv_gss_c_nt_hostbased_service=no
  111. if test "$ac_cv_header_gssapi_h" = "yes"; then
  112. AC_EGREP_HEADER(
  113. [GSS_C_NT_HOSTBASED_SERVICE], [gssapi.h],
  114. [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
  115. [
  116. AC_EGREP_HEADER(
  117. [gss_nt_service_name], [gssapi.h],
  118. [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
  119. ])
  120. fi
  121. if test $acx_gssapi_cv_gss_c_nt_hostbased_service = no &&
  122. test "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
  123. AC_EGREP_HEADER(
  124. [GSS_C_NT_HOSTBASED_SERVICE], [gssapi/gssapi.h],
  125. [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
  126. [
  127. AC_EGREP_HEADER([gss_nt_service_name], [gssapi/gssapi.h],
  128. [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
  129. ])
  130. else :; fi
  131. if test $acx_gssapi_cv_gss_c_nt_hostbased_service = no &&
  132. test "$ac_cv_header_gssapi_gssapi_generic_h" = "yes"; then
  133. AC_EGREP_HEADER(
  134. [GSS_C_NT_HOSTBASED_SERVICE], [gssapi/gssapi_generic.h],
  135. [acx_gssapi_cv_gss_c_nt_hostbased_service=yes],
  136. [
  137. AC_EGREP_HEADER(
  138. [gss_nt_service_name], [gssapi/gssapi_generic.h],
  139. [acx_gssapi_cv_gss_c_nt_hostbased_service=gss_nt_service_name])
  140. ])
  141. else :; fi
  142. ])
  143. if test $acx_gssapi_cv_gss_c_nt_hostbased_service != yes &&
  144. test $acx_gssapi_cv_gss_c_nt_hostbased_service != no; then
  145. # don't define for yes since that means it already means something and
  146. # don't define for no since we'd rather the compiler catch the error
  147. # It's debatable whether we'd prefer that the compiler catch the error
  148. # - it seems our estranged developer is more likely to be familiar with
  149. # the intricacies of the compiler than with those of autoconf, but by
  150. # the same token, maybe we'd rather alert them to the fact that most
  151. # of the support they need to fix the problem is installed if they can
  152. # simply locate the appropriate symbol.
  153. AC_DEFINE_UNQUOTED(
  154. [GSS_C_NT_HOSTBASED_SERVICE],
  155. [$acx_gssapi_cv_gss_c_nt_hostbased_service],
  156. [Define to an alternative value if GSS_C_NT_HOSTBASED_SERVICE isn't defined
  157. in the gssapi.h header file. MIT Kerberos 1.2.1 requires this. Only relevant
  158. when using GSSAPI.])
  159. else :; fi
  160. CPPFLAGS=$acx_gssapi_save_CPPFLAGS
  161. # Expect the libs to be installed parallel to the headers
  162. #
  163. # We could try once with and once without, but I'm not sure it's worth the
  164. # trouble.
  165. if test x$acx_gssapi_cv_gssapi != xyes; then
  166. if test -z "$LIBS"; then
  167. LIBS="-L$acx_gssapi_cv_gssapi/lib"
  168. else
  169. LIBS="-L$acx_gssapi_cv_gssapi/lib $LIBS"
  170. fi
  171. else :; fi
  172. dnl What happens if we want to enable, say, krb5 and some other GSSAPI
  173. dnl authentication method at the same time?
  174. #
  175. # Some of the order below is particular due to library dependencies
  176. #
  177. #
  178. # des Heimdal K 0.3d, but Heimdal seems to be set up such
  179. # that it could have been installed from elsewhere.
  180. #
  181. AC_SEARCH_LIBS([des_set_odd_parity], [des])
  182. #
  183. # com_err Heimdal K 0.3d
  184. #
  185. # com_err MIT K5 v1.2.2-beta1
  186. #
  187. AC_SEARCH_LIBS([com_err], [com_err])
  188. #
  189. # asn1 Heimdal K 0.3d -lcom_err
  190. #
  191. AC_SEARCH_LIBS([initialize_asn1_error_table_r], [asn1])
  192. #
  193. # resolv required, but not installed by Heimdal K 0.3d
  194. #
  195. # resolv MIT K5 1.2.2-beta1
  196. # Linux 2.2.17
  197. #
  198. AC_SEARCH_LIBS([__dn_expand], [resolv])
  199. #
  200. # crypto Need by gssapi under FreeBSD 5.4
  201. #
  202. AC_SEARCH_LIBS([RC4], [crypto])
  203. #
  204. # crypt Needed by roken under FreeBSD 4.6.
  205. #
  206. AC_SEARCH_LIBS([crypt], [crypt])
  207. #
  208. # roken Heimdal K 0.3d -lresolv
  209. # roken FreeBSD 4.6 -lcrypt
  210. #
  211. AC_SEARCH_LIBS([roken_gethostbyaddr], [roken])
  212. #
  213. # k5crypto MIT K5 v1.2.2-beta1
  214. #
  215. AC_SEARCH_LIBS([valid_enctype], [k5crypto])
  216. #
  217. # gen ? ? ? Needed on Irix 5.3 with some
  218. # Irix 5.3 version of Kerberos. I'm not
  219. # sure which since Irix didn't
  220. # get any testing this time
  221. # around. Original comment:
  222. #
  223. # This is necessary on Irix 5.3, in order to link against libkrb5 --
  224. # there, an_to_ln.o refers to things defined only in -lgen.
  225. #
  226. AC_SEARCH_LIBS([compile], [gen])
  227. #
  228. # krb5 ? ? ? -lgen -l???
  229. # Irix 5.3
  230. #
  231. # krb5 MIT K5 v1.1.1
  232. #
  233. # krb5 MIT K5 v1.2.2-beta1 -lcrypto -lcom_err
  234. # Linux 2.2.17
  235. #
  236. # krb5 MIT K5 v1.2.2-beta1 -lcrypto -lcom_err -lresolv
  237. #
  238. # krb5 Heimdal K 0.3d -lasn1 -lroken -ldes
  239. #
  240. AC_SEARCH_LIBS([krb5_free_context], [krb5])
  241. #
  242. # gss This may be the only lib needed under HP-UX, so find it
  243. # first.
  244. #
  245. # gssapi_krb5 Only lib needed with MIT K5 v1.2.1, so find it first in
  246. # order to prefer MIT Kerberos. If both MIT & Heimdal
  247. # Kerberos are installed and in the path, this will leave
  248. # some of the libraries above in LIBS unnecessarily, but
  249. # noone would ever do that, right?
  250. #
  251. # gss HP-UX ???
  252. #
  253. # gssapi_krb5 MIT K5 v1.2.2-beta1 -lkrb5
  254. #
  255. # gssapi Heimdal K 0.3d -lkrb5
  256. #
  257. AC_SEARCH_LIBS([gss_import_name], [gss gssapi_krb5 gssapi])
  258. fi
  259. ])dnl
  260. # size_max.m4 serial 2
  261. dnl Copyright (C) 2003 Free Software Foundation, Inc.
  262. dnl This file is free software, distributed under the terms of the GNU
  263. dnl General Public License. As a special exception to the GNU General
  264. dnl Public License, this file may be distributed as part of a program
  265. dnl that contains a configuration script generated by Autoconf, under
  266. dnl the same distribution terms as the rest of that program.
  267. dnl From Bruno Haible.
  268. AC_DEFUN([gl_SIZE_MAX],
  269. [
  270. AC_CHECK_HEADERS(stdint.h)
  271. dnl First test whether the system already has SIZE_MAX.
  272. AC_MSG_CHECKING([for SIZE_MAX])
  273. result=
  274. AC_EGREP_CPP([Found it], [
  275. #include <limits.h>
  276. #if HAVE_STDINT_H
  277. #include <stdint.h>
  278. #endif
  279. #ifdef SIZE_MAX
  280. Found it
  281. #endif
  282. ], result=yes)
  283. if test -z "$result"; then
  284. dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
  285. dnl than the type 'unsigned long'.
  286. dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
  287. dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
  288. _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
  289. [#include <stddef.h>], result=?)
  290. _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
  291. [#include <stddef.h>], result=?)
  292. _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
  293. [#include <stddef.h>], result=?)
  294. if test "$fits_in_uint" = 1; then
  295. dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
  296. dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
  297. AC_TRY_COMPILE([#include <stddef.h>
  298. extern size_t foo;
  299. extern unsigned long foo;
  300. ], [], fits_in_uint=0)
  301. fi
  302. if test -z "$result"; then
  303. if test "$fits_in_uint" = 1; then
  304. result="$res_hi$res_lo"U
  305. else
  306. result="$res_hi$res_lo"UL
  307. fi
  308. else
  309. dnl Shouldn't happen, but who knows...
  310. result='~(size_t)0'
  311. fi
  312. fi
  313. AC_MSG_RESULT([$result])
  314. if test "$result" != yes; then
  315. AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
  316. [Define as the maximum value of type 'size_t', if the system doesn't define it.])
  317. fi
  318. ])
  319. # xsize.m4 serial 3
  320. dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
  321. dnl This file is free software, distributed under the terms of the GNU
  322. dnl General Public License. As a special exception to the GNU General
  323. dnl Public License, this file may be distributed as part of a program
  324. dnl that contains a configuration script generated by Autoconf, under
  325. dnl the same distribution terms as the rest of that program.
  326. AC_DEFUN([gl_XSIZE],
  327. [
  328. dnl Prerequisites of lib/xsize.h.
  329. AC_REQUIRE([gl_SIZE_MAX])
  330. AC_REQUIRE([AC_C_INLINE])
  331. AC_CHECK_HEADERS(stdint.h)
  332. ])