autotools cleanups:

* reorganize configure.ac
 * remove eina dependency, use the new ac_attribute m4 macro
 * fix Libs.private field and add Requires field in embryo.pc
 * rename embryo.c.in to embryo.dox.in
 * add doc rule to build the documentation. The doc will completely
   be fixed in the next commit



SVN revision: 37116
This commit is contained in:
Vincent Torri 2008-10-26 08:04:06 +00:00
parent 852046b7cd
commit 9be35d243b
15 changed files with 271 additions and 68 deletions

View File

@ -1,4 +1,6 @@
SUBDIRS = src include
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src include doc
MAINTAINERCLEANFILES = \
Makefile.in \
@ -12,7 +14,9 @@ depcomp \
install-sh \
ltmain.sh \
missing \
embryo_docs.tar.gz \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.bz2 \
$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc.tar.bz2 \
m4/libtool.m4 \
m4/lt~obsolete.m4 \
m4/ltoptions.m4 \
@ -24,15 +28,19 @@ AUTHORS \
COPYING \
COPYING-PLAIN \
autogen.sh \
embryo.c.in \
embryo.pc.in \
embryo.spec.in \
embryo.spec \
README.in \
README \
Doxyfile \
doc \
gendoc
README
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = embryo.pc
.PHONY: doc
# Documentation
doc:
@echo "entering doc/"
make -C doc doc

View File

@ -11,14 +11,6 @@ AC_ISC_POSIX
AM_INIT_AUTOMAKE(1.6 dist-bzip2)
AM_CONFIG_HEADER(config.h)
AC_C_BIGENDIAN
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AM_PROG_CC_C_O
AC_C___ATTRIBUTE__
AC_LIBTOOL_WIN32_DLL
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
@ -31,34 +23,103 @@ SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
AC_SUBST(version_info)
PKG_CHECK_MODULES([EINA], [eina-0])
WIN32_CFLAGS=""
lt_enable_auto_import=""
### Default options with respect to host
requirement_embryo=""
embryoincludedir="${datadir}/include"
### Additional options to configure
### Checks for libraries
PKG_PROG_PKG_CONFIG
# Evil library for compilation on Windows
EFL_EMBRYO_BUILD=""
case "$host_os" in
mingw*|cegcc)
PKG_CHECK_MODULES([EVIL], evil)
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
dnl needed for correct definition of EAPI
AC_DEFINE(EFL_EMBRYO_BUILD, 1, [Define to mention that embryo is built])
AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defined to 1 (MinGW / CeGCC platform)])
if test "x$host_os" = "xcegcc" ; then
WIN32_CFLAGS="-mwin32"
lt_enable_auto_import="-Wl,--enable-auto-import"
fi
;;
*)
AC_CHECK_FUNCS(gettimeofday)
mingw* | cegcc*)
PKG_CHECK_MODULES([EVIL], [evil])
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
requirement_embryo="evil ${requirement_embryo}"
EFL_EMBRYO_BUILD="-DEFL_EMBRYO_BUILD"
;;
esac
AC_SUBST(WIN32_CFLAGS)
AC_SUBST(lt_enable_auto_import)
AC_SUBST(EFL_EMBRYO_BUILD)
AC_FUNC_ALLOCA
### Checks for header files
AC_CHECK_HEADER([fnmatch.h],
[dummy="yes"],
[AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file. MinGW users: see the INSTALL file])])
### Checks for programs
AC_PROG_CC
# doxygen program for documentation building
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
### Checks for types
### Checks for structures
### Checks for compiler characteristics
AC_C_BIGENDIAN
AM_PROG_CC_C_O
AC_C_CONST
AC_C_INLINE
AC_PROG_CC_STDC
AC_HEADER_STDC
AC_C___ATTRIBUTE__
EMBRYO_CPPFLAGS=""
EMBRYO_CFLAGS=""
case "$host_os" in
mingw32ce*)
EMBRYO_CPPFLAGS="-D_WIN32_WCE=0x0420"
;;
cegcc*)
EMBRYO_CPPFLAGS="-D_WIN32_WCE=0x0420"
EMBRYO_CFLAGS="-mwin32"
;;
esac
AC_SUBST(EMBRYO_CPPFLAGS)
AC_SUBST(EMBRYO_CFLAGS)
### Checks for linker characteristics
lt_enable_auto_import=""
case "$host_os" in
mingw* | cegcc*)
lt_enable_auto_import="-Wl,--enable-auto-import"
;;
esac
AC_SUBST(lt_enable_auto_import)
### Checks for library functions
AC_FUNC_ALLOCA
case "$host_os" in
mingw* | cegcc*)
AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defined to 1 (MinGW / CeGCC platform)])
;;
*)
AC_CHECK_FUNCS(gettimeofday)
;;
esac
fnmatch_libs=""
AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
if test "x$res" = "xno"; then
AC_SEARCH_LIBS([fnmatch],
@ -67,14 +128,19 @@ if test "x$res" = "xno"; then
[res="no"])
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
fi
fi
fnmatch_libs="${ac_cv_search_fnmatch}"
fi
AC_SUBST(fnmatch_libs)
embryoincludedir='${datadir}/include'
AC_SUBST(requirement_embryo)
AC_SUBST(embryoincludedir)
AC_OUTPUT([
Makefile
doc/Makefile
doc/embryo.dox
embryo.pc
include/Makefile
src/Makefile

View File

@ -7,7 +7,8 @@ embryoincludedir=@embryoincludedir@
Name: embryo
Description: A small virtual machine engine and bytecode compiler
Requires: @requirement_embryo@
Version: @VERSION@
Libs: -L${libdir} -lembryo
Libs.private: -lm
Libs.private: @EVIL_LIBS@ @fnmatch_libs@ -lm
Cflags: -I${includedir}

View File

@ -1,10 +0,0 @@
#!/bin/sh
rm -rf ./doc/html ./doc/latex ./doc/man
mkdir -p ./doc/html ./doc/latex ./doc/man
doxygen
cp doc/img/*.png doc/html/
cp doc/img/*.gif doc/html/
rm -f embryo_docs.tar embryo_docs.tar.gz
tar -cvf embryo_docs.tar doc/html doc/man doc/latex
gzip -9 embryo_docs.tar
exit 0

View File

@ -1,14 +1,44 @@
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
dnl That code is public domain and can be freely used or copied.
dnl Macro that check if the compiler supports __atribute__
dnl Usage: AC_C___ATTRIBUTE__
dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__
dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is
dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused))
dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is
dnl defined to nothing.
AC_DEFUN([AC_C___ATTRIBUTE__],
[
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([#include <stdlib.h>],
[int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }],
ac_cv___attribute__=yes, ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__])
fi
AC_MSG_RESULT($ac_cv___attribute__)
])
AC_MSG_CHECKING([for __attribute__])
AC_CACHE_VAL([ac_cv___attribute__],
[AC_TRY_COMPILE(
[
#include <stdlib.h>
],
[
int func(int x);
int foo(int x __attribute__ ((unused)))
{
exit(1);
}
],
[ac_cv___attribute__="yes"],
[ac_cv___attribute__="no"]
)]
)
AC_MSG_RESULT($ac_cv___attribute__)
if test "x${ac_cv___attribute__}" = "xyes" ; then
AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__])
AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Define to __attribute__((unused)) if your compiler has __attribute__])
else
AC_DEFINE([__UNUSED__], [], [Define to nothing if your compiler does not support __attribute__])
fi
])

View File

@ -0,0 +1,88 @@
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
dnl That code is public domain and can be freely used or copied.
dnl Macro that check if doxygen is available or not.
dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for the doxygen program
dnl Defines DOXYGEN
dnl Defines the automake conditionnal EFL_BUILD_DOC
dnl
AC_DEFUN([EFL_CHECK_DOXYGEN],
[
DOXYGEN="doxygen"
dnl
dnl Disable the build of the documentation
dnl
AC_ARG_ENABLE([doc],
AC_HELP_STRING(
[--disable-doc],
[Disable the build of the documentation]),
[if test "${disable_doc}" = "yes" ; then
enable_doc="no"
else
enable_doc="yes"
fi],
[enable_doc="yes"]
)
dnl
dnl Specify the full file name, with path
dnl
AC_ARG_WITH([doxygen],
AC_HELP_STRING(
[--with-doxygen=FILE],
[doxygen program to use @<:@default=doxygen@:>@]),
dnl
dnl Check the given doxygen program.
dnl
[DOXYGEN=${withval}
AC_CHECK_PROG([BUILD_DOCS],
[${DOXYGEN}],
[yes],
[no])
if test "x${BUILD_DOCS}" = "xno" ; then
echo "WARNING:"
echo "The doxygen program you specified:"
echo "$DOXYGEN"
echo "was not found. Please check the path and make sure "
echo "the program exists and is executable."
AC_MSG_WARN([Warning: no doxygen detected. Documentation will not be built])
fi
],
[AC_CHECK_PROG([BUILD_DOCS],
[${DOXYGEN}],
[yes],
[no])
if test "x${BUILD_DOCS}" = "xno" ; then
echo "WARNING:"
echo "The doxygen program was not found in your execute"
echo "You may have doxygen installed somewhere not covered by your path."
echo ""
echo "If this is the case make sure you have the packages installed, AND"
echo "that the doxygen program is in your execute path (see your"
echo "shell manual page on setting the \$PATH environment variable), OR"
echo "alternatively, specify the program to use with --with-doxygen."
AC_MSG_WARN([Warning: no doxygen detected. Documentation will not be built])
fi
]
)
dnl
dnl Substitution
dnl
AC_SUBST([DOXYGEN])
AM_CONDITIONAL(EFL_BUILD_DOC, test "x${BUILD_DOCS}" = "xyes")
if test "x${BUILD_DOCS}" = "xyes" ; then
ifelse([$1], , :, [$1])
else
ifelse([$2], , :, [$2])
fi
])
dnl End of doxygen.m4

View File

@ -9,8 +9,7 @@ AM_CPPFLAGS = \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@EVIL_CFLAGS@ \
@EINA_CFLAGS@
@EVIL_CFLAGS@
bin_PROGRAMS = embryo_cc
@ -31,7 +30,7 @@ embryo_cc_scvars.c \
embryo_cc_prefix.c \
embryo_cc_prefix.h
embryo_cc_CFLAGS = @WIN32_CFLAGS@
embryo_cc_CFLAGS = @EMBRYO_CFLAGS@
embryo_cc_LDADD = $(top_builddir)/src/lib/libembryo.la @EVIL_LIBS@ -lm
embryo_cc_LDFLAGS = @lt_enable_auto_import@

View File

@ -36,8 +36,6 @@
#include <stdio.h>
#include <setjmp.h>
#include <eina_types.h>
#include "embryo_cc_osdefs.h"
#include "embryo_cc_amx.h"

View File

@ -10,7 +10,8 @@ AM_CPPFLAGS = \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@EINA_CFLAGS@
@EMBRYO_CPPFLAGS@ \
@EFL_EMBRYO_BUILD@
include_HEADERS = Embryo.h
@ -25,8 +26,8 @@ embryo_rand.c \
embryo_str.c \
embryo_time.c
libembryo_la_CFLAGS = @WIN32_CFLAGS@
libembryo_la_CFLAGS = @EMBRYO_CFLAGS@
libembryo_la_LIBADD = -lm
libembryo_la_LDFLAGS = -no-undefined@lt_enable_auto_import@ -version-info @version_info@
libembryo_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@
EXTRA_DIST = embryo_private.h

View File

@ -32,6 +32,10 @@
#include <stdio.h>
#include <string.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "Embryo.h"
#include "embryo_private.h"

View File

@ -2,9 +2,6 @@
#define _EMBRYO_PRIVATE_H
#include <eina_types.h>
#ifdef __GNUC__
# if __GNUC__ >= 4
// BROKEN in gcc 4 on amd64

View File

@ -11,6 +11,23 @@
#include <string.h>
#include <fnmatch.h>
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif
#include "Embryo.h"
#include "embryo_private.h"

View File

@ -13,6 +13,10 @@
#include <sys/time.h>
#include <time.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "Embryo.h"
#include "embryo_private.h"