1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-24 12:31:00 +02:00

configure: add pkg-config helpers

This commit is contained in:
Hristo Venev 2020-10-26 18:57:02 +02:00
parent 30acc0a563
commit a6ee955e44

56
configure vendored
View File

@ -38,6 +38,35 @@ testlibraw() {
fi
}
# testpkg pkg1 pkg2 ...
# If all libraries are found, sets PKG_CFLAGS/PKG_LIBS and returns success.
# Otherwise, returns failure.
testpkg() {
PKG_LIBS="$($PKGCONFIG --libs "$@" 2>/dev/null)"
if [ $? -ne 0 ] ; then
return 1
fi
PKG_CFLAGS="$($PKGCONFIG --cflags "$@")"
}
# testpkg_db pkg1 pkg2 ...
# If all libraries are found, adds them to DBCFLAGS/DBLIBS and returns success.
# Otherwise, returns failure.
testpkg_db() {
testpkg "$@" || return $?
DBCFLAGS="${DBCFLAGS} ${PKG_CFLAGS}"
DBLIBS="${DBLIBS} ${PKG_LIBS}"
}
# testpkg_common pkg1 pkg2 ...
# If all libraries are found, adds them to OSCFLAGS/OSLIBS and returns success.
# Otherwise, returns failure.
testpkg_common() {
testpkg "$@" || return $?
OSCFLAGS="${OSCFLAGS} ${PKG_CFLAGS}"
OSLIBS="${OSLIBS} ${PKG_LIBS}"
}
testsqlite_comp() {
SQLITE_LIBS=-lsqlite3
${CC} -c ${SQL_TMPCPROGC} -o ${SQL_TMPCPROGO} ${OSCFLAGS} 2>>/dev/null
@ -807,6 +836,33 @@ if [ -z "${TURN_ACCEPT_RPATH}" ] ; then
fi
fi
##########################
# Which pkg-config?
##########################
if [ -z "$PKGCONFIG" ] ; then
for PKGCONFIG in pkgconf pkg-config ; do
if type "$PKGCONFIG" 2>/dev/null ; then
break
fi
PKGCONFIG=
done
if [ -z "$PKGCONFIG" ] ; then
${ECHO_CMD} "ERROR: pkg-config not found"
cleanup
exit
fi
else
if ! type "$PKGCONFIG" 2>/dev/null ; then
${ECHO_CMD} "ERROR: cannot use $PKGCONFIG"
cleanup
exit
fi
fi
${ECHO_CMD} "pkg-config: $PKGCONFIG"
###########################
# Check if we can use GNU
# or Clang compiler flags