Fix compilation on Linux systems without vDSO support
Summary:
Problems:
- The vDSO check code in configure.ac is broken, and will always fail (uses AC_LANG_PROGRAM but with arguments in the AC_LANG_SOURCE style)
- On Linux, using dlopen/dlsym requires -ldl (libdl) during the link phase. This check was missing and this argument was not added to the linker arguments.
- On a Linux system without vDSO support, libfolly.so still uses vDSO in ClockGettimeWrappers.cpp
Solution:
- Switched to AC_LANG_SOURCE
- Required libdl to exist when build target is Linux. This also adds this dependency to libfolly.la, resulting in fixing a dependency issue for Proxygen (recent Proxygen build would have issues in building examples due to failing linking step due to missing dlopen / dlsym / dlclose symbols)
- In ClockGettimeWrappers.cpp, checking if `__linux__` is set is not sufficient to determine that the system has vDSO support. The autoconf script already exposes a correct check: FOLLY_HAVE_LINUX_VDSO (this is already used in folly/detail/CacheLocality.cpp), so switched to that one.
Closes https://github.com/facebook/folly/pull/592
Reviewed By: yfeldblum
Differential Revision:
D5049816
Pulled By: Orvid
fbshipit-source-id:
58b2ed4c4101274505c61b4825accf262c0d56ef