From 9be35d243bdf8f1a177f3812a0aef90ddfaab05c Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sun, 26 Oct 2008 08:04:06 +0000 Subject: [PATCH] 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 --- legacy/embryo/Makefile.am | 22 +++- legacy/embryo/configure.ac | 124 ++++++++++++++---- legacy/embryo/{ => doc}/Doxyfile | 0 .../embryo/{embryo.c.in => doc/embryo.dox.in} | 0 legacy/embryo/embryo.pc.in | 3 +- legacy/embryo/gendoc | 10 -- legacy/embryo/m4/ac_attribute.m4 | 50 +++++-- legacy/embryo/m4/efl_doxygen.m4 | 88 +++++++++++++ legacy/embryo/src/bin/Makefile.am | 5 +- legacy/embryo/src/bin/embryo_cc_sc.h | 2 - legacy/embryo/src/lib/Makefile.am | 7 +- legacy/embryo/src/lib/embryo_amx.c | 4 + legacy/embryo/src/lib/embryo_private.h | 3 - legacy/embryo/src/lib/embryo_str.c | 17 +++ legacy/embryo/src/lib/embryo_time.c | 4 + 15 files changed, 271 insertions(+), 68 deletions(-) rename legacy/embryo/{ => doc}/Doxyfile (100%) rename legacy/embryo/{embryo.c.in => doc/embryo.dox.in} (100%) delete mode 100755 legacy/embryo/gendoc create mode 100644 legacy/embryo/m4/efl_doxygen.m4 diff --git a/legacy/embryo/Makefile.am b/legacy/embryo/Makefile.am index 44b44d4067..0a3ee45592 100644 --- a/legacy/embryo/Makefile.am +++ b/legacy/embryo/Makefile.am @@ -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 diff --git a/legacy/embryo/configure.ac b/legacy/embryo/configure.ac index 8fb1f5fdeb..aa948837cc 100644 --- a/legacy/embryo/configure.ac +++ b/legacy/embryo/configure.ac @@ -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 diff --git a/legacy/embryo/Doxyfile b/legacy/embryo/doc/Doxyfile similarity index 100% rename from legacy/embryo/Doxyfile rename to legacy/embryo/doc/Doxyfile diff --git a/legacy/embryo/embryo.c.in b/legacy/embryo/doc/embryo.dox.in similarity index 100% rename from legacy/embryo/embryo.c.in rename to legacy/embryo/doc/embryo.dox.in diff --git a/legacy/embryo/embryo.pc.in b/legacy/embryo/embryo.pc.in index 8ffd2c62ec..925f990552 100644 --- a/legacy/embryo/embryo.pc.in +++ b/legacy/embryo/embryo.pc.in @@ -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} diff --git a/legacy/embryo/gendoc b/legacy/embryo/gendoc deleted file mode 100755 index 29d98f86ec..0000000000 --- a/legacy/embryo/gendoc +++ /dev/null @@ -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 diff --git a/legacy/embryo/m4/ac_attribute.m4 b/legacy/embryo/m4/ac_attribute.m4 index 46c1a42291..e0df55d985 100644 --- a/legacy/embryo/m4/ac_attribute.m4 +++ b/legacy/embryo/m4/ac_attribute.m4 @@ -1,14 +1,44 @@ +dnl Copyright (C) 2008 Vincent Torri +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 ], - [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 + ], + [ +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 + +]) diff --git a/legacy/embryo/m4/efl_doxygen.m4 b/legacy/embryo/m4/efl_doxygen.m4 new file mode 100644 index 0000000000..49a3dfa0c4 --- /dev/null +++ b/legacy/embryo/m4/efl_doxygen.m4 @@ -0,0 +1,88 @@ +dnl Copyright (C) 2008 Vincent Torri +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 diff --git a/legacy/embryo/src/bin/Makefile.am b/legacy/embryo/src/bin/Makefile.am index bcfd8bd908..93143c6023 100644 --- a/legacy/embryo/src/bin/Makefile.am +++ b/legacy/embryo/src/bin/Makefile.am @@ -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@ diff --git a/legacy/embryo/src/bin/embryo_cc_sc.h b/legacy/embryo/src/bin/embryo_cc_sc.h index 7fba24804c..afa8df0f52 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc.h +++ b/legacy/embryo/src/bin/embryo_cc_sc.h @@ -36,8 +36,6 @@ #include #include -#include - #include "embryo_cc_osdefs.h" #include "embryo_cc_amx.h" diff --git a/legacy/embryo/src/lib/Makefile.am b/legacy/embryo/src/lib/Makefile.am index f982353999..9b5d060197 100644 --- a/legacy/embryo/src/lib/Makefile.am +++ b/legacy/embryo/src/lib/Makefile.am @@ -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 diff --git a/legacy/embryo/src/lib/embryo_amx.c b/legacy/embryo/src/lib/embryo_amx.c index 9ae5929a5c..2af81de719 100644 --- a/legacy/embryo/src/lib/embryo_amx.c +++ b/legacy/embryo/src/lib/embryo_amx.c @@ -32,6 +32,10 @@ #include #include +#ifdef HAVE_EVIL +# include +#endif + #include "Embryo.h" #include "embryo_private.h" diff --git a/legacy/embryo/src/lib/embryo_private.h b/legacy/embryo/src/lib/embryo_private.h index a4f4d57848..240772fc0c 100644 --- a/legacy/embryo/src/lib/embryo_private.h +++ b/legacy/embryo/src/lib/embryo_private.h @@ -2,9 +2,6 @@ #define _EMBRYO_PRIVATE_H -#include - - #ifdef __GNUC__ # if __GNUC__ >= 4 // BROKEN in gcc 4 on amd64 diff --git a/legacy/embryo/src/lib/embryo_str.c b/legacy/embryo/src/lib/embryo_str.c index 8781cfd99e..16b508a672 100644 --- a/legacy/embryo/src/lib/embryo_str.c +++ b/legacy/embryo/src/lib/embryo_str.c @@ -11,6 +11,23 @@ #include #include +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +# define alloca __builtin_alloca +#elif defined _AIX +# define alloca __alloca +#elif defined _MSC_VER +# include +# define alloca _alloca +#else +# include +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +#endif + #include "Embryo.h" #include "embryo_private.h" diff --git a/legacy/embryo/src/lib/embryo_time.c b/legacy/embryo/src/lib/embryo_time.c index 97c28f1daa..9127f80bdf 100644 --- a/legacy/embryo/src/lib/embryo_time.c +++ b/legacy/embryo/src/lib/embryo_time.c @@ -13,6 +13,10 @@ #include #include +#ifdef HAVE_EVIL +# include +#endif + #include "Embryo.h" #include "embryo_private.h"