Browse Source

Add autotools & checks

Yann Weber 4 years ago
parent
commit
fa17445573
14 changed files with 82 additions and 42 deletions
  1. 0
    0
      COPYING
  2. 0
    17
      Makefile
  3. 1
    0
      Makefile.am
  4. 0
    0
      README
  5. 11
    0
      autogen.sh
  6. 54
    0
      configure.ac
  7. 0
    0
      include/conf.h
  8. 0
    0
      include/config.h.in
  9. 0
    0
      include/logger.h
  10. 0
    0
      include/pyworker.h
  11. 0
    0
      include/responder.h
  12. 0
    25
      src/Makefile
  13. 11
    0
      src/Makefile.am
  14. 5
    0
      tests/Makefile.am

Licence.txt → COPYING View File


+ 0
- 17
Makefile View File

@@ -1,17 +0,0 @@
1
-all:
2
-	+make -C src
3
-
4
-doc: 
5
-	doxygen
6
-
7
-.PHONY: distclean clean __pycache__clean doc
8
-
9
-distclean: __pycache__clean
10
-	-make -C src distclean;\
11
-	rm -Rvf doc/latex doc/html doc/man
12
-
13
-clean: __pycache__clean
14
-	-make -C src clean;\
15
-
16
-__pycache__clean:
17
-	rm -Rvf __pycache__

+ 1
- 0
Makefile.am View File

@@ -0,0 +1 @@
1
+SUBDIRS = src tests

README.txt → README View File


+ 11
- 0
autogen.sh View File

@@ -0,0 +1,11 @@
1
+#!/bin/sh
2
+
3
+[ "$1" = "clean" ] && [ -f "Makefile" ] && make distclean # pour les .o
4
+
5
+rm -fR configure aclocal.m4 autom4te.cache src/Makefile.in tests/Makefile.in Makefile.in compile depcomp install-sh missing
6
+
7
+[ "$1" = "clean" ] && exit 0
8
+
9
+aclocal
10
+automake -a -c
11
+autoconf

+ 54
- 0
configure.ac View File

@@ -0,0 +1,54 @@
1
+#                                               -*- Autoconf -*-
2
+# Process this file with autoconf to produce a configure script.
3
+
4
+AC_PREREQ([2.69])
5
+AC_INIT([PyFCGI], [0.0.1], [yann.weber@member.fsf.org])
6
+AC_CONFIG_SRCDIR([src/main.c])
7
+AC_CONFIG_HEADERS([include/config.h])
8
+
9
+AC_ARG_ENABLE([debug],
10
+	AS_HELP_STRING([--enable-debug], [Enable debug, disabling -Werror, etc.]))
11
+
12
+# Checks for programs.
13
+AC_PROG_CC
14
+AC_PROG_RANLIB
15
+AC_CHECK_PROG(PYTHON_CONFIG, [python3-config], [yes])
16
+if test x"${PYTHON_CONFIG}" == x"yes"; then
17
+	PYTHON_CFLAGS=`python3-config --includes`
18
+	PYTHON_LDFLAGS=`python3-config --libs`
19
+	AC_SUBST([PYTHON_CFLAGS])
20
+	AC_SUBST([PYTHON_LDFLAGS])
21
+else
22
+	AC_MSG_ERROR([Unable to find python3-config])
23
+fi
24
+
25
+if test x"${enable_debug}" = x"yes"; then
26
+	AM_CFLAGS="-Wall -g"
27
+else
28
+	AM_CFLAGS="-Wall -Werror -O2"
29
+fi
30
+
31
+AC_SUBST([AM_CFLAGS])
32
+
33
+# Checks for libraries.
34
+AC_CHECK_LIB([fcgi], [FCGI_Accept])
35
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
36
+
37
+# Checks for header files.
38
+AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h syslog.h unistd.h sem.h])
39
+
40
+# Checks for typedefs, structures, and compiler characteristics.
41
+AC_TYPE_PID_T
42
+AC_TYPE_SIZE_T
43
+
44
+# Checks for library functions.
45
+AC_FUNC_FORK
46
+AC_FUNC_MALLOC
47
+AC_FUNC_REALLOC
48
+AC_CHECK_FUNCS([bzero getcwd gettimeofday memmove strdup strerror strndup semop clone])
49
+
50
+AM_INIT_AUTOMAKE
51
+AC_CONFIG_FILES([Makefile
52
+                 src/Makefile
53
+		 tests/Makefile])
54
+AC_OUTPUT

src/conf.h → include/conf.h View File


src/config.h → include/config.h.in View File


src/logger.h → include/logger.h View File


src/pyworker.h → include/pyworker.h View File


src/responder.h → include/responder.h View File


+ 0
- 25
src/Makefile View File

@@ -1,25 +0,0 @@
1
-CC=gcc
2
-CFLAGS=-c -Wall `python3-config --includes`
3
-#CFLAGS=-c -Wall -Werror `python3-config --includes`
4
-LDFLAGS=`python3-config --libs` -lfcgi
5
-#LDFLAGS= -L`python3-config --configdir` `python3-config --libs` -lfcgi
6
-
7
-BIN=pyfcgi
8
-SRCS=$(wildcard *.c)
9
-OBJS=$(SRCS:.c=.o)
10
-
11
-all: $(BIN)
12
-
13
-$(BIN): $(OBJS)
14
-	$(CC) $(LDFLAGS) -o $@ $^
15
-
16
-%.o: %.c
17
-	$(CC) $(CFLAGS) -o $@ $<
18
-
19
-.PHONY: clean distclean
20
-
21
-distclean: clean
22
-	-rm -v $(BIN)
23
-
24
-clean:
25
-	-rm -v $(OBJS)

+ 11
- 0
src/Makefile.am View File

@@ -0,0 +1,11 @@
1
+bin_PROGRAMS = pyfcgi
2
+noinst_LIBRARIES = libpyfcgi.a
3
+
4
+libpyfcgi_a_SOURCES = logger.c pyworker.c responder.c
5
+libpyfcgi_a_CFLAGS = $(PYTHON_CFLAGS)
6
+
7
+
8
+pyfcgi_SOURCES = main.c $(libpyfcgi_a_SOURCES)
9
+pyfcgi_CFLAGS = $(PYTHON_CFLAGS) $(AM_CFLAGS)
10
+pyfcgi_LDADD = $(PYTHON_LDFLAGS)
11
+

+ 5
- 0
tests/Makefile.am View File

@@ -0,0 +1,5 @@
1
+TESTS = check_logger
2
+check_PROGRAMS = check_logger
3
+check_logger_SOURCES = check_logger.c $(top_builddir)/include/logger.h
4
+check_logger_CFLAGS = @CHECK_CFLAGS@
5
+check_logger_LDADD = $(top_builddir)/src/libpyfcgi.a @CHECK_LIBS@

Loading…
Cancel
Save