Skip to content

m4: drop redundant conditions in TLS library detections#21781

Closed
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:m4-redundant-checks
Closed

m4: drop redundant conditions in TLS library detections#21781
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:m4-redundant-checks

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented May 27, 2026

Omit checking OPT_<BACKEND> against no twice.

Also:


https://github.com/curl/curl/pull/21781/files?w=1

Comment thread m4/curl-rustls.m4
fi
])

RUSTLS_ENABLED
Copy link
Copy Markdown
Contributor

@cpu cpu May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not enough of an autotools knower to evaluate on its face that this trailing RUSTLS_ENABLED being removed is a no-op. Can you help me understand why it is?

It looks like it was added fairly recently in 9c42098 as part of a bug fix and it'd be a shame to regress accidentally.

Copy link
Copy Markdown
Member Author

@vszakats vszakats May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two signals that make me think this was a placebo/mistake:

  • configure generates identical whether this line is there or not.
  • no other, functionally equivalent m4 module have this.

+1 this line by itself just evaluates to a value, which value is not consumed
by anything. Maybe it was meant as a return value of the m4 file, but AFAIU
this is not how m4 files work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are convincing observations, thank you.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies curl’s Autoconf TLS backend detection macros by removing redundant OPT_<BACKEND> != no conditions, cleaning up a few backend-specific no-op/stray checks, and slightly restructuring conditionals for readability while keeping behavior equivalent.

Changes:

  • Remove duplicated OPT_<BACKEND> != no checks inside TLS backend detection blocks.
  • OpenSSL: drop the special-case OPT_OPENSSL=off check and consolidate error handling paths.
  • Minor cleanup: remove a Rustls no-op line, fix GnuTLS comment casing, and trim trailing whitespace in AmiSSL macro.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
m4/curl-wolfssl.m4 Removes redundant nesting and keeps wolfSSL detection/error flow intact.
m4/curl-schannel.m4 Drops redundant OPT_SCHANNEL check inside an already-guarded block.
m4/curl-rustls.m4 Simplifies the final failure check and removes a no-op trailing token.
m4/curl-openssl.m4 Removes OPT_OPENSSL=off special-case and merges conditional branches around failure handling.
m4/curl-mbedtls.m4 Removes redundant outer condition and tightens the structure of the detection flow.
m4/curl-gnutls.m4 Removes redundant nesting and normalizes comment casing while preserving detection logic.
m4/curl-amissl.m4 Removes a trailing whitespace-only line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats changed the title m4: drop redundant conditions in TLS detections m4: drop redundant conditions in TLS library detections May 27, 2026
@vszakats vszakats closed this in a5fcaa8 May 27, 2026
@vszakats vszakats deleted the m4-redundant-checks branch May 27, 2026 21:28
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
Omit checking `OPT_<BACKEND>` against `no` twice.

Also:
- openssl: drop stray `OPT_OPENSSL=off` check.
  Follow-up to 68d89f2 curl#6897
- rustls: drop no-op line.
  Follow-up to 9c42098 curl#13202
- gnutls: fix casing in comment.
- merge `if` branches where possible after these changes.

Closes curl#21781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants