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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
AC_PREREQ(2.59)
m4_include([version.m4])
AC_INIT([gssproxy],
VERSION_NUMBER,
[simo@redhat.com])
m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
[AC_USE_SYSTEM_EXTENSIONS],
[AC_GNU_SOURCE])
AC_PROG_CC_C99
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
AC_CONFIG_SRCDIR([BUILD.txt])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax])
AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_INSTALL
LT_INIT([disable-static])
AC_CONFIG_MACRO_DIR([m4])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.14])
AC_SUBST([PRERELEASE_VERSION],
PRERELEASE_VERSION_NUMBER)
AC_DEFINE([PRERELEASE_VERSION], "PRERELEASE_VERSION_NUMBER",
[Prerelease version number of package])
AM_CONDITIONAL([GIT_CHECKOUT], [git log -1 &>/dev/null])
m4_pattern_allow([AM_SILENT_RULES])
AM_SILENT_RULES
AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
AC_CHECK_HEADERS(stdint.h dlfcn.h)
AC_CONFIG_HEADER(config.h)
AC_CHECK_TYPES([errno_t], [], [], [[#include <errno.h>]])
m4_include([build_macros.m4])
BUILD_WITH_SHARED_BUILD_DIR
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <pthread.h>]],
[[pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;]])],
[AC_DEFINE([HAVE_PTHREAD], [1], [Pthread mutexes available.])],
[AC_MSG_WARN([Pthread library not found! Clients will not be thread safe...])])
m4_include([external/platform.m4])
m4_include(conf_macros.m4)
WITH_DISTRO_VERSION
WITH_CC_PATH
WITH_LOG_PATH
WITH_PUBCONF_PATH
WITH_SOCKET_NAME
WITH_PID_FILE
WITH_TEST_DIR
WITH_MANPAGES
WITH_XML_CATALOG
WITH_SELINUX
WITH_GSSIDEBUG
WITH_GPSTATE_PATH
WITH_GPP_DEFAULT_BEHAVIOR
WITH_HARDENING
m4_include([external/pkg.m4])
m4_include([external/libpopt.m4])
m4_include([external/docbook.m4])
m4_include([external/sizes.m4])
m4_include([external/selinux.m4])
m4_include([external/libkeyutils.m4])
m4_include([external/systemd.m4])
m4_include([external/ax_pthread.m4])
PKG_CHECK_MODULES([VERTO], [libverto >= 0.2.2], [have_libverto=1], [have_libverto=])
if test x$have_libverto = x; then
AC_MSG_ERROR([Could not find VERTO headers])
fi
AC_CHECK_LIB(verto, verto_free,,
AC_MSG_ERROR(["Error: libverto is not found or lacks verto_free"]))
AC_CHECK_FUNCS(verto_cleanup,,
AC_MSG_WARN(["Warning: libverto lacks verto_cleanup function"]))
#Check for libini_config
PKG_CHECK_MODULES([LIBINI_CONFIG], [ini_config >= 1.2.0], [have_libini_config=1], [have_libini_config=])
if test x$have_libini_config = x; then
AC_MSG_WARN([Could not find LIBINI_CONFIG headers])
else
INI_CONFIG_CFLAGS="`$PKG_CONFIG --cflags ini_config`"
INI_CONFIG_LIBS="`$PKG_CONFIG --libs ini_config`"
AC_CHECK_LIB(ini_config, ini_config_file_open, [],
[AC_MSG_WARN([ini_config library must support ini_config_file_open])],
[$INI_CONFIG_LIBS])
AC_CHECK_LIB(ini_config, ini_config_augment, [],
[AC_MSG_WARN([ini_config library must support ini_config_augment])],
[$INI_CONFIG_LIBS])
fi
if test x$have_libini_config = x1; then
INI_CFLAGS="$INI_CONFIG_CFLAGS"
INI_LIBS="$INI_CONFIG_LIBS"
else
AC_MSG_ERROR([ini_config development packages not available])
fi
AC_SUBST(INI_LIBS)
AC_SUBST(INI_CFLAGS)
AC_CHECK_LIB(ref_array, ref_array_destroy, [],
[AC_MSG_WARN([ref_array library must support ref_array_destroy])],
[$INI_CONFIG_LIBS])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
/* See: https://pagure.io/SSSD/ding-libs/pull-request/3172 */
#include <linux/limits.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <ini_configobj.h>
#include <ini_config.h>
static int write_to_file(char *path, char *text)
{
FILE *f = fopen(path, "w");
int bytes = 0;
if (f == NULL)
return 1;
bytes = fprintf(f, "%s", text);
if (bytes != strlen(text))
return 1;
return fclose(f);
}
int main(void)
{
char base_path[PATH_MAX];
char augment_path[PATH_MAX];
char config_base[] =
"[section]\n"
"key1 = first\n"
"key2 = exists\n";
char config_augment[] =
"[section]\n"
"key1 = augment\n"
"key3 = exists\n";
char *builddir;
struct ini_cfgobj *in_cfg, *result_cfg;
struct ini_cfgfile *file_ctx;
uint32_t merge_flags = INI_MS_DETECT | INI_MS_PRESERVE;
int ret;
builddir = getenv("builddir");
if (builddir == NULL) {
builddir = strdup(".");
}
snprintf(base_path, PATH_MAX, "%s/tmp_augment_base.conf", builddir);
snprintf(augment_path, PATH_MAX, "%s/tmp_augment_augment.conf", builddir);
ret = write_to_file(base_path, config_base);
if (ret != 0) {
ret = 1;
goto cleanup;
}
ret = write_to_file(augment_path, config_augment);
if (ret != 0) {
goto cleanup;
}
/* Match only augment.conf */
const char *m_patterns[] = { "^tmp_augment_augment.conf$", NULL };
/* Match all sections */
const char *m_sections[] = { ".*", NULL };
/* Create config collection */
ret = ini_config_create(&in_cfg);
if (ret != EOK)
goto cleanup;
/* Open base.conf */
ret = ini_config_file_open(base_path, 0, &file_ctx);
if (ret != EOK)
goto cleanup;
/* Seed in_cfg with base.conf */
ret = ini_config_parse(file_ctx, 1, 0, 0, in_cfg);
if (ret != EOK)
goto cleanup;
/* Update base.conf with augment.conf */
ret = ini_config_augment(in_cfg,
builddir,
m_patterns,
m_sections,
NULL,
INI_STOP_ON_NONE,
0,
INI_PARSE_NOSPACE|INI_PARSE_NOTAB,
merge_flags,
&result_cfg,
NULL,
NULL);
/* We always expect EEXIST due to DETECT being set. */
if (ret != EEXIST)
goto cleanup;
ret = 0;
cleanup:
remove(base_path);
remove(augment_path);
/* Per autoconf guidelines */
if (ret != 0)
ret = 1;
return ret;
}
]])]
,, [AC_MSG_ERROR(["ini_config library must support extended INI_MS_DETECT. See: https://pagure.io/SSSD/ding-libs/pull-request/3172"])])
AX_PTHREAD(,[AC_MSG_ERROR([Could not find Pthreads support])])
LIBS="$PTHREAD_LIBS $LIBS"
LIBS="$PTHREAD_CFLAGS $CFLAGS"
CC="$PTHREAD_CC"
AC_CHECK_HEADERS([gssapi/gssapi.h],,[AC_MSG_ERROR([Could not find GSSAPI headers])])
PKG_CHECK_MODULES([KRB5_GSSAPI], [krb5-gssapi >= 1.12.0],
[have_krb5_gssapi=1], [have_krb5_gssapi=])
if test x$have_krb5_gssapi = x; then
AC_MSG_ERROR([Could not find Krb5 / GSSAPI development libraries])
else
KRB5_CFLAGS="`$PKG_CONFIG --cflags krb5`"
KRB5_LIBS="`$PKG_CONFIG --libs krb5`"
GSSAPI_CFLAGS="`$PKG_CONFIG --cflags krb5-gssapi`"
GSSAPI_LIBS="`$PKG_CONFIG --libs krb5-gssapi`"
fi
AC_CHECK_LIB(gssapi_krb5, gss_import_cred,,
[AC_MSG_ERROR([GSSAPI library does not support gss_import_cred])],
[$GSSAPI_LIBS])
AC_CHECK_LIB(gssapi_krb5, gss_export_cred,,
[AC_MSG_ERROR([GSSAPI library does not support gss_export_cred])],
[$GSSAPI_LIBS])
AC_CHECK_DECLS([GSS_KRB5_GET_CRED_IMPERSONATOR], [], [],
[[#include <gssapi/gssapi_krb5.h>]])
AC_CHECK_DECLS([GSS_KRB5_CRED_NO_CI_FLAGS_X], [],
[AC_MSG_ERROR([krb5 too old; missing GSS_KRB5_CRED_NO_CI_FLAGS_X (v1.14)])],
[[#include <gssapi/gssapi_krb5.h>]])
AC_SUBST([KRB5_CFLAGS])
AC_SUBST([KRB5_LIBS])
AC_SUBST([GSSAPI_CFLAGS])
AC_SUBST([GSSAPI_LIBS])
AC_CHECK_HEADERS([gssrpc/rpc.h],,[AC_MSG_ERROR([Could not find GSSRPC headers])])
GSSRPC_LIBS="-lgssrpc"
AC_CHECK_LIB(gssrpc, gssrpc_xdrmem_create,,
[AC_MSG_ERROR([Failed to find GSSRPC symbols])],
[$GSSAPI_LIBS $GSSRPC_LIBS])
AC_SUBST([GSSRPC_LIBS])
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
WITH_INITSCRIPT
if test x$initscript = xsystemd; then
WITH_SYSTEMD_UNIT_DIR
fi
if test x$HAVE_MANPAGES != x; then
CHECK_XML_TOOLS
CHECK_STYLESHEET([$SGML_CATALOG_FILES],
[http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
[Docbook XSL templates])
AC_CHECK_PROG([PO4A],[po4a],[po4a],[no])
fi
AM_CONDITIONAL([HAVE_MANPAGES], [test "x$HAVE_MANPAGES" != "x"])
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"])
if test x$HAVE_SELINUX != x; then
AM_CHECK_SELINUX
fi
if test x$HAVE_SYSTEMD_UNIT != x; then
AM_CHECK_SYSTEMD
fi
AC_PATH_PROG([DOXYGEN], [doxygen], [false])
AM_CONDITIONAL([HAVE_DOXYGEN], [test x$DOXYGEN != xfalse ])
abs_build_dir=`pwd`
AC_DEFINE_UNQUOTED([ABS_BUILD_DIR], ["$abs_build_dir"], [Absolute path to the build directory])
AC_SUBST([abs_builddir], $abs_build_dir)
AC_CONFIG_FILES([Makefile tests/Makefile man/Makefile
contrib/gssproxy.spec
man/gssproxy-mech.8.xml])
AC_OUTPUT
|