build: Check if we need to link against libargp

The build of `cockpit-tls` otherwise fails with a linker error on systems using
the musl C library:
```
[...]

  CCLD     cockpit-tls
ld.lld: error: undefined symbol: argp_parse
>>> referenced by main.c:103 (/home/marv/devel/cockpit/src/tls/main.c:103)
>>>               src/tls/main.o:(main)

ld.lld: error: undefined symbol: argp_error
>>> referenced by main.c:51 (/home/marv/devel/cockpit/src/tls/main.c:51)
>>>               src/tls/main.o:(arg_parse_int)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```
This commit is contained in:
Marvin Schmidt 2022-11-03 03:47:42 +01:00 committed by Martin Pitt
parent 76bf6b03d3
commit ceb5e694da
2 changed files with 8 additions and 1 deletions

View File

@ -82,6 +82,13 @@ AC_ARG_ENABLE(old_bridge, AS_HELP_STRING([--enable-old-bridge], [Install old C c
AM_CONDITIONAL(WITH_OLD_BRIDGE, test "$enable_old_bridge" = "yes")
AC_MSG_RESULT(${enable_old_bridge:=no})
AC_SEARCH_LIBS([argp_parse], [argp])
case "$ac_cv_search_argp_parse" in
no) AC_MSG_FAILURE([failed to find argp_parse]) ;;
-l*) argp_LIBS="$ac_cv_search_argp_parse" ;;
*) argp_LIBS= ;;
esac
AC_SUBST([argp_LIBS])
AC_SEARCH_LIBS([fts_close], [fts])
case "$ac_cv_search_fts_close" in

View File

@ -31,7 +31,7 @@ libcockpit_tls_a_SOURCES = \
# cockpit-tls
libexec_PROGRAMS += cockpit-tls
cockpit_tls_LDADD = $(libcockpit_tls_a_LIBS)
cockpit_tls_LDADD = $(libcockpit_tls_a_LIBS) $(argp_LIBS)
cockpit_tls_SOURCES = src/tls/main.c
# -----------------------------------------------------------------------------