use efl_fnmatch m4 macro
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 3 Feb 2010 21:01:02 +0000 (21:01 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 3 Feb 2010 21:01:02 +0000 (21:01 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/embryo@45854 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
embryo.pc.in
m4/efl_fnmatch.m4 [new file with mode: 0644]

index cfdfaa2..bc354a3 100644 (file)
@@ -86,10 +86,6 @@ AC_SUBST(EFL_EMBRYO_BUILD)
 
 ### 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 types
 
@@ -133,8 +129,13 @@ AC_SUBST(lt_enable_auto_import)
 
 
 ### Checks for library functions
+
+# alloca
 AC_FUNC_ALLOCA
 
+# fnmatch
+EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
+
 case "$host_os" in
    mingw* | cegcc*)
       AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defined to 1 (MinGW / CeGCC platform)])
@@ -144,20 +145,6 @@ case "$host_os" in
       ;;
 esac
 
-fnmatch_libs=""
-AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
-if test "x$res" = "xno"; then
-   AC_SEARCH_LIBS([fnmatch],
-      [fnmatch evil iberty],
-      [res="yes"],
-      [res="no"])
-   if test "x$res" = "xno"; then
-      AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
-   fi
-   fnmatch_libs="${ac_cv_search_fnmatch}"
-fi
-AC_SUBST(fnmatch_libs)
-
 
 AC_SUBST(requirement_embryo)
 AC_SUBST(embryoincludedir)
index b30742a..d7dc2a1 100644 (file)
@@ -11,5 +11,5 @@ Description: A small virtual machine engine and bytecode compiler
 @pkgconfig_requires_private@: @requirement_embryo@
 Version: @VERSION@
 Libs: -L${libdir} -lembryo
-Libs.private: @fnmatch_libs@ -lm
+Libs.private: @EFL_FNMATCH_LIBS@ -lm
 Cflags: -I${includedir}
diff --git a/m4/efl_fnmatch.m4 b/m4/efl_fnmatch.m4
new file mode 100644 (file)
index 0000000..a92ac6b
--- /dev/null
@@ -0,0 +1,31 @@
+dnl Copyright (C) 2010 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 fnmatch functions are available or not.
+
+dnl Usage: EFL_CHECK_FNMATCH([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Call AC_SUBST(EFL_FNMATCH_LIBS)
+
+AC_DEFUN([EFL_CHECK_FNMATCH],
+[
+
+AC_CHECK_HEADER([fnmatch.h], [_efl_have_fnmatch="yes"], [_efl_have_fnmatch="no"])
+
+if test "x${_efl_have_fnmatch}" = "xyes" ; then
+   AC_SEARCH_LIBS([fnmatch],
+      [fnmatch evil iberty],
+      [_efl_have_fnmatch="yes"],
+      [_efl_have_fnmatch="no"])
+fi
+
+EFL_FNMATCH_LIBS=""
+
+if (! test "x${ac_cv_search_fnmatch}" = "xnone required") && (! test "x${ac_cv_search_fnmatch}" = "xno") && (! test "x${ac_cv_search_fnmatch}" = "x-levil") ; then
+   EFL_FNMATCH_LIBS=${ac_cv_search_fnmatch}
+fi
+
+AC_SUBST(EFL_FNMATCH_LIBS)
+
+AS_IF([test "x$_efl_have_fnmatch" = "xyes"], [$1], [$2])
+
+])