summaryrefslogtreecommitdiff
path: root/dev-db/recutils/files/1.9/0006-configure.ac-add-options-for-dependencies.patch
blob: ead6cd696b1264d957430903870fd6762e45a4f6 (plain)
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
https://lists.gnu.org/archive/html/bug-recutils/2024-10/msg00002.html

From 42e038b1024c4e225b8309bab2438137f2c0a088 Mon Sep 17 00:00:00 2001
Message-ID: <42e038b1024c4e225b8309bab2438137f2c0a088.1728191717.git.sam@gentoo.org>
In-Reply-To: <9f08064fef75ce02df9b6133d240c0fa84df458e.1728191717.git.sam@gentoo.org>
References: <9f08064fef75ce02df9b6133d240c0fa84df458e.1728191717.git.sam@gentoo.org>
From: Sam James <sam@gentoo.org>
Date: Sun, 6 Oct 2024 05:04:15 +0100
Subject: [PATCH 06/10] configure.ac: add options for dependencies

Avoid "automagic" dependencies by adding options to control them so
they can be easily overridden, rather than detection based on installed
packages.

2024-10-06  Sam James  <sam@gentoo.org>

	* configure.ac: Add --enable-curl, --enable-uuid, --enable-mdb.
---
 configure.ac | 129 ++++++++++++++++++++++++++-------------------------
 1 file changed, 67 insertions(+), 62 deletions(-)

diff --git a/configure.ac b/configure.ac
index 24495b4..d6ffb01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,18 +84,35 @@ AM_CONDITIONAL([CHECK], [test "x$have_check" != "xno"])
 AC_SUBST([CHECK_CFLAGS])
 AC_SUBST([CHECK_LIBS])
 
+AC_ARG_ENABLE([curl],
+              AS_HELP_STRING([--enable-curl],
+                             [Enable support for remote descriptors using libcurl (default is YES)]),
+              [curl_enabled=$enableval], [curl_enabled=yes])
 have_curl=no
-AC_CHECK_LIB([curl],[curl_global_init],[have_curl=yes],)
-if test "x$have_curl" = "xyes"; then
-   CURLLIBS=-lcurl
-fi
+AS_IF([test "x$curl_enabled" = "xyes"], [
+    AC_CHECK_LIB([curl], [curl_global_init], [have_curl=yes], [])
+    AS_IF([test "x$have_curl" = "xyes"], [
+        CURLLIBS=-lcurl
+    ], [
+        AC_MSG_ERROR([curl support enabled but libcurl not found])
+    ])
+], [])
 AC_SUBST([CURLLIBS])
 
+AC_ARG_ENABLE([uuid],
+              AS_HELP_STRING([--enable-uuid],
+                             [Compile recutils with support for uuid types (default is YES)]),
+              [uuid_enabled=$enableval], [uuid_enabled=yes])
+
 have_uuid=no
-AC_CHECK_LIB([uuid],[uuid_generate],[have_uuid=yes],)
-if test "x$have_uuid" = "xyes"; then
-   UUIDLIBS=-luuid
-fi
+AS_IF([test "x$uuid_enabled" = "xyes"], [
+    AC_CHECK_LIB([uuid], [uuid_generate], [have_uuid=yes], [])
+    AS_IF([test "x$have_uuid" = "xyes"], [
+        UUIDLIBS=-luuid
+    ], [
+        AC_MSG_ERROR([uuid support enabled but libuuid not found])
+    ])
+], [])
 AC_SUBST([UUIDLIBS])
 AC_SUBST([have_uuid])
 
@@ -105,45 +122,56 @@ AC_ARG_ENABLE([encryption],
               [crypt_enabled=$enableval], [crypt_enabled=yes])
 
 crypt_support=no
-if test "x$crypt_enabled" = "xyes"; then
+AS_IF([test "x$crypt_enabled" = "xyes"], [
+    AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gpg-error.h>])
+    crypt_support=$HAVE_LIBGCRYPT
 
-   AC_LIB_HAVE_LINKFLAGS([gcrypt],[gpg-error],[#include <gpg-error.h>])
-   crypt_support=$HAVE_LIBGCRYPT
-
-   if test "x$crypt_support" = "xyes"; then
-      AC_DEFINE([REC_CRYPT_SUPPORT],[1],[Compile encryption support])
-   fi
-fi
+    AS_IF([test "x$crypt_support" = "xyes"], [
+        AC_DEFINE([REC_CRYPT_SUPPORT], [1], [Compile encryption support])
+    ], [])
+], [])
 
 AM_CONDITIONAL([CRYPT], [test "x$crypt_support" = "xyes"])
 AC_SUBST([crypt_support])
 
-have_glib=no
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0.0],
-                  [have_glib=yes], [have_glib=no])
-
+AC_ARG_ENABLE([mdb],
+              AS_HELP_STRING([--enable-mdb],
+                             [Build the mdb2rec utility (default is YES)]),
+              [mdb_enabled=$enableval], [mdb_enabled=yes])
 have_mdb=no
-AC_CHECK_LIB([mdb],[mdb_init],[have_mdb=yes],)
-if test "x$have_mdb" = "xyes"; then
-   MDBLIBS=-lmdb
-
-   OLD_CFLAGS=$CFLAGS
-   CFLAGS="$CFLAGS $pkg_cv_GLIB_CFLAGS"
-   mdb_uses_sdatetime=no
-   AC_CHECK_DECL([MDB_SDATETIME],[mdb_uses_sdatetime=yes],,[#include <glib.h>
-#include <mdbtools.h>])
-   CFLAGS=$OLD_CFLAGS
-
-   if test "x$mdb_uses_sdatetime" = "xyes"; then
-      MDB_DATETIME="MDB_SDATETIME"
-   else
-      MDB_DATETIME="MDB_DATETIME"
-   fi
-
-   AC_SUBST([MDB_DATETIME])
-fi
+AS_IF([test "x$mdb_enabled" = "xyes"], [
+    AC_CHECK_LIB([mdb], [mdb_init], [have_mdb=yes], [])
+    AS_IF([test "x$have_mdb" = "xyes"], [
+        MDBLIBS=-lmdb
+
+        OLD_CFLAGS=$CFLAGS
+        CFLAGS="$CFLAGS $pkg_cv_GLIB_CFLAGS"
+        mdb_uses_sdatetime=no
+        AC_CHECK_DECL([MDB_SDATETIME], [mdb_uses_sdatetime=yes], [], [
+            #include <glib.h>
+            #include <mdbtools.h>
+        ])
+        CFLAGS=$OLD_CFLAGS
+
+        AS_IF([test "x$mdb_uses_sdatetime" = "xyes"], [
+           MDB_DATETIME="MDB_SDATETIME"
+        ], [
+         MDB_DATETIME="MDB_DATETIME"
+       ])
+    ], [
+        AC_MSG_ERROR([mdb support enabled but libmdb not found])
+    ])
+
+    AC_SUBST([MDB_DATETIME])
+], [])
 AC_SUBST([MDBLIBS])
 
+have_glib=no
+AS_IF([test "x$mdb_enabled" = "xyes"], [
+    PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0.0],
+                      [have_glib=yes], [have_glib=no])
+], [])
+
 AM_CONDITIONAL([COMPILE_MDB2REC],
                [test "x$have_glib" = "xyes" && test "x$have_mdb" = "xyes"])
 AM_CONDITIONAL([REMOTE_DESCRIPTORS], [test "x$have_curl" = "xyes"])
@@ -217,29 +245,6 @@ AC_OUTPUT
 
 dnl Report warnings
 
-if test "x$have_check" = "xno"; then
-   echo "warning: libcheck was not found in the system."
-   echo "warning: unit tests wont be compiled and executed upon make check."
-fi
-
-if test "x$have_mdb" = "xno"; then
-   echo "warning: libmdb was not found in the system."
-   echo "warning: the mdb2rec utility won't get built."
-fi
-
-if test "x$have_glib" = "xno"; then
-   echo "warning: glib was not found in the system."
-   echo "warning: the mdb2rec utility won't get built."
-fi
-
-if test "x$crypt_support" = "xno"; then
-   echo "warning: building recutils without encryption support."
-fi
-
-if test "x$have_uuid" = "xno"; then
-   echo "warning: building recutils without support for uuid types."
-fi
-
 if test "x$bash_headers_available" = "xno" || test "x$bash_builtins_enabled" = "xno"; then
    echo "warning: not building the recutils bash builtins."
 fi
-- 
2.46.2