Detect -lm in genlib

genlib's configure checks for -lmangle before -lm; as a result, the
-lm checks include -lmangle which fails because the required library
path isn't specified. To avoid this, we check for -lm before checking
for -lmangle.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Signed-off-by: Liu Hao <lh_mouse@126.com>
diff --git a/mingw-w64-tools/genlib/configure.ac b/mingw-w64-tools/genlib/configure.ac
index 18a5267..1c334f5 100644
--- a/mingw-w64-tools/genlib/configure.ac
+++ b/mingw-w64-tools/genlib/configure.ac
@@ -15,6 +15,14 @@
 # Checks for programs.
 AC_PROG_CC
 
+# Checks for library functions.
+# Disabled due the fact that once the autoconf detects that malloc
+# is not available, it places in config.h the define of malloc as
+# rpl_malloc. By this linkage could fail on cross-compiles.
+#AC_FUNC_MALLOC
+AC_CHECK_FUNCS([memset strdup strrchr strlwr])
+AC_CHECK_LIB([m], [floor])
+
 # Checks for libraries.
 AC_MSG_CHECKING([whether to build genlib with libmangle])
 AC_ARG_WITH([mangle],
@@ -54,13 +62,5 @@
 AC_TYPE_UINT64_T
 AC_TYPE_UINT8_T
 
-# Checks for library functions.
-# Disabled due the fact that once the autoconf detects that malloc
-# is not available, it places in config.h the define of malloc as
-# rpl_malloc. By this linkage could fail on cross-compiles.
-#AC_FUNC_MALLOC
-AC_CHECK_FUNCS([memset strdup strrchr strlwr])
-AC_CHECK_LIB([m], [floor])
-
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT