From 5e8d8633439ece755bfbe22ad428097feb1910c2 Mon Sep 17 00:00:00 2001 From: caro Date: Mon, 1 Mar 2010 20:16:15 +0000 Subject: [PATCH] fix autotools stuff git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/efreet@46737 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- configure.ac | 158 +++++++++++++++++++++++++++++++++++------------- efreet-mime.pc.in | 2 +- efreet-trash.pc.in | 2 +- efreet.pc.in | 2 +- m4/efl_compiler_flag.m4 | 57 +++++++++++++++++ m4/efl_path_max.m4 | 1 + src/bin/Makefile.am | 2 - src/lib/Makefile.am | 10 +-- src/tests/Makefile.am | 2 - 9 files changed, 182 insertions(+), 54 deletions(-) create mode 100644 m4/efl_compiler_flag.m4 diff --git a/configure.ac b/configure.ac index e933dd8..361fd7f 100644 --- a/configure.ac +++ b/configure.ac @@ -13,13 +13,6 @@ AM_INIT_AUTOMAKE([1.6 dist-bzip2]) AM_CONFIG_HEADER([config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AC_ISC_POSIX -AC_PROG_CC -AM_PROG_CC_STDC -AC_HEADER_STDC -AC_C_CONST -AC_C___ATTRIBUTE__ - AC_LIBTOOL_WIN32_DLL define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl @@ -38,8 +31,58 @@ AC_SUBST(efreet_release_info) AC_SUBST(efreet_mime_release_info) AC_SUBST(efreet_trash_release_info) -EFL_CHECK_PATH_MAX +### Needed information + + +### Additional options to configure + +AC_ARG_ENABLE([strict-spec], + [AC_HELP_STRING([--enable-strict-spec], [Enable strict spec compliance @<:@default=disabled@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + enable_strict_spec="yes" + else + enable_strict_spec="no" + fi + ], + [enable_strict_spec="no"]) + +if test "x${enable_strict_spec}" = "xyes" ; then + AC_DEFINE([STRICT_SPEC], [1], [Strict Spec Compliance]) +fi + +AC_ARG_ENABLE([sloppy-spec], + [AC_HELP_STRING([--disable-sloppy-spec], [Enable sloppy spec compliance @<:@default=enabled@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + enable_sloppy_spec="yes" + else + enable_sloppy_spec="no" + fi + ], + [enable_sloppy_spec="yes"]) + +if test "x${enable_sloppy_spec}" = "xyes" ; then + AC_DEFINE([SLOPPY_SPEC], [1], [Sloppy Spec Compliance]) +fi + +#AC_ARG_ENABLE(hidden-visibility, +# [AC_HELP_STRING([--enable-hidden-visibility],[Enable hidden visibility])], +# [enable_hidden_visibility=$enableval], [enable_hidden_visibility="auto"]) +#if test "x$enable_hidden_visibility" = "xyes" ; then +# CPPFLAGS="$CPPFLAGS -fvisibility=hidden" +#else +# AC_DEFINE(DEFAULT_VISIBLITY, 1, [Default visibility]) +#fi +#AM_CONDITIONAL(DEFAULT_VISIBILITY, test "x$enable_hidden_visibility" != "xyes") +AM_CONDITIONAL(DEFAULT_VISIBILITY, 0) + + +### Checks for programs +AC_PROG_CC + +# pkg-config PKG_PROG_PKG_CONFIG # Check whether pkg-config supports Requires.private @@ -50,61 +93,89 @@ else fi AC_SUBST(pkgconfig_requires_private) +# doxygen program for documentation building +EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) + + +### Checks for libraries + +# Evil library for compilation on Windows CE + EFL_EFREET_BUILD="" EFL_EFREET_MIME_BUILD="" EFL_EFREET_TRASH_BUILD="" -win32_libs="" case "$host_os" in - mingw* | cegcc*) + mingw*) PKG_CHECK_MODULES([EVIL], [evil]) - AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed]) + AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed]) + requirement_efreet="evil" EFL_EFREET_BUILD="-DEFL_EFREET_BUILD" EFL_EFREET_MIME_BUILD="-DEFL_EFREET_MIME_BUILD" EFL_EFREET_TRASH_BUILD="-DEFL_EFREET_TRASH_BUILD" - win32_libs="-lws2_32" ;; esac AC_SUBST(EFL_EFREET_BUILD) AC_SUBST(EFL_EFREET_MIME_BUILD) AC_SUBST(EFL_EFREET_TRASH_BUILD) -AC_SUBST(win32_libs) -AC_FUNC_ALLOCA +PKG_CHECK_MODULES(EFREET, [eina-0 eet ecore >= 0.9.9 ecore-file >= 0.9.9]) +PKG_CHECK_MODULES(EINA, [eina-0]) + +requirement_efreet="ecore-file ecore eet eina-0 ${requirement_efreet}" + +### Checks for header files AC_CHECK_HEADERS([arpa/inet.h]) -PKG_CHECK_MODULES(EFREET, [eet eina-0 ecore >= 0.9.9 ecore-file >= 0.9.9]) -PKG_CHECK_MODULES(EINA, [eina-0]) +### Checks for types -requirements="ecore-file ecore eina-0" -AC_ARG_ENABLE(strict-spec, - [AC_HELP_STRING([--enable-strict-spec],[Enable strict spec compliance])], - [enable_strict_spec=$enableval], [enable_strict_spec="auto"]) -if test "x$enable_strict_spec" = "xyes" ; then - AC_DEFINE(STRICT_SPEC, 1, [Strict Spec Compliance]) -fi +### Checks for structures + -AC_ARG_ENABLE(sloppy-spec, - [AC_HELP_STRING([--disable-sloppy-spec],[Enable sloppy spec compliance])], - [enable_sloppy_spec=$enableval], [enable_sloppy_spec="yes"]) -if test "x$enable_sloppy_spec" = "xyes" ; then - AC_DEFINE(SLOPPY_SPEC, 1, [Sloppy Spec Compliance]) +### Checks for compiler characteristics + +AC_C_CONST +AC_ISC_POSIX +AC_C___ATTRIBUTE__ +AM_PROG_CC_STDC +AC_HEADER_STDC + +case "${host_os}" in + mingw*) + EFREET_CFLAGS="${EFREET_CFLAGS} ${EVIL_CFLAGS}" + ;; +esac + +if ! test "x${VMIC}" = "x" ; then + EFL_COMPILER_FLAG([-Wall]) + EFL_COMPILER_FLAG([-W]) fi -#AC_ARG_ENABLE(hidden-visibility, -# [AC_HELP_STRING([--enable-hidden-visibility],[Enable hidden visibility])], -# [enable_hidden_visibility=$enableval], [enable_hidden_visibility="auto"]) -#if test "x$enable_hidden_visibility" = "xyes" ; then -# CPPFLAGS="$CPPFLAGS -fvisibility=hidden" -#else -# AC_DEFINE(DEFAULT_VISIBLITY, 1, [Default visibility]) -#fi -#AM_CONDITIONAL(DEFAULT_VISIBILITY, test "x$enable_hidden_visibility" != "xyes") -AM_CONDITIONAL(DEFAULT_VISIBILITY, 0) -EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) +EFL_COMPILER_FLAG([-Wshadow]) + +EFL_CHECK_PATH_MAX + + +### Checks for linker characteristics +lt_enable_auto_import="" +WIN32_LIBS="" +case "${host_os}" in + mingw*) + WIN32_LIBS="-lws2_32" + lt_enable_auto_import="-Wl,--enable-auto-import" + ;; +esac +AC_SUBST(WIN32_LIBS) +AC_SUBST(lt_enable_auto_import) + + +### Checks for library functions +AC_FUNC_ALLOCA +AC_CHECK_FUNCS(strlcpy) + +AC_SUBST(requirement_efreet) -AC_SUBST(requirements) AC_OUTPUT([ efreet.spec efreet.pc @@ -120,8 +191,7 @@ src/tests/data/Makefile src/tests/data/sub/Makefile src/tests/compare/Makefile src/bin/Makefile -], [] -) +]) ##################################################################### @@ -136,6 +206,10 @@ echo "------------------------------------------------------------------------" echo echo "Configuration Options Summary:" echo +echo " Specification compliance:" +echo " Strict.............: ${enable_strict_spec}" +echo " Sloppy.............: ${enable_sloppy_spec}" +echo echo " Documentation........: ${build_doc}" echo echo "Compilation............: make (or gmake)" diff --git a/efreet-mime.pc.in b/efreet-mime.pc.in index e343b0f..cf37682 100644 --- a/efreet-mime.pc.in +++ b/efreet-mime.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: efreet-mime Description: Freedesktop Shared Mime Info standard implementation for the EFL -@pkgconfig_requires_private@: @requirements@ +@pkgconfig_requires_private@: @requirement_efreet@ Version: @VERSION@ Libs: -L${libdir} -lefreet_mime Cflags: -I${includedir}/efreet diff --git a/efreet-trash.pc.in b/efreet-trash.pc.in index 598049c..ef58201 100644 --- a/efreet-trash.pc.in +++ b/efreet-trash.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: efreet-trash Description: Freedesktop Shared Trash implementation for the EFL -@pkgconfig_requires_private@: @requirements@ +@pkgconfig_requires_private@: @requirement_efreet@ Version: @VERSION@ Libs: -L${libdir} -lefreet_trash Cflags: -I${includedir}/efreet diff --git a/efreet.pc.in b/efreet.pc.in index 7be2b3c..e547ee4 100644 --- a/efreet.pc.in +++ b/efreet.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: efreet Description: Freedesktop standards implementation for the EFL -@pkgconfig_requires_private@: @requirements@ +@pkgconfig_requires_private@: @requirement_efreet@ Version: @VERSION@ Libs: -L${libdir} -lefreet Cflags: -I${includedir}/efreet diff --git a/m4/efl_compiler_flag.m4 b/m4/efl_compiler_flag.m4 new file mode 100644 index 0000000..618c6a6 --- /dev/null +++ b/m4/efl_compiler_flag.m4 @@ -0,0 +1,57 @@ +dnl Copyright (C) 2010 Vincent Torri +dnl and Albin Tonnerre +dnl That code is public domain and can be freely used or copied. + +dnl Macro that checks if a compiler flag is supported by the compiler. + +dnl Usage: EFL_COMPILER_FLAG(flag) +dnl flag is added to CFLAGS if supported. + +AC_DEFUN([EFL_COMPILER_FLAG], +[ + +CFLAGS_save="${CFLAGS}" +CFLAGS="${CFLAGS} $1" + +AC_LANG_PUSH([C]) +AC_MSG_CHECKING([whether the compiler supports $1]) + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]])], + [have_flag="yes"], + [have_flag="no"]) +AC_MSG_RESULT([${have_flag}]) + +if test "x${have_flag}" = "xno" ; then + CFLAGS="${CFLAGS_save}" +fi +AC_LANG_POP([C]) + +]) + +dnl Macro that checks if a linker flag is supported by the compiler. + +dnl Usage: EFL_LINKER_FLAG(flag) +dnl flag is added to CFLAGS if supported (will be passed to ld anyway). + +AC_DEFUN([EFL_LINKER_FLAG], +[ + +CFLAGS_save="${CFLAGS}" +CFLAGS="${CFLAGS} $1" + +AC_LANG_PUSH([C]) +AC_MSG_CHECKING([whether the compiler supports $1]) + +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]])], + [have_flag="yes"], + [have_flag="no"]) +AC_MSG_RESULT([${have_flag}]) + +if test "x${have_flag}" = "xno" ; then + CFLAGS="${CFLAGS_save}" +fi +AC_LANG_POP([C]) + +]) diff --git a/m4/efl_path_max.m4 b/m4/efl_path_max.m4 index f57bfd2..3ac29bd 100644 --- a/m4/efl_path_max.m4 +++ b/m4/efl_path_max.m4 @@ -11,6 +11,7 @@ AC_DEFUN([EFL_CHECK_PATH_MAX], [ default_max=m4_default([$1], "4096") + AC_LANG_PUSH([C]) AC_MSG_CHECKING([for PATH_MAX in limits.h]) diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index cbdde9c..a516ebe 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -12,8 +12,6 @@ AM_CPPFLAGS = \ bin_PROGRAMS = \ efreet_desktop_cache_create -efreet_desktop_cache_create_DEPENDENCIES = \ -$(top_builddir)/src/lib/libefreet.la efreet_desktop_cache_create_LDADD = \ $(top_builddir)/src/lib/libefreet.la \ @EFREET_LIBS@ diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index eff8ed6..f3d1c6c 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -36,8 +36,8 @@ libefreet_la_CPPFLAGS = \ -I$(top_srcdir)/src/lib \ @EFL_EFREET_BUILD@ \ @EFREET_CFLAGS@ -libefreet_la_LIBADD = @EFREET_LIBS@ @win32_libs@ -libefreet_la_LDFLAGS = -no-undefined -version-info @version_info@ @efreet_release_info@ +libefreet_la_LIBADD = @EFREET_LIBS@ @WIN32_LIBS@ +libefreet_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @efreet_release_info@ libefreet_mime_la_SOURCES = efreet_mime.c @@ -46,8 +46,8 @@ libefreet_mime_la_CPPFLAGS = \ -I$(top_srcdir)/src/lib \ @EFL_EFREET_MIME_BUILD@ \ @EFREET_CFLAGS@ -libefreet_mime_la_LIBADD = @EFREET_LIBS@ libefreet.la @win32_libs@ -libefreet_mime_la_LDFLAGS = -no-undefined -version-info @version_info@ @efreet_mime_release_info@ +libefreet_mime_la_LIBADD = @EFREET_LIBS@ libefreet.la @WIN32_LIBS@ +libefreet_mime_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @efreet_mime_release_info@ libefreet_trash_la_SOURCES = efreet_trash.c @@ -57,6 +57,6 @@ libefreet_trash_la_CPPFLAGS = \ @EFL_EFREET_TRASH_BUILD@ \ @EFREET_CFLAGS@ libefreet_trash_la_LIBADD = @EFREET_LIBS@ libefreet.la -libefreet_trash_la_LDFLAGS = -no-undefined -version-info @version_info@ @efreet_trash_release_info@ +libefreet_trash_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @efreet_trash_release_info@ EXTRA_DIST = efreet_private.h efreet_xml.h diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index d2790fe..375cd15 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -13,8 +13,6 @@ AM_CPPFLAGS = \ bin_PROGRAMS = efreet_test efreet_spec_test efreet_cache_test -efreet_test_DEPENDENCIES = $(top_builddir)/src/lib/libefreet.la \ - $(top_builddir)/src/lib/libefreet_mime.la efreet_test_LDADD = $(top_builddir)/src/lib/libefreet.la \ $(top_builddir)/src/lib/libefreet_mime.la \ @EFREET_LIBS@ -- 2.7.4