Skip to content

Commit

Permalink
More OS specific hacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Dec 30, 2014
1 parent d70fd94 commit 05d33ca
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions compat/file_at.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <fcntl.h>
#include <pthread.h>
#include <stdarg.h>
#define _GNU_SOURCE
#include <unistd.h>

#include <bsd_compat.h>
Expand Down
28 changes: 19 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,22 @@ gl_LD_VERSION_SCRIPT

AC_CANONICAL_HOST
case $host_os in
darwin* )
# Do something specific for mac
;;
linux*)
CFLAGS+= "-pthread"
LIBS+= "-ldl -lrt"
OS_CFLAGS="-pthread"
OS_LDFLAGS="-pthread"
OS_LIBS="-ldl -lrt -llzo2 -llzma"
;;
*BSD*)
# Do something specific for BSD
*)
OS_CFLAGS=
OS_LDFLAGS=
OS_LIBS=
;;
esac

AC_SUBST(OS_CFLAGS)
AC_SUBST(OS_LDFLAGS)
AC_SUBST(OS_LIBS)

AC_CHECK_HEADERS_ONCE([machine/endian.h])
AC_CHECK_HEADERS_ONCE([endian.h])
AC_CHECK_HEADERS_ONCE([sys/endian.h])
Expand Down Expand Up @@ -280,15 +284,21 @@ AC_CHECK_HEADER([execinfo.h], [
AC_ARG_WITH([ldns], AS_HELP_STRING([--with-ldns], [Build with ldns for name resolving]))

AS_IF([test "x$with_ldns" = "xyes"], [
PKG_CHECK_MODULES([LDNS], [libldns], [AC_DEFINE([HAVE_LDNS], [1], [Use ldns])],
PKG_CHECK_MODULES([LDNS], [libldns], [
AC_DEFINE([HAVE_LDNS], [1], [Use ldns])
AC_SUBST([HAVE_LDNS], [1], [Use ldns])
],
[
AC_CHECK_HEADER([ldns/ldns.h], [
AC_CHECK_LIB(ldns, ldns_resolver_new_frm_file, [
AC_DEFINE([HAVE_LDNS], [1], [Use ldns])
AC_DEFINE([LDNS_LIBS], [-lldns], [LDNS library])
AC_SUBST([HAVE_LDNS], [1], [Use ldns])
AC_SUBST([LDNS_LIBS], [-lldns], [LDNS library])
])
])
])
AS_IF([test "x$HAVE_LDNS" != "x1"],
[AC_MSG_ERROR([Unable to find the libdns])])
])

AC_CHECK_LIB(c, cap_sandboxed, [
Expand Down
2 changes: 1 addition & 1 deletion libpkg/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ libpkg_la_SOURCES+= pkg_macho.c
pkg_common_cflags+= -I$(top_srcdir)/external/libmachista
endif

libpkg_la_CFLAGS= $(pkg_common_cflags) -shared
libpkg_la_CFLAGS= @OS_CFLAGS@ $(pkg_common_cflags) -shared
libpkg_la_LIBADD= $(top_builddir)/compat/libbsd_compat.la \
$(top_builddir)/external/libucl.la \
$(top_builddir)/external/libsqlite.la \
Expand Down
12 changes: 8 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,30 @@ pkg_SOURCES= add.c \
version.c \
which.c

pkg_LDADD= $(top_builddir)/libpkg/libpkg.la \
$(top_builddir)/external/libsbuf.la \
pkg_LDADD= @OS_LDFLAGS@ \
$(top_builddir)/libpkg/libpkg.la \
$(top_builddir)/external/libsbuf.la \
@LIBJAIL_LIB@ \
-lutil \
-lcrypto
pkg_CFLAGS= -I$(top_srcdir)/libpkg \
pkg_CFLAGS= @OS_CFLAGS@ \
-I$(top_srcdir)/libpkg \
-I$(top_builddir)/libpkg \
-I$(top_srcdir)/compat \
-I$(top_srcdir)/external/libsbuf \
-I$(top_srcdir)/external/uthash \
-I$(top_srcdir)/external/expat/lib \
-DGITHASH=\"$(GIT_HEAD)\"
pkg_static_SOURCES=
pkg_static_LDADD= $(top_builddir)/libpkg/libpkg_static.la \
pkg_static_LDADD= @OS_LDFLAGS@ \
$(top_builddir)/libpkg/libpkg_static.la \
$(top_builddir)/compat/libbsd_compat.la \
$(top_builddir)/external/libsbuf_static.la \
$(pkg_OBJECTS) \
@LIBJAIL_LIB@ \
@LIBEXECINFO_LIB@ \
@LDNS_LIBS@ \
@OS_LIBS@ \
-larchive \
-lz \
-lutil \
Expand Down

0 comments on commit 05d33ca

Please sign in to comment.