summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-13 16:47:47 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-13 17:03:55 -0700
commitc4e6767272fd37b6464f67b4dde387895297eb63 (patch)
tree28f295729ad88b136868cb470f558ed0e137b57f
parentaf3f9bd84de98baff8df88cf51fe2750829254c0 (diff)
configure: Add --with-rgb-db-library option
Allows builders to choose a specific database library instead of relying on the default auto-detection, which can allow use of libraries we don't normally search for (like gdbm_compat) or to bypass libraries we do normally search for (like Berkeley db). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--README.md11
-rw-r--r--configure.ac23
2 files changed, 28 insertions, 6 deletions
diff --git a/README.md b/README.md
index 312335a..7576e3f 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,17 @@ The "others" subdirectory contains some alternate color databases.
The configure script accepts --with-rgb-db-type=(text|dbm|ndbm) to specify
the type of database to use for the color name data. The default is "text".
+The configure script accepts --with-rgb-db-library=<library-name> to specify
+the dbm or ndbm compatible library to use for the color name data. The default
+is "auto" to search for known implementations. Library names should be
+specified as would be provided for the "-l" flag for the linker - for
+instance, "c" for libc, "dbm" for libdbm, etc.
+
+Distributors who do choose to enable the use of a database library are
+responsible for understanding the requirements of the license terms of
+the library they link with, which may impose additional restrictions
+beyond the MIT/X11 license used for this package.
+
If the dbm or ndbm format are chosen, this package also builds the
rgb command to build the database in that format from rgb.txt.
diff --git a/configure.ac b/configure.ac
index 8e4315f..cbfc924 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,11 @@ AC_MSG_RESULT([$db_type])
RGB_DB_TYPE=$db_type
+AC_ARG_WITH([rgb-db-library],
+ AS_HELP_STRING([--with-rgb-db-library=<library-name>],
+ [rgb database library (default is to search for one)]),
+ [db_lib=$withval], [db_lib="auto"])
+
case $db_type in
text)
RGB_DB_FILES=""
@@ -70,8 +75,11 @@ case $db_type in
[Define to 1 to use plain text files for rgb database])
;;
dbm)
- AC_SEARCH_LIBS([dbminit], [db dbm nsl], [],
- AC_MSG_ERROR([dbm requested but dbminit() not found in any libraries]))
+ AS_IF([test "x$db_lib" = "xauto"],
+ [AC_SEARCH_LIBS([dbminit], [db dbm nsl], [],
+ AC_MSG_ERROR([dbm requested but dbminit() not found in any libraries]))],
+ [AC_CHECK_LIB([$db_lib], [dbminit], [],
+ AC_MSG_ERROR([dbm requested but dbminit() not found when linking with -l$db_lib]))])
AC_CHECK_HEADER([dbm.h], [DBM_HEADER='<dbm.h>'],
[AC_CHECK_HEADER([rpcsvc/dbm.h], [DBM_HEADER='<rpcsvc/dbm.h>'],
[AC_MSG_ERROR([dbm requested but dbm.h not found])])])
@@ -81,10 +89,13 @@ case $db_type in
;;
ndbm)
# Find a dbm or ndbm implementation
- AC_SEARCH_LIBS([dbm_open], [db ndbm dbm],
- AC_DEFINE([NDBM], [1],
- [Define to 1 if you have ndbm.h interfaces]),
- AC_MSG_ERROR([ndbm requested but dbm_open() not found in any libraries]))
+ AS_IF([test "x$db_lib" = "xauto"],
+ [AC_SEARCH_LIBS([dbm_open], [db ndbm dbm], [],
+ AC_MSG_ERROR([ndbm requested but dbm_open() not found in any libraries]))],
+ [AC_CHECK_LIB([$db_lib], [dbm_open], [],
+ AC_MSG_ERROR([ndbm requested but dbm_open() not found when linking with -l$db_lib]))])
+ AC_DEFINE([NDBM], [1],
+ [Define to 1 if you have ndbm.h interfaces])
DBM_HEADER='<ndbm.h>'
PKG_CHECK_MODULES(XORG, [xorg-server])
RGB_CFLAGS="$RGB_CFLAGS $XORG_CFLAGS"