0d32080e1d12a52df270d6cdc9f3bf442172f8dd
[rtl-433.git] / configure.ac
1 AC_INIT([rtl433],
2         m4_esyscmd([./git-version-gen .tarball-version]),
3         [rtl_433@googlegroups.com])
4
5 AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
6
7 dnl kernel style compile messages
8 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9
10 dnl checks for programs
11 AC_PROG_MAKE_SET
12 AC_PROG_CC
13 AC_PROG_INSTALL
14 LT_INIT
15 AC_PROG_LIBTOOL
16
17 PKG_CHECK_MODULES(LIBRTLSDR, librtlsdr)
18 LIBS="$LIBS $LIBRTLSDR_LIBS"
19 CFLAGS="$CFLAGS $LIBRTLSDR_CFLAGS"
20
21 AC_PATH_PROG(DOXYGEN,doxygen,false)
22 AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
23
24 AC_CONFIG_MACRO_DIR([m4])
25
26 dnl checks for header files
27 AC_HEADER_STDC
28 AC_CHECK_HEADERS(sys/types.h)
29
30 # pc variables
31 AC_SUBST(RTLSDR_PC_LIBS,["$LIBS"])
32 AC_SUBST(RTLSDR_PC_CFLAGS,["$CFLAGS"])
33
34 dnl checks for required libraries
35
36 # The following test is taken from WebKit's webkit.m4
37 saved_CFLAGS="$CFLAGS"
38 CFLAGS="$CFLAGS -fvisibility=hidden "
39 AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
40 AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
41     [ AC_MSG_RESULT([yes])
42       SYMBOL_VISIBILITY="-fvisibility=hidden"],
43       AC_MSG_RESULT([no]))
44 CFLAGS="$saved_CFLAGS"
45 AC_SUBST(SYMBOL_VISIBILITY)
46
47 AC_MSG_CHECKING(whether compiler understands -Wall)
48 old_CFLAGS="$CFLAGS"
49 CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused -Wsign-compare"
50 AC_TRY_COMPILE([],[],
51   AC_MSG_RESULT(yes),
52   AC_MSG_RESULT(no)
53   CFLAGS="$old_CFLAGS")
54
55 dnl Generate the output
56 AM_CONFIG_HEADER(config.h)
57
58 AC_OUTPUT(
59         rtl433.pc
60         include/Makefile
61         src/Makefile
62         Makefile
63         Doxyfile
64 )