Here is a moderately complex real world example of how to use: detecting ZSTD
either externally or internally.
In configure.ac:
```
dnl # Facebook Zstd
RPM_CHECK_LIB(
[Facebook Zstd], [zstd],
[zstd], [ZSTD_versionNumber], [zstd.h],
[no,external:internal:none], [zstd:lib:lib],
[
], [])
```
When the generated configure is invoked with --with-zstd=internal (with a
github zstd git checkout in the top level directory) succeeds, then these
values are available in Makefile's for adding to the usual libtool variables:
```
WITH_ZSTD = yes
WITH_ZSTD_CPPFLAGS = -I$(top_srcdir)/$(WITH_ZSTD_SUBDIR)/lib
-I$(top_builddir)/$(WITH_ZSTD_SUBDIR)/lib -I$(top_srcdir)/$(WITH_ZSTD_SUBDIR)
-I$(top_builddir)/$(WITH_ZSTD_SUBDIR)
WITH_ZSTD_LDFLAGS = -L$(top_builddir)/$(WITH_ZSTD_SUBDIR)/lib
-L$(top_builddir)/$(WITH_ZSTD_SUBDIR)
WITH_ZSTD_LIBS = -lzstd
WITH_ZSTD_SUBDIR = zstd
```
The equivalent Makefile values for configure --with-zstd=external success:
```
WITH_ZSTD = yes
WITH_ZSTD_CPPFLAGS =
WITH_ZSTD_LDFLAGS =
WITH_ZSTD_LIBS =
WITH_ZSTD_SUBDIR =
...
LIBS = ... -lzstd
```
And config.h of course contains
```
/* Define as 1 if building with Facebook Zstd library */
#define WITH_ZSTD 1
...
/* Define to 1 if you have the `zstd' library (-lzstd). */
#define HAVE_LIBZSTD 1
...
/* Define to 1 if you have the <zstd.h> header file. */
#define HAVE_ZSTD_H 1
```
Note: I've left out the definition's for HAVE_LIBZSTD and HAVE_ZSTD_H when
using --with-zstd=internal for simplicity of explanation. In practice, these
definitions are seldom needed with an internal zest source tree.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/257#issuecomment-316087315
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint