diff --git a/desmume/src/frontend/posix/configure.ac b/desmume/src/frontend/posix/configure.ac index 15f01fa50..b1e7b946f 100644 --- a/desmume/src/frontend/posix/configure.ac +++ b/desmume/src/frontend/posix/configure.ac @@ -40,6 +40,9 @@ AC_DEFINE_UNQUOTED([SVN_REV_STR], ["$REVISION"], [subversion revision number str dnl - Check for zlib AC_CHECK_LIB(z, gzopen, [], [AC_MSG_ERROR([zlib was not found, we can't go further. Please install it or specify the location where it's installed.])]) +dnl - Check for libpcap +AC_CHECK_LIB(pcap, main, [LIBS="$LIBS -lpcap"], [AC_MSG_ERROR([libpcap was not found, we can't go further. Please install it or specify the location where it's installed.])]) + dnl - Check for zziplib AC_CHECK_LIB(zzip, zzip_open, [ LIBS="-lzzip $LIBS" @@ -261,13 +264,12 @@ AM_CONDITIONAL([HAVE_JIT], [test "x$HAVE_JIT" = "xyes"]) dnl - wifi support AC_ARG_ENABLE(wifi, - [AC_HELP_STRING(--enable-wifi, enable experimental wifi comm support)], - [ - AC_CHECK_LIB(pcap, main,[ - AC_DEFINE(EXPERIMENTAL_WIFI_COMM) - LIBS="$LIBS -lpcap"], - [AC_MSG_WARN([pcap library not found, wifi will not work])]) - ]) + [AC_HELP_STRING(--enable-wifi, enable wifi support)], + [wifisupport=yes]) + +if test "x$wifisupport" = "xyes" ; then + AC_DEFINE(EXPERIMENTAL_WIFI_COMM) +fi dnl Set compiler library flags per host architecture case $host in diff --git a/desmume/src/wifi.cpp b/desmume/src/wifi.cpp index 86410897a..95ae87a6a 100755 --- a/desmume/src/wifi.cpp +++ b/desmume/src/wifi.cpp @@ -2733,37 +2733,40 @@ bool WifiHandler::CommStart() WifiCommInterface *selectedCommInterface = NULL; WifiMACMode selectedMACMode = WifiMACMode_Manual; - switch (this->_selectedCommID) + if (pendingEmulationLevel != WifiEmulationLevel_Off) { - case WifiCommInterfaceID_AdHoc: + switch (this->_selectedCommID) { - if (this->_isSocketsSupported) + case WifiCommInterfaceID_AdHoc: { - selectedCommInterface = this->_adhocCommInterface; - selectedMACMode = this->_adhocMACMode; + if (this->_isSocketsSupported) + { + selectedCommInterface = this->_adhocCommInterface; + selectedMACMode = this->_adhocMACMode; + } + else + { + WIFI_LOG(1, "Ad-hoc mode requires sockets, but sockets are not supported on this system.\n"); + pendingEmulationLevel = WifiEmulationLevel_Off; + } + break; } - else + + case WifiCommInterfaceID_Infrastructure: { - WIFI_LOG(1, "Ad-hoc mode requires sockets, but sockets are not supported on this system.\n"); - pendingEmulationLevel = WifiEmulationLevel_Off; + selectedCommInterface = this->_softAPCommInterface; + selectedMACMode = this->_infrastructureMACMode; + + if (!this->IsPCapSupported()) + { + WIFI_LOG(1, "Infrastructure mode requires libpcap for full functionality,\n but libpcap is not available on this system. Network functions\n will be disabled for this session.\n"); + } + break; } - break; + + default: + break; } - - case WifiCommInterfaceID_Infrastructure: - { - selectedCommInterface = this->_softAPCommInterface; - selectedMACMode = this->_infrastructureMACMode; - - if (!this->IsPCapSupported()) - { - WIFI_LOG(1, "Infrastructure mode requires libpcap for full functionality,\n but libpcap is not available on this system. Network functions\n will be disabled for this session.\n"); - } - break; - } - - default: - break; } // Stop the current comm interface.