Hi Yamato,
On Mon, 2008-11-10 at 11:08 +0900, Masatake YAMATO wrote:
> > And another thing to point out. Shouldn´t:
> >
> > make clean
> >
> > be removing stuff like configure, config.status, config.log,
> > autom4te.cache from the sources. It is retaining them. Is it expected ?
> > I would like them to clean up on make clean.
>
> I revisied my patch.
>
> - signalfd.m4 is renamed to ltp-signalfd.m4.
> - configure is run by make if config.h is older than config.h.in.
> - autoconf is run by make if configure is older than configure.ac.
> - autoheader is run by make if config.h.in is older than configure.ac.
> - dist-clean, a new make target, removes autom4te.cache,
> config.log and config.status.
> - maintainer-clean, a new make target, removes configure and
> config.h.in.
However, i wanted:
make clean
to do all that stuff. So, updated accordingly.
>
> Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]>
Thanks for this Patch. Merged.
Regards--
Subrata
>
>
> diff --git a/Makefile b/Makefile
> index de0e5c8..0a48ee8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -44,7 +44,8 @@ export CC AR RANLIB CPPFLAGS LDFLAGS HAS_NUMA
>
> -include config.mk
>
> -all: libltp.a
> +VPATH += include m4
> +all: config.h libltp.a
> @$(MAKE) -C pan $@
> @$(MAKE) -C testcases $@
> @$(MAKE) -C tools $@
> @@ -59,6 +60,7 @@ install: all
> @$(MAKE) -C lib install
> @$(MAKE) -C include install
> @$(MAKE) -C pan install
> + @$(MAKE) -C m4 install
> @$(MAKE) -C doc/man1 install
> @$(MAKE) -C doc/man3 install
>
> @@ -93,7 +95,32 @@ clean:
> @$(MAKE) -C tools $@
> @$(MAKE) -C testcases $@
>
> +dist-clean: clean ac-dist-clean
> + @$(MAKE) -C include $@
> +
> +maintainer-clean: dist-clean ac-maintainer-clean
> + @$(MAKE) -C include $@
> +
> package:
> rpmbuild -ba ltp-devel.spec
>
>
> +#
> +# Autoconf related
> +#
> +config.h: config.h.in configure
> + ./configure
> +
> +config.h.in: configure.ac
> + autoheader
> +
> +configure: configure.ac $(notdir $(wildcard m4/*.m4))
> + autoconf
> +
> +.PHONY: ac-dist-clean ac-maintainer-clean
> +ac-dist-clean:
> + rm -rf autom4te.cache
> + rm -f config.log config.status
> +
> +ac-maintainer-clean:
> + rm -f configure
> diff --git a/configure.ac b/configure.ac
> new file mode 100644
> index 0000000..2ee6c2c
> --- /dev/null
> +++ b/configure.ac
> @@ -0,0 +1,9 @@
> +AC_INIT([runltp])
> +AC_CONFIG_HEADERS([include/config.h])
> +
> +
> +m4_include([m4/ltp-signalfd.m4])
> +LTP_CHECK_SYSCALL_SIGNALFD
> +
> +
> +AC_OUTPUT
> diff --git a/include/Makefile b/include/Makefile
> index 464b9a5..dd9d14f 100644
> --- a/include/Makefile
> +++ b/include/Makefile
> @@ -4,7 +4,7 @@ PREFIX=/opt/ltp
> HEADERS=compiler.h dataascii.h databin.h file_lock.h forker.h open_flags.h \
> pattern.h random_range.h rmobj.h search_path.h string_to_tokens.h \
> str_to_bytes.h test.h tlibio.h usctest.h write_log.h \
> - linux_syscall_numbers.h libtestsuite.h
> + linux_syscall_numbers.h libtestsuite.h config.h
>
> all:
>
> @@ -13,3 +13,11 @@ install: $(HEADERS)
> install -D -m 644 $$i $(DESTDIR)/$(PREFIX)/include/ltp/$$i; \
> done
>
> +dist-clean: ac-dist-clean
> +maintainer-clean: dist-clean ac-maintainer-clean
> +
> +.PHONY: ac-dist-clean ac-maintainer-clean
> +ac-dist-clean:
> + rm -f config.h
> +ac-maintainer-clean:
> + rm -f config.h.in
> diff --git a/m4/Makefile b/m4/Makefile
> new file mode 100644
> index 0000000..a1641d4
> --- /dev/null
> +++ b/m4/Makefile
> @@ -0,0 +1,12 @@
> +
> +
> +PREFIX=/opt/ltp
> +M4MACROS=$(notdir $(wildcard *.m4))
> +
> +all:
> +
> +install: $(M4MACROS)
> + for i in $(M4MACROS); do \
> + install -D -m 644 $$i $(DESTDIR)/$(PREFIX)/share/aclocal/$$i; \
> + done
> +
> diff --git a/m4/ltp-signalfd.m4 b/m4/ltp-signalfd.m4
> new file mode 100644
> index 0000000..665c5cb
> --- /dev/null
> +++ b/m4/ltp-signalfd.m4
> @@ -0,0 +1,91 @@
> +dnl
> +dnl Copyright (c) Red Hat Inc., 2008
> +dnl
> +dnl This program is free software; you can redistribute it and/or modify
> +dnl it under the terms of the GNU General Public License as published by
> +dnl the Free Software Foundation; either version 2 of the License, or
> +dnl (at your option) any later version.
> +dnl
> +dnl This program is distributed in the hope that it will be useful,
> +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
> +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> +dnl the GNU General Public License for more details.
> +dnl
> +dnl You should have received a copy of the GNU General Public License
> +dnl along with this program; if not, write to the Free Software
> +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> +dnl
> +dnl Author: Masatake YAMATO <[EMAIL PROTECTED]>
> +dnl
> +
> +dnl
> +dnl LTP_CHECK_SYSCALL_SIGNALFD
> +dnl --------------------------
> +dnl
> +dnl * Checking the existence of the libc wrapper for signalfd.
> +dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FUNCTION is set to
> "yes".
> +dnl
> +dnl * Checking the existence of signalfd.h.
> +dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_HEADER is set to
> "yes".
> +dnl
> +dnl * Checking the prefix used in fileds for signalfd_siginfo structure.
> +dnl If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FIELD_PREFIX is
> set to "given".
> +dnl
> +dnl About cpp macros defined in this macro,
> +dnl see testcases/kernel/syscalls/signalfd/signalfd01.c of ltp.
> +dnl
> +
> +AC_DEFUN([LTP_CHECK_SYSCALL_SIGNALFD],
> +[dnl
> +_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
> +_LTP_CHECK_SYSCALL_SIGNALFD_HEADER
> +
> +if test "$LTP_SYSCALL_SIGNALFD_HEADER" = yes; then
> + _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
> +fi]dnl
> +)dnl
> +
> +dnl _LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
> +dnl ------------------------------------
> +dnl
> +dnl
> +AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION],[dnl
> +AC_CHECK_FUNCS(signalfd,[LTP_SYSCALL_SIGNALFD_FUNCTION=yes])])
> +
> +dnl _LTP_CHECK_SYSCALL_SIGNALFD_HEADER
> +dnl ----------------------------------
> +dnl
> +dnl
> +AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_HEADER],
> +[dnl
> +AC_CHECK_HEADERS([linux/types.h])
> +AC_CHECK_HEADERS(sys/signalfd.h linux/signalfd.h signalfd.h,[dnl
> +LTP_SYSCALL_SIGNALFD_HEADER=yes],[],[dnl
> +#ifdef HAVE_LINUX_TYPES_H
> +#include <linux/types.h>
> +#endif)
> +]dnl
> +)dnl
> +]dnl
> +)dnl
> +
> +dnl _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
> +dnl ----------------------------------------
> +dnl
> +dnl
> +AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX],
> +[dnl
> +AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo, struct
> signalfd_siginfo.signo],[dnl
> +LTP_SYSCALL_SIGNALFD_FIELD_PREFIX=given],[],[dnl
> +#ifdef HAVE_LINUX_TYPES_H
> +#include <linux/types.h>
> +#endif
> +#if defined HAVE_SYS_SIGNALFD_H
> +#include <sys/signalfd.h>
> +#elif defined HAVE_LINUX_SIGNALFD_H
> +#include <linux/signalfd.h>
> +#elif defined HAVE_SIGNALFD_H
> +#include <signalfd.h>
> +#endif])
> +]dnl
> +)dnl
> diff --git a/testcases/kernel/syscalls/signalfd/Makefile
> b/testcases/kernel/syscalls/signalfd/Makefile
> index 93517da..cf5a156 100644
> --- a/testcases/kernel/syscalls/signalfd/Makefile
> +++ b/testcases/kernel/syscalls/signalfd/Makefile
> @@ -15,15 +15,7 @@
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> #
> -
> -include ../utils/cond.mk
> -
> -
> -CFLAGS += -I../../../../include \
> - $(call check_header,sys/signalfd.h, -DHAS_SYS_SIGNALFD_H
> -DHAS_SIGNALFD, ) \
> - $(call check_header,linux/signalfd.h, -DHAS_LINUX_SIGNALFD_H
> -DHAS_SIGNALFD, ) \
> - $(call check_header,signalfd.h, -DHAS_SIGNALFD_H -DHAS_SIGNALFD, )
> \
> - -Wall
> +CFLAGS += -I../../../../include -Wall
> LDLIBS += -L../../../../lib -lltp
>
> SRCS = $(wildcard *.c)
> diff --git a/testcases/kernel/syscalls/signalfd/signalfd01.c
> b/testcases/kernel/syscalls/signalfd/signalfd01.c
> index f4ac38f..c8566be 100644
> --- a/testcases/kernel/syscalls/signalfd/signalfd01.c
> +++ b/testcases/kernel/syscalls/signalfd/signalfd01.c
> @@ -35,6 +35,8 @@
> */
> # define _GNU_SOURCE
>
> +#include "config.h"
> +
>
> #include "test.h"
> #include "usctest.h"
> @@ -50,29 +52,22 @@ TCID_DEFINE(signalfd01);
> int TST_TOTAL = 1;
> extern int Tst_count;
>
> -#ifdef HAS_SIGNALFD
> -#include <linux/version.h>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
> -#define SSI_SIGNO signo
> -#else
> -#define SSI_SIGNO ssi_signo
> -#endif
> -
> -
> -#ifdef HAS_SYS_SIGNALFD_H
> -
> -#include <sys/signalfd.h>
> -
> -#elif HAS_LINUX_SIGNALFD_H || HAS_SIGNALFD_H
>
> +#ifdef HAVE_LINUX_TYPES_H
> #include <linux/types.h>
> +#endif
>
> -#ifdef HAS_LINUX_SIGNALFD_H
> +#if defined HAVE_SYS_SIGNALFD_H
> +#include <sys/signalfd.h>
> +#elif defined HAVE_LINUX_SIGNALFD_H
> #include <linux/signalfd.h>
> -#else
> +#elif defined HAVE_SIGNALFD_H
> #include <signalfd.h>
> -#endif /* HAS_LINUX_SIGNALFD_H */
> +#else
> +#define USE_STUB
> +#endif
>
> +#ifndef HAVE_SIGNALFD
> #include "linux_syscall_numbers.h"
> #ifndef __NR_signalfd
> #define __NR_signalfd 0
> @@ -84,8 +79,26 @@ signalfd(int fd, const sigset_t *mask, int flags)
> /* Taken from GLIBC. */
> return (syscall(__NR_signalfd, fd, mask, _NSIG / 8));
> }
> +#endif
> +
> +#if defined HAVE_SIGNALFD_SIGINFO_SSI_SIGNO
> +#define LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(FIELD) ssi_##FIELD
> +#elif defined HAVE_SIGNALFD_SIGINFO_SIGNO
> +#define LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(FIELD) FIELD
> +#else
> +#define USE_STUB
> +#endif
> +
> +#ifdef USE_STUB
> +int
> +main(int argc, char** argv)
> +{
> + tst_resm(TCONF,
> + "System doesn't support execution of the test");
> + return 0;
> +}
> +#else
>
> -#endif /* HAS_SYS_SIGNALFD_H */
>
> void cleanup(void);
> void setup(void);
> @@ -177,15 +190,15 @@ do_test1(int ntst, int sig)
> goto out;
> }
>
> - if (fdsi.SSI_SIGNO == sig) {
> + if (fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo) == sig) {
> tst_resm(TPASS, "got expected signal");
> sfd_for_next = sfd;
> goto out;
> }
> else {
> tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
> - fdsi.SSI_SIGNO,
> - strsignal(fdsi.SSI_SIGNO));
> + fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo),
> + strsignal(fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo)));
> sfd_for_next = -1;
> close(sfd);
> goto out;
> @@ -271,14 +284,14 @@ do_test2(int ntst, int fd, int sig)
> goto out;
> }
>
> - if (fdsi.SSI_SIGNO == sig) {
> + if (fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo) == sig) {
> tst_resm(TPASS, "got expected signal");
> goto out;
> }
> else {
> tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
> - fdsi.SSI_SIGNO,
> - strsignal(fdsi.SSI_SIGNO));
> + fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo),
> + strsignal(fdsi.LTP_SYSCALL_SIGNALFD_FIELD_PREFIX(signo)));
> goto out;
> }
> out:
> @@ -348,16 +361,5 @@ cleanup(void)
> tst_exit();
> }
>
> +#endif
>
> -#else /* !HAS_SIGNALFD */
> -
> -int
> -main(int argc, char** argv)
> -{
> - tst_resm(TCONF,
> - "System doesn't support execution of the test");
> - return 0;
> -}
> -
> -
> -#endif /* !HAS_SIGNALFD */
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list