configure.ac (11823B)
1 AC_PREREQ([2.69]) 2 AC_INIT([iwd],[3.12]) 3 4 AC_CONFIG_HEADERS(config.h) 5 AC_CONFIG_AUX_DIR(build-aux) 6 AC_CONFIG_MACRO_DIR(build-aux) 7 8 AC_REQUIRE_AUX_FILE([tap-driver.sh]) 9 10 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules 11 tar-pax no-dist-gzip dist-xz]) 12 13 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 14 15 AM_MAINTAINER_MODE 16 17 AC_PREFIX_DEFAULT(/usr/local) 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_CC_ASAN 28 AC_PROG_CC_LSAN 29 AC_PROG_CC_UBSAN 30 AC_PROG_CC_GCOV 31 AC_PROG_INSTALL 32 AC_PROG_MKDIR_P 33 AC_PROG_LN_S 34 AC_PROG_AWK 35 36 AC_SYS_LARGEFILE 37 38 LT_PREREQ(2.2) 39 LT_INIT([disable-static]) 40 41 AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization], 42 [disable code optimization through compiler]), [ 43 if (test "${enableval}" = "no"); then 44 CFLAGS="$CFLAGS -O0" 45 fi 46 ]) 47 48 if (test "${enable_optimization}" != "no"); then 49 CFLAGS="$CFLAGS -O2" 50 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" 51 fi 52 53 AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], 54 [enable compiling with debugging information]), [ 55 if (test "${enableval}" = "yes" && 56 test "${ac_cv_prog_cc_g}" = "yes"); then 57 CFLAGS="$CFLAGS -g" 58 fi 59 ]) 60 61 AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], 62 [enable compiling with code coverage information]), [ 63 if (test "${enableval}" = "yes" && 64 test "${ac_cv_prog_cc_profile_arcs}" = "yes" && 65 test "${ac_cv_prog_cc_test_coverage}" = "yes"); then 66 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" 67 fi 68 ]) 69 70 if (test "${enable_gcov}" = "yes"); then 71 AC_CHECK_PROGS(LCOV, [lcov], "no") 72 AC_CHECK_PROGS(GENHTML, [genhtml], "no") 73 if (test "${LCOV}" == "no"); then 74 AC_MSG_ERROR([lcov is required]) 75 fi 76 if (test "${GENHTML}" == "no"); then 77 AC_MSG_ERROR([genhtml is required]) 78 fi 79 fi 80 81 AM_CONDITIONAL(GCOV, test "${enable_gcov}" != "no") 82 83 AC_ARG_ENABLE(pie, AS_HELP_STRING([--enable-pie], 84 [enable position independent executables flag]), [ 85 if (test "${enableval}" = "yes" && 86 test "${ac_cv_prog_cc_pie}" = "yes"); then 87 CFLAGS="$CFLAGS -fPIE" 88 LDFLAGS="$LDFLAGS -pie" 89 fi 90 ]) 91 92 save_LIBS=$LIBS 93 AC_CHECK_LIB(asan, _init) 94 LIBS=$save_LIBS 95 96 AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], 97 [enable linking with address sanitizer]), [ 98 if (test "${enableval}" = "yes" && 99 test "${ac_cv_lib_asan__init}" = "yes" && 100 test "${ac_cv_prog_cc_asan}" = "yes"); then 101 CFLAGS="$CFLAGS -fsanitize=address"; 102 LDFLAGS="$LDFLAGS -fsanitize=address" 103 fi 104 ]) 105 106 save_LIBS=$LIBS 107 AC_CHECK_LIB(lsan, _init) 108 LIBS=$save_LIBS 109 110 AC_ARG_ENABLE(lsan, AS_HELP_STRING([--enable-lsan], 111 [enable linking with leak sanitizer]), [ 112 if (test "${enableval}" = "yes" && 113 test "${ac_cv_lib_lsan__init}" = "yes" && 114 test "${ac_cv_prog_cc_lsan}" = "yes"); then 115 CFLAGS="$CFLAGS -fsanitize=leak"; 116 LDFLAGS="$LDFLAGS -fsanitize=leak" 117 fi 118 ]) 119 120 save_LIBS=$LIBS 121 AC_CHECK_LIB(ubsan, _init) 122 LIBS=$save_LIBS 123 124 AC_ARG_ENABLE(ubsan, AS_HELP_STRING([--enable-ubsan], 125 [enable linking with undefined behavior sanitizer]), [ 126 if (test "${enableval}" = "yes" && 127 test "${ac_cv_lib_ubsan__init}" = "yes" && 128 test "${ac_cv_prog_cc_ubsan}" = "yes"); then 129 CFLAGS="$CFLAGS -fsanitize=undefined"; 130 LDFLAGS="$LDFLAGS -fsanitize=undefined" 131 fi 132 ]) 133 if (test "${prefix}" = "NONE"); then 134 dnl no prefix and no localstatedir, so default to /var 135 if (test "$localstatedir" = '${prefix}/var'); then 136 AC_SUBST([localstatedir], ['/var']) 137 fi 138 139 prefix="${ac_default_prefix}" 140 fi 141 142 if (test "$localstatedir" = '${prefix}/var'); then 143 daemon_storagedir="${prefix}/var/lib/iwd" 144 wired_storagedir="${prefix}/var/lib/ead" 145 else 146 daemon_storagedir="${localstatedir}/lib/iwd" 147 wired_storagedir="${localstatedir}/lib/ead" 148 fi 149 150 AC_SUBST([daemon_storagedir], [${daemon_storagedir}]) 151 AC_SUBST([wired_storagedir], [${wired_storagedir}]) 152 153 AC_DEFINE_UNQUOTED(DAEMON_STORAGEDIR, "${daemon_storagedir}", 154 [Directory for Wireless daemon storage files]) 155 AC_DEFINE_UNQUOTED(DAEMON_CONFIGDIR, "/etc/iwd", 156 [Directory for Wireless daemon configuration]) 157 158 AC_DEFINE_UNQUOTED(WIRED_STORAGEDIR, "${wired_storagedir}", 159 [Directory for Ethernet daemon storage files]) 160 161 AC_CHECK_FUNCS(explicit_bzero) 162 AC_CHECK_FUNCS(rawmemchr) 163 AC_CHECK_FUNCS(reallocarray) 164 165 AC_CHECK_HEADERS(linux/types.h linux/if_alg.h) 166 167 # In maintainer mode: try to build with application backtrace and disable PIE. 168 if (test "${USE_MAINTAINER_MODE}" = yes); then 169 AC_SEARCH_LIBS([backtrace], [execinfo], 170 [ 171 AC_DEFINE([HAVE_BACKTRACE], [1], 172 [Define to 1 if you have backtrace(3).]) 173 CFLAGS="$CFLAGS -fno-PIE" 174 LDFLAGS="$LDFLAGS -no-pie" 175 ]) 176 fi 177 178 AC_ARG_ENABLE([dbus], AS_HELP_STRING([--disable-dbus], 179 [don't provide dbus support]), 180 [disable_dbus=${enableval}]) 181 AM_CONDITIONAL(DBUS, test "${disable_dbus}" != "no") 182 183 AC_ARG_ENABLE([daemon], AS_HELP_STRING([--disable-daemon], 184 [don't install iwd system daemon]), 185 [enable_daemon=${enableval}]) 186 AM_CONDITIONAL(DAEMON, test "${enable_daemon}" != "no") 187 188 AC_ARG_ENABLE([client], AS_HELP_STRING([--disable-client], 189 [don't install iwctl client utility]), 190 [enable_client=${enableval}]) 191 if (test "${disable_dbus}" != "no" && test "${enable_client}" != "no"); then 192 if (test "${enable_libedit}" = "yes"); then 193 PKG_CHECK_MODULES(LIBEDIT, libedit >= 3.1, dummy=yes, 194 AC_MSG_ERROR(Editline library is required)) 195 AC_SUBST(LIBEDIT_CFLAGS) 196 AC_SUBST(LIBEDIT_LIBS) 197 else 198 PKG_CHECK_MODULES(READLINE, readline, dummy=yes, 199 AC_MSG_ERROR(Readline library is required)) 200 AC_SUBST(READLINE_CFLAGS) 201 AC_SUBST(READLINE_LIBS) 202 fi 203 fi 204 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no" && test "${disable_dbus}" != "no") 205 206 AC_ARG_ENABLE([monitor], AS_HELP_STRING([--disable-monitor], 207 [don't install iwmon monitor utility]), 208 [enable_monitor=${enableval}]) 209 AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no") 210 211 AC_ARG_ENABLE([dbus-policy], AS_HELP_STRING([--disable-dbus-policy], 212 [don't install D-Bus system policy files]), 213 [enable_dbus_policy=${enableval}]) 214 AM_CONDITIONAL(DBUS_POLICY, test "${enable_dbus_policy}" != "no" && test "${disable_dbus}" != "no") 215 216 AC_ARG_WITH([dbus-datadir], AS_HELP_STRING([--with-dbus-datadir=DIR], 217 [path to D-Bus data directory]), 218 [path_dbus_datadir=${withval}]) 219 if (test "${disable_dbus}" != "no" && test "${enable_dbus_policy}" != "no" && test -z "${path_dbus_datadir}"); then 220 AC_MSG_CHECKING([D-Bus data directory]) 221 path_dbus_datadir="`$PKG_CONFIG --variable=datadir dbus-1`" 222 if (test -z "${path_dbus_datadir}"); then 223 path_dbus_datadir="`$PKG_CONFIG --variable=sysconfdir dbus-1`" 224 if (test -z "${path_dbus_datadir}"); then 225 AC_MSG_ERROR([D-Bus data directory is required]) 226 fi 227 fi 228 AC_MSG_RESULT([${path_dbus_datadir}]) 229 fi 230 AC_SUBST(DBUS_DATADIR, [${path_dbus_datadir}]) 231 232 AC_ARG_ENABLE([systemd-service], AS_HELP_STRING([--disable-systemd-service], 233 [don't install systemd service files]), 234 [enable_systemd_service=${enableval}]) 235 AM_CONDITIONAL(SYSTEMD_SERVICE, test "${enable_systemd_service}" != "no" && test "${disable_dbus}" != "no") 236 237 AC_ARG_ENABLE([manual-pages], AS_HELP_STRING([--disable-manual-pages], 238 [don't install manual pages]), 239 [enable_manual_pages=${enableval}]) 240 if (test "${enable_manual_pages}" != "no"); then 241 AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], "no") 242 fi 243 AM_CONDITIONAL(MANUAL_PAGES, test "${enable_manual_pages}" != "no") 244 AM_CONDITIONAL(RUN_RST2MAN, test "${enable_manual_pages}" != "no" && test "${RST2MAN}" != "no") 245 246 AC_ARG_WITH([dbus-busdir], AS_HELP_STRING([--with-dbus-busdir=DIR], 247 [path to D-Bus bus services directory]), 248 [path_dbus_busdir=${withval}]) 249 if (test "${disable_dbus}" != "no" && test "${enable_dbus_policy}" != "no" && test -z "${path_dbus_busdir}"); then 250 AC_MSG_CHECKING([D-Bus bus services directory]) 251 path_dbus_busdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`" 252 if (test -z "${path_dbus_busdir}"); then 253 AC_MSG_ERROR([D-Bus bus services directory is required]) 254 fi 255 AC_MSG_RESULT([${path_dbus_busdir}]) 256 fi 257 AC_SUBST(DBUS_BUSDIR, [${path_dbus_busdir}]) 258 259 AC_ARG_WITH([systemd-unitdir], AS_HELP_STRING([--with-systemd-unitdir=DIR], 260 [path to systemd unit directory]), 261 [path_systemd_unitdir=${withval}]) 262 if (test "${disable_dbus}" != "no" && test "${enable_systemd_service}" != "no" && test -z "${path_systemd_unitdir}"); then 263 AC_MSG_CHECKING([systemd unit directory]) 264 path_systemd_unitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`" 265 if (test -z "${path_systemd_unitdir}"); then 266 AC_MSG_ERROR([systemd unit directory is required]) 267 fi 268 AC_MSG_RESULT([${path_systemd_unitdir}]) 269 fi 270 AC_SUBST(SYSTEMD_UNITDIR, [${path_systemd_unitdir}]) 271 272 AC_ARG_WITH([systemd-networkdir], AS_HELP_STRING([--with-systemd-networkdir=DIR], 273 [path to systemd network directory]), 274 [path_systemd_networkdir=${withval}]) 275 if (test "${disable_dbus}" != "no" && test "${enable_systemd_service}" != "no" && test -z "${path_systemd_networkdir}"); then 276 AC_MSG_CHECKING([systemd network directory]) 277 path_systemd_networkdir="`$PKG_CONFIG --variable=systemdutildir systemd`" 278 if (test -z "${path_systemd_networkdir}"); then 279 AC_MSG_ERROR([systemd network directory is required]) 280 fi 281 path_systemd_networkdir="${path_systemd_networkdir}/network" 282 AC_MSG_RESULT([${path_systemd_networkdir}]) 283 fi 284 AC_SUBST(SYSTEMD_NETWORKDIR, [${path_systemd_networkdir}]) 285 286 AC_ARG_WITH([systemd-modloaddir], AS_HELP_STRING([--with-systemd-modloaddir=DIR], 287 [path to systemd modules load directory]), 288 [path_systemd_modloaddir=${withval}]) 289 if (test "${disable_dbus}" != "no" && test "${enable_systemd_service}" != "no" && test -z "${path_systemd_modloaddir}"); then 290 AC_MSG_CHECKING([systemd modules load directory]) 291 path_systemd_modloaddir="`$PKG_CONFIG --variable=modulesloaddir systemd`" 292 if (test -z "${path_systemd_modloaddir}"); then 293 AC_MSG_ERROR([systemd modules load directory is required]) 294 fi 295 AC_MSG_RESULT([${path_systemd_modloaddir}]) 296 fi 297 AC_SUBST(SYSTEMD_MODLOADDIR, [${path_systemd_modloaddir}]) 298 299 AC_ARG_ENABLE([external_ell], AS_HELP_STRING([--enable-external-ell], 300 [enable external Embedded Linux library]), 301 [enable_external_ell=${enableval}]) 302 if (test "${enable_external_ell}" = "yes"); then 303 if (test "${enable_daemon}" != "no" || 304 test "${enable_client}" != "no" || 305 test "${enable_monitor}" != "no" || 306 test "${enable_wired}" = "yes" || 307 test "${enable_hwsim}" = "yes"); then 308 ell_min_version="0.77" 309 else 310 ell_min_version="0.5" 311 fi 312 PKG_CHECK_MODULES(ELL, ell >= ${ell_min_version}, dummy=yes, 313 AC_MSG_ERROR(Embedded Linux library >= ${ell_min_version} is required)) 314 AC_SUBST(ELL_CFLAGS) 315 AC_SUBST(ELL_LIBS) 316 fi 317 AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes") 318 319 AC_ARG_ENABLE([libedit], AS_HELP_STRING([--enable-libedit], 320 [enable Editline library instead of Readline]), 321 [enable_libedit=${enableval}]) 322 AM_CONDITIONAL(LIBEDIT, test "${enable_libedit}" = "yes") 323 324 AC_ARG_ENABLE([wired], AS_HELP_STRING([--enable-wired], 325 [enable Ethernet authentication support]), 326 [enable_wired=${enableval}]) 327 AM_CONDITIONAL(WIRED, test "${enable_wired}" = "yes" && test "${disable_dbus}" != "no") 328 329 AC_ARG_ENABLE([hwsim], AS_HELP_STRING([--enable-hwsim], 330 [enable Wireless simulation utility]), 331 [enable_hwsim=${enableval}]) 332 AM_CONDITIONAL(HWSIM, test "${enable_hwsim}" = "yes" && test "${disable_dbus}" != "no") 333 334 AC_ARG_ENABLE([tools], AS_HELP_STRING([--enable-tools], 335 [enable internal testing utilities]), 336 [enable_tools=${enableval}]) 337 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes" && test "${disable_dbus}" != "no") 338 339 AC_ARG_ENABLE([ofono], AS_HELP_STRING([--enable-ofono], 340 [enable oFono SIM authentication support]), 341 [enable_ofono=${enableval}]) 342 AM_CONDITIONAL(OFONO, test "${enable_ofono}" = "yes" && test "${disable_dbus}" != "no") 343 344 AC_CONFIG_FILES(Makefile) 345 346 AC_OUTPUT 347 348 AC_MSG_RESULT([ 349 $PACKAGE_NAME $VERSION 350 ])