sched_setattr syscall has been added in v3.14 with deadline scheduler. This new syscall is not always implemented in the lib and libdl is used in this case.
We add a test on the presence of sched_setattr in the system environment and compile libdl iff sched_setattr has not been already defined by another library
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- Makefile.am | 5 +++++ configure.ac | 10 +++++----- src/Makefile.am | 5 ++++- 3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 3e4d129..ad50fa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,6 @@ +if SET_DLSCHED SUBDIRS = libdl src +else +SUBDIRS = src +endif + diff --git a/configure.ac b/configure.ac index 6b24f11..d4d3df8 100644 --- a/configure.ac +++ b/configure.ac @@ -9,20 +9,20 @@ AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/rt-app.c]) AC_HEADER_STDC + AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([m], [round]) AC_CHECK_LIB([rt], [clock_gettime]) AC_CHECK_LIB([json-c], [json_object_from_file]) +AC_CHECK_FUNCS(sched_setattr, [], [])
AC_ARG_WITH([deadline], [AS_HELP_STRING([--with-deadline], - [Add support for SCHED_DEADLINE])], - [], + [Add support for SCHED_DEADLINE])], + [AC_DEFINE([DLSCHED], [1], [Define if you have SCHED_DEADLINE support])], [with_deadline=no])
-AS_IF([test "x$with_deadline" != xno], - [AC_DEFINE([DLSCHED], [1], [Define if you have SCHED_DEADLINE support]) - ]) +AM_CONDITIONAL([SET_DLSCHED], [test x$with_deadline != xno && test !HAVE_SCHED_SETATTR])
AC_ARG_VAR([LOGLVL], [verbosity level, from 0 to 100. 100 is very verbose])
diff --git a/src/Makefile.am b/src/Makefile.am index 9bca1dc..1fe362d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,5 +3,8 @@ AM_CPPFLAGS = -I$(srcdir)/../libdl/ bin_PROGRAMS = rt-app rt_app_SOURCES= rt-app_types.h rt-app_args.h rt-app_utils.h rt-app_utils.c rt-app_args.c rt-app.h rt-app.c rt_app_SOURCES += rt-app_parse_config.h rt-app_parse_config.c -rt_app_LDADD = $(QRESLIB) ../libdl/libdl.a +rt_app_LDADD = $(QRESLIB) +if SET_DLSCHED +rt_app_LDADD += ../libdl/libdl.a +endif dist_bin_SCRIPTS = $(srcdir)/../doc/workgen