Skip to content

Commit

Permalink
Cleaned up autotooling: added more checks as hinted at by autoscan.
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuerig committed Jan 22, 2009
1 parent 39cfdf1 commit 88a3d18
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 16 deletions.
2 changes: 2 additions & 0 deletions TODO
@@ -1,6 +1,8 @@

* Don't restart command if exited with a specific set of status codes
* Listen to multiple streams (stderr)?
* Don't set CLAGS and LDFLAGS in configure.ac
* USE the flags set in config.h!

Packaging

Expand Down
49 changes: 37 additions & 12 deletions configure.ac
@@ -1,11 +1,12 @@
AC_PREREQ(2.61)
AC_INIT([hangon],[0.1],[michael@schuerig.de])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall -Werror])

AC_PROG_CC
AC_CONFIG_SRCDIR([src/hangon.c])
AC_CONFIG_HEADERS([config.h])

gl_EARLY
gl_INIT
# Options

# -Wextra enables additional checks not included in -Wall
# AM_INIT_AUTOMAKE doesn't accept -Wextra so it is added
Expand All @@ -28,20 +29,42 @@ else
CPPFLAGS="$CPPFLAGS -DNDEBUG"
fi

# Use a libintl installed on the system.
# Checks for programs.
AC_PROG_CC

## gnulib needs to be initialized before any further checks.
gl_EARLY
gl_INIT

## Checks for libraries.
## would go here

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SSIZE_T

# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([atexit dup2 setlocale])

# Checks for gettext.
## Use a libintl installed on the system.
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/hangon.c])
AC_CONFIG_FILES([Makefile gnulib/lib/Makefile src/Makefile doc/Makefile po/Makefile.in])

# Testing
AC_CONFIG_TESTDIR([tests], [tests:src])
AC_CONFIG_FILES([tests/Makefile])

# Define additional programs needed for hacking on this project,
# but not required for simply building it.
# autom4te: used for merging tests into a suite
## Define additional programs needed for hacking on this project,
## but not required for simply building it.
## autom4te: used for merging tests into a suite
AM_MISSING_PROG([AUTOM4TE], [autom4te])

if test "x$cross_compiling" = "xno"; then
Expand All @@ -51,4 +74,6 @@ else
HELP2MAN=:
fi

## Generate Output
AC_CONFIG_FILES([Makefile gnulib/lib/Makefile src/Makefile doc/Makefile po/Makefile.in tests/Makefile])
AC_OUTPUT
2 changes: 2 additions & 0 deletions doc/tutorial.texi
Expand Up @@ -36,6 +36,8 @@ Copyright © 2008 Michael Schürig
@node Nobody expects the autoconf-iscation
@section Nobody Expects the @t{autoconf}-iscation

autoscan

@node Languages aplenty
@section Languages Aplenty

Expand Down
14 changes: 10 additions & 4 deletions src/hangon.c
@@ -1,4 +1,10 @@

/* config.h needs to included first for gnulib to work its magic */
#include <config.h>

/*
* standard includes
*/
#include <errno.h>
#include <getopt.h>
#include <locale.h>
Expand All @@ -12,10 +18,10 @@
#include <sys/time.h>
#include <sys/wait.h>

#include "config.h"

#include "closeout.h"
#include "gettext.h"
/*
* gnulib utilities
*/
#include <closeout.h>


#define PROGRAM_NAME "hangon"
Expand Down

0 comments on commit 88a3d18

Please sign in to comment.