Remove all uses of the HAVE_CONFIG_H define.

BUG=
R=henrik.lundin@webrtc.org, pthatcher@google.com, stefan@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1820023004 .

Cr-Commit-Position: refs/heads/master@{#12141}
diff --git a/webrtc/base/basictypes.h b/webrtc/base/basictypes.h
index 4c3d5d1..6ca09d0 100644
--- a/webrtc/base/basictypes.h
+++ b/webrtc/base/basictypes.h
@@ -14,10 +14,6 @@
 #include <stddef.h>  // for NULL, size_t
 #include <stdint.h>  // for uintptr_t and (u)int_t types.
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"  // NOLINT
-#endif
-
 // Detect compiler is for x86 or x64.
 #if defined(__x86_64__) || defined(_M_X64) || \
     defined(__i386__) || defined(_M_IX86)
diff --git a/webrtc/base/logging.h b/webrtc/base/logging.h
index e40ca44..8c7b3f7 100644
--- a/webrtc/base/logging.h
+++ b/webrtc/base/logging.h
@@ -46,10 +46,6 @@
 #ifndef WEBRTC_BASE_LOGGING_H_
 #define WEBRTC_BASE_LOGGING_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"  // NOLINT
-#endif
-
 #include <list>
 #include <sstream>
 #include <string>
diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc
index 4780e2f..0018779 100644
--- a/webrtc/base/network.cc
+++ b/webrtc/base/network.cc
@@ -8,10 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "webrtc/base/network.h"
 
 #if defined(WEBRTC_POSIX)
diff --git a/webrtc/base/openssladapter.cc b/webrtc/base/openssladapter.cc
index 264dae9..40c352d 100644
--- a/webrtc/base/openssladapter.cc
+++ b/webrtc/base/openssladapter.cc
@@ -27,10 +27,6 @@
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif  // HAVE_CONFIG_H
-
 #include "webrtc/base/arraysize.h"
 #include "webrtc/base/common.h"
 #include "webrtc/base/logging.h"
diff --git a/webrtc/base/opensslstreamadapter.cc b/webrtc/base/opensslstreamadapter.cc
index 052e54d..8a3044d 100644
--- a/webrtc/base/opensslstreamadapter.cc
+++ b/webrtc/base/opensslstreamadapter.cc
@@ -8,10 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif  // HAVE_CONFIG_H
-
 #if HAVE_OPENSSL_SSL_H
 
 #include "webrtc/base/opensslstreamadapter.h"
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index 4cea040..708499d 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -50,11 +50,6 @@
 #include "webrtc/base/winping.h"
 #include "webrtc/base/win32socketinit.h"
 
-// stm: this will tell us if we are on OSX
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #if defined(WEBRTC_POSIX)
 #include <netinet/tcp.h>  // for TCP_NODELAY
 #define IP_MTU 14 // Until this is integrated from linux/in.h to netinet/in.h
diff --git a/webrtc/base/proxydetect.cc b/webrtc/base/proxydetect.cc
index 30959ca..abb8f0a 100644
--- a/webrtc/base/proxydetect.cc
+++ b/webrtc/base/proxydetect.cc
@@ -15,10 +15,6 @@
 #include <shlobj.h>
 #endif  // WEBRTC_WIN
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <CoreFoundation/CoreFoundation.h>
diff --git a/webrtc/base/proxydetect.h b/webrtc/base/proxydetect.h
index f9bf5f8..708c332 100644
--- a/webrtc/base/proxydetect.h
+++ b/webrtc/base/proxydetect.h
@@ -13,10 +13,6 @@
 
 #include "webrtc/base/proxyinfo.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 namespace rtc {
 // Auto-detect the proxy server.  Returns true if a proxy is configured,
 // although hostname may be empty if the proxy is not required for
diff --git a/webrtc/base/ssladapter.cc b/webrtc/base/ssladapter.cc
index 454a566..ba24e61 100644
--- a/webrtc/base/ssladapter.cc
+++ b/webrtc/base/ssladapter.cc
@@ -8,10 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif  // HAVE_CONFIG_H
-
 #include "webrtc/base/ssladapter.h"
 
 #include "webrtc/base/sslconfig.h"
diff --git a/webrtc/base/sslidentity.cc b/webrtc/base/sslidentity.cc
index 3673d74..14dfeb7 100644
--- a/webrtc/base/sslidentity.cc
+++ b/webrtc/base/sslidentity.cc
@@ -9,10 +9,6 @@
  */
 
 // Handling of certificates and keypairs for SSLStreamAdapter's peer mode.
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif  // HAVE_CONFIG_H
-
 #include "webrtc/base/sslidentity.h"
 
 #include <ctime>
diff --git a/webrtc/base/sslstreamadapter.cc b/webrtc/base/sslstreamadapter.cc
index bcecc03..e0fce3a 100644
--- a/webrtc/base/sslstreamadapter.cc
+++ b/webrtc/base/sslstreamadapter.cc
@@ -8,10 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif  // HAVE_CONFIG_H
-
 #include "webrtc/base/sslstreamadapter.h"
 #include "webrtc/base/sslconfig.h"
 
diff --git a/webrtc/base/sslstreamadapterhelper.cc b/webrtc/base/sslstreamadapterhelper.cc
new file mode 100644
index 0000000..ccb689e
--- /dev/null
+++ b/webrtc/base/sslstreamadapterhelper.cc
@@ -0,0 +1,140 @@
+/*
+ *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+
+#include <vector>
+
+#include "webrtc/base/sslstreamadapterhelper.h"
+
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stream.h"
+
+namespace rtc {
+
+SSLStreamAdapterHelper::SSLStreamAdapterHelper(StreamInterface* stream)
+    : SSLStreamAdapter(stream),
+      state_(SSL_NONE),
+      role_(SSL_CLIENT),
+      ssl_error_code_(0),  // Not meaningful yet
+      ssl_mode_(SSL_MODE_TLS),
+      ssl_max_version_(SSL_PROTOCOL_TLS_12) {}
+
+SSLStreamAdapterHelper::~SSLStreamAdapterHelper() = default;
+
+void SSLStreamAdapterHelper::SetIdentity(SSLIdentity* identity) {
+  ASSERT(identity_.get() == NULL);
+  identity_.reset(identity);
+}
+
+void SSLStreamAdapterHelper::SetServerRole(SSLRole role) {
+  role_ = role;
+}
+
+int SSLStreamAdapterHelper::StartSSLWithServer(const char* server_name) {
+  ASSERT(server_name != NULL && server_name[0] != '\0');
+  ssl_server_name_ = server_name;
+  return StartSSL();
+}
+
+int SSLStreamAdapterHelper::StartSSLWithPeer() {
+  ASSERT(ssl_server_name_.empty());
+  // It is permitted to specify peer_certificate_ only later.
+  return StartSSL();
+}
+
+void SSLStreamAdapterHelper::SetMode(SSLMode mode) {
+  ASSERT(state_ == SSL_NONE);
+  ssl_mode_ = mode;
+}
+
+void SSLStreamAdapterHelper::SetMaxProtocolVersion(SSLProtocolVersion version) {
+  ssl_max_version_ = version;
+}
+
+StreamState SSLStreamAdapterHelper::GetState() const {
+  switch (state_) {
+    case SSL_WAIT:
+    case SSL_CONNECTING:
+      return SS_OPENING;
+    case SSL_CONNECTED:
+      return SS_OPEN;
+    default:
+      return SS_CLOSED;
+  };
+  // not reached
+}
+
+bool SSLStreamAdapterHelper::GetPeerCertificate(SSLCertificate** cert) const {
+  if (!peer_certificate_)
+    return false;
+
+  *cert = peer_certificate_->GetReference();
+  return true;
+}
+
+bool SSLStreamAdapterHelper::SetPeerCertificateDigest(
+    const std::string &digest_alg,
+    const unsigned char* digest_val,
+    size_t digest_len) {
+  ASSERT(peer_certificate_.get() == NULL);
+  ASSERT(peer_certificate_digest_algorithm_.empty());
+  ASSERT(ssl_server_name_.empty());
+  size_t expected_len;
+
+  if (!GetDigestLength(digest_alg, &expected_len)) {
+    LOG(LS_WARNING) << "Unknown digest algorithm: " << digest_alg;
+    return false;
+  }
+  if (expected_len != digest_len)
+    return false;
+
+  peer_certificate_digest_value_.SetData(digest_val, digest_len);
+  peer_certificate_digest_algorithm_ = digest_alg;
+
+  return true;
+}
+
+void SSLStreamAdapterHelper::Error(const char* context, int err, bool signal) {
+  LOG(LS_WARNING) << "SSLStreamAdapterHelper::Error("
+                  << context << ", " << err << "," << signal << ")";
+  state_ = SSL_ERROR;
+  ssl_error_code_ = err;
+  Cleanup();
+  if (signal)
+    StreamAdapterInterface::OnEvent(stream(), SE_CLOSE, err);
+}
+
+void SSLStreamAdapterHelper::Close() {
+  Cleanup();
+  ASSERT(state_ == SSL_CLOSED || state_ == SSL_ERROR);
+  StreamAdapterInterface::Close();
+}
+
+int SSLStreamAdapterHelper::StartSSL() {
+  ASSERT(state_ == SSL_NONE);
+
+  if (StreamAdapterInterface::GetState() != SS_OPEN) {
+    state_ = SSL_WAIT;
+    return 0;
+  }
+
+  state_ = SSL_CONNECTING;
+  int err = BeginSSL();
+  if (err) {
+    Error("BeginSSL", err, false);
+    return err;
+  }
+
+  return 0;
+}
+
+}  // namespace rtc
+
diff --git a/webrtc/libjingle/xmpp/xmppsocket.cc b/webrtc/libjingle/xmpp/xmppsocket.cc
index 25e03ef..fd07828 100644
--- a/webrtc/libjingle/xmpp/xmppsocket.cc
+++ b/webrtc/libjingle/xmpp/xmppsocket.cc
@@ -10,10 +10,6 @@
 
 #include "xmppsocket.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <errno.h>
 #include "webrtc/base/logging.h"
 #include "webrtc/base/thread.h"
diff --git a/webrtc/media/base/mediaengine.cc b/webrtc/media/base/mediaengine.cc
index 4027137..fda7fac 100644
--- a/webrtc/media/base/mediaengine.cc
+++ b/webrtc/media/base/mediaengine.cc
@@ -16,10 +16,6 @@
 #include "webrtc/media/engine/webrtcmediaengine.h"
 #endif  // HAVE_WEBRTC_VOICE && HAVE_WEBRTC_VIDEO
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif  // HAVE_CONFIG
-
 namespace cricket {
 
 MediaEngineFactory::MediaEngineCreateFunction
@@ -45,4 +41,4 @@
   return parameters;
 }
 
-};  // namespace cricket
\ No newline at end of file
+};  // namespace cricket
diff --git a/webrtc/media/engine/webrtcvideocapturer.cc b/webrtc/media/engine/webrtcvideocapturer.cc
index e175688..a540551 100644
--- a/webrtc/media/engine/webrtcvideocapturer.cc
+++ b/webrtc/media/engine/webrtcvideocapturer.cc
@@ -10,10 +10,6 @@
 
 #include "webrtc/media/engine/webrtcvideocapturer.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "webrtc/base/arraysize.h"
 #include "webrtc/base/bind.h"
 #include "webrtc/base/checks.h"
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index fbaab67..2c7f221 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -8,10 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef HAVE_WEBRTC_VOICE
 
 #include "webrtc/media/engine/webrtcvoiceengine.h"
diff --git a/webrtc/modules/audio_coding/codecs/g722/g722_decode.c b/webrtc/modules/audio_coding/codecs/g722/g722_decode.c
index 952a7d0..4ebdb58 100644
--- a/webrtc/modules/audio_coding/codecs/g722/g722_decode.c
+++ b/webrtc/modules/audio_coding/codecs/g722/g722_decode.c
@@ -7,7 +7,7 @@
  *
  * Copyright (C) 2005 Steve Underwood
  *
- *  Despite my general liking of the GPL, I place my own contributions 
+ *  Despite my general liking of the GPL, I place my own contributions
  *  to this code in the public domain for the benefit of all mankind -
  *  even the slimy ones who might try to proprietize my work and use it
  *  to my detriment.
@@ -30,10 +30,6 @@
 /*! \file */
 
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <memory.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -125,7 +121,7 @@
         s->band[band].d[i] = s->band[band].d[i - 1];
         s->band[band].b[i] = s->band[band].bp[i];
     }
-    
+
     for (i = 2;  i > 0;  i--)
     {
         s->band[band].r[i] = s->band[band].r[i - 1];
@@ -201,9 +197,9 @@
     static const int wh[3] = {0, -214, 798};
     static const int rh2[4] = {2, 1, 2, 1};
     static const int qm2[4] = {-7408, -1616,  7408,   1616};
-    static const int qm4[16] = 
+    static const int qm4[16] =
     {
-              0, -20456, -12896,  -8968, 
+              0, -20456, -12896,  -8968,
           -6288,  -4240,  -2584,  -1200,
           20456,  12896,   8968,   6288,
            4240,   2584,   1200,      0
@@ -323,7 +319,7 @@
         else if (wd1 > 18432)
             wd1 = 18432;
         s->band[0].nb = wd1;
-            
+
         /* Block 3L, SCALEL */
         wd1 = (s->band[0].nb >> 6) & 31;
         wd2 = 8 - (s->band[0].nb >> 11);
@@ -331,7 +327,7 @@
         s->band[0].det = wd3 << 2;
 
         block4(s, 0, dlowt);
-        
+
         if (!s->eight_k)
         {
             /* Block 2H, INVQAH */
@@ -354,7 +350,7 @@
             else if (wd1 > 22528)
                 wd1 = 22528;
             s->band[1].nb = wd1;
-            
+
             /* Block 3H, SCALEH */
             wd1 = (s->band[1].nb >> 6) & 31;
             wd2 = 10 - (s->band[1].nb >> 11);
diff --git a/webrtc/modules/audio_coding/codecs/g722/g722_encode.c b/webrtc/modules/audio_coding/codecs/g722/g722_encode.c
index 01ec127..2bd784b 100644
--- a/webrtc/modules/audio_coding/codecs/g722/g722_encode.c
+++ b/webrtc/modules/audio_coding/codecs/g722/g722_encode.c
@@ -9,7 +9,7 @@
  *
  * All rights reserved.
  *
- *  Despite my general liking of the GPL, I place my own contributions 
+ *  Despite my general liking of the GPL, I place my own contributions
  *  to this code in the public domain for the benefit of all mankind -
  *  even the slimy ones who might try to proprietize my work and use it
  *  to my detriment.
@@ -30,10 +30,6 @@
 
 /*! \file */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <memory.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -122,7 +118,7 @@
         s->band[band].d[i] = s->band[band].d[i - 1];
         s->band[band].b[i] = s->band[band].bp[i];
     }
-    
+
     for (i = 2;  i > 0;  i--)
     {
         s->band[band].r[i] = s->band[band].r[i - 1];
@@ -311,7 +307,7 @@
                     s->x[i] = s->x[i + 2];
                 s->x[22] = amp[j++];
                 s->x[23] = amp[j++];
-    
+
                 /* Discard every other QMF output */
                 sumeven = 0;
                 sumodd = 0;
@@ -371,7 +367,7 @@
         s->band[0].det = wd3 << 2;
 
         block4(s, 0, dlow);
-        
+
         if (s->eight_k)
         {
             /* Just leave the high bits as zero */
diff --git a/webrtc/pc/channelmanager.cc b/webrtc/pc/channelmanager.cc
index 6e6623c..996a263 100644
--- a/webrtc/pc/channelmanager.cc
+++ b/webrtc/pc/channelmanager.cc
@@ -10,10 +10,6 @@
 
 #include "webrtc/pc/channelmanager.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <algorithm>
 
 #include "webrtc/api/mediacontroller.h"
diff --git a/webrtc/pc/srtpfilter.cc b/webrtc/pc/srtpfilter.cc
index 01db444..e8ea289 100644
--- a/webrtc/pc/srtpfilter.cc
+++ b/webrtc/pc/srtpfilter.cc
@@ -8,8 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#undef HAVE_CONFIG_H
-
 #include "webrtc/pc/srtpfilter.h"
 
 #include <string.h>