From 2db195ecaea367974aabe53a6208cd6e9bf6f147 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Thu, 3 Nov 2016 07:28:43 +0100 Subject: [PATCH] Fix build issue in Mac OS X due missing scheduler --- advance/lib/config.hin | 12 ++++++++++++ advance/linux/os.c | 2 +- advance/linux/target.c | 2 +- configure.ac | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/advance/lib/config.hin b/advance/lib/config.hin index 6a7f24bcf..58bc8b345 100644 --- a/advance/lib/config.hin +++ b/advance/lib/config.hin @@ -106,9 +106,21 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H +/* Define to 1 if you have the `sched_getscheduler' function. */ +#undef HAVE_SCHED_GETSCHEDULER + +/* Define to 1 if you have the `sched_get_priority_max' function. */ +#undef HAVE_SCHED_GET_PRIORITY_MAX + /* Define to 1 if you have the header file. */ #undef HAVE_SCHED_H +/* Define to 1 if you have the `sched_setscheduler' function. */ +#undef HAVE_SCHED_SETSCHEDULER + +/* Define to 1 if you have the `sched_yield' function. */ +#undef HAVE_SCHED_YIELD + /* Define to 1 if you have the header file. */ #undef HAVE_SLANG_H diff --git a/advance/linux/os.c b/advance/linux/os.c index bcd16065e..212ca78a1 100644 --- a/advance/linux/os.c +++ b/advance/linux/os.c @@ -346,7 +346,7 @@ int os_inner_init(const char* title) #endif #endif -#ifdef _POSIX_PRIORITY_SCHEDULING /* OSDEF Check for POSIX scheduling */ +#if HAVE_SCHED_GETSCHEDULER && HAVE_SCHED_SETSCHEDULER && HAVE_SCHED_GET_PRIORITY_MAX && defined(_POSIX_PRIORITY_SCHEDULING) /* OSDEF Check for POSIX scheduling */ log_std(("os: scheduling available\n")); #ifdef SCHED_FIFO /* set the SCHED_FIFO scheduling policy with maximum priority */ diff --git a/advance/linux/target.c b/advance/linux/target.c index 715ad4d20..0e99c582f 100644 --- a/advance/linux/target.c +++ b/advance/linux/target.c @@ -135,7 +135,7 @@ void target_done(void) void target_yield(void) { -#ifdef _POSIX_PRIORITY_SCHEDULING /* OSDEF Check for POSIX scheduling */ +#if HAVE_SCHED_YIELD && defined(_POSIX_PRIORITY_SCHEDULING) /* OSDEF Check for POSIX scheduling */ sched_yield(); #endif } diff --git a/configure.ac b/configure.ac index cfc877ffc..b14467412 100644 --- a/configure.ac +++ b/configure.ac @@ -339,7 +339,7 @@ if test $ac_system = unix ; then AC_CHECK_FUNCS([strcasecmp strerror]) AC_CHECK_FUNCS([uname sysconf backtrace backtrace_symbols]) AC_CHECK_FUNCS([flockfile funlockfile fread_unlocked fwrite_unlocked fgetc_unlocked feof_unlocked fseeko ftello]) - AC_CHECK_FUNCS([iopl mprotect]) + AC_CHECK_FUNCS([iopl mprotect sched_getscheduler sched_setscheduler sched_get_priority_max sched_yield]) AC_MSG_CHECKING([for port in/out]) AC_TRY_LINK([ #include