diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 3db0f75176..84aa218eea 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,35 @@ +2008-10-05 Vincent Torri + + * m4: + add m4 macro for doxygen, mpatrol and __attribute__ + + * doc: + move Doxyfile from toplevel dir to doc/ + + * src/bin/Makefile.am + * src/lib/Makefile.am + * src/lib/dlfcn/Makefile.am + remove _DEPENDENCIES, add flags for mpatrol and put + defines for EAPI + + * src/bin: + add memcpy for i686. Need an asm expert to modify it + + * src/bin/memcpy_glibc_arm.S: + formatting + + * src/bin/suite.c: + fix seg fault by increasing the size of the buffers + + * src/bin/test_memcpy.c: + add a test with a bigger size for the memory to copy + + * configure.ac: + reorganise a lot, use m4 macro, add mpatrol support + + * Makefile.am: + add doc rule + 2008-10-03 Vincent Torri * src/bin/Makefile.am: diff --git a/legacy/evil/Makefile.am b/legacy/evil/Makefile.am index 18e70d3ffa..f07550abcb 100644 --- a/legacy/evil/Makefile.am +++ b/legacy/evil/Makefile.am @@ -1,4 +1,6 @@ +ACLOCAL_AMFLAGS = -I m4 + MAINTAINERCLEANFILES = \ aclocal.m4 \ compile \ @@ -23,9 +25,16 @@ SUBDIRS = src EXTRA_DIST = \ COPYING \ COPYING-PLAIN \ -Doxyfile \ autogen.sh \ evil.pc.in pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = evil.pc + +.PHONY: doc + +# Documentation + +doc: + @echo "entering doc/" + make -C doc doc diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac index 6246327ff0..6fb7f5ee74 100644 --- a/legacy/evil/configure.ac +++ b/legacy/evil/configure.ac @@ -1,45 +1,18 @@ -AC_INIT(evil, 0.0.1, enlightenment-devel@lists.sourceforge.net) -AC_PREREQ(2.52) +AC_INIT([evil], [0.0.1], [enlightenment-devel@lists.sourceforge.net]) +AC_PREREQ([2.52]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_HOST -dnl If the host is not windows, we exit, -dnl otherwise, we set the correct flags -dnl for each platform. -have_wince="no" -win32_libs="" -win32_cflags="" +dnl If the host is not Windows, we exit case "$host_os" in - mingw | mingw32 | mingw32msvc) - win32_libs="-lole32 -luuid -lws2_32" - ;; - cegcc) - have_wince="yes" - win32_cflags="-mwin32" - win32_libs="-lws2" - ;; - mingw32ce) - have_wince="yes" - win32_libs="-lws2" + mingw* | cegcc*) ;; *) AC_MSG_ERROR([OS must be Windows. Exiting...]) ;; esac -AC_SUBST(win32_cflags) -AC_SUBST(win32_libs) - -if test "x${have_wince}" = "xyes" ; then - AC_DEFINE(EVIL_HAVE_WINCE, 1, [Define to mention that Windows CE is the target]) -fi - -AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes") - -dnl needed for correct definition of EAPI -AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built]) -AC_DEFINE(EFL_EVIL_DLFCN_BUILD, 1, [Define to mention that evil dlfcn is built]) AM_INIT_AUTOMAKE(1.6 dist-bzip2) @@ -55,31 +28,82 @@ SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'` version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN" AC_SUBST(version_info) + +### Checks for libraries + +win32_libs="" +case "$host_os" in + mingw | mingw32 | mingw32msvc) + win32_libs="-lole32 -luuid -lws2_32" + ;; + cegcc) + win32_libs="-lws2" + ;; + mingw32ce) + win32_libs="-lws2" + ;; +esac +AC_SUBST(win32_libs) + +EFL_CHECK_MPATROL([have_mpatrol="yes"], [have_mpatrol="no"]) + + +### Checks for header files + + +### Checks for programs AM_PROG_AS AC_LANG(C) AC_PROG_CPP 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_CONST +AC_C___ATTRIBUTE__ -AC_MSG_CHECKING([for __attribute__]) -AC_CACHE_VAL(_cv_have___attribute__, - [ - AC_TRY_COMPILE([#include ], - [int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }], - [_cv_have___attribute__="yes"], - [_cv_have___attribute__="no"]) - ] -) +win32_cflags="" +case "$host_os" in + cegcc) + have_wince="yes" + win32_cflags="-mwin32" + ;; + mingw32ce) + have_wince="yes" + ;; + *) + have_wince="no" + ;; +esac +AC_SUBST(win32_cflags) -if test "x${_cv_have___attribute__}" = "xyes" ; then - AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__]) +if test "x${have_wince}" = "xyes" ; then + AC_DEFINE(EVIL_HAVE_WINCE, 1, [Define to mention that Windows CE is the target]) fi -AC_MSG_RESULT(${_cv_have___attribute__}) + +AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes") + + +### Checks for linker characteristics + + +### Checks for library functions AC_CONFIG_FILES([ Makefile evil.pc +doc/Makefile src/Makefile src/bin/Makefile src/lib/Makefile @@ -103,6 +127,9 @@ echo "Configuration Options Summary:" echo echo " OS...................: ${host_os}" echo +echo " Documentation........: ${build_doc}" +echo " Mpatrol..............: ${have_mpatrol}" +echo echo " Compilation..........: make" echo echo " Installation.........: make install" diff --git a/legacy/evil/Doxyfile b/legacy/evil/doc/Doxyfile similarity index 99% rename from legacy/evil/Doxyfile rename to legacy/evil/doc/Doxyfile index 5ac2556346..952593428d 100644 --- a/legacy/evil/Doxyfile +++ b/legacy/evil/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NUMBER = # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = doc +OUTPUT_DIRECTORY = . # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -493,7 +493,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = "src" +INPUT = "../src" # This tag can be used to specify the character encoding of the source files that # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default diff --git a/legacy/evil/m4/ac_attribute.m4 b/legacy/evil/m4/ac_attribute.m4 new file mode 100755 index 0000000000..46c1a42291 --- /dev/null +++ b/legacy/evil/m4/ac_attribute.m4 @@ -0,0 +1,14 @@ + +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__) +]) + diff --git a/legacy/evil/m4/efl_doxygen.m4 b/legacy/evil/m4/efl_doxygen.m4 new file mode 100755 index 0000000000..5f02bb4b0a --- /dev/null +++ b/legacy/evil/m4/efl_doxygen.m4 @@ -0,0 +1,84 @@ +dnl Configure script for doxygen +dnl Vincent Torri 2008-08-25 +dnl +dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for the doxygen program, and define DOXYGEN. +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/evil/m4/efl_mpatrol.m4 b/legacy/evil/m4/efl_mpatrol.m4 new file mode 100755 index 0000000000..16ffc778fb --- /dev/null +++ b/legacy/evil/m4/efl_mpatrol.m4 @@ -0,0 +1,128 @@ +dnl Copyright (C) 2008 Vincent Torri +dnl That code is public domain and can be freely used or copied. + +dnl Macro that check if mpatrol is wanted and if yes, if +dnl it is available. + +dnl Usage: EFL_CHECK_MPATROL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Defines EFL_MPATROL_CPPFLAGS and EFL_MPATROL_LIBS variables + +AC_DEFUN([EFL_CHECK_MPATROL], +[ + +dnl configure options + +AC_ARG_ENABLE([mpatrol], + [AC_HELP_STRING([--enable-mpatrol], [enable mpatrol @<:@default=no@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + _efl_enable_mpatrol="yes" + else + _efl_enable_mpatrol="no" + fi + ], + [_efl_enable_mpatrol="no"] +) +AC_MSG_CHECKING([whether mpatrol is used]) +AC_MSG_RESULT([${_efl_enable_mpatrol}]) + +AC_ARG_WITH([mpatrol-dir], + [AC_HELP_STRING([--enable-mpatrol-dir], [specify the directory of mpatrol @<:@default=/usr/local@:>@])], + [_efl_with_mpatrol_dir=${withval}], + [_efl_with_mpatrol_dir="/usr/local"] +) + +AC_ARG_WITH([mpatrol-bindir], + [AC_HELP_STRING([--enable-mpatrol-bindir], [specify the binary directory of mpatrol])], + [_efl_with_mpatrol_bindir=${withval}] +) + +AC_ARG_WITH([mpatrol-includedir], + [AC_HELP_STRING([--enable-mpatrol-includedir], [specify the include directory of mpatrol])], + [_efl_with_mpatrol_includedir=${withval}] +) + +AC_ARG_WITH([mpatrol-libdir], + [AC_HELP_STRING([--enable-mpatrol-libdir], [specify the library directory of mpatrol])], + [_efl_with_mpatrol_libdir=${withval}] +) + +if test "x${_efl_enable_mpatrol}" = "xyes" ; then + +dnl values of the different paths + + if test ! "x${_efl_with_mpatrol_bindir}" = "x" ; then + _efl_mpatrol_bindir=${_efl_with_mpatrol_bindir} + else + _efl_mpatrol_bindir="${_efl_with_mpatrol_dir}/bin" + fi + + if test ! "x${_efl_with_mpatrol_includedir}" = "x" ; then + _efl_mpatrol_includedir=${_efl_with_mpatrol_includedir} + else + _efl_mpatrol_includedir="${_efl_with_mpatrol_dir}/include" + fi + + if test ! "x${_efl_with_mpatrol_libdir}" = "x" ; then + _efl_mpatrol_libdir=${_efl_with_mpatrol_libdir} + else + _efl_mpatrol_libdir="${_efl_with_mpatrol_dir}/lib" + fi + +dnl check of mpatrol program + + AC_CHECK_PROG([_efl_have_mpatrol], + [mpatrol], + ["yes"], + ["no"], + [$PATH$PATH_SEPARATOR${_efl_mpatrol_bindir}] + ) + + SAVE_CPPFLAGS=${CPPFLAGS} + SAVE_LIBS=${LDFLAGS} + CPPFLAGS="-I${_efl_mpatrol_includedir}" + LIBS="-L${_efl_mpatrol_libdir} -lmpatrol -lbfd -liberty -limagehlp" + +dnl check of mpatrol.h header file + + AC_CHECK_HEADER([mpatrol.h], + [], + [_efl_have_mpatrol="no"] + ) + +dnl check of mpatrol library and its needed dependencies + + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include + ]], + [[ +__mp_clearleaktable(); + ]])], + [], + [_efl_have_mpatrol="no"] + ) + + AC_MSG_CHECKING([whether libmpatrol is usuable]) + AC_MSG_RESULT([${_efl_have_mpatrol}]) + + CPPFLAGS=${SAVE_CPPFLAGS} + LIBS=${SAVE_LIBS} + +fi + +EFL_MPATROL_CPPFLAGS="-include ${_efl_mpatrol_includedir}/mpatrol.h" +EFL_MPATROL_LIBS="-L${_efl_mpatrol_libdir} -lmpatrol -lbfd -liberty -limagehlp" + +AC_SUBST(EFL_MPATROL_CPPFLAGS) +AC_SUBST(EFL_MPATROL_LIBS) + +AM_CONDITIONAL(EFL_HAVE_MPATROL, test "x${_efl_have_mpatrol}" = "xyes") + +if test "x${_efl_have_mpatrol}" = "xyes" ; then + ifelse([$1], , :, [$1]) +else + ifelse([$2], , :, [$2]) +fi + +]) diff --git a/legacy/evil/src/bin/Makefile.am b/legacy/evil/src/bin/Makefile.am index ba3410f37b..988f394acd 100644 --- a/legacy/evil/src/bin/Makefile.am +++ b/legacy/evil/src/bin/Makefile.am @@ -17,25 +17,25 @@ if EVIL_HAVE_WINCE suite_SOURCES += memcpy_glibc_arm.S +#else + +#suite_SOURCES += memcpy_glibc_i686.S + endif suite_LDADD = $(top_builddir)/src/lib/libevil.la suite_LDFLAGS = -Wl,--enable-auto-import -suite_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la test_dlfcn_SOURCES = test_dlfcn.c test_dlfcn_LDADD = $(top_builddir)/src/lib/libevil.la $(top_builddir)/src/lib/dlfcn/libdl.la test_dlfcn_LDFLAGS = -Wl,--enable-auto-import -test_dlfcn_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la $(top_builddir)/src/lib/dlfcn/libdl.la test_pipe_SOURCES = test_pipe.c test_pipe_LDADD = $(top_builddir)/src/lib/libevil.la test_pipe_LDFLAGS = -Wl,--enable-auto-import -test_pipe_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la test_evil_SOURCES = test_evil.c test_evil_LDADD = $(top_builddir)/src/lib/libevil.la test_evil_LDFLAGS = -Wl,--enable-auto-import -test_evil_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la -EXTRA_DIST = suite.h test_memcpy.h \ No newline at end of file +EXTRA_DIST = suite.h test_memcpy.h diff --git a/legacy/evil/src/bin/memcpy_glibc_arm.S b/legacy/evil/src/bin/memcpy_glibc_arm.S index ca7fe21a43..7c42898647 100644 --- a/legacy/evil/src/bin/memcpy_glibc_arm.S +++ b/legacy/evil/src/bin/memcpy_glibc_arm.S @@ -53,7 +53,7 @@ #define push lsr #endif - .text + .text /* Prototype: void *memcpy_glibc(void *dest, const void *src, size_t n); */ diff --git a/legacy/evil/src/bin/memcpy_glibc_i686.S b/legacy/evil/src/bin/memcpy_glibc_i686.S new file mode 100755 index 0000000000..72da118cf0 --- /dev/null +++ b/legacy/evil/src/bin/memcpy_glibc_i686.S @@ -0,0 +1,81 @@ +/* Copy memory block and return pointer to beginning of destination block + For Intel 80x86, x>=6. + This file is part of the GNU C Library. + Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) \ + CHECK_BOUNDS_LOW(VAL_REG, BP_MEM); \ + addl LENGTH, VAL_REG; \ + cmpl 8+BP_MEM, VAL_REG; \ + jbe 0f; /* continue if value <= high */ \ + BOUNDS_VIOLATED; \ + 0: subl LENGTH, VAL_REG /* restore value */ + +# define RETURN_BOUNDED_POINTER(BP_MEM) \ + movl RTN(%esp), %edx; \ + movl %eax, 0(%edx); \ + movl 4+BP_MEM, %eax; \ + movl %eax, 4(%edx); \ + movl 8+BP_MEM, %eax; \ + movl %eax, 8(%edx) + +#define PTR_SIZE 12 +#define RTN_SIZE 4 +#define LINKAGE 8 + +#define PARMS LINKAGE /* no space for saved regs */ +#define RTN PARMS +#define DEST RTN+RTN_SIZE +#define SRC DEST+PTR_SIZE +#define LEN SRC+PTR_SIZE + + .text + + .align + .global memcpy_glibc + .func memcpy_glibc +memcpy_glibc: + + pushl %ebp + movl %esp, %ebp + + movl LEN(%esp), %ecx + movl %edi, %eax + movl DEST(%esp), %edi + movl %esi, %edx + movl SRC(%esp), %esi + + cld + shrl $1, %ecx + jnc 1f + movsb +1: shrl $1, %ecx + jnc 2f + movsw +2: rep + movsl + movl %eax, %edi + movl %edx, %esi + movl DEST(%esp), %eax + RETURN_BOUNDED_POINTER (DEST(%esp)) + + movl %ebp, %esp + popl %ebp + +.endfunc diff --git a/legacy/evil/src/bin/suite.c b/legacy/evil/src/bin/suite.c index 9a1661db1e..837b6bcb20 100644 --- a/legacy/evil/src/bin/suite.c +++ b/legacy/evil/src/bin/suite.c @@ -152,10 +152,10 @@ main() page_size = 2 * getpagesize(); - buf1 = (unsigned char *)malloc(4 * getpagesize()); + buf1 = (unsigned char *)malloc(16 * getpagesize()); if (!buf1) return EXIT_FAILURE; - buf2 = (unsigned char *)malloc(4 * getpagesize()); + buf2 = (unsigned char *)malloc(16 * getpagesize()); if (!buf2) { free(buf1); diff --git a/legacy/evil/src/bin/test_memcpy.c b/legacy/evil/src/bin/test_memcpy.c index 1a91f5dc40..8607587363 100644 --- a/legacy/evil/src/bin/test_memcpy.c +++ b/legacy/evil/src/bin/test_memcpy.c @@ -116,4 +116,5 @@ test_memcpy(void) test_memcpy_tests_run(0, 0, 2 * getpagesize ()); test_memcpy_tests_run(0, 0, 4 * getpagesize ()); test_memcpy_tests_run(0, 0, 8 * getpagesize ()); + test_memcpy_tests_run(0, 0, 16 * getpagesize ()); } diff --git a/legacy/evil/src/lib/Makefile.am b/legacy/evil/src/lib/Makefile.am index 7df63b3524..dba00318b2 100644 --- a/legacy/evil/src/lib/Makefile.am +++ b/legacy/evil/src/lib/Makefile.am @@ -25,7 +25,7 @@ evil_stdlib.c \ evil_unistd.c \ evil_util.c +libevil_la_CPPFLAGS = -DEFL_EVIL_BUILD libevil_la_CFLAGS = @win32_cflags@ -libevil_la_LIBADD = @win32_libs@ -libevil_la_DEPENDENCIES = $(top_builddir)/config.h +libevil_la_LIBADD = @win32_libs@ $(EFL_MPATROL_LIBS) libevil_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@ diff --git a/legacy/evil/src/lib/dlfcn/Makefile.am b/legacy/evil/src/lib/dlfcn/Makefile.am index efff02ca8c..1c2bc8244c 100644 --- a/legacy/evil/src/lib/dlfcn/Makefile.am +++ b/legacy/evil/src/lib/dlfcn/Makefile.am @@ -6,7 +6,7 @@ lib_LTLIBRARIES = libdl.la include_HEADERS = dlfcn.h libdl_la_SOURCES = dlfcn.c +libdl_la_CPPFLAGS = -DEFL_EVIL_DLFCN_BUILD libdl_la_CFLAGS = @win32_cflags@ -libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la -libdl_la_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la +libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la $(EFL_MPATROL_LIBS) libdl_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@