autotools cleanups:
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 26 Oct 2008 08:04:06 +0000 (08:04 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 26 Oct 2008 08:04:06 +0000 (08:04 +0000)
 * 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

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/embryo@37116 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

15 files changed:
Makefile.am
configure.ac
doc/Doxyfile [moved from Doxyfile with 100% similarity]
doc/embryo.dox.in [moved from embryo.c.in with 100% similarity]
embryo.pc.in
gendoc [deleted file]
m4/ac_attribute.m4
m4/efl_doxygen.m4 [new file with mode: 0644]
src/bin/Makefile.am
src/bin/embryo_cc_sc.h
src/lib/Makefile.am
src/lib/embryo_amx.c
src/lib/embryo_private.h
src/lib/embryo_str.c
src/lib/embryo_time.c

index 44b44d4..0a3ee45 100644 (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
index 8fb1f5f..aa94883 100644 (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
similarity index 100%
rename from Doxyfile
rename to doc/Doxyfile
similarity index 100%
rename from embryo.c.in
rename to doc/embryo.dox.in
index 8ffd2c6..925f990 100644 (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}
diff --git a/gendoc b/gendoc
deleted file mode 100755 (executable)
index 29d98f8..0000000
--- a/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
index 46c1a42..e0df55d 100644 (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
+
+])
diff --git a/m4/efl_doxygen.m4 b/m4/efl_doxygen.m4
new file mode 100644 (file)
index 0000000..49a3dfa
--- /dev/null
@@ -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
index bcfd8bd..93143c6 100644 (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@
 
index 7fba248..afa8df0 100644 (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"
 
index f982353..9b5d060 100644 (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
index 9ae5929..2af81de 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
 #include "Embryo.h"
 #include "embryo_private.h"
 
index a4f4d57..240772f 100644 (file)
@@ -2,9 +2,6 @@
 #define _EMBRYO_PRIVATE_H
 
 
-#include <eina_types.h>
-
-
 #ifdef __GNUC__
 # if __GNUC__ >= 4
 // BROKEN in gcc 4 on amd64
index 8781cfd..16b508a 100644 (file)
 #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"
 
index 97c28f1..9127f80 100644 (file)
 #include <sys/time.h>
 #include <time.h>
 
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
 #include "Embryo.h"
 #include "embryo_private.h"