[LTP] [PATCH 1/1] m4: Fix warnings

Cyril Hrubis chrubis@suse.cz
Mon Jan 24 16:16:18 CET 2022


Hi!
> diff --git a/m4/ltp-eventfd.m4 b/m4/ltp-eventfd.m4
> index 5d729a33d..580df00a3 100644
> --- a/m4/ltp-eventfd.m4
> +++ b/m4/ltp-eventfd.m4
> @@ -12,12 +12,10 @@ AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [
>  		AC_SUBST(AIO_LIBS, "-laio")
>  
>  		AC_MSG_CHECKING([io_set_eventfd is defined in aio library or aio header])
> -		AC_TRY_LINK([#include <stdio.h>
> +		AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
>                               #include <libaio.h>
> -		            ],
> -		            [io_set_eventfd(NULL, 0); return 0;],
> +		            ]], [[io_set_eventfd(NULL, 0); return 0;]])],
>  		            [AC_DEFINE(HAVE_IO_SET_EVENTFD, 1, [Define to 1 if you have `io_set_eventfd' function.])
> -						AC_MSG_RESULT(yes)],
> -		            [AC_MSG_RESULT(no)])
> +						AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])

Shouldn't we convert this bit into AC_CHECK_FUNCS() (in a separte patch)?

>  	fi
>  ])
> diff --git a/m4/ltp-kernel_devel.m4 b/m4/ltp-kernel_devel.m4
> index 8a0598e5a..d46d54775 100644
> --- a/m4/ltp-kernel_devel.m4
> +++ b/m4/ltp-kernel_devel.m4
> @@ -9,7 +9,7 @@ AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[
>  AC_MSG_CHECKING([for kernel-devel])
>  AC_ARG_WITH(
>  	[linux-version],
> -	[AC_HELP_STRING([--with-linux-version=VERSION],
> +	[AS_HELP_STRING([--with-linux-version=VERSION],
>  			[specify the Linux version to build modules for])],
>  	[LINUX_VERSION="${withval}"],
>  	AS_IF([test "$cross_compiling" = "no"],
> @@ -18,7 +18,7 @@ AC_ARG_WITH(
>  AC_SUBST(LINUX_VERSION)
>  
>  AC_ARG_WITH([linux-dir],
> -	[AC_HELP_STRING([--with-linux-dir=DIR],
> +	[AS_HELP_STRING([--with-linux-dir=DIR],
>  			[specify path to kernel-devel directory])],
>  	[LINUX_DIR="${withval}"],
>  	AS_IF([test -n "$LINUX_VERSION"],
> @@ -44,7 +44,7 @@ AC_MSG_RESULT([$WITH_MODULES])
>  
>  AC_ARG_WITH(
>  	[modules],
> -	[AC_HELP_STRING([--without-modules],
> +	[AS_HELP_STRING([--without-modules],
>  			[disable auto-building kernel modules])],
>  			[WITH_MODULES="no"],
>  			[])
> diff --git a/m4/ltp-mremap_fixed.m4 b/m4/ltp-mremap_fixed.m4
> index 66548b82b..ff2696909 100644
> --- a/m4/ltp-mremap_fixed.m4
> +++ b/m4/ltp-mremap_fixed.m4
> @@ -6,7 +6,7 @@ AC_DEFUN([LTP_CHECK_MREMAP_FIXED],[
>  AH_TEMPLATE(HAVE_MREMAP_FIXED,
>  [Define to 1 if you have MREMAP_FIXED in <sys/mman.h>.])
>  AC_MSG_CHECKING([for MREMAP_FIXED in <sys/mman.h>])
> -AC_TRY_COMPILE([#define _GNU_SOURCE
> -                #include <sys/mman.h>], [int flags = MREMAP_FIXED;],
> -               AC_DEFINE(HAVE_MREMAP_FIXED) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
> +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
> +                #include <sys/mman.h>]], [[int flags = MREMAP_FIXED;]])],
> +                [AC_DEFINE(HAVE_MREMAP_FIXED) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
>  ])
> diff --git a/m4/ltp-perf_event_open.m4 b/m4/ltp-perf_event_open.m4
> index 6966cf270..4a488ffa3 100644
> --- a/m4/ltp-perf_event_open.m4
> +++ b/m4/ltp-perf_event_open.m4
> @@ -7,10 +7,8 @@ AC_DEFUN([LTP_CHECK_SYSCALL_PERF_EVENT_OPEN],[
>  AH_TEMPLATE(HAVE_PERF_EVENT_ATTR,
>  [Define to 1 if you have struct perf_event_attr])
>  AC_MSG_CHECKING([for perf_event_attr in linux/perf_event.h])
> -AC_TRY_COMPILE([#include <unistd.h>
> -		#include <linux/perf_event.h>],
> -		[
> +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
> +		#include <linux/perf_event.h>]], [[
>  			struct perf_event_attr pe;
> -		],
> -		AC_DEFINE(HAVE_PERF_EVENT_ATTR) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
> +		]])],[AC_DEFINE(HAVE_PERF_EVENT_ATTR) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])

And this one with AC_CHECK_TYPES()?

>  ])
> diff --git a/testcases/realtime/m4/check.m4 b/testcases/realtime/m4/check.m4
> index e60ae1928..d04a2cc73 100644
> --- a/testcases/realtime/m4/check.m4
> +++ b/testcases/realtime/m4/check.m4
> @@ -1,10 +1,10 @@
>  AC_DEFUN([REALTIME_CHECK_PRIO_INHERIT],[
>  AC_MSG_CHECKING([for PTHREAD_PRIO_INHERIT])
> -AC_TRY_COMPILE([
> -#include <pthread.h>],[int main(void) {
> +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> +#include <pthread.h>]], [[int main(void) {
>  	pthread_mutexattr_t attr;
>  	return pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
> -}],[has_priority_inherit="yes"],[])
> +}]])],[has_priority_inherit="yes"],[])
>  if test "x$has_priority_inherit" = "xyes" ; then
>  	AC_DEFINE(HAS_PRIORITY_INHERIT,1,[Define to 1 if you have PTHREAD_PRIO_INHERIT])
>  	AC_MSG_RESULT(yes)
> diff --git a/testcases/realtime/m4/ltp-exp10.m4 b/testcases/realtime/m4/ltp-exp10.m4
> index 3d2320a20..625175c31 100644
> --- a/testcases/realtime/m4/ltp-exp10.m4
> +++ b/testcases/realtime/m4/ltp-exp10.m4
> @@ -26,12 +26,10 @@ AH_TEMPLATE(HAVE_EXP10,
>  AC_MSG_CHECKING([for exp10])
>  backup_ldlibs="$LIBS"
>  LIBS+=" -lm"
> -AC_TRY_LINK([#define _GNU_SOURCE
> -             #include <math.h>],
> -            [
> +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
> +             #include <math.h>]], [[
>               volatile float val;
>               exp10(val);
> -            ],
> -             AC_DEFINE(HAVE_EXP10) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
> +            ]])],[AC_DEFINE(HAVE_EXP10) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
>  LIBS="$backup_ldlibs"
>  ])

Similarily here AC_CHECK_FUNCS()?

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list