title: Compile libcurl With Custom OpenSSL Directory
body: <p>I've built OpenSSL into a custom build directory:</p>
  
  <pre><code>/Users/builder/dev/artifact_staging/temp/openssl
  </code></pre>
  
  <p>Now when I configure libcurl I point it to use OpenSSL in that directory:</p>
  
  <pre><code>./configure
    --without-zlib \
    --enable-static \
    --enable-ipv6 \
    --with-ssl=/Users/builder/dev/artifact_staging/temp/openssl \
    --host="arm-apple-darwin" \
    --prefix=/Users/builder/dev/artifact_staging/temp/libcurl
  </code></pre>
  
  <p>The problem is that in the summary report I get at the end of configure it tells me that it will not use SSL:</p>
  
  <pre><code>curl version:     7.59.0
    Host setup:       x86_64-apple-darwin17.5.0
    Install prefix:   /usr/local
    Compiler:         gcc
    SSL support:      no      (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )
    SSH support:      no      (--with-libssh2)
    zlib support:     enabled
    brotli support:   no      (--with-brotli)
    GSS-API support:  no      (--with-gssapi)
    TLS-SRP support:  no      (--enable-tls-srp)
    resolver:         POSIX threaded
    IPv6 support:     enabled
    Unix sockets support: enabled
    IDN support:      enabled (libidn2)
    Build libcurl:    Shared=yes, Static=yes
    Built-in manual:  enabled
    --libcurl option: enabled (--disable-libcurl-option)
    Verbose errors:   enabled (--disable-verbose)
    SSPI support:     no      (--enable-sspi)
    ca cert bundle:   /etc/ssl/cert.pem
    ca cert path:     no
    ca fallback:      no
    LDAP support:     enabled (OpenLDAP)
    LDAPS support:    enabled
    RTSP support:     enabled
    RTMP support:     no      (--with-librtmp)
    metalink support: no      (--with-libmetalink)
    PSL support:      no      (libpsl not found)
    HTTP2 support:    disabled (--with-nghttp2)
    Protocols:        DICT FILE FTP GOPHER HTTP IMAP LDAP LDAPS POP3 RTSP SMTP TELNET TFTP
  </code></pre>
  
  <p>What am I missing here in my configure call?</p>
  
  <h1>UPDATE 1</h1>
  
  <p>Some errors found in my config.log file</p>
  
  <pre><code>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:277:17: note: previous declaration is here
  int             getnameinfo(const struct sockaddr * __restrict, socklen_t,
                  ^
  1 error generated.
  
  
  gcc -o conftest -Qunused-arguments -Os -mmacosx-version-min=10.8 -Werror=partial-availability  -I/usr/local/Cellar/libidn2/2.0.4/include  -L/usr/local/Cellar/libidn2/2.0.4/lib conftest.c -lidn2 -lldap &gt;&amp;5
  conftest.c:307:3: error: expected identifier or '('
  } # AC-LANG-PROGRAM
    ^
  1 error generated.
  
  
  fatal error: 'ac_nonexistent.h' file not found
  #include &lt;ac_nonexistent.h&gt;
           ^~~~~~~~~~~~~~~~~~
  1 error generated.
  
  
  error: use of undeclared identifier 'force'
        force compilation error
        ^
  1 error generated.
  
  
  error: 'bad_t' declared as an array with a negative size
        typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  </code></pre>
  
  <h1>UPDATE 2</h1>
  
  <p>After more reading I've made the following modifications. It still is not giving me what I want but I would like to know if I am on the right track.</p>
  
  <p>I've modified my configure parameters with what I think is the correct host:</p>
  
  <pre><code>./configure
    --without-zlib \
    --enable-static \
    --enable-ipv6 \
    --with-ssl=/Users/builder/dev/artifact_staging/temp/openssl \
    --host="arm64-apple-darwin" \
    --prefix=/Users/builder/dev/artifact_staging/temp/libcurl
  </code></pre>
  
  <p>I've also added a couple of flags:</p>
  
  <pre><code>export CPPFLAGS="-arch=arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -I/Users/builder/dev/artifact_staging/temp/openssl/include"
  
  export LDFLAGS="-arch=arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -L/Users/builder/dev/artifact_staging/temp/openssl/lib"
  </code></pre>
  
  <p>Now when I run configure I still do not end up with ssl support in the end and when I examine the config.log file I see</p>
  
  <pre><code>clang: warning: using sysroot for 'iPhoneOS' but targeting 'MacOSX' [-Wincompatible-sysroot]
  </code></pre>
  
  <p>I'm not sure what I'm missing here to make it think that I'm targeting MacOSX; every thing that I have done thus far specifies arm64.</p>
  
  <p>There are other actual errors but I think they are a result of it thinking that I'm trying to build for x86_64 rather than arm64.</p>
  
  <pre><code>ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  configure:4386: $? = 1
  configure:4424: result: no
  configure: failed program was:
  | /* confdefs.h */
  | #define PACKAGE_NAME "curl"
  | #define PACKAGE_TARNAME "curl"
  | #define PACKAGE_VERSION "-"
  | #define PACKAGE_STRING "curl -"
  | #define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.haxx.se/mail/"
  | #define PACKAGE_URL ""
  | /* end confdefs.h.  */
  | 
  | int main (void)
  | {
  | 
  |  ;
  |  return 0;
  | }
  configure:4429: error: in `/Users/builder/dev/artifact_staging/curl-7.59.0':
  configure:4431: error: C compiler cannot create executables
  </code></pre>
  
  <p>Am I missing a parameter in my flags?</p>