From 910b02c3d4777bca59d4b618c69e92ceb91a48be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 7 Mar 2017 01:33:16 +0100 Subject: [PATCH] Start using pkg-config / pkgconf. --- configure.ac | 46 +++++++++++------------------------------- lib/otp/Makefile.am | 2 ++ lib/otp/cryb-otp.pc.in | 11 ++++++++++ t/Makefile.am | 4 ++-- 4 files changed, 27 insertions(+), 36 deletions(-) create mode 100644 lib/otp/cryb-otp.pc.in diff --git a/configure.ac b/configure.ac index 166121f..d23ad78 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,10 @@ AC_TYPE_UINTPTR_T LT_PREREQ([2.2.6]) LT_INIT() +# pkg-config +PKG_PROG_PKG_CONFIG +PKG_INSTALLDIR + # other programs AC_PROG_INSTALL @@ -76,40 +80,13 @@ AC_CHECK_FUNCS([wcslcat wcslcmp wcslcpy]) # Extra libraries # -# cryb-core -save_LIBS="${LIBS}" -LIBS="" -AC_SEARCH_LIBS([cryb_core_version], [cryb-core], [ - CRYB_CORE_LIBS="${LIBS}" -], [ - AC_MSG_ERROR([cryb-core library not found]) -]) -LIBS="${save_LIBS}" -AC_SUBST(CRYB_CORE_LIBS) - -# cryb-oath -save_LIBS="${LIBS}" -LIBS="" -AC_SEARCH_LIBS([cryb_oath_version], [cryb-oath], [ - CRYB_OATH_LIBS="${LIBS}" -], [ - AC_MSG_ERROR([cryb-oath library not found]) -]) -LIBS="${save_LIBS}" -AC_SUBST(CRYB_OATH_LIBS) - -# cryb-test -save_LIBS="${LIBS}" -LIBS="" -AC_SEARCH_LIBS([cryb_test_version], [cryb-test], [ - CRYB_TEST_LIBS="${LIBS}" -], [ - CRYB_TEST_LIBS="" - AC_MSG_WARN([cryb-test library not found, unit tests disabled]) -]) -LIBS="${save_LIBS}" -AC_SUBST(CRYB_TEST_LIBS) -AM_CONDITIONAL([WITH_CRYB_TEST], [ test x"$CRYB_TEST_LIBS" != x"" ]) +# Cryb.to components +PKG_HAVE_WITH_MODULES([CRYB_CORE], [cryb-core], + [Cryb.to core utilities]) +PKG_HAVE_WITH_MODULES([CRYB_OATH], [cryb-oath], + [Cryb.to Open Authentication primitives]) +PKG_HAVE_WITH_MODULES([CRYB_TEST], [cryb-test], + [Cryb.to test framework]) # libpam save_LIBS="${LIBS}" @@ -248,6 +225,7 @@ AC_CONFIG_FILES([ include/cryb/Makefile lib/Makefile lib/otp/Makefile + lib/otp/cryb-otp.pc pam/Makefile pam/pam_otp/Makefile libexec/Makefile diff --git a/lib/otp/Makefile.am b/lib/otp/Makefile.am index 378349b..02223c2 100644 --- a/lib/otp/Makefile.am +++ b/lib/otp/Makefile.am @@ -9,3 +9,5 @@ libcryb_otp_la_SOURCES = \ libcryb_otp_la_LIBADD = \ $(CRYB_CORE_LIBS) \ $(CRYB_OATH_LIBS) + +pkgconfig_DATA = cryb-otp.pc diff --git a/lib/otp/cryb-otp.pc.in b/lib/otp/cryb-otp.pc.in new file mode 100644 index 0000000..cb872fc --- /dev/null +++ b/lib/otp/cryb-otp.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +libdir=@libdir@ + +Name: cryb-otp +Description: Cryb.to one-time password library +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lcryb-otp +Requires.private: cryb-core cryb-oath diff --git a/t/Makefile.am b/t/Makefile.am index 11d5efc..0cac1d9 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -2,7 +2,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_DIST = -if WITH_CRYB_TEST +if HAVE_CRYB_TEST libotp = $(top_builddir)/lib/otp/libcryb-otp.la @@ -25,4 +25,4 @@ endif OTP_LIB check_PROGRAMS = $(TESTS) -endif WITH_CRYB_TEST +endif HAVE_CRYB_TEST