Blame configure.ac

Packit Service 6d40f9
AC_PREREQ(2.61)
Packit Service 6d40f9
Packit Service 6d40f9
AC_INIT([adcli],
Packit Service 6d40f9
	[0.8.2],
Packit Service 6d40f9
	[https://bugs.freedesktop.org/enter_bug.cgi?product=realmd],
Packit Service 6d40f9
	[adcli],
Packit Service 6d40f9
	[http://example.com/website.html])
Packit Service 6d40f9
Packit Service 6d40f9
AC_USE_SYSTEM_EXTENSIONS
Packit Service 6d40f9
Packit Service 6d40f9
# ------------------------------------------------------------------------------
Packit Service 6d40f9
# adcli libtool versioning
Packit Service 6d40f9
# CURRENT : REVISION : AGE
Packit Service 6d40f9
#   +1    :     0    : +1   == new interface that does not break old one.
Packit Service 6d40f9
#   +1    :     0    :  0   == removed an interface. Breaks old apps.
Packit Service 6d40f9
#    ?    :    +1    :  ?   == internal changes that doesn't break anything.
Packit Service 6d40f9
Packit Service 6d40f9
ADCLI_CURRENT=0
Packit Service 6d40f9
ADCLI_REVISION=0
Packit Service 6d40f9
ADCLI_AGE=0
Packit Service 6d40f9
Packit Service 6d40f9
# ------------------------------------------------------------------------------
Packit Service 6d40f9
Packit Service 6d40f9
AC_CONFIG_HEADERS([config.h])
Packit Service 6d40f9
AC_CONFIG_MACRO_DIR([build/m4])
Packit Service 6d40f9
AM_INIT_AUTOMAKE([1.10])
Packit Service 6d40f9
AM_SANITY_CHECK
Packit Service 6d40f9
AM_MAINTAINER_MODE([enable])
Packit Service 6d40f9
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
Packit Service 6d40f9
Packit Service 6d40f9
LT_PREREQ([2.2.6])
Packit Service 6d40f9
LT_INIT([dlopen disable-static])
Packit Service 6d40f9
AC_PROG_CC
Packit Service 6d40f9
AC_PROG_CPP
Packit Service 6d40f9
AM_PROG_CC_C_O
Packit Service 6d40f9
AM_PROG_LIBTOOL
Packit Service 6d40f9
Packit Service 6d40f9
# -------------------------------------------------------------------
Packit Service 6d40f9
# Kerberos
Packit Service 6d40f9
Packit Service 6d40f9
if test "$KRB5_LIBS" != ""; then
Packit Service 6d40f9
	KRB5_PASSED_LIBS=$KRB5_LIBS
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
if test "$KRB5_CFLAGS" != ""; then
Packit Service 6d40f9
	KRB5_PASSED_CFLAGS=$KRB5_CFLAGS
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AC_PATH_PROG(KRB5_CONFIG, krb5-config)
Packit Service 6d40f9
AC_MSG_CHECKING(for working krb5-config)
Packit Service 6d40f9
if test -x "$KRB5_CONFIG"; then
Packit Service 6d40f9
	KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5 gssapi`"
Packit Service 6d40f9
	KRB5_LIBS="`$KRB5_CONFIG --libs krb5 gssapi`"
Packit Service 6d40f9
Packit Service 6d40f9
	# Linking failures, so try this
Packit Service 6d40f9
	AC_CHECK_LIB(krb5support, krb5int_labeled_open, KRB5_LIBS="$KRB5_LIBS -lkrb5support")
Packit Service 6d40f9
Packit Service 6d40f9
	AC_MSG_RESULT(yes)
Packit Service 6d40f9
else
Packit Service 6d40f9
	if test "$KRB5_PASSED_LIBS" = ""; then
Packit Service 6d40f9
		AC_MSG_ERROR(no. Please install MIT kerberos devel package)
Packit Service 6d40f9
	fi
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
if test "$KRB5_PASSED_LIBS" != ""; then
Packit Service 6d40f9
	KRB5_LIBS=$KRB5_PASSED_LIBS
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
if test "$KRB5_PASSED_CFLAGS" != ""; then
Packit Service 6d40f9
	KRB5_CFLAGS=$KRB5_PASSED_CFLAGS
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AC_ARG_VAR([KRB5_CFLAGS], [C compiler flags for kerberos, overriding krb5-config])dnl
Packit Service 6d40f9
AC_ARG_VAR([KRB5_LIBS], [linker flags for kerberos, overriding krb5-config])dnl
Packit Service 6d40f9
Packit Service 6d40f9
AC_SUBST(KRB5_CFLAGS)
Packit Service 6d40f9
AC_SUBST(KRB5_LIBS)
Packit Service 6d40f9
Packit Service 6d40f9
Packit Service 6d40f9
# -------------------------------------------------------------------
Packit Service 6d40f9
# LDAP
Packit Service 6d40f9
Packit Service 6d40f9
AC_CHECK_LIB(ldap, ldap_search, , [ldap_invalid=yes])
Packit Service 6d40f9
AC_CHECK_LIB(lber, ber_pvt_opt_on, , [ldap_invalid=yes])
Packit Service 6d40f9
AC_CHECK_HEADERS([ldap.h], , [ldap_invalid=yes])
Packit Service 6d40f9
Packit Service 6d40f9
if test "$ldap_invalid" = "yes"; then
Packit Service 6d40f9
	AC_MSG_ERROR([Couldn't find OpenLDAP headers or libraries])
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AC_CHECK_LIB(ldap, ldap_init_fd, [true], [
Packit Service 6d40f9
	AC_MSG_ERROR([Couldn't find ldap_init_fd function in libldap])
Packit Service 6d40f9
])
Packit Service 6d40f9
Packit Service 6d40f9
AC_SUBST(LDAP_LIBS)
Packit Service 6d40f9
AC_SUBST(LDAP_CFLAGS)
Packit Service 6d40f9
Packit Service 6d40f9
# -------------------------------------------------------------------
Packit Service 6d40f9
# resolv
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_CHECKING(for which library has res_query)
Packit Service 6d40f9
for lib in "" "-lresolv"; do
Packit Service 6d40f9
	saved_LIBS="$LIBS"
Packit Service 6d40f9
	LIBS="$LIBS $lib"
Packit Service 6d40f9
	AC_LINK_IFELSE([
Packit Service 6d40f9
		AC_LANG_PROGRAM([#include <resolv.h>],
Packit Service 6d40f9
		                [res_query (0, 0, 0, 0, 0)])
Packit Service 6d40f9
	],
Packit Service 6d40f9
	[ AC_MSG_RESULT(${lib:-libc}); have_res_query="yes"; break; ],
Packit Service 6d40f9
	[ LIBS="$saved_LIBS" ])
Packit Service 6d40f9
done
Packit Service 6d40f9
if test "$have_res_query" != "yes"; then
Packit Service 6d40f9
	AC_MSG_RESULT(no)
Packit Service 6d40f9
	AC_MSG_ERROR([Couldn't find the library for the res_query function])
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
# --------------------------------------------------------------------
Packit Service 6d40f9
# SASL
Packit Service 6d40f9
Packit Service 6d40f9
AC_CHECK_HEADERS([sasl/sasl.h], , [sasl_invalid=yes])
Packit Service 6d40f9
Packit Service 6d40f9
if test "$sasl_invalid" = "yes"; then
Packit Service 6d40f9
	AC_MSG_ERROR([Couldn't find Cyrus SASL headers])
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
# --------------------------------------------------------------------
Packit Service 6d40f9
# Documentation options
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_CHECKING([whether to build documentation])
Packit Service 6d40f9
AC_ARG_ENABLE(doc,
Packit Service 6d40f9
              AC_HELP_STRING([--enable-doc],
Packit Service 6d40f9
                             [Disable building documentation])
Packit Service 6d40f9
             )
Packit Service 6d40f9
Packit Service 6d40f9
if test "$enable_doc" = "no"; then
Packit Service 6d40f9
	AC_MSG_RESULT($enable_doc)
Packit Service 6d40f9
Packit Service 6d40f9
else
Packit Service 6d40f9
	if test "$enable_doc" = ""; then
Packit Service 6d40f9
		disable_msg="(perhaps --disable-doc)"
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	enable_doc="yes"
Packit Service 6d40f9
	AC_MSG_RESULT($enable_doc)
Packit Service 6d40f9
Packit Service 6d40f9
	AC_PATH_PROG([XSLTPROC], [xsltproc], [no])
Packit Service 6d40f9
	if test "$XSLTPROC" = "no"; then
Packit Service 6d40f9
		AC_MSG_ERROR([the xsltproc command was not found $disable_msg])
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	AC_PATH_PROG([XMLTO], [xmlto], [no])
Packit Service 6d40f9
	if test "$XMLTO" = "no"; then
Packit Service 6d40f9
		AC_MSG_ERROR([the xmlto command was not found $disable_msg])
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	AC_SUBST(XSLTPROC)
Packit Service 6d40f9
	AC_SUBST(XMLTO)
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AM_CONDITIONAL([ENABLE_DOC], [test "$enable_doc" = "yes"])
Packit Service 6d40f9
doc_status=$enable_doc
Packit Service 6d40f9
Packit Service 6d40f9
# --------------------------------------------------------------------
Packit Service 6d40f9
# Compilation and linking options
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_CHECKING([for debug mode])
Packit Service 6d40f9
AC_ARG_ENABLE(debug,
Packit Service 6d40f9
              AC_HELP_STRING([--enable-debug=no/default/yes],
Packit Service 6d40f9
              [Turn on or off debugging]))
Packit Service 6d40f9
Packit Service 6d40f9
if test "$enable_debug" != "no"; then
Packit Service 6d40f9
	AC_DEFINE_UNQUOTED(WITH_DEBUG, 1, [Print debug output])
Packit Service 6d40f9
	AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
Packit Service 6d40f9
	CFLAGS="$CFLAGS -g"
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
if test "$enable_debug" = "yes"; then
Packit Service 6d40f9
	debug_status="yes (-g, -O0, debug output)"
Packit Service 6d40f9
	CFLAGS="$CFLAGS -O0"
Packit Service 6d40f9
elif test "$enable_debug" = "no"; then
Packit Service 6d40f9
	debug_status="no (no debug output, NDEBUG)"
Packit Service 6d40f9
	AC_DEFINE_UNQUOTED(NDEBUG, 1, [Disable glib assertions])
Packit Service 6d40f9
else
Packit Service 6d40f9
	debug_status="default (-g, debug output)"
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_RESULT($debug_status)
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_CHECKING(for more warnings)
Packit Service 6d40f9
if test "$GCC" = "yes"; then
Packit Service 6d40f9
	CFLAGS="$CFLAGS \
Packit Service 6d40f9
		-Wall -Wstrict-prototypes -Wmissing-declarations \
Packit Service 6d40f9
		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
Packit Service 6d40f9
		-Wdeclaration-after-statement -Wformat=2 -Winit-self \
Packit Service 6d40f9
		-Waggregate-return -Wno-missing-format-attribute"
Packit Service 6d40f9
Packit Service 6d40f9
	for option in -Wmissing-include-dirs -Wundef; do
Packit Service 6d40f9
		SAVE_CFLAGS="$CFLAGS"
Packit Service 6d40f9
		CFLAGS="$CFLAGS $option"
Packit Service 6d40f9
		AC_MSG_CHECKING([whether gcc understands $option])
Packit Service 6d40f9
		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
Packit Service 6d40f9
				  [has_option=yes],
Packit Service 6d40f9
				  [has_option=no])
Packit Service 6d40f9
		AC_MSG_RESULT($has_option)
Packit Service 6d40f9
		if test $has_option = no; then
Packit Service 6d40f9
			CFLAGS="$SAVE_CFLAGS"
Packit Service 6d40f9
		fi
Packit Service 6d40f9
	done
Packit Service 6d40f9
else
Packit Service 6d40f9
	AC_MSG_RESULT(no)
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AC_ARG_ENABLE(strict,
Packit Service 6d40f9
              [AS_HELP_STRING([--enable-strict], [Strict code compilation])]
Packit Service 6d40f9
             )
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_CHECKING([build strict])
Packit Service 6d40f9
Packit Service 6d40f9
if test "$enable_strict" = "yes"; then
Packit Service 6d40f9
	CFLAGS="$CFLAGS -Werror"
Packit Service 6d40f9
	AC_DEFINE_UNQUOTED(WITH_STRICT, 1, [More strict checks])
Packit Service 6d40f9
	strict_status="yes (-Werror, fatals)"
Packit Service 6d40f9
else
Packit Service 6d40f9
	strict_status="no"
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_RESULT($strict_status)
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_CHECKING([whether to build with gcov testing])
Packit Service 6d40f9
AC_ARG_ENABLE([coverage],
Packit Service 6d40f9
		[AS_HELP_STRING([--enable-coverage], [Whether to enable coverage testing ])],
Packit Service 6d40f9
		[],
Packit Service 6d40f9
		[enable_coverage=no])
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_RESULT([$enable_coverage])
Packit Service 6d40f9
Packit Service 6d40f9
if test "$enable_coverage" = "yes"; then
Packit Service 6d40f9
	if test "$GCC" != "yes"; then
Packit Service 6d40f9
		AC_MSG_ERROR(Coverage testing requires GCC)
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	AC_PATH_PROG(GCOV, gcov, no)
Packit Service 6d40f9
	if test "$GCOV" = "no" ; then
Packit Service 6d40f9
		AC_MSG_ERROR(gcov tool is not available)
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	AC_PATH_PROG(LCOV, lcov, no)
Packit Service 6d40f9
	if test "$LCOV" = "no" ; then
Packit Service 6d40f9
		AC_MSG_ERROR(lcov tool is not installed)
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	AC_PATH_PROG(GENHTML, genhtml, no)
Packit Service 6d40f9
	if test "$GENHTML" = "no" ; then
Packit Service 6d40f9
		AC_MSG_ERROR(lcov's genhtml tool is not installed)
Packit Service 6d40f9
	fi
Packit Service 6d40f9
Packit Service 6d40f9
	CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
Packit Service 6d40f9
	LDFLAGS="$LDFLAGS -lgcov"
Packit Service 6d40f9
fi
Packit Service 6d40f9
Packit Service 6d40f9
AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
Packit Service 6d40f9
AC_SUBST(LCOV)
Packit Service 6d40f9
AC_SUBST(GCOV)
Packit Service 6d40f9
AC_SUBST(GENHTML)
Packit Service 6d40f9
Packit Service f6f735
AC_PATH_PROG(BIN_CAT, cat, no)
Packit Service f6f735
if test "$BIN_CAT" = "no" ; then
Packit Service f6f735
	AC_MSG_ERROR([cat is not available])
Packit Service f6f735
else
Packit Service f6f735
	AC_DEFINE_UNQUOTED(BIN_CAT, "$BIN_CAT", [path to cat, used in unit test])
Packit Service f6f735
fi
Packit Service f6f735
Packit Service f6f735
AC_PATH_PROG(BIN_TAC, tac, no)
Packit Service f6f735
if test "$BIN_TAC" = "no" ; then
Packit Service f6f735
	AC_MSG_ERROR([tac is not available])
Packit Service f6f735
else
Packit Service f6f735
	AC_DEFINE_UNQUOTED(BIN_TAC, "$BIN_TAC", [path to tac, used in unit test])
Packit Service f6f735
fi
Packit Service f6f735
Packit Service f6f735
AC_PATH_PROG(BIN_REV, rev, no)
Packit Service f6f735
if test "$BIN_REV" = "no" ; then
Packit Service f6f735
	AC_MSG_ERROR([rev is not available])
Packit Service f6f735
else
Packit Service f6f735
	AC_DEFINE_UNQUOTED(BIN_REV, "$BIN_REV", [path to rev, used in unit test])
Packit Service f6f735
fi
Packit Service f6f735
Packit Service f6f735
AC_PATH_PROG(BIN_ECHO, echo, no)
Packit Service f6f735
if test "$BIN_ECHO" = "no" ; then
Packit Service f6f735
	AC_MSG_ERROR([echo is not available])
Packit Service f6f735
else
Packit Service f6f735
	AC_DEFINE_UNQUOTED(BIN_ECHO, "$BIN_ECHO", [path to echo, used in unit test])
Packit Service f6f735
fi
Packit Service f6f735
Packit Service bff25d
AC_MSG_CHECKING([where is Samba's net utility])
Packit Service bff25d
AC_ARG_WITH([samba_data_tool],
Packit Service bff25d
              AC_HELP_STRING([--with-samba-data-tool=/path],
Packit Service bff25d
              [Path to Samba's net utility]),
Packit Service bff25d
              [],
Packit Service bff25d
              [with_samba_data_tool=/usr/bin/net])
Packit Service bff25d
AC_MSG_RESULT([$with_samba_data_tool])
Packit Service bff25d
Packit Service bff25d
AC_DEFINE_UNQUOTED(SAMBA_DATA_TOOL, "$with_samba_data_tool",
Packit Service bff25d
                   [Path to Samba's net utility])
Packit Service bff25d
Packit Service bff25d
AC_SUBST(SAMBA_DATA_TOOL, [$with_samba_data_tool])
Packit Service 6d40f9
# ---------------------------------------------------------------------
Packit Service 6d40f9
Packit Service 6d40f9
ADCLI_LT_RELEASE=$ADCLI_CURRENT:$ADCLI_REVISION:$ADCLI_AGE
Packit Service 6d40f9
AC_SUBST(ADCLI_LT_RELEASE)
Packit Service 6d40f9
Packit Service 6d40f9
AC_CONFIG_FILES([Makefile
Packit Service 6d40f9
	build/Makefile
Packit Service 6d40f9
	doc/Makefile
Packit Service 6d40f9
	doc/version.xml
Packit Service bff25d
	doc/samba_data_tool_path.xml
Packit Service 6d40f9
	library/Makefile
Packit Service 6d40f9
	tools/Makefile
Packit Service 6d40f9
])
Packit Service 6d40f9
AC_OUTPUT
Packit Service 6d40f9
Packit Service 6d40f9
AC_MSG_NOTICE([build options:
Packit Service 6d40f9
    Host:                            $host
Packit Service 6d40f9
    Debug build:                     $debug_status
Packit Service 6d40f9
    Strict build:                    $strict_status
Packit Service 6d40f9
    Documentation:                   $doc_status
Packit Service 6d40f9
])