Browse Source

Autotools + check

Yann Weber 1 year ago
parent
commit
444b88926b
11 changed files with 277 additions and 40 deletions
  1. 0
    0
      AUTHORS
  2. 0
    0
      ChangeLog
  3. 0
    40
      Makefile
  4. 15
    0
      Makefile.am
  5. 0
    0
      NEWS
  6. 146
    0
      config.h.in
  7. 68
    0
      configure.ac
  8. 18
    0
      regen.sh
  9. 9
    0
      tests/Makefile.am
  10. 21
    0
      tests/regen.sh
  11. 0
    0
      tests/tests_mmap.c

+ 0
- 0
AUTHORS View File


+ 0
- 0
ChangeLog View File


+ 0
- 40
Makefile View File

@@ -1,40 +0,0 @@
1
-GCC=gcc
2
-AS=as
3
-LD=ld
4
-ASFLAGS=--64
5
-LDFLAGS=-s -melf_x86_64
6
-
7
-CFLAGS=-Wall
8
-CLDFLAGS=-s
9
-
10
-# To build with debugging symbols
11
-ifeq ($(DEBUG), 1)
12
-	ASFLAGS += -DDEBUG=1 --gdwarf-5 -g
13
-	LDFLAGS = -g -melf_x86_64
14
-	LIB_FILE = src/lib$(LIBNAME)_dbg.a
15
-	CFLAGS += -g
16
-	CLDFLAGS = -g
17
-endif
18
-
19
-C_SRCS=$(wildcard *.c)
20
-C_OBJ=$(C_SRCS:.c=.o)
21
-
22
-
23
-all: child asmsh
24
-
25
-asmsh: $(C_OBJ)
26
-	$(GCC) $(CLDFLAGS) -o $@ $<
27
-
28
-$(C_OBJ): %.o: %.c Makefile
29
-	$(GCC) $(CFLAGS) -o $@ -c $<
30
-
31
-child: child.o
32
-	$(LD) $(LDFLAGS) -o $@ $<
33
-
34
-child.o: child.s Makefile
35
-	$(AS) $(ASFLAGS) -o $@ $<
36
-
37
-.PHONY: clean
38
-
39
-clean:
40
-	-rm -f $(C_OBJ) child.o

+ 15
- 0
Makefile.am View File

@@ -0,0 +1,15 @@
1
+bin_PROGRAMS = asmsh child
2
+noinst_LIBRARIES = libasmsh.a
3
+
4
+libasmsh_a_SOURCES = mmap_parse.c
5
+
6
+asmsh_SOURCES = asmsh.c $(libasmsh_a_SOURCES)
7
+child_SOURCES = child.s
8
+
9
+SUBDIRS = 
10
+if CHECK
11
+SUBDIRS += tests
12
+endif
13
+
14
+child$(EXEEXT): $(child_SOURCES:.s=.o)
15
+	ld $(child_LDFLAGS) -o $@ $<

+ 0
- 0
NEWS View File


+ 146
- 0
config.h.in View File

@@ -0,0 +1,146 @@
1
+/* config.h.in.  Generated from configure.ac by autoheader.  */
2
+
3
+/* Define to 1 if you have the `bzero' function. */
4
+#undef HAVE_BZERO
5
+
6
+/* Define to 1 if you have the <fcntl.h> header file. */
7
+#undef HAVE_FCNTL_H
8
+
9
+/* Define to 1 if you have the `fork' function. */
10
+#undef HAVE_FORK
11
+
12
+/* Define to 1 if you have the <inttypes.h> header file. */
13
+#undef HAVE_INTTYPES_H
14
+
15
+/* Define to 1 if you have the <limits.h> header file. */
16
+#undef HAVE_LIMITS_H
17
+
18
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
19
+   to 0 otherwise. */
20
+#undef HAVE_MALLOC
21
+
22
+/* Define to 1 if you have the <memory.h> header file. */
23
+#undef HAVE_MEMORY_H
24
+
25
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
26
+   and to 0 otherwise. */
27
+#undef HAVE_REALLOC
28
+
29
+/* Define to 1 if you have the <stdint.h> header file. */
30
+#undef HAVE_STDINT_H
31
+
32
+/* Define to 1 if you have the <stdlib.h> header file. */
33
+#undef HAVE_STDLIB_H
34
+
35
+/* Define to 1 if you have the <strings.h> header file. */
36
+#undef HAVE_STRINGS_H
37
+
38
+/* Define to 1 if you have the <string.h> header file. */
39
+#undef HAVE_STRING_H
40
+
41
+/* Define to 1 if you have the `strtoull' function. */
42
+#undef HAVE_STRTOULL
43
+
44
+/* Define to 1 if you have the <sys/stat.h> header file. */
45
+#undef HAVE_SYS_STAT_H
46
+
47
+/* Define to 1 if you have the <sys/types.h> header file. */
48
+#undef HAVE_SYS_TYPES_H
49
+
50
+/* Define to 1 if you have the <unistd.h> header file. */
51
+#undef HAVE_UNISTD_H
52
+
53
+/* Define to 1 if you have the `vfork' function. */
54
+#undef HAVE_VFORK
55
+
56
+/* Define to 1 if you have the <vfork.h> header file. */
57
+#undef HAVE_VFORK_H
58
+
59
+/* Define to 1 if `fork' works. */
60
+#undef HAVE_WORKING_FORK
61
+
62
+/* Define to 1 if `vfork' works. */
63
+#undef HAVE_WORKING_VFORK
64
+
65
+/* Name of package */
66
+#undef PACKAGE
67
+
68
+/* Define to the address where bug reports for this package should be sent. */
69
+#undef PACKAGE_BUGREPORT
70
+
71
+/* Define to the full name of this package. */
72
+#undef PACKAGE_NAME
73
+
74
+/* Define to the full name and version of this package. */
75
+#undef PACKAGE_STRING
76
+
77
+/* Define to the one symbol short name of this package. */
78
+#undef PACKAGE_TARNAME
79
+
80
+/* Define to the home page for this package. */
81
+#undef PACKAGE_URL
82
+
83
+/* Define to the version of this package. */
84
+#undef PACKAGE_VERSION
85
+
86
+/* Define to 1 if you have the ANSI C header files. */
87
+#undef STDC_HEADERS
88
+
89
+/* Enable extensions on AIX 3, Interix.  */
90
+#ifndef _ALL_SOURCE
91
+# undef _ALL_SOURCE
92
+#endif
93
+/* Enable GNU extensions on systems that have them.  */
94
+#ifndef _GNU_SOURCE
95
+# undef _GNU_SOURCE
96
+#endif
97
+/* Enable threading extensions on Solaris.  */
98
+#ifndef _POSIX_PTHREAD_SEMANTICS
99
+# undef _POSIX_PTHREAD_SEMANTICS
100
+#endif
101
+/* Enable extensions on HP NonStop.  */
102
+#ifndef _TANDEM_SOURCE
103
+# undef _TANDEM_SOURCE
104
+#endif
105
+/* Enable general extensions on Solaris.  */
106
+#ifndef __EXTENSIONS__
107
+# undef __EXTENSIONS__
108
+#endif
109
+
110
+
111
+/* Version number of package */
112
+#undef VERSION
113
+
114
+/* Define to 1 if on MINIX. */
115
+#undef _MINIX
116
+
117
+/* Define to 2 if the system does not provide POSIX.1 features except with
118
+   this defined. */
119
+#undef _POSIX_1_SOURCE
120
+
121
+/* Define to 1 if you need to in order for `stat' and other things to work. */
122
+#undef _POSIX_SOURCE
123
+
124
+/* Define to empty if `const' does not conform to ANSI C. */
125
+#undef const
126
+
127
+/* Define to `__inline__' or `__inline' if that's what the C compiler
128
+   calls it, or to nothing if 'inline' is not supported under any name.  */
129
+#ifndef __cplusplus
130
+#undef inline
131
+#endif
132
+
133
+/* Define to rpl_malloc if the replacement function should be used. */
134
+#undef malloc
135
+
136
+/* Define to `int' if <sys/types.h> does not define. */
137
+#undef pid_t
138
+
139
+/* Define to rpl_realloc if the replacement function should be used. */
140
+#undef realloc
141
+
142
+/* Define to `unsigned int' if <sys/types.h> does not define. */
143
+#undef size_t
144
+
145
+/* Define as `fork' if `vfork' does not work. */
146
+#undef vfork

+ 68
- 0
configure.ac View File

@@ -0,0 +1,68 @@
1
+#                                               -*- Autoconf -*-
2
+# Process this file with autoconf to produce a configure script.
3
+
4
+AC_PREREQ([2.69])
5
+AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
6
+AM_INIT_AUTOMAKE([-Wall])
7
+
8
+AC_ARG_ENABLE([debug],[  --enable-debug turn on debugging],
9
+[case "${enableval}" in
10
+	yes) debug=true ;;
11
+	no)  debug=false ;;
12
+	*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
13
+esac],[debug=false])
14
+AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
15
+
16
+AC_ARG_ENABLE([check],[  --disable-check disable unit test support],
17
+[case "${enableval}" in
18
+	yes) check=true ;;
19
+	no)  check=false ;;
20
+	*) AC_MSG_ERROR([bad value ${enableval} for --enable-check]) ;;
21
+esac],[check=true])
22
+AM_CONDITIONAL([CHECK], [test x$check = xtrue])
23
+
24
+
25
+# Checks for libraries.
26
+if test "x$check" = "xtrue"
27
+then
28
+	PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [],
29
+	AC_MSG_FAILURE([Unable to locate (check unit test c framework).
30
+You can run ./configure --disable-check if you do not need unit tests.
31
+])) 
32
+	AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
33
+fi
34
+
35
+
36
+
37
+AC_CONFIG_SRCDIR([asmsh.c])
38
+AC_CONFIG_HEADERS([config.h])
39
+
40
+
41
+
42
+# Checks for programs.
43
+AC_GNU_SOURCE
44
+AC_C_CONST
45
+AC_C_INLINE
46
+AC_PROG_CC
47
+AC_PROG_RANLIB
48
+
49
+AM_PROG_AS
50
+AM_PROG_AR
51
+
52
+# Checks for libraries.
53
+
54
+# Checks for header files.
55
+AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h])
56
+
57
+# Checks for typedefs, structures, and compiler characteristics.
58
+AC_TYPE_PID_T
59
+AC_TYPE_SIZE_T
60
+
61
+# Checks for library functions.
62
+AC_FUNC_FORK
63
+AC_FUNC_MALLOC
64
+AC_FUNC_REALLOC
65
+AC_CHECK_FUNCS([bzero strtoull])
66
+
67
+AC_CONFIG_FILES([Makefile tests/Makefile])
68
+AC_OUTPUT

+ 18
- 0
regen.sh View File

@@ -0,0 +1,18 @@
1
+#!/bin/sh
2
+
3
+make distclean
4
+rm -v ar-lib aclocal.m4 "config.h.in~" compile COPYING depcomp INSTALL install-sh missing test-driver configure Makefile.in tests/Makefile.in 2>/dev/null
5
+rm -vR autom4te.cache/ .deps 2>/dev/null
6
+
7
+if [ "$1" =  "--clean" ]
8
+then
9
+	exit 0
10
+fi
11
+
12
+sh tests/regen.sh
13
+autoheader
14
+autoreconf -i -m
15
+#automake --add-missing
16
+#autoconf
17
+#automake --add-missing
18
+#autoreconf

+ 9
- 0
tests/Makefile.am View File

@@ -0,0 +1,9 @@
1
+TESTS = tests_mmap
2
+check_PROGRAMS = tests_mmap
3
+#noinst_HEADERS = ttail_check.h
4
+EXTRA_DIST = samples
5
+
6
+tests_mmap_SOURCES = tests_mmap.c
7
+tests_mmap_CFLAGS = @CHECK_CFLAGS@
8
+tests_mmap_LDADD = $(top_builddir)/libasmsh.a @CHECK_LIBS@
9
+

+ 21
- 0
tests/regen.sh View File

@@ -0,0 +1,21 @@
1
+#!/bin/bash
2
+
3
+cd $(dirname "$0")
4
+echo "Generating $(pwd)/Makefile.am"
5
+
6
+progs="$(echo *.c | sed -e 's/\.c / /g' -e 's/\.c$//')"
7
+cat << __EOF__ > Makefile.am
8
+TESTS = $progs
9
+check_PROGRAMS = $progs
10
+#noinst_HEADERS = ttail_check.h
11
+EXTRA_DIST = samples
12
+__EOF__
13
+
14
+for p in $progs
15
+do
16
+	echo "
17
+${p}_SOURCES = ${p}.c
18
+${p}_CFLAGS = @CHECK_CFLAGS@
19
+${p}_LDADD = \$(top_builddir)/libasmsh.a @CHECK_LIBS@
20
+"
21
+done >> Makefile.am

+ 0
- 0
tests/tests_mmap.c View File


Loading…
Cancel
Save