Release 0.6
[platform/upstream/neard.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(neard, 0.6)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
5 AM_CONFIG_HEADER(config.h)
6
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9 AM_MAINTAINER_MODE
10
11 AC_PREFIX_DEFAULT(/usr/local)
12
13 if (test "${libdir}" = '${exec_prefix}/lib'); then
14         libdir="${prefix}/lib"
15 fi
16
17 plugindir="${libdir}/near/plugins"
18
19 PKG_PROG_PKG_CONFIG
20
21 COMPILER_FLAGS
22
23 AC_LANG_C
24
25 AC_PROG_CC
26 AC_PROG_CC_PIE
27 AC_PROG_INSTALL
28
29 m4_define([_LT_AC_TAGCONFIG], [])
30 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
31
32 AC_DISABLE_STATIC
33 AC_PROG_LIBTOOL
34
35 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
36                         [disable code optimization through compiler]), [
37         if (test "${enableval}" = "no"); then
38                 CFLAGS="$CFLAGS -O0"
39         fi
40 ])
41
42 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
43                         [enable compiling with debugging information]), [
44         if (test "${enableval}" = "yes" &&
45                                 test "${ac_cv_prog_cc_g}" = "yes"); then
46                 CFLAGS="$CFLAGS -g"
47         fi
48 ])
49
50 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
51                         [enable position independent executables flag]), [
52         if (test "${enableval}" = "yes" &&
53                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
54                 CFLAGS="$CFLAGS -fPIE"
55                 LDFLAGS="$LDFLAGS -pie"
56         fi
57 ])
58
59 AC_CHECK_LIB(dl, dlopen, dummy=yes,
60                         AC_MSG_ERROR(dynamic linking loader is required))
61
62 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
63                                 AC_MSG_ERROR(GLib >= 2.28 is required))
64 AC_SUBST(GLIB_CFLAGS)
65 AC_SUBST(GLIB_LIBS)
66
67 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.2, dummy=yes,
68                                 AC_MSG_ERROR(D-Bus >= 1.2 is required))
69 AC_SUBST(DBUS_CFLAGS)
70 AC_SUBST(DBUS_LIBS)
71
72 PKG_CHECK_MODULES(LIBNL3, libnl-3.0 libnl-genl-3.0, [
73         NETLINK_CFLAGS=${LIBNL3_CFLAGS}
74         NETLINK_LIBS=${LIBNL3_LIBS}
75 ], [
76         PKG_CHECK_MODULES(LIBNL2, libnl-2.0, [
77                 NETLINK_CFLAGS=${LIBNL2_CFLAGS}
78                 NETLINK_LIBS=${LIBNL2_LIBS}
79         ], [
80                 PKG_CHECK_MODULES(LIBNL1, libnl-1, dummy=yes,
81                         AC_MSG_ERROR(Netlink library is required))
82                 AC_DEFINE(NEED_LIBNL_COMPAT, 1,
83                         [Define to 1 if you need libnl-1 compat functions.])
84                 NETLINK_CFLAGS=${LIBNL1_CFLAGS}
85                 NETLINK_LIBS=${LIBNL1_LIBS}
86         ])
87 ])
88 AC_SUBST(NETLINK_CFLAGS)
89 AC_SUBST(NETLINK_LIBS)
90
91 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
92                                         [enable test/example scripts]),
93                                         [enable_test=${enableval}])
94 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
95
96 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
97                                         [enable testing tools]),
98                                         [enable_tools=${enableval}])
99 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
100
101 AC_ARG_ENABLE(nfctype1, AC_HELP_STRING([--disable-nfctype1],
102                                 [disable NFC forum type 1 tags support]),
103                                 [enable_nfctype1=${enableval}])
104 AM_CONDITIONAL(NFCTYPE1, test "${enable_nfctype1}" != "no")
105
106 AC_ARG_ENABLE(nfctype2, AC_HELP_STRING([--disable-nfctype2],
107                                 [disable NFC forum type 2 tags support]),
108                                 [enable_nfctype2=${enableval}])
109 AM_CONDITIONAL(NFCTYPE2, test "${enable_nfctype2}" != "no")
110
111 AC_ARG_ENABLE(nfctype3, AC_HELP_STRING([--disable-nfctype3],
112                                 [disable NFC forum type 3 tags support]),
113                                 [enable_nfctype3=${enableval}])
114 AM_CONDITIONAL(NFCTYPE3, test "${enable_nfctype3}" != "no")
115
116 AC_ARG_ENABLE(nfctype4, AC_HELP_STRING([--disable-nfctype4],
117                                 [disable NFC forum type 4 tags support]),
118                                 [enable_nfctype4=${enableval}])
119 AM_CONDITIONAL(NFCTYPE4, test "${enable_nfctype4}" != "no")
120
121 AC_ARG_ENABLE(p2p, AC_HELP_STRING([--disable-p2p],
122                                 [disable NFC peer to peer support]),
123                                 [enable_p2p=${enableval}])
124 AM_CONDITIONAL(P2P, test "${enable_p2p}" != "no")
125
126 AC_OUTPUT(Makefile include/version.h neard.pc)