Skip to content

Commit

Permalink
add pkgconfig file
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Oct 19, 2015
1 parent 194d843 commit ddc1da3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile.am
Expand Up @@ -12,6 +12,7 @@ $(LIBSECP256K1): $(wildcard src/secp256k1/src/*) $(wildcard src/secp256k1/includ
include_HEADERS = include/libbtc.h
lib_LTLIBRARIES = libbtc.la

include_HEADERS = include/libbtc.h
noinst_HEADERS = \
src/sha2.h \
src/utils.h \
Expand All @@ -28,6 +29,9 @@ noinst_HEADERS = \
src/script.h \
src/ecc_key.h

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libbtc.pc

libbtc_la_SOURCES = \
src/sha2.c \
src/utils.c \
Expand Down
37 changes: 36 additions & 1 deletion configure.ac
Expand Up @@ -12,6 +12,36 @@ AM_INIT_AUTOMAKE([no-define subdir-objects foreign])
AC_HEADER_STDBOOL
LT_INIT

PKG_PROG_PKG_CONFIG
AC_PATH_TOOL(AR, ar)
AC_PATH_TOOL(RANLIB, ranlib)
AC_PATH_TOOL(STRIP, strip)
AX_PROG_CC_FOR_BUILD
AM_PROG_CC_C_O
AC_PROG_CC_C99

CFLAGS="$CFLAGS -W"

warn_CFLAGS="-std=c99 -pedantic -Wall -Wextra -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings"
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $warn_CFLAGS"
AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
[ AC_MSG_RESULT([yes]) ],
[ AC_MSG_RESULT([no])
CFLAGS="$saved_CFLAGS"
])

saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
[ AC_MSG_RESULT([yes]) ],
[ AC_MSG_RESULT([no])
CFLAGS="$saved_CFLAGS"
])


# Enable debug
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
Expand Down Expand Up @@ -47,11 +77,16 @@ if test "x$random_device" = x"/dev/random"; then
AC_DEFINE([RANDOM_DEVICE],["/dev/random"],[Define to set random file handle])
fi

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile libbtc.pc])
AC_SUBST(LIBTOOL_APP_LDFLAGS)
AC_SUBST(BUILD_EXEEXT)
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])

AC_CONFIG_SUBDIRS([src/secp256k1])

dnl make sure nothing new is exported so that we don't break the cache
PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
unset PKG_CONFIG_PATH
PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP"

AC_OUTPUT
12 changes: 12 additions & 0 deletions libbtc.pc
@@ -0,0 +1,12 @@
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libbtc
Description: C library for manipulating bitcoin data structures
URL: https://github.com/jonasschnelli/libbtc
Version: 0.1
Cflags: -I${includedir}
Libs: -L${libdir} -lbtc

12 changes: 12 additions & 0 deletions libbtc.pc.in
@@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: libbtc
Description: C library for manipulating bitcoin data structures
URL: https://github.com/jonasschnelli/libbtc
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lbtc

0 comments on commit ddc1da3

Please sign in to comment.