From a43f62e54e2578822787415b70ab793d2cb975fa Mon Sep 17 00:00:00 2001 From: Alexander Vdolainen Date: Sat, 20 Mar 2021 16:14:25 +0200 Subject: [PATCH] Added autotools configure option and build stuff to build tests; --- configure.ac | 10 +++++++++- src/.gitignore | 1 + src/Makefile.am | 10 ++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e92fe6d..5f18dc3 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(ejabberdauth, m4_esyscmd([tr -d '\n' < VERSION])) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([1.11] [foreign]) +AM_INIT_AUTOMAKE([1.11] [foreign subdir-objects]) AM_SILENT_RULES([yes]) @@ -12,6 +12,14 @@ AC_PROG_CC LT_INIT +dnl options to build +AC_ARG_ENABLE([build_tests], AC_HELP_STRING([--enable-build-tests], [Enable tests build])) + +AS_IF([test "x$enable_build_tests" = "xyes"], + AC_DEFINE([BUILD_TESTS], 1, [tests building enabled])) + +AM_CONDITIONAL(BUILD_TESTS, test "x$enable_build_tests" = "xyes") + dnl checking for dependencies dnl check for the openssl/libressl PKG_CHECK_MODULES(OPENSSL, [openssl]) diff --git a/src/.gitignore b/src/.gitignore index 3bfdf68..b0f7895 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,2 +1,3 @@ ejabberdauth .deps +testimap diff --git a/src/Makefile.am b/src/Makefile.am index 18a53f3..874a027 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,9 +9,19 @@ AM_CPPFLAGS = \ AM_CFLAGS = -Wall -g +if BUILD_TESTS +bin_PROGRAMS = ejabberdauth testimap +else bin_PROGRAMS = ejabberdauth +endif ejabberdauth_SOURCES = main.c eport.c tls.c imap.c ejabberdauth_LDADD = $(LIBS) $(OPENSSL_LIBS) +if BUILD_TESTS +testimap_SOURCES = tls.c imap.c tests/testimap.c + +testimap_LDADD = $(LIBS) $(OPENSSL_LIBS) +endif +