Skip to content

Commit

Permalink
fix pthread required library missing
Browse files Browse the repository at this point in the history
Signed-off-by: Pantelis Antoniou <[email protected]>
  • Loading branch information
pantoniou committed Sep 5, 2023
1 parent 27ae08c commit 376b63f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
25 changes: 15 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ AC_INIT([libfyaml],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[[email protected]])

AC_CONFIG_AUX_DIR([build-aux])

AC_PATH_PROG([M4], [m4 gm4], [no])
if test "x$M4" = xno ; then
AC_MSG_ERROR([m4 missing])
fi

AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")

AC_CANONICAL_TARGET

AC_CONFIG_SRCDIR([src/lib/fy-parse.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign 1.8.5 subdir-objects -Wno-portability])

m4_pattern_allow([^(AM_EXTRA_RECURSIVE_TARGETS|AM_PROG_AR)$])dnl
Expand Down Expand Up @@ -86,14 +94,15 @@ AC_PROG_CXX
AC_PROG_AWK
AC_PROG_LN_S

AX_PTHREAD
AX_PTHREAD([], [AC_MSG_ERROR("Missing required pthread support")])

AC_PATH_PROG([M4], [m4 gm4], [no])
if test "x$M4" = xno ; then
AC_MSG_ERROR([m4 missing])
# in some cases PTHREAD_LIBS is empty - force -lpthread */
if test "x$PTHREAD_LIBS" = "x"; then
PTHREAD_LIBS="-lpthread"
fi

AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $PTHREAD_LIBS"

# pkg-config
PKG_PROG_PKG_CONFIG
Expand Down Expand Up @@ -216,9 +225,6 @@ AM_CONDITIONAL([HAVE_ASAN],
[ test x$HAVE_ASAN = x1 ])
AC_DEFINE_UNQUOTED([HAVE_ASAN], [$HAVE_ASAN], [Define to 1 if ASAN is enabled])

# include -lm in the link
AC_SEARCH_LIBS([llrintf], [m], [], [AC_MSG_ERROR([unable to find the llrintf() function])])

# check if there's a qsort_r available (musl does not have it)
AC_CHECK_FUNC([qsort_r],
HAVE_QSORT_R=1,
Expand Down Expand Up @@ -554,5 +560,4 @@ echo "
TESTSUITECHECKOUT: $TESTSUITECHECKOUT
JSONTESTSUITEURL: $JSONTESTSUITEURL
JSONTESTSUITECHECKOUT: $JSONTESTSUITECHECKOUT

"
2 changes: 1 addition & 1 deletion libfyaml.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ includedir=@includedir@
Name: libfyaml
Description: Fancy YAML 1.3 parser library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} @ASAN_LIBS@ -lfyaml @PTHREAD_LIBS@
Libs: -L${libdir} @ASAN_LIBS@ @PTHREAD_LIBS@ -lfyaml
Cflags: -I${includedir} @ASAN_CFLAGS@ @PTHREAD_CFLAGS@

0 comments on commit 376b63f

Please sign in to comment.