}
'
+check_cc_snippet llabs '
+#include <stdlib.h>
+int test(void)
+{
+ llabs(-10);
+ return 0;
+}
+'
+
#
# Python
#
if enabled_or_auto inotify; then
if check_cc_header "sys/inotify" inotify_h; then
enable inotify
+ check_cc_snippet inotify_init1 '
+ #include <sys/inotify.h>
+ int test(void)
+ {
+ inotify_init1(IN_CLOEXEC);
+ return 0;
+ }
+ '
elif enabled inotify; then
die "Inotify support not found (use --disable-inotify)"
fi
#
if [ ${PLATFORM} = "linux" ]; then
enable epoll
+ check_cc_snippet epoll_create1 '
+ #include <sys/epoll.h>
+ int test(void)
+ {
+ epoll_create1(EPOLL_CLOEXEC);
+ return 0;
+ }
+ '
fi
#
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef COMPAT_H
-#define COMPAT_H
+#ifndef TVH_COMPAT_H
+#define TVH_COMPAT_H
#if ENABLE_ANDROID
#ifndef strdupa
#define pthread_yield() sched_yield()
#endif
#define S_IEXEC S_IXUSR
-#define epoll_create1(EPOLL_CLOEXEC) epoll_create(n)
-#define inotify_init1(IN_CLOEXEC) inotify_init()
#include <time64.h>
// 32-bit Android has only timegm64() and not timegm().
// We replicate the behaviour of timegm() when the result overflows time_t.
#endif /* ENABLE_ANDROID */
+#ifndef ENABLE_EPOLL_CREATE1
+#define epoll_create1(EPOLL_CLOEXEC) epoll_create(n)
+#endif
+#ifndef ENABLE_INOTIFY_INIT1
+#define inotify_init1(IN_CLOEXEC) inotify_init()
+#endif
+#ifndef ENABLE_LLABS
+static inline long long int llabs(long long int a)
+{
+ if (a < 0) return -a; else return a;
+}
+#endif
+
#ifdef COMPAT_IPTOS
#ifndef IPTOS_DSCP_MASK
#endif /* COMPAT_IPTOS */
-#endif /* COMPAT_H */
+#endif /* TVH_COMPAT_H */