[PATCH v5 02/11] configure: detect libdl and librt

Pekka Paalanen ppaalanen at gmail.com
Mon Feb 25 11:47:30 UTC 2019


On Wed, 13 Feb 2019 13:39:07 +0200
Leonid Bobrov via wayland-devel <wayland-devel at lists.freedesktop.org> wrote:

> Signed-off-by: Leonid Bobrov <mazocomp at disroot.org>
> ---
>  Makefile.am  |  6 +++---
>  configure.ac | 16 ++++++++++++++++
>  2 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index f47d055..489f581 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -71,7 +71,7 @@ nodist_include_HEADERS =			\
>  	protocol/wayland-client-protocol.h
>  
>  libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
> -libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
> +libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
>  libwayland_server_la_LDFLAGS = -version-info 1:0:1
>  libwayland_server_la_SOURCES =			\
>  	src/wayland-server.c			\
> @@ -83,7 +83,7 @@ nodist_libwayland_server_la_SOURCES =		\
>  	protocol/wayland-protocol.c
>  
>  libwayland_client_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
> -libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
> +libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
>  libwayland_client_la_LDFLAGS = -version-info 3:0:3
>  libwayland_client_la_SOURCES =			\
>  	src/wayland-client.c
> @@ -227,7 +227,7 @@ libtest_runner_la_LIBADD =			\
>  	libwayland-client.la			\
>  	libwayland-server.la			\
>  	libtest-helpers.la			\
> -	-lrt -ldl $(FFI_LIBS)
> +	$(RT_LIBS) $(DL_LIBS) $(FFI_LIBS)
>  
>  array_test_SOURCES = tests/array-test.c
>  array_test_LDADD = libtest-runner.la
> diff --git a/configure.ac b/configure.ac
> index 18fb649..f53408a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -65,6 +65,22 @@ AC_SUBST(GCC_CFLAGS)
>  AC_CHECK_HEADERS([sys/prctl.h])
>  AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl])
>  
> +# *BSD don't have libdl, but they have its functions
> +SAVE_LIBS="$LIBS"
> +LIBS=
> +AC_CHECK_LIB([dl], [dlsym])
> +DL_LIBS="$LIBS"
> +LIBS="$SAVE_LIBS"
> +AC_SUBST(DL_LIBS)
> +
> +# *BSD don't have librt, but they have its functions
> +SAVE_LIBS="$LIBS"
> +LIBS=
> +AC_CHECK_LIB([rt], [clock_gettime])
> +RT_LIBS="$LIBS"
> +LIBS="$SAVE_LIBS"
> +AC_SUBST(RT_LIBS)
> +

Hi Leonid,

the idea is good, but I think AC_SEARCH_LIBS would fit better here than
AC_CHECK_LIB. Then we can even error out if the function is not found
anywhere.

Since we don't want to add stuff to LIBS either, maybe the best would
be to import m4/weston.m4 from weston and use WESTON_SEARCH_LIBS.
Weston already uses that for dlsym and clock_gettime. I think you could
import that as is, no need to rename WESTON_SEARCH_LIBS or anything.


Thanks,
pq

>  AC_ARG_ENABLE([libraries],
>  	      [AC_HELP_STRING([--disable-libraries],
>  			      [Disable compilation of wayland libraries])],

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190225/c6944236/attachment.sig>


More information about the wayland-devel mailing list