From c5b075b77234c5776c278d789dd835a58cdc2bdd Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 11 Dec 2013 18:56:31 +0100 Subject: [PATCH 1/8] Autotools: enable subdir-object since we build subdir sources --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5dd149d..b45c906 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_INIT([TuneL server], AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_AUX_DIR([build/aux]) AC_CONFIG_MACRO_DIR([build/m4]) -AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror foreign]) +AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror foreign subdir-objects]) AM_PROG_AR AC_CONFIG_HEADERS([config.h]) From 2ba63b301147fc275fca6fdaa90356e65ad2b936 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 11 Dec 2013 18:57:38 +0100 Subject: [PATCH 2/8] Autotools: don't treat Automake warnings as errors Automake often adds new warnings in new versions that may be harmless, yet break the build if treating Automake warnings as errors. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b45c906..cbadcb4 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_INIT([TuneL server], AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_AUX_DIR([build/aux]) AC_CONFIG_MACRO_DIR([build/m4]) -AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror foreign subdir-objects]) +AM_INIT_AUTOMAKE([1.11.1 -Wall foreign subdir-objects]) AM_PROG_AR AC_CONFIG_HEADERS([config.h]) From ae00964e13aefaaa4237f8b13a2bc2953c6491ec Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 11 Dec 2013 19:56:01 +0100 Subject: [PATCH 3/8] Autotools: remove --enable-paranoia option Extra compiler flags should be a developer choice, not a build system option. --- configure.ac | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/configure.ac b/configure.ac index cbadcb4..1ad23d6 100644 --- a/configure.ac +++ b/configure.ac @@ -121,29 +121,6 @@ else fi AC_SUBST([DEBUG_CFLAGS]) -AC_ARG_ENABLE([paranoia], - AC_HELP_STRING([--enable-paranoia], - [enable excessively strict compiler options \ - (works only with GCC and compatible) [[default=no]]]), - [enable_paranoia="$enableval"], - [enable_paranoia="no"]) -AC_MSG_CHECKING([[whether to enable paranoiac compiler options]]) -if test "x$enable_paranoia" = "xyes"; then - CFLAGS="$CFLAGS \ - -Wall -W -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int \ - -Werror-implicit-function-declaration -Wmain -Wparentheses -Wsequence-point \ - -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas \ - -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \ - -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return \ - -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ - -Wmissing-noreturn -Wformat -Wmissing-format-attribute \ - -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs \ - -Winline -Wlong-long -Wunreachable-code -pedantic" - AC_MSG_RESULT([[yes]]) -else - AC_MSG_RESULT([[no]]) -fi - # output AC_CONFIG_FILES([Makefile tlserver.pc @@ -155,7 +132,6 @@ AC_OUTPUT echo "------------------------------------------" echo "Configuration choices:" echo "* Debugging enabled : $enable_debug" -echo "* Paranoiac compiler options : $enable_paranoia" echo "* Base installation directory : $prefix" echo "" echo "Now type 'make' to build $PACKAGE_NAME" From 06e7f62f5f0f3f7166f7f9091ee5c01d4e493892 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 11 Dec 2013 20:00:46 +0100 Subject: [PATCH 4/8] Autotools: don't define installation directories at configure time --- Makefile.am | 1 + configure.ac | 7 ------- src/Makefile.am | 5 +++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index c0654e9..dd9af3d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,7 @@ tlserver_SOURCES = src/main.c tlserver_LDADD = src/libtlserver.la @TL_SERVER_LIBS@ tlserver_CFLAGS = @TL_SERVER_CFLAGS@ +pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = tlserver.pc ACLOCAL_AMFLAGS = -I build/m4 diff --git a/configure.ac b/configure.ac index 1ad23d6..777cae9 100644 --- a/configure.ac +++ b/configure.ac @@ -42,13 +42,6 @@ AM_PROG_CC_C_O TL_SERVER_LTVERSION="0:0:0" AC_SUBST([TL_SERVER_LTVERSION]) -pkgconfigdir="$libdir/pkgconfig" -tl_includedir="$includedir/tunel" -tl_include_serverdir="$tl_includedir/server" -AC_SUBST(pkgconfigdir) -AC_SUBST(tl_includedir) -AC_SUBST(tl_include_serverdir) - # Checks for libraries. # AX_REQUIRE_HEADER(HEADER, IF-PRESENT) diff --git a/src/Makefile.am b/src/Makefile.am index 11ec413..87c54c9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,5 +7,6 @@ libtlserver_la_LIBADD = $(AM_LIBS) @TL_SERVER_LIBS@ libtlserver_la_SOURCES = server.c \ perlin.c -tl_include_server_HEADERS = server.h \ - perlin.h +tlserver_includedir = $(includedir)/tunel/server +tlserver_include_HEADERS = server.h \ + perlin.h From 2b6f714899ac7f0ee6e3c474e673c95b03e9f3d9 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 11 Dec 2013 20:02:21 +0100 Subject: [PATCH 5/8] Autotools: cleanup --debug option handling a bit Cleanup Autoconf usage, and rename the variable to TL_DEBUG_CPPFLAGS. --- Makefile.am | 7 ++++--- configure.ac | 23 ++++++++++------------- src/Makefile.am | 7 ++++--- tlserver.pc.in | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index dd9af3d..27e12ac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,10 @@ SUBDIRS = src bin_PROGRAMS = tlserver -tlserver_SOURCES = src/main.c -tlserver_LDADD = src/libtlserver.la @TL_SERVER_LIBS@ -tlserver_CFLAGS = @TL_SERVER_CFLAGS@ +tlserver_SOURCES = src/main.c +tlserver_LDADD = src/libtlserver.la @TL_SERVER_LIBS@ +tlserver_CPPFLAGS = @TL_DEBUG_CPPFLAGS@ +tlserver_CFLAGS = @TL_SERVER_CFLAGS@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = tlserver.pc diff --git a/configure.ac b/configure.ac index 777cae9..eed5894 100644 --- a/configure.ac +++ b/configure.ac @@ -98,21 +98,18 @@ AC_CHECK_FUNCS([strchr]) # Tuning AC_ARG_ENABLE([debug], - AC_HELP_STRING([--enable-debug], [enable debugging [[default=yes]]]), + [AS_HELP_STRING([--enable-debug], [enable debugging [[default=yes]]])], [enable_debug="$enableval"], [enable_debug="yes"]) -AC_MSG_CHECKING([[whether to enable debugging]]) -if test "x$enable_debug" = "xyes"; then - AC_DEFINE([TL_DEBUG], [1], [is debugging enabled]) - # FIXME: please only use TL_DEBUG, not DEBUG - DEBUG_CPPFLAGS="-DTL_DEBUG -DDEBUG" - CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS" - AC_MSG_RESULT([[yes]]) -else - DEBUG_CFLAGS= - AC_MSG_RESULT([[no]]) -fi -AC_SUBST([DEBUG_CFLAGS]) +AC_MSG_CHECKING([whether to enable debugging]) +AS_IF([test "x$enable_debug" = "xyes"], + [AC_DEFINE([TL_DEBUG], [1], [is debugging enabled]) + # FIXME: please only use TL_DEBUG, not DEBUG + TL_DEBUG_CPPFLAGS="-DTL_DEBUG -DDEBUG" + AC_MSG_RESULT([yes])], + [TL_DEBUG_CPPFLAGS= + AC_MSG_RESULT([no])]) +AC_SUBST([TL_DEBUG_CPPFLAGS]) # output AC_CONFIG_FILES([Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 87c54c9..25bf3ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,9 +3,10 @@ lib_LTLIBRARIES = libtlserver.la AM_LDFLAGS = -version-info @TL_SERVER_LTVERSION@ AM_CFLAGS = @TL_SERVER_CFLAGS@ -libtlserver_la_LIBADD = $(AM_LIBS) @TL_SERVER_LIBS@ -libtlserver_la_SOURCES = server.c \ - perlin.c +libtlserver_la_CPPFLAGS = @TL_DEBUG_CPPFLAGS@ +libtlserver_la_LIBADD = $(AM_LIBS) @TL_SERVER_LIBS@ +libtlserver_la_SOURCES = server.c \ + perlin.c tlserver_includedir = $(includedir)/tunel/server tlserver_include_HEADERS = server.h \ diff --git a/tlserver.pc.in b/tlserver.pc.in index e76d3af..93c41b8 100644 --- a/tlserver.pc.in +++ b/tlserver.pc.in @@ -9,4 +9,4 @@ Version: @VERSION@ Requires: sceutils tlcommon Libs: -L${libdir} -ltlserver Libs.private: -lpthread -Cflags: -I${includedir} @DEBUG_CFLAGS@ +Cflags: -I${includedir} @TL_DEBUG_CFLAGS@ From 9bb1d82c813a7d1402ded01176a4ace111aabba4 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 11 Dec 2013 20:11:05 +0100 Subject: [PATCH 6/8] Autotools: cleanup Makefile.ams --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 25bf3ba..ec135a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,8 @@ lib_LTLIBRARIES = libtlserver.la -AM_LDFLAGS = -version-info @TL_SERVER_LTVERSION@ -AM_CFLAGS = @TL_SERVER_CFLAGS@ +libtlserver_la_LDFLAGS = -version-info @TL_SERVER_LTVERSION@ +libtlserver_la_CFLAGS = @TL_SERVER_CFLAGS@ libtlserver_la_CPPFLAGS = @TL_DEBUG_CPPFLAGS@ libtlserver_la_LIBADD = $(AM_LIBS) @TL_SERVER_LIBS@ libtlserver_la_SOURCES = server.c \ From 2c494fcef647740931c183a4ff7fed8dcc765b31 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 12 Dec 2013 17:09:38 +0100 Subject: [PATCH 7/8] Autotools: don't build a library, it's a server application --- Makefile.am | 14 +++++++------- configure.ac | 24 ------------------------ src/Makefile.am | 13 ------------- tlserver.pc.in | 12 ------------ 4 files changed, 7 insertions(+), 56 deletions(-) delete mode 100644 src/Makefile.am delete mode 100644 tlserver.pc.in diff --git a/Makefile.am b/Makefile.am index 27e12ac..a03eb15 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,13 +1,13 @@ -SUBDIRS = src bin_PROGRAMS = tlserver -tlserver_SOURCES = src/main.c -tlserver_LDADD = src/libtlserver.la @TL_SERVER_LIBS@ +tlserver_SOURCES = src/main.c \ + src/server.c \ + src/server.h \ + src/perlin.c \ + src/perlin.h +tlserver_LDADD = $(AM_LIBS) @TL_SERVER_LIBS@ tlserver_CPPFLAGS = @TL_DEBUG_CPPFLAGS@ -tlserver_CFLAGS = @TL_SERVER_CFLAGS@ - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = tlserver.pc +tlserver_CFLAGS = $(AM_CFLAGS) @TL_SERVER_CFLAGS@ ACLOCAL_AMFLAGS = -I build/m4 diff --git a/configure.ac b/configure.ac index eed5894..61df470 100644 --- a/configure.ac +++ b/configure.ac @@ -10,38 +10,16 @@ AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_AUX_DIR([build/aux]) AC_CONFIG_MACRO_DIR([build/m4]) AM_INIT_AUTOMAKE([1.11.1 -Wall foreign subdir-objects]) -AM_PROG_AR AC_CONFIG_HEADERS([config.h]) AM_SILENT_RULES([yes]) # Checks for programs. -LT_PREREQ([2.2.0]) -LT_INIT AC_PROG_CC AM_PROG_CC_C_O # basic setup -# -# revision of the library -# -# CURRENT:REVISION:AGE -# -# Please remeber to bump library version before releases -# Remeberer: -# ===================================================================== -# | If you have... | Bump version to | -# ===================================================================== -# | Not changed the interface (bug fixes) | CURRENT:REV+1:AGE | -# --------------------------------------------------------------------- -# | Augmented the interface (new functions) | CURRENT+1:0:AGE+1 | -# --------------------------------------------------------------------- -# | Broken old interface (e.g. removed functions) | CURRENT+1:0:0 | -# --------------------------------------------------------------------- -TL_SERVER_LTVERSION="0:0:0" -AC_SUBST([TL_SERVER_LTVERSION]) - # Checks for libraries. # AX_REQUIRE_HEADER(HEADER, IF-PRESENT) @@ -113,8 +91,6 @@ AC_SUBST([TL_DEBUG_CPPFLAGS]) # output AC_CONFIG_FILES([Makefile - tlserver.pc - src/Makefile ]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index ec135a0..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ - -lib_LTLIBRARIES = libtlserver.la - -libtlserver_la_LDFLAGS = -version-info @TL_SERVER_LTVERSION@ -libtlserver_la_CFLAGS = @TL_SERVER_CFLAGS@ -libtlserver_la_CPPFLAGS = @TL_DEBUG_CPPFLAGS@ -libtlserver_la_LIBADD = $(AM_LIBS) @TL_SERVER_LIBS@ -libtlserver_la_SOURCES = server.c \ - perlin.c - -tlserver_includedir = $(includedir)/tunel/server -tlserver_include_HEADERS = server.h \ - perlin.h diff --git a/tlserver.pc.in b/tlserver.pc.in deleted file mode 100644 index 93c41b8..0000000 --- a/tlserver.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: TuneL server library -Description: TuneL server library -Version: @VERSION@ -Requires: sceutils tlcommon -Libs: -L${libdir} -ltlserver -Libs.private: -lpthread -Cflags: -I${includedir} @TL_DEBUG_CFLAGS@ From b80197cfdbf01c04444e9b38fbaa09a410be4297 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 12 Dec 2013 17:10:49 +0100 Subject: [PATCH 8/8] Autotools: allow make-ing inside subdirectories While keeping a non-recursive setup, allow to run make inside subdirectories for convenience. --- configure.ac | 2 +- src/Makefile.am | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/Makefile.am diff --git a/configure.ac b/configure.ac index 61df470..04142ea 100644 --- a/configure.ac +++ b/configure.ac @@ -91,7 +91,7 @@ AC_SUBST([TL_DEBUG_CPPFLAGS]) # output AC_CONFIG_FILES([Makefile - ]) + src/Makefile]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..1c8de27 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,3 @@ +# dummy Makefile to chain up to the top non-recursive one, so one can run +# make in this directory +SUBDIRS = $(top_builddir)