Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow --with-rt configure option #2665

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 73 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,7 @@ AM_CONDITIONAL([USE_LIBMEDIAINFO], [test "x$libmediainfo" = "xtrue"])
#
openssl=false
cares=false
rt=undef
if test "x$WIN32" = "xno" ; then

AC_ARG_WITH([poll],
Expand All @@ -1378,12 +1379,71 @@ if test "x$WIN32" = "xno" ; then
LDFLAGS="-pthread $LDFLAGS"
fi

# librt #TODO: allow --with-rt=...
AC_CHECK_LIB([rt], [aio_write], [
SAVE_LDFLAGS="-lrt $SAVE_LDFLAGS"
LDFLAGS="-lrt $LDFLAGS"
AC_DEFINE(HAVE_AIO_RT, [1], [Define to indicate AIO presence in librt])
],
# librt
AC_MSG_CHECKING(for rt)
AC_ARG_WITH([rt],
AS_HELP_STRING(--with-rt=PATH, base of Real-time Library installation),
[
case $with_rt in
no)
AC_MSG_RESULT([no])

rt=false
;;
yes)
AC_CHECK_HEADERS([aio.h], [],
AC_MSG_ERROR([aio.h header not found or not usable])
)
AC_CHECK_LIB(rt, [aio_write], [LIBRT_LIBS="$LIBRT_LIBS -lrt"],
AC_MSG_ERROR([Could not find rt library!])
)

AC_SUBST(LIBRT_LIBS)
rt=true
;;
*)
# determine if library is installed
if test -d "$with_rt/lib"; then
LDFLAGS="-L$with_rt/lib $LDFLAGS"
CXXFLAGS="-I$with_rt/include $CXXFLAGS"

AC_CHECK_HEADERS([aio.h], [
LIBRT_LDFLAGS="-L$with_rt/lib"
LIBRT_CXXFLAGS="-I$with_rt/include"],
AC_MSG_ERROR([aio.h header not found or not usable])
)

AC_CHECK_LIB(rt, [aio_write], [LIBRT_LIBS="$LIBRT_LIBS -lrt"],
AC_MSG_ERROR([Could not find rt library!])
)
else
AC_MSG_ERROR([Could not find rt library in "$with_rt/lib"!])
fi

AC_SUBST(LIBRT_LDFLAGS)
AC_SUBST(LIBRT_CXXFLAGS)
AC_SUBST(LIBRT_LIBS)
rt=true

#restore
LDFLAGS=$SAVE_LDFLAGS
CXXFLAGS=$SAVE_CXXFLAGS
;;
esac
],
[
AC_MSG_RESULT([--with-rt not specified])

AC_CHECK_HEADERS([aio.h], [],
AC_MSG_ERROR([aio.h header not found or not usable])
)
AC_CHECK_LIB(rt, [aio_write], [LIBRT_LIBS="$LIBRT_LIBS -lrt"],
AC_MSG_NOTICE([Could not find librt])
)

AC_SUBST(LIBRT_LIBS)
rt=true
]
)

# OpenSSL
Expand Down Expand Up @@ -1695,6 +1755,12 @@ AS_IF([test "x$LINUX" = xyes -o "x$DARWIN" = xyes], [
dnl Let AM know whether we found a fuse backend.
AM_CONDITIONAL([WITH_FUSE], [test "x$enable_fuse" != xno])

# define on all platforms
AM_CONDITIONAL(HAVE_RT, test x$rt = xtrue)
if test "x$rt" = "xtrue" ; then
AC_DEFINE(HAVE_AIO_RT, [1], [Define to indicate AIO presence in librt])
fi

# define on all platforms
AM_CONDITIONAL(HAVE_OPENSSL, test x$openssl = xtrue)
if test "x$openssl" = "xtrue" ; then
Expand Down Expand Up @@ -2322,6 +2388,7 @@ AC_MSG_NOTICE([Configured to build Mega SDK:
PCRE: $PCRE_CXXFLAGS $PCRE_LDFLAGS $PCRE_LIBS
LIBUV: $LIBUV_CXXFLAGS $LIBUV_LDFLAGS $LIBUV_LIBS
LIBRAW: $LIBRAW_CXXFLAGS $LIBRAW_LDFLAGS $LIBRAW_LIBS
LIBRT: $LIBRT_CXXFLAGS $LIBRT_LDFLAGS $LIBRT_LIBS
LIBMEDIAINFO: $LIBMEDIAINFO_CXXFLAGS $LIBMEDIAINFO_LDFLAGS $LIBMEDIAINFO_LIBS
FFMPEG: $FFMPEG_CXXFLAGS $FFMPEG_LDFLAGS $FFMPEG_LIBS
FUSE: $FUSE_CPPFLAGS $FUSE_LDFLAGS $FUSE_LIBS
Expand Down
4 changes: 2 additions & 2 deletions src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ lib_LTLIBRARIES = src/libmega.la
if WIN32
src_libmega_la_CXXFLAGS = -D_WIN32=1 -Iinclude/ -Iinclude/mega/win32 $(LIBS_EXTRA) $(ZLIB_CXXFLAGS) $(LIBUV_CXXFLAGS) $(LIBRAW_CXXFLAGS) $(LIBMEDIAINFO_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(CRYPTO_CXXFLAGS) $(SODIUM_CXXFLAGS) $(DB_CXXFLAGS) $(CXXFLAGS) $(WINHTTP_CXXFLAGS) $(FI_CXXFLAGS) $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(PCRE_CXXFLAGS)
else
src_libmega_la_CXXFLAGS = $(CARES_FLAGS) $(LIBCURL_FLAGS) $(ZLIB_CXXFLAGS) $(LIBUV_CXXFLAGS) $(LIBRAW_CXXFLAGS) $(LIBMEDIAINFO_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(CRYPTO_CXXFLAGS) $(SODIUM_CXXFLAGS) $(DB_CXXFLAGS) $(FI_CXXFLAGS) $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(LIBSSL_FLAGS) $(PCRE_CXXFLAGS)
src_libmega_la_CXXFLAGS = $(CARES_FLAGS) $(LIBCURL_FLAGS) $(ZLIB_CXXFLAGS) $(LIBUV_CXXFLAGS) $(LIBRAW_CXXFLAGS) $(LIBRT_CXXFLAGS) $(LIBMEDIAINFO_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(CRYPTO_CXXFLAGS) $(SODIUM_CXXFLAGS) $(DB_CXXFLAGS) $(FI_CXXFLAGS) $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(LIBSSL_FLAGS) $(PCRE_CXXFLAGS)
endif

# Libs
if WIN32
src_libmega_la_LIBADD = $(LIBS_EXTRA) $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS) $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(SODIUM_LDFLAGS) $(SODIUM_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(WINHTTP_LDFLAGS) $(WINHTTP_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS)
else
src_libmega_la_LIBADD = $(CARES_LDFLAGS) $(CARES_LIBS) $(LIBCURL_LIBS) $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS) $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(SODIUM_LDFLAGS) $(SODIUM_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS)
src_libmega_la_LIBADD = $(CARES_LDFLAGS) $(CARES_LIBS) $(LIBCURL_LIBS) $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS) $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBRT_LDFLAGS) $(LIBRT_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(SODIUM_LDFLAGS) $(SODIUM_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS)
endif

# add library version
Expand Down