[build] Adding pkg-config support

This commit is contained in:
Al
2016-02-16 11:31:02 -05:00
parent 37c09d1ed9
commit 4349a45b0f
4 changed files with 32 additions and 3 deletions

View File

@@ -1 +1,4 @@
SUBDIRS = src test
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libpostal.pc

View File

@@ -201,12 +201,12 @@ Before you install, make sure you have the following prerequisites:
**On Linux (Debian)**
```
sudo apt-get install libsnappy-dev autoconf automake libtool
sudo apt-get install libsnappy-dev autoconf automake libtool pkg-config
```
**On Mac OSX**
```
sudo brew install snappy autoconf automake libtool
sudo brew install snappy autoconf automake libtool pkg-config
```
Then to install the C library:
@@ -223,6 +223,20 @@ sudo make install
sudo ldconfig
```
libpostal has support for pkg-config, so you can use the pkg-config to print the flags needed to link your program against it:
```
pkg-config --cflags libpostal # print compiler flags
pkg-config --libs libpostal # print linker flags
pkg-config --cflags --libs libpostal # print both
```
For example:
```
gcc app.c `pkg-config --cflags --libs libpostal`
```
Bindings
--------

View File

@@ -51,6 +51,7 @@ AC_FUNC_REALLOC
AC_CHECK_FUNCS([getcwd gettimeofday memmove memset munmap regcomp setlocale sqrt strdup strndup])
AC_CONFIG_FILES([Makefile
libpostal.pc
src/Makefile
src/sparkey/Makefile
test/Makefile])

11
libpostal.pc.in Normal file
View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libpostal
Description: Fast international street address parsing and normalization using statistical NLP.
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpostal
Libs.private: @LIBS@
Cflags: -I${includedir}