Add name-resolver unit tests
[platform/upstream/libevdev.git] / configure.ac
index cfa9746..894e0a6 100644 (file)
@@ -1,13 +1,14 @@
-AC_PREREQ([2.64])
+AC_PREREQ([2.62])
 
 AC_INIT([libevdev],
-        [0.3],
+        [0.4],
         [],
         [libevdev],
         [])
 
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
+AC_USE_SYSTEM_EXTENSIONS
 
 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
 
@@ -31,30 +32,59 @@ AC_PROG_CC
 # Initialize libtool
 LT_PREREQ([2.2])
 LT_INIT
+LT_PATH_LD
+
+with_ldflags=""
+if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
+       CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
+                               -Wl,--as-needed \
+                               -Wl,--gc-sections \
+                               -Wl,-z,relro \
+                               -Wl,-z,now])
+fi
+AC_SUBST([GNU_LD_FLAGS], $with_ldflags)
 
 PKG_PROG_PKG_CONFIG()
-PKG_CHECK_MODULES(CHECK, [check])
+PKG_CHECK_MODULES(CHECK, [check >= 0.9.9], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
+if test "x$HAVE_CHECK" != "xyes"; then
+       AC_MSG_WARN([check not found - skipping building unit tests])
+fi
+AM_CONDITIONAL(BUILD_TESTS, [test "x$HAVE_CHECK" = "xyes"])
 
+with_cflags=""
 if test "x$GCC" = "xyes"; then
-       GCC_CFLAGS="-Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
+       CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+                               -Wall \
+                               -Wextra \
+                               -Wno-unused-parameter \
+                               -Wstrict-prototypes \
+                               -Wmissing-prototypes \
+                               -fvisibility=hidden \
+                               -pipe \
+                               -fno-strict-aliasing \
+                               -ffunction-sections \
+                               -fdata-sections \
+                               -fno-strict-aliasing \
+                               -fdiagnostics-show-option \
+                               -fno-common])
 fi
-AC_SUBST(GCC_CFLAGS)
+AC_SUBST([GCC_CFLAGS], $with_cflags)
 
 AC_PATH_PROG(DOXYGEN, [doxygen])
 if test "x$DOXYGEN" = "x"; then
        AC_MSG_WARN([doxygen not found - required for documentation])
-       have_doxygen=no
+       have_doxygen="no"
 else
-       have_doxygen=yes
+       have_doxygen="yes"
 fi
-AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
+AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$have_doxygen" = "xyes"])
 
 AC_MSG_CHECKING([whether to build with gcov])
 AC_ARG_ENABLE([gcov],
              [AS_HELP_STRING([--enable-gcov],
-                             [Whether to enable coverage testing (default:enabled)])]
+                             [Whether to enable coverage testing (default:disabled)])],
              [],
-             [enable_gcov=yes],
+             [enable_gcov=no],
              )
 AS_IF([test "x$enable_gcov" != "xno"],
       [
@@ -64,6 +94,11 @@ AS_IF([test "x$enable_gcov" != "xno"],
        ],
 )
 
+AM_PATH_PYTHON()
+AC_SUBST(PYTHON)
+AS_IF([$($PYTHON -c "import argparse")], [:],
+       AC_MSG_ERROR([python argparse module is missing]))
+
 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
 AC_SUBST([GCOV_CFLAGS])
 AC_SUBST([GCOV_LDFLAGS])
@@ -77,3 +112,9 @@ AC_CONFIG_FILES([Makefile
                 test/Makefile
                 libevdev.pc])
 AC_OUTPUT
+
+AC_MSG_RESULT([
+              Build documentation      ${have_doxygen}
+              Build unit-tests         ${HAVE_CHECK}
+              Enable profiling         ${enable_gcov}
+              ])