Autotools enhancement
This commit is contained in:
parent
5339fbf800
commit
25034c1d0b
2 changed files with 73 additions and 36 deletions
|
|
@ -1,4 +1,8 @@
|
|||
SUBDIRS = . src docs
|
||||
SUBDIRS = . src
|
||||
|
||||
if HAVE_DOXYGEN
|
||||
SUBDIRS += docs
|
||||
endif
|
||||
|
||||
EXTRA_DIST = regen.sh
|
||||
|
||||
|
|
|
|||
103
configure.ac
103
configure.ac
|
|
@ -5,25 +5,37 @@ AC_PREREQ([2.69])
|
|||
AC_INIT([asmsh], [0.0-dev], [asmsh@yannweb.net])
|
||||
AM_INIT_AUTOMAKE([-Wall])
|
||||
|
||||
AC_ARG_ENABLE([check],[ --disable-check disable unit test support],
|
||||
[case "${enableval}" in
|
||||
yes) check=true ;;
|
||||
no) check=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-check]) ;;
|
||||
esac],[check=true])
|
||||
AM_CONDITIONAL([CHECK], [test x$check = xtrue])
|
||||
AC_ARG_WITH([readline],
|
||||
[AS_HELP_STRING([--without-readline],
|
||||
[disable support for readline])],
|
||||
[],
|
||||
[with_readline=yes])
|
||||
|
||||
AC_ARG_WITH([doxygen],
|
||||
[AS_HELP_STRING([--without-doxygen],
|
||||
[disable code documentation])],
|
||||
[],
|
||||
[with_doxygen=yes])
|
||||
|
||||
AC_ARG_WITH([check],
|
||||
[AS_HELP_STRING([--without-check],
|
||||
[disable unit-tests])],
|
||||
[],
|
||||
[with_check=yes])
|
||||
|
||||
AM_CONDITIONAL([CHECK], [test x$with_check = xyes])
|
||||
|
||||
# Checks for libraries.
|
||||
if test "x$check" = "xtrue"
|
||||
then
|
||||
AS_IF([test "x$with_check" = "xyes"],
|
||||
[
|
||||
PKG_PROG_PKG_CONFIG([1.8])
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [],
|
||||
AC_MSG_FAILURE([Unable to locate (check unit test c framework).
|
||||
You can run ./configure --disable-check if you do not need unit tests.
|
||||
]))
|
||||
AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
|
||||
fi
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
AC_CONFIG_SRCDIR([src/asmsh.c])
|
||||
|
|
@ -32,7 +44,7 @@ AC_CONFIG_HEADERS([src/config.h])
|
|||
|
||||
|
||||
# Checks for programs.
|
||||
AC_GNU_SOURCE
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_PROG_CC
|
||||
|
|
@ -41,30 +53,27 @@ AC_PROG_RANLIB
|
|||
AM_PROG_AS
|
||||
AM_PROG_AR
|
||||
|
||||
if test "x$check" = "xtrue"
|
||||
then
|
||||
AS_IF([test "x$with_check" = "xyes"],
|
||||
[
|
||||
AC_CHECK_PROGS([GCOV], [gcov])
|
||||
if test -z "$GCOV";
|
||||
then
|
||||
AC_MSG_WARN([gcov not found - continuing without coverage monitoring])
|
||||
else
|
||||
AC_CHECK_PROGS([LCOV], [lcov])
|
||||
if test -z "$LCOV";
|
||||
then
|
||||
AC_MSG_WARN([lcov not found - continuing without HTML coverage summary])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_PROGS([LCOV], [lcov])
|
||||
]
|
||||
)
|
||||
AC_CHECK_PROGS([CPPCHECK], [cppcheck])
|
||||
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
||||
if test -z "$DOXYGEN";
|
||||
then
|
||||
AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
|
||||
fi
|
||||
AC_CHECK_PROGS([DOT], [dot])
|
||||
if test -z "$DOT"; then
|
||||
AC_MSG_ERROR([Doxygen needs dot, please install dot first])
|
||||
fi
|
||||
|
||||
AS_IF([test "x$with_doxygen" = "xyes"],
|
||||
[
|
||||
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
||||
AS_IF([test -n "$DOXYGEN"],
|
||||
[
|
||||
AC_CHECK_PROGS([DOT], [dot])
|
||||
AS_IF([test -z "$DOT"],
|
||||
[AC_MSG_ERROR([Doxygen needs dot from graphviz (--without-doxygen to disable)])]
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
|
||||
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Doxyfile])])
|
||||
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Makefile])])
|
||||
|
|
@ -74,7 +83,13 @@ AM_CONDITIONAL([HAVE_LCOV], [test -n "$LCOV"])
|
|||
AM_CONDITIONAL([HAVE_CPPCHECK], [test -n "$CPPCHECK"])
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB(readline, readline)
|
||||
LIBREADLINE=
|
||||
AS_IF([test "x$with_readline" != "xno"],
|
||||
[AC_CHECK_LIB([readline], [readline],
|
||||
[],
|
||||
[AC_MSG_FAILURE(
|
||||
[libreadline not found (--without-readline to disable)])]
|
||||
)])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h])
|
||||
|
|
@ -91,3 +106,21 @@ AC_CHECK_FUNCS([bzero strtoull, gmtime_r, ptrace])
|
|||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile tests/samples/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
yesno_out(){ if test -n "$1";then echo "yes";else echo "no ";fi; }
|
||||
echo "
|
||||
Features
|
||||
--------
|
||||
- libreadline support : $with_readline
|
||||
|
||||
Tests
|
||||
-----
|
||||
- check unit tests : $with_check
|
||||
- gcov coverage : $(yesno_out $GCOV)
|
||||
- lcov html report : $(yesno_out $LCOV)
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
- doxygen : $(yesno_out $DOXYGEN)
|
||||
|
||||
"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue