ft_ssl/configure.ac
2026-04-29 15:31:45 +02:00

120 lines
2.7 KiB
Text

AC_PREREQ([2.69])
AC_INIT([ft_ssl], [0.0.1], [])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects])
AC_PROG_CC
# Compiler: prefer clang
AC_PROG_CC
if test "x$GCC" = "xyes" && test "x$CC" = "xgcc"; then
AC_CHECK_PROG([CLANG], [clang], [clang])
if test -n "$CLANG"; then
CC="clang"
AC_MSG_NOTICE([Using clang])
fi
fi
if test "x$ac_cv_env_CFLAGS_set" != "xset"; then
CFLAGS=""
fi
STRICT_CFLAGS="-Wall -Wextra -Werror -pipe -Wpedantic -Wconversion -Wshadow -Wvla"
AC_SUBST([STRICT_CFLAGS])
AM_PROG_AR
LT_PREREQ([2.2])
LT_INIT
PKG_PROG_PKG_CONFIG
# --enable-debug
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug], [Enable debug build: -g -O0 (default: no)])],
[enable_debug=$enableval],
[enable_debug=no]
)
AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
AS_IF([test "x$enable_debug" = "xyes"],
[CFLAGS="-g -O0"],
[CFLAGS="-O2"],
)
AC_SUBST([DEBUG_CFLAGS])
AC_ARG_WITH([bundled-libcli],
AS_HELP_STRING(
[--with-bundled-libcli],
[force using bundled ./libcli (ignore system)]),
[],
[with_bundled_libcli=no])
have_system_libcli=no
AS_IF([test "x$with_bundled_libcli" != "xyes"], [
PKG_CHECK_MODULES([LIBCLI], [libcli >= 0.1.0],
[have_system_libcli=yes],
[have_system_libcli=no]
)
])
AM_CONDITIONAL([USE_SYSTEM_LIBCLI], [test "x$have_system_libcli" = "xyes"])
AM_CONDITIONAL([BUILD_BUNDLED_LIBCLI], [test "x$have_system_libcli" != "xyes"])
AC_SUBST([LIBCLI_CFLAGS])
AC_SUBST([LIBCLI_LIBS])
AS_IF([test "x$have_system_libcli" != "xyes"], [
AC_CONFIG_SUBDIRS([libcli])
])
///
AC_ARG_WITH([bundled-libft_ssl],
AS_HELP_STRING(
[--with-bundled-libft_ssl],
[force using bundled ./libft_ssl (ignore system)]),
[],
[with_bundled_libft_ssl=no])
have_system_libft_ssl=no
AS_IF([test "x$with_bundled_libft_ssl" != "xyes"], [
PKG_CHECK_MODULES([LIBFT_SSL], [libft_ssl >= 0.1.0],
[have_system_libft_ssl=yes],
[have_system_libft_ssl=no]
)
])
AM_CONDITIONAL([USE_SYSTEM_LIBFT_SSL], [test "x$have_system_libft_ssl" = "xyes"])
AM_CONDITIONAL([BUILD_BUNDLED_LIBFT_SSL], [test "x$have_system_libft_ssl" != "xyes"])
AC_SUBST([LIBFT_SSL_CFLAGS])
AC_SUBST([LIBFT_SSL_LIBS])
AS_IF([test "x$have_system_libft_ssl" != "xyes"], [
AC_CONFIG_SUBDIRS([libft_ssl])
])
////
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
AC_MSG_NOTICE([
ft_ssl $VERSION
---------------
prefix : $prefix
CC : $CC
CFLAGS : $STRICT_CFLAGS $CFLAGS
libcli : system=$have_system_libcli (forced bundled=$with_bundled_libcli)
libft_ssl : system=$have_system_libft_ssl (forced bundled=$with_bundled_libft_ssl)
])