From b21fb2cb051cbd5a20f661959517a16ac74f3960 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Fri, 16 Dec 2011 17:50:13 +0000 Subject: [PATCH] Evil: organize the m4 files in common and "private" dirs, remove mpatrol, add a "windows-version" option to configure SVN revision: 66293 --- legacy/evil/Makefile.am | 2 +- legacy/evil/configure.ac | 14 ++- legacy/evil/evil.pc.in | 4 +- legacy/evil/m4/ac_attribute.m4 | 46 -------- legacy/evil/m4/common/efl_attribute.m4 | 56 +++++++++ legacy/evil/m4/{ => common}/efl_doxygen.m4 | 0 legacy/evil/m4/efl_mpatrol.m4 | 130 --------------------- legacy/evil/m4/evil/evil_windows.m4 | 59 ++++++++++ 8 files changed, 128 insertions(+), 183 deletions(-) delete mode 100755 legacy/evil/m4/ac_attribute.m4 create mode 100644 legacy/evil/m4/common/efl_attribute.m4 rename legacy/evil/m4/{ => common}/efl_doxygen.m4 (100%) delete mode 100755 legacy/evil/m4/efl_mpatrol.m4 create mode 100644 legacy/evil/m4/evil/evil_windows.m4 diff --git a/legacy/evil/Makefile.am b/legacy/evil/Makefile.am index 991bf6584c..32b7731651 100644 --- a/legacy/evil/Makefile.am +++ b/legacy/evil/Makefile.am @@ -1,5 +1,5 @@ -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -I m4/common -I m4/evil MAINTAINERCLEANFILES = \ aclocal.m4 \ diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac index cd47b7b2f3..dcc438a961 100644 --- a/legacy/evil/configure.ac +++ b/legacy/evil/configure.ac @@ -54,6 +54,11 @@ version_info="lt_cur:lt_rev:lt_age" AC_SUBST(version_info) +### Needed information + +EFL_SELECT_WINDOWS_VERSION() + + ### Checks for programs AM_PROG_AS AC_PROG_CXX @@ -83,8 +88,6 @@ esac AC_SUBST([win32_libs]) AC_SUBST([win32_dl_libs]) -EFL_CHECK_MPATROL([have_mpatrol="yes"], [have_mpatrol="no"]) - ### Checks for header files AC_CHECK_HEADERS([errno.h]) @@ -98,7 +101,7 @@ AC_CHECK_HEADERS([errno.h]) ### Checks for compiler characteristics AC_C_CONST -AC_C___ATTRIBUTE__ +EFL_ATTRIBUTE_UNUSED win32_cppflags="-DEFL_EVIL_BUILD" win32_cflags="-Wall -Wextra -Wshadow -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls" @@ -107,12 +110,12 @@ have_wince="no" case "$host_os" in mingw32ce*) have_wince="yes" - win32_cppflags="${win32_cppflags} -D_WIN32_WCE=0x0420" + win32_cppflags="${win32_cppflags}" ;; *) have_wince="no" win32_cxxflags="-fno-rtti -fno-exceptions" - win32_cppflags="${win32_cppflags} -D_WIN32_WINNT=0x0501 -DSECURITY_WIN32" + win32_cppflags="${win32_cppflags} -DSECURITY_WIN32" ;; esac AC_SUBST([win32_cppflags]) @@ -154,6 +157,7 @@ echo echo "Configuration Options Summary:" echo echo " OS...................: ${host_os}" +echo " Windows version......: ${_efl_windows_version}" echo echo " Documentation........: ${build_doc}" echo " Mpatrol..............: ${have_mpatrol}" diff --git a/legacy/evil/evil.pc.in b/legacy/evil/evil.pc.in index 78669377d7..96878e2de4 100644 --- a/legacy/evil/evil.pc.in +++ b/legacy/evil/evil.pc.in @@ -3,9 +3,11 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ +winver=@_efl_windows_version@ + Name: evil Description: Library that ports on Windows some specific Unix functions. Version: @VERSION@ Libs: -L${libdir} -levil Libs.private: -Cflags: -I${includedir}/evil-@VMAJ@ +Cflags: -I${includedir}/evil-@VMAJ@ @EFL_WINDOWS_VERSION_CFLAGS@ diff --git a/legacy/evil/m4/ac_attribute.m4 b/legacy/evil/m4/ac_attribute.m4 deleted file mode 100755 index 3926d23d56..0000000000 --- a/legacy/evil/m4/ac_attribute.m4 +++ /dev/null @@ -1,46 +0,0 @@ -dnl Copyright (C) 2004-2008 Kim Woelders -dnl Copyright (C) 2008 Vincent Torri -dnl That code is public domain and can be freely used or copied. -dnl Originally snatched from somewhere... - -dnl Macro for checking if the compiler supports __attribute__ - -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"] - )] -) - -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))], [Macro declaring a function argument to be unused]) - else - AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused]) -fi - -]) diff --git a/legacy/evil/m4/common/efl_attribute.m4 b/legacy/evil/m4/common/efl_attribute.m4 new file mode 100644 index 0000000000..78bff15679 --- /dev/null +++ b/legacy/evil/m4/common/efl_attribute.m4 @@ -0,0 +1,56 @@ +dnl Copyright (C) 2011 Vincent Torri +dnl That code is public domain and can be freely used or copied. + +dnl Macros for checking if the compiler supports some __attribute__ uses + +dnl Usage: EFL_ATTRIBUTE_UNUSED +dnl call AC_DEFINE for __UNUSED__ if __attribute__((unused)) is available + +AC_DEFUN([EFL_ATTRIBUTE_UNUSED], +[ +AC_MSG_CHECKING([for __attribute__ ((unused))]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +void foo(int x __attribute__ ((unused))) {} + ]], + [[ + ]])], + [have_attribute_unused="yes"], + [have_attribute_unused="no"]) +AC_MSG_RESULT([${have_attribute_unused}]) + +if test "x${have_attribute_unused}" = "xyes" ; then + AC_DEFINE([__UNUSED__], [__attribute__ ((unused))], [Macro declaring a function argument to be unused.]) +else + AC_DEFINE([__UNUSED__], [], [__attribute__ ((unused)) is not supported.]) +fi +]) + +dnl Usage: EFL_ATTRIBUTE_VECTOR +dnl call AC_DEFINE for HAVE_GCC_ATTRIBUTE_VECTOR if __attribute__((vector)) is available + +AC_DEFUN([EFL_ATTRIBUTE_VECTOR], +[ +AC_MSG_CHECKING([for __attribute__ ((vector))]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +typedef int v4si __attribute__ ((vector_size (16))); + ]], + [[ +if (sizeof(v4si) == 16) + return 0; +else + return -1; + ]])], + [have_attribute_vector="yes"], + [have_attribute_vector="no"]) +AC_MSG_RESULT([${have_attribute_vector}]) + +if test "x${have_attribute_vector}" = "xyes" ; then + AC_DEFINE([HAVE_GCC_ATTRIBUTE_VECTOR], [1], [Define to 1 if your compiler supports __attribute__ ((vector)).]) +fi +]) + +dnl End of efl_attribute.m4 diff --git a/legacy/evil/m4/efl_doxygen.m4 b/legacy/evil/m4/common/efl_doxygen.m4 similarity index 100% rename from legacy/evil/m4/efl_doxygen.m4 rename to legacy/evil/m4/common/efl_doxygen.m4 diff --git a/legacy/evil/m4/efl_mpatrol.m4 b/legacy/evil/m4/efl_mpatrol.m4 deleted file mode 100755 index 88bf3bed2c..0000000000 --- a/legacy/evil/m4/efl_mpatrol.m4 +++ /dev/null @@ -1,130 +0,0 @@ -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 - -if test "x${_efl_enable_mpatrol}" = "xyes" ; then - EFL_MPATROL_CPPFLAGS="-include ${_efl_mpatrol_includedir}/mpatrol.h" - EFL_MPATROL_LIBS="-L${_efl_mpatrol_libdir} -lmpatrol -lbfd -liberty -limagehlp" -fi - -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/m4/evil/evil_windows.m4 b/legacy/evil/m4/evil/evil_windows.m4 new file mode 100644 index 0000000000..be79b8296b --- /dev/null +++ b/legacy/evil/m4/evil/evil_windows.m4 @@ -0,0 +1,59 @@ +dnl Copyright (C) 2011 Vincent Torri +dnl This code is public domain and can be freely used or copied. + +dnl Macro that select the Windows version (XP (default), Vista, 7) + +dnl Usage: EFL_SELECT_WINDOWS_VERSION() +dnl Update CPPFLAGS accordingly + +AC_DEFUN([EFL_SELECT_WINDOWS_VERSION], +[ + +dnl configure option + +AC_ARG_WITH([windows-version], + [AC_HELP_STRING([--with-windows-version], [select the target Windows version (xp, vista, win7 or ce) @<:@default=xp@:>@])], + [ + if test "x${with_windows_version}" = "xvista" ; then + _winver="vista" + else + if test "x${with_windows_version}" = "xwin7" ; then + _winver="win7" + else + if test "x${with_windows_version}" = "ce" ; then + _winver="ce" + else + _winver="xp" + fi + fi + fi + ], + [_winver="xp"]) + +AC_MSG_CHECKING([which Windows version to target]) +AC_MSG_RESULT([${_winver}]) + +case "${_winver}" in + ce) + EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WCE=0x0420" + _efl_windows_version="Windows CE" + ;; + vista) + EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0600" + _efl_windows_version="Windows Vista" + ;; + win7) + EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0601" + _efl_windows_version="Windows 7" + ;; + *) + EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0501" + _efl_windows_version="Windows XP" + ;; +esac + +CPPFLAGS="${CPPFLAGS} ${EFL_WINDOWS_VERSION_CFLAGS}" +AC_SUBST([EFL_WINDOWS_VERSION_CFLAGS]) +AC_SUBST([_efl_windows_version]) + +])