netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread
@ 2013-12-10 12:24 Gustavo Zacarias
  2013-12-11  0:46 ` Eric Leblond
  2013-12-11  8:03 ` Eric Leblond
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo Zacarias @ 2013-12-10 12:24 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Gustavo Zacarias

Some uClibc-based toolchains lack threading support, so use
AC_SEARCH_LIB instead of AC_CHECK_LIB to check for libpthread
availability and link conditionally if found since it's only used for
the database backends.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 configure.ac    | 3 ++-
 src/Makefile.am | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7f5ffa9..5e45aaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,8 @@ AC_CHECK_FUNCS(socket strerror)
 regular_CFLAGS="-Wall -Wextra -Wno-unused-parameter"
 AC_SUBST([regular_CFLAGS])
 
-AC_CHECK_LIB(pthread, pthread_create)
+AC_SEARCH_LIBS([pthread_create], [pthread], [libpthread_LIBS="$LIBS"; LIBS=""])
+AC_SUBST([libpthread_LIBS])
 
 dnl Check for the right nfnetlink version
 PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 1.0.1])
diff --git a/src/Makefile.am b/src/Makefile.am
index 1097468..998e776 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,5 +7,5 @@ AM_CFLAGS = ${regular_CFLAGS}
 sbin_PROGRAMS = ulogd
 
 ulogd_SOURCES = ulogd.c select.c timer.c rbtree.c conffile.c hash.c addr.c
-ulogd_LDADD   = ${libdl_LIBS}
-ulogd_LDFLAGS = -export-dynamic -lpthread
+ulogd_LDADD   = ${libdl_LIBS} ${libpthread_LIBS}
+ulogd_LDFLAGS = -export-dynamic
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread
  2013-12-10 12:24 [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread Gustavo Zacarias
@ 2013-12-11  0:46 ` Eric Leblond
  2013-12-11  0:56   ` Gustavo Zacarias
  2013-12-11  8:03 ` Eric Leblond
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Leblond @ 2013-12-11  0:46 UTC (permalink / raw)
  To: Gustavo Zacarias; +Cc: netfilter-devel

Hello,
On Tue, 2013-12-10 at 09:24 -0300, Gustavo Zacarias wrote:
> Some uClibc-based toolchains lack threading support, so use
> AC_SEARCH_LIB instead of AC_CHECK_LIB to check for libpthread
> availability and link conditionally if found since it's only used for
> the database backends.

Is there some need for this type of systems to have access to the
database backends ? In this case, it will be interesting to make
conditional the build of the new thread running mode.

BR,

> 
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
>  configure.ac    | 3 ++-
>  src/Makefile.am | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7f5ffa9..5e45aaa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -39,7 +39,8 @@ AC_CHECK_FUNCS(socket strerror)
>  regular_CFLAGS="-Wall -Wextra -Wno-unused-parameter"
>  AC_SUBST([regular_CFLAGS])
>  
> -AC_CHECK_LIB(pthread, pthread_create)
> +AC_SEARCH_LIBS([pthread_create], [pthread], [libpthread_LIBS="$LIBS"; LIBS=""])
> +AC_SUBST([libpthread_LIBS])
>  
>  dnl Check for the right nfnetlink version
>  PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 1.0.1])
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 1097468..998e776 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -7,5 +7,5 @@ AM_CFLAGS = ${regular_CFLAGS}
>  sbin_PROGRAMS = ulogd
>  
>  ulogd_SOURCES = ulogd.c select.c timer.c rbtree.c conffile.c hash.c addr.c
> -ulogd_LDADD   = ${libdl_LIBS}
> -ulogd_LDFLAGS = -export-dynamic -lpthread
> +ulogd_LDADD   = ${libdl_LIBS} ${libpthread_LIBS}
> +ulogd_LDFLAGS = -export-dynamic

-- 
Eric Leblond <eric@regit.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread
  2013-12-11  0:46 ` Eric Leblond
@ 2013-12-11  0:56   ` Gustavo Zacarias
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo Zacarias @ 2013-12-11  0:56 UTC (permalink / raw)
  To: Eric Leblond; +Cc: netfilter-devel

On 12/10/2013 09:46 PM, Eric Leblond wrote:

> Is there some need for this type of systems to have access to the
> database backends ? In this case, it will be interesting to make
> conditional the build of the new thread running mode.

My $.02 say no, it's probably not worth the effort, such a system would
probably be resourceful (not memory/storage constrained) and just be
able to use a threaded libc (an ARM uClibc libpthread is ~68 KiB stripped).
Regards.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread
  2013-12-10 12:24 [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread Gustavo Zacarias
  2013-12-11  0:46 ` Eric Leblond
@ 2013-12-11  8:03 ` Eric Leblond
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Leblond @ 2013-12-11  8:03 UTC (permalink / raw)
  To: Gustavo Zacarias; +Cc: netfilter-devel

Hello,

On Tue, 2013-12-10 at 09:24 -0300, Gustavo Zacarias wrote:
> Some uClibc-based toolchains lack threading support, so use
> AC_SEARCH_LIB instead of AC_CHECK_LIB to check for libpthread
> availability and link conditionally if found since it's only used for
> the database backends.

Thanks a lot. Patch pushed to git.

BR,

> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
>  configure.ac    | 3 ++-
>  src/Makefile.am | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7f5ffa9..5e45aaa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -39,7 +39,8 @@ AC_CHECK_FUNCS(socket strerror)
>  regular_CFLAGS="-Wall -Wextra -Wno-unused-parameter"
>  AC_SUBST([regular_CFLAGS])
>  
> -AC_CHECK_LIB(pthread, pthread_create)
> +AC_SEARCH_LIBS([pthread_create], [pthread], [libpthread_LIBS="$LIBS"; LIBS=""])
> +AC_SUBST([libpthread_LIBS])
>  
>  dnl Check for the right nfnetlink version
>  PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 1.0.1])
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 1097468..998e776 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -7,5 +7,5 @@ AM_CFLAGS = ${regular_CFLAGS}
>  sbin_PROGRAMS = ulogd
>  
>  ulogd_SOURCES = ulogd.c select.c timer.c rbtree.c conffile.c hash.c addr.c
> -ulogd_LDADD   = ${libdl_LIBS}
> -ulogd_LDFLAGS = -export-dynamic -lpthread
> +ulogd_LDADD   = ${libdl_LIBS} ${libpthread_LIBS}
> +ulogd_LDFLAGS = -export-dynamic

-- 
Eric Leblond <eric@regit.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-11  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 12:24 [PATCH ulogd] ulogd: use AC_SEARCH_LIBS for libpthread Gustavo Zacarias
2013-12-11  0:46 ` Eric Leblond
2013-12-11  0:56   ` Gustavo Zacarias
2013-12-11  8:03 ` Eric Leblond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).