Skip to content

Commit 36ad610

Browse files
committed
Enabling PCRE in autoconf for mqexec.
1 parent c66d736 commit 36ad610

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Copyright 2012 Jonathan Reams
12
Copyright 2012 The Trustees of Columbia University in the City of New York
23

34
Licensed under the Apache License, Version 2.0 (the "License");

configure.ac

+21
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ AC_ARG_WITH([zmq-headers],
1212
[]
1313
[with_zmq_headers=default])
1414

15+
AC_ARG_WITH([pcre-config],
16+
[AC_HELP_STRING([--with-pcre-config],
17+
[Path to PCRE configuration for mqexec filtering])],
18+
[pcre_config_prog=$withval])
19+
AC_PATH_PROG(PCRE_CONFIG, [pcre-config], $pcre_config_prog)
20+
1521
AC_PROG_CC
1622
AC_PROG_LIBTOOL
1723

@@ -33,6 +39,21 @@ AC_FUNC_REALLOC
3339
AC_FUNC_STRTOD
3440

3541
m4_include([libev/libev.m4])
42+
if test "x$PCRE_CONFIG" != "x"; then
43+
CFLAGS_SAVE=$CFLAGS
44+
LIBS_SAVE=$LIBS
45+
CFLAGS="$CFLAGS $($PCRE_CONFIG --cflags)"
46+
LIBS="$LIBS $($PCRE_CONFIG --libs)"
47+
AC_CHECK_HEADER([pcre.h], [],
48+
AC_MSG_FAILURE([PCRE was enabled but headers weren't found]), [])
49+
AC_CHECK_LIB([pcre], [pcre_compile], [],
50+
AC_MSG_FAILURE([PCRE was enabled but libraries weren't found]), [])
51+
CFLAGS=$CFLAGS_SAVE
52+
LIBS=$LIBS_SAVE
53+
AC_SUBST([PCRE_HEADERS], $($PCRE_CONFIG --cflags))
54+
AC_SUBST([PCRE_LIBS], $($PCRE_CONFIG --libs))
55+
AC_DEFINE([HAVE_PCRE], [], [PCRE Libraries are installed])
56+
fi
3657

3758
AC_CONFIG_FILES([Makefile mods/Makefile dnxmq/Makefile])
3859
AC_CONFIG_SUBDIRS([jansson])

dnxmq/Makefile.am

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
sbin_PROGRAMS = mqexec
22

33
mqexec_SOURCES = mqexec.c ../libev/ev.c
4-
mqexec_LDADD = ../jansson/src/libjansson.la
5-
mqexec_CFLAGS = -I../jansson/src
4+
mqexec_LDADD = ../jansson/src/libjansson.la @PCRE_LIBS@
5+
mqexec_CFLAGS = -I../jansson/src @PCRE_HEADERS@

dnxmq/config.h.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* Define to 1 if you have the PCRE libraries installed */
2+
#undef HAVE_PCRE

0 commit comments

Comments
 (0)