Skip to content

Commit

Permalink
Add custom path options for msgpack in autotols
Browse files Browse the repository at this point in the history
  • Loading branch information
nurupo committed Feb 10, 2022
1 parent 5568feb commit 64b5622
Showing 1 changed file with 85 additions and 8 deletions.
93 changes: 85 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ LIBSODIUM_SEARCH_HEADERS=
LIBSODIUM_SEARCH_LIBS=
NACL_SEARCH_HEADERS=
NACL_SEARCH_LIBS=
MSGPACK_SEARCH_HEADERS=
MSGPACK_SEARCH_LIBS=

AC_ARG_WITH(dependency-search,
AC_HELP_STRING([--with-dependency-search=DIR],
Expand Down Expand Up @@ -242,6 +244,24 @@ AC_ARG_WITH(libsodium-libs,
]
)

AC_ARG_WITH(msgpack-headers,
AC_HELP_STRING([--with-msgpack-headers=DIR],
[search for libmsgpackc header files in DIR]),
[
MSGPACK_SEARCH_HEADERS="$withval"
AC_MSG_NOTICE([will search for libmsgpackc header files in $withval])
]
)

AC_ARG_WITH(msgpack-libs,
AC_HELP_STRING([--with-msgpack-libs=DIR],
[search for libmsgpackc libraries in DIR]),
[
MSGPACK_SEARCH_LIBS="$withval"
AC_MSG_NOTICE([will search for libmsgpackc libraries in $withval])
]
)

if test "x$WANT_NACL" = "xyes"; then
enable_shared=no
enable_static=yes
Expand Down Expand Up @@ -302,14 +322,6 @@ PKG_CHECK_MODULES([LIBSODIUM], [libsodium],
LIBSODIUM_FOUND="no"
])

PKG_CHECK_MODULES([MSGPACK], [msgpack],
[
MSGPACK_FOUND="yes"
],
[
MSGPACK_FOUND="no"
])

if test "x$WANT_NACL" = "xyes"; then
NACL_LIBS=
NACL_LDFLAGS=
Expand Down Expand Up @@ -441,6 +453,71 @@ elif test "x$LIBSODIUM_FOUND" = "xno"; then
AC_SUBST(LIBSODIUM_CFLAGS)
fi

PKG_CHECK_MODULES([MSGPACK], [msgpack],
[
MSGPACK_FOUND="yes"
],
[
MSGPACK_FOUND="no"
])

if test "x$MSGPACK_FOUND" = "xno"; then
MSGPACK_LIBS=
MSGPACK_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
if test -n "$MSGPACK_SEARCH_LIBS"; then
LDFLAGS="-L$MSGPACK_SEARCH_LIBS $LDFLAGS"
AC_CHECK_LIB(msgpackc, msgpack_sbuffer_init,
[
MSGPACK_LDFLAGS="-L$MSGPACK_SEARCH_LIBS"
MSGPACK_LIBS="-lmsgpackc"
],
[
AC_MSG_ERROR([required library libmsgpackc was not found in requested location $MSGPACK_SEARCH_LIBS or library version is too old])
]
)
else
AC_CHECK_LIB(msgpackc, msgpack_sbuffer_init,
[],
[
AC_MSG_ERROR([required library libmsgpackc was not found on your system, please check https://github.com/msgpack/msgpack-c or library version is too old])
]
)
fi

LDFLAGS="$LDFLAGS_SAVE"
AC_SUBST(MSGPACK_LIBS)
AC_SUBST(MSGPACK_LDFLAGS)
fi

if test "x$MSGPACK_FOUND" = "xno"; then
MSGPACK_CFLAGS=
CFLAGS_SAVE="$CFLAGS"
CPPFLAGS_SAVE="$CPPFLAGS"
if test -n "$MSGPACK_SEARCH_HEADERS"; then
CFLAGS="-I$MSGPACK_SEARCH_HEADERS $CFLAGS"
CPPFLAGS="-I$MSGPACK_SEARCH_HEADERS $CPPFLAGS"
AC_CHECK_HEADER(msgpack.h,
[
MSGPACK_CFLAGS="-I$MSGPACK_SEARCH_HEADERS"
],
[
AC_MSG_ERROR([header files for required library libmsgpackc were not found in requested location $MSGPACK_SEARCH_HEADERS])
]
)
else
AC_CHECK_HEADER(msgpack.h,
[],
[
AC_MSG_ERROR([header files for required library libmsgpackc was not found on your system, please check https://github.com/msgpack/msgpack-c])
]
)
fi
CFLAGS="$CFLAGS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST(MSGPACK_CFLAGS)
fi

# Checks for library functions.
if (test "x$WIN32" != "xyes") && (test "x$MACH" != "xyes") && (test "x${host_os#*openbsd}" = "x$host_os") && (test "x$DISABLE_RT" != "xyes"); then
AC_CHECK_LIB(rt, clock_gettime,
Expand Down

0 comments on commit 64b5622

Please sign in to comment.