build: add compile option to disable building of Wi-Fi plugin
authorThomas Haller <thaller@redhat.com>
Fri, 23 Jan 2015 13:12:02 +0000 (14:12 +0100)
committerThomas Haller <thaller@redhat.com>
Fri, 30 Jan 2015 21:20:13 +0000 (22:20 +0100)
Before, the Wi-Fi plugin was always build. Users who didn't want
to use it would simply drop "libnm-device-plugin-wifi.so".

Add a compile time option to disable needlessly building the plugin.

https://bugzilla.gnome.org/show_bug.cgi?id=743388

configure.ac
contrib/fedora/rpm/NetworkManager.spec
src/Makefile.am

index cd609d4..3e23728 100644 (file)
@@ -145,11 +145,26 @@ if ! test x"$ac_distver" = x""; then
   AC_DEFINE_UNQUOTED(NM_DIST_VERSION, "$ac_distver", [Define the distribution version string])
 fi
 
+AC_ARG_ENABLE(wifi, AS_HELP_STRING([--enable-wifi], [enable Wi-Fi support]))
+if test "${enable_wifi}" != "no"; then
+       enable_wifi='yes'
+       AC_DEFINE(WITH_WIFI, 1, [Define if you have Wi-Fi support])
+else
+       AC_DEFINE(WITH_WIFI, 0, [Define if you have Wi-Fi support])
+fi
+AM_CONDITIONAL(WITH_WIFI, test "${enable_wifi}" = "yes")
+
 dnl
 dnl Default to using WEXT but allow it to be disabled
 dnl
-AC_ARG_WITH(wext, AS_HELP_STRING([--with-wext=yes], [Enable or disable Linux Wireless Extensions]), ac_with_wext=$withval, ac_with_wext="yes")
+AC_ARG_WITH(wext, AS_HELP_STRING([--with-wext=yes], [Enable or disable Linux Wireless Extensions]), ac_with_wext=$withval, ac_with_wext="$enable_wifi")
+if test "$ac_with_wext" != 'no'; then
+       ac_with_wext='yes'
+fi
 if test x"$ac_with_wext" = x"yes"; then
+       if test "$enable_wifi" != "yes"; then
+               AC_MSG_ERROR(Enabling WEXT support and disabling Wi-Fi makes no sense)
+       fi
        AC_MSG_CHECKING([Linux kernel WEXT headers])
        AC_COMPILE_IFELSE(
                [AC_LANG_PROGRAM(
@@ -193,20 +208,24 @@ if test "$ac_have_nl80211" = no; then
        AC_MSG_ERROR(Linux kernel development header linux/nl80211.h not installed or not functional)
 fi
 
-AC_MSG_CHECKING([Linux kernel nl80211 Critical Protocol Start/Stop])
-AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-              [[#ifndef __user
-                #define __user
-                #endif
-                #include <sys/types.h>
-                #include <linux/types.h>
-                #include <sys/socket.h>
-                #include <linux/nl80211.h>]],
-              [[unsigned int a = NL80211_CMD_CRIT_PROTOCOL_START; a++;]])],
-        [ac_have_nl80211_critproto=yes],
-        [ac_have_nl80211_critproto=no])
-AC_MSG_RESULT($ac_have_nl80211_critproto)
+if test "$with_wifi" = "yes"; then
+       AC_MSG_CHECKING([Linux kernel nl80211 Critical Protocol Start/Stop])
+       AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                  [[#ifndef __user
+                    #define __user
+                    #endif
+                    #include <sys/types.h>
+                    #include <linux/types.h>
+                    #include <sys/socket.h>
+                    #include <linux/nl80211.h>]],
+                  [[unsigned int a = NL80211_CMD_CRIT_PROTOCOL_START; a++;]])],
+               [ac_have_nl80211_critproto=yes],
+               [ac_have_nl80211_critproto=no])
+       AC_MSG_RESULT($ac_have_nl80211_critproto)
+else
+       ac_have_nl80211_critproto='no'
+fi
 if test "$ac_have_nl80211_critproto" = yes; then
        AC_DEFINE(HAVE_NL80211_CRITICAL_PROTOCOL_CMDS, 1, [Define if nl80211 has critical protocol support])
 else
@@ -1066,6 +1085,7 @@ echo
 
 echo "Features:"
 echo "  wext: $ac_with_wext"
+echo "  wifi: $enable_wifi"
 echo "  wimax: $enable_wimax"
 echo "  ppp: $enable_ppp"
 echo "  modemmanager-1: $with_modem_manager_1"
index 0b3f702..f88ce95 100644 (file)
@@ -389,6 +389,11 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
 %else
        --with-modem-manager-1=no \
 %endif
+%if 0%{?with_wifi}
+       --enable-wifi=yes \
+%else
+       --enable-wifi=no \
+%endif
 %if 0%{?with_wimax}
        --enable-wimax=yes \
 %else
@@ -576,8 +581,6 @@ fi
 %files wifi
 %defattr(-,root,root,0755)
 %{_libdir}/%{name}/libnm-device-plugin-wifi.so
-%else
-%exclude %{_libdir}/%{name}/libnm-device-plugin-wifi.so
 %endif
 
 %if 0%{?with_wwan}
index b8e4c36..a5a40fb 100644 (file)
@@ -5,7 +5,6 @@ include $(GLIB_MAKEFILE)
 SUBDIRS =                              \
        .                               \
        devices/adsl                    \
-       devices/wifi                    \
        dhcp-manager                    \
        ppp-manager                     \
        settings/plugins
@@ -16,6 +15,10 @@ SUBDIRS +=                           \
        devices/bluetooth
 endif
 
+if WITH_WIFI
+SUBDIRS += devices/wifi
+endif
+
 if WITH_WIMAX
 SUBDIRS += devices/wimax
 endif