Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-09 Thread Torsten Bögershausen
On 09.11.16 10:29, Lars Schneider wrote:
> 
>> On 09 Nov 2016, at 09:18, Torsten Bögershausen  wrote:
>>
>> On 07.11.16 18:26, Jeff King wrote:
>>> On Sun, Nov 06, 2016 at 08:35:04PM +0100, Lars Schneider wrote:
>>>
 Good point. I think I found an even easier way to achieve the same.
 What do you think about the patch below?

 [...]

 diff --git a/Makefile b/Makefile
 index 9d6c245..f53fcc9 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -1047,6 +1047,7 @@ ifeq ($(uname_S),Darwin)
endif
endif
ifndef NO_APPLE_COMMON_CRYPTO
 +  NO_OPENSSL = YesPlease
APPLE_COMMON_CRYPTO = YesPlease
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
endif
>>>
>>> That is much simpler.
>> []
>> I don't know if that is a correct solution.
>>
>> If I have Mac OS 10.12 and Mac Ports installed, I may want to use
>> OPENSSL from Mac Ports.
> 
> Can't you define `NO_APPLE_COMMON_CRYPTO` in that case? 
> I think if you use OpenSSL then you don't need the Apple crypto lib, right?

After re-reading the Makefile: that makes sense :-)

Do you want to send a new patch ?

Feel free to omit
"Original-patch-by: Torsten Bögershausen "






Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-09 Thread Lars Schneider

> On 09 Nov 2016, at 09:18, Torsten Bögershausen  wrote:
> 
> On 07.11.16 18:26, Jeff King wrote:
>> On Sun, Nov 06, 2016 at 08:35:04PM +0100, Lars Schneider wrote:
>> 
>>> Good point. I think I found an even easier way to achieve the same.
>>> What do you think about the patch below?
>>> 
>>> [...]
>>> 
>>> diff --git a/Makefile b/Makefile
>>> index 9d6c245..f53fcc9 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -1047,6 +1047,7 @@ ifeq ($(uname_S),Darwin)
>>> endif
>>> endif
>>> ifndef NO_APPLE_COMMON_CRYPTO
>>> +   NO_OPENSSL = YesPlease
>>> APPLE_COMMON_CRYPTO = YesPlease
>>> COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
>>> endif
>> 
>> That is much simpler.
> []
> I don't know if that is a correct solution.
> 
> If I have Mac OS 10.12 and Mac Ports installed, I may want to use
> OPENSSL from Mac Ports.

Can't you define `NO_APPLE_COMMON_CRYPTO` in that case? 
I think if you use OpenSSL then you don't need the Apple crypto lib, right?

- Lars


> How about this:
> 
> 
> diff --git a/Makefile b/Makefile
> index ee89c06..e93511f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1038,17 +1038,22 @@ ifeq ($(uname_S),Darwin)
>ifeq ($(shell test -d /sw/lib && echo y),y)
>BASIC_CFLAGS += -I/sw/include
>BASIC_LDFLAGS += -L/sw/lib
> +   HAS_OPENSSL = Yes
>endif
>endif
>ifndef NO_DARWIN_PORTS
>ifeq ($(shell test -d /opt/local/lib && echo y),y)
>BASIC_CFLAGS += -I/opt/local/include
>BASIC_LDFLAGS += -L/opt/local/lib
> +   HAS_OPENSSL = Yes
>endif
>endif
>ifndef NO_APPLE_COMMON_CRYPTO
>APPLE_COMMON_CRYPTO = YesPlease
>COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
> +   ifndef HAS_OPENSSL
> +   NO_OPENSSL = YesPlease
> +   endif
>endif
>NO_REGEX = YesPlease
>PTHREAD_LIBS =
> 



Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-09 Thread Torsten Bögershausen
On 07.11.16 18:26, Jeff King wrote:
> On Sun, Nov 06, 2016 at 08:35:04PM +0100, Lars Schneider wrote:
> 
>> Good point. I think I found an even easier way to achieve the same.
>> What do you think about the patch below?
>>
>> [...]
>>
>> diff --git a/Makefile b/Makefile
>> index 9d6c245..f53fcc9 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1047,6 +1047,7 @@ ifeq ($(uname_S),Darwin)
>>  endif
>>  endif
>>  ifndef NO_APPLE_COMMON_CRYPTO
>> +NO_OPENSSL = YesPlease
>>  APPLE_COMMON_CRYPTO = YesPlease
>>  COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
>>  endif
> 
> That is much simpler.
[]
I don't know if that is a correct solution.

If I have Mac OS 10.12 and Mac Ports installed, I may want to use
OPENSSL from Mac Ports.
How about this:


diff --git a/Makefile b/Makefile
index ee89c06..e93511f 100644
--- a/Makefile
+++ b/Makefile
@@ -1038,17 +1038,22 @@ ifeq ($(uname_S),Darwin)
ifeq ($(shell test -d /sw/lib && echo y),y)
BASIC_CFLAGS += -I/sw/include
BASIC_LDFLAGS += -L/sw/lib
+   HAS_OPENSSL = Yes
endif
endif
ifndef NO_DARWIN_PORTS
ifeq ($(shell test -d /opt/local/lib && echo y),y)
BASIC_CFLAGS += -I/opt/local/include
BASIC_LDFLAGS += -L/opt/local/lib
+   HAS_OPENSSL = Yes
endif
endif
ifndef NO_APPLE_COMMON_CRYPTO
APPLE_COMMON_CRYPTO = YesPlease
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
+   ifndef HAS_OPENSSL
+   NO_OPENSSL = YesPlease
+   endif
endif
NO_REGEX = YesPlease
PTHREAD_LIBS =



Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-07 Thread Paul Smith
On Mon, 2016-11-07 at 12:46 -0500, Jeff King wrote:
> Specifically I wanted to make sure that
> 
>   FOO = bar
>   FOO =
>   ifdef FOO
>   ... something ...
>   endif
> 
> works as if FOO had never been set in the first place. Which it seems
> to, at least in GNU make (and that is the only one we support, for
> other reasons).

Yes, it will work.  Confusingly, "ifdef" actually tests whether the
variable has a non-empty value, not whether it's defined:

> The 'ifdef' form takes the _name_ of a variable as its argument, not
> a reference to a variable.  The value of that variable has a non-
> empty value, the TEXT-IF-TRUE is effective; otherwise, the TEXT-IF-
> FALSE, if any, is effective

*sigh* History...


Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-07 Thread Jeff King
On Mon, Nov 07, 2016 at 12:36:34PM -0500, Paul Smith wrote:

> On Mon, 2016-11-07 at 12:26 -0500, Jeff King wrote:
> > I have in the back of my mind a fear that it is harder to unset a
> > make variable than it is to override it with a new value (which is
> > what you'd want to do here to turn openssl back on),
> 
> It depends on what you mean by "unset".
> 
> If you mean it as per the shell "unset" command, where the variable is
> completely forgotten as if it never was set at all, that's tricky.  You
> have to use the "undefine" special command which was introduced in GNU
> make 3.82 (released in 2010).
> 
> But if you just want to set the variable to the empty string, using
> "FOO=" works fine for that in all versions of make (GNU and otherwise)
> and using all the normal rules (command line override, etc.)

Specifically I wanted to make sure that

  FOO = bar
  FOO =
  ifdef FOO
  ... something ...
  endif

works as if FOO had never been set in the first place. Which it seems
to, at least in GNU make (and that is the only one we support, for other
reasons).

-Peff


Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-07 Thread Paul Smith
On Mon, 2016-11-07 at 12:26 -0500, Jeff King wrote:
> I have in the back of my mind a fear that it is harder to unset a
> make variable than it is to override it with a new value (which is
> what you'd want to do here to turn openssl back on),

It depends on what you mean by "unset".

If you mean it as per the shell "unset" command, where the variable is
completely forgotten as if it never was set at all, that's tricky.  You
have to use the "undefine" special command which was introduced in GNU
make 3.82 (released in 2010).

But if you just want to set the variable to the empty string, using
"FOO=" works fine for that in all versions of make (GNU and otherwise)
and using all the normal rules (command line override, etc.)

It's not easy to distinguish between a variable that is empty and one
that is actually not defined, in make, so it's a difference without a
distinction in almost all situations.


Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-07 Thread Jeff King
On Sun, Nov 06, 2016 at 08:35:04PM +0100, Lars Schneider wrote:

> Good point. I think I found an even easier way to achieve the same.
> What do you think about the patch below?
>
> [...]
>
> diff --git a/Makefile b/Makefile
> index 9d6c245..f53fcc9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1047,6 +1047,7 @@ ifeq ($(uname_S),Darwin)
>   endif
>   endif
>   ifndef NO_APPLE_COMMON_CRYPTO
> + NO_OPENSSL = YesPlease
>   APPLE_COMMON_CRYPTO = YesPlease
>   COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
>   endif

That is much simpler.

I have in the back of my mind a fear that it is harder to unset a make
variable than it is to override it with a new value (which is what you'd
want to do here to turn openssl back on), but I can't seem to come up
with a case that doesn't work. So I am probably misremembering, or just
thinking of something that used to be a problem long ago.

-Peff


Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-11-06 Thread Lars Schneider

> On 17 Oct 2016, at 11:50, Jeff King  wrote:
> 
> On Sun, Oct 16, 2016 at 05:25:49PM -0700, larsxschnei...@gmail.com wrote:
> 
>> From: Lars Schneider 
>> 
>> Apple removed the OpenSSL header files in macOS 10.11 and above. OpenSSL
>> was deprecated since macOS 10.7.
>> 
>> Set `NO_OPENSSL` and `APPLE_COMMON_CRYPTO` to `YesPlease` as default for
>> macOS. Make it possible to override this and use OpenSSL by defining
>> `DARWIN_OPENSSL`.
> 
> I like that you gave an override, but I don't think it works in all
> cases:
> 
>> diff --git a/config.mak.uname b/config.mak.uname
>> index b232908..f0c94a9 100644
>> --- a/config.mak.uname
>> +++ b/config.mak.uname
>> @@ -108,6 +108,12 @@ ifeq ($(uname_S),Darwin)
>>  ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 
>> && echo 1),1)
>>  HAVE_GETDELIM = YesPlease
>>  endif
>> +ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 15 
>> && echo 1),1)
>> +ifndef DARWIN_OPENSSL
>> +NO_OPENSSL = YesPlease
>> +APPLE_COMMON_CRYPTO=YesPlease
>> +endif
>> +endif
> 
> This is in config.mak.uname, which gets sourced before config.mak (and
> ifndef is evaluated at the time of parsing). So it would work to do:
> 
>  make DARWIN_OPENSSL=Yep
> 
> but not:
> 
>  echo DARWIN_OPENSSL=Yep >>config.mak
>  make
> 
> I think you'd have to set a flag in config.mak.uname, and then resolve
> it in the Makefile proper like:
> 
>  ifdef DARWIN_OPENSSL
>   # Overrides AUTO_AVOID_OPENSSL, do nothing.
>  else ifdef AUTO_AVOID_OPENSSL
>   NO_OPENSSL = YesPlease
>   APPLE_COMMON_CRYPTO = YesPlease
>  endif
> 
> but that's totally untested.

Good point. I think I found an even easier way to achieve the same.
What do you think about the patch below?

Thanks,
Lars

-- >8 --
Subject: Makefile: set NO_OPENSSL on macOS by default

Apple removed the OpenSSL header files in macOS 10.11 and above. OpenSSL
was deprecated since macOS 10.7.

Set `NO_OPENSSL` and `APPLE_COMMON_CRYPTO` to `YesPlease` as default for
macOS. It is possible to override this and use OpenSSL by defining
`NO_APPLE_COMMON_CRYPTO`.

Original-patch-by: Torsten Bögershausen 
Signed-off-by: Lars Schneider 
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 9d6c245..f53fcc9 100644
--- a/Makefile
+++ b/Makefile
@@ -1047,6 +1047,7 @@ ifeq ($(uname_S),Darwin)
endif
endif
ifndef NO_APPLE_COMMON_CRYPTO
+   NO_OPENSSL = YesPlease
APPLE_COMMON_CRYPTO = YesPlease
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
endif
-- 

Re: [PATCH v1 1/2] config.mak.in: set NO_OPENSSL and APPLE_COMMON_CRYPTO for macOS >10.11

2016-10-17 Thread Jeff King
On Sun, Oct 16, 2016 at 05:25:49PM -0700, larsxschnei...@gmail.com wrote:

> From: Lars Schneider 
> 
> Apple removed the OpenSSL header files in macOS 10.11 and above. OpenSSL
> was deprecated since macOS 10.7.
> 
> Set `NO_OPENSSL` and `APPLE_COMMON_CRYPTO` to `YesPlease` as default for
> macOS. Make it possible to override this and use OpenSSL by defining
> `DARWIN_OPENSSL`.

I like that you gave an override, but I don't think it works in all
cases:

> diff --git a/config.mak.uname b/config.mak.uname
> index b232908..f0c94a9 100644
> --- a/config.mak.uname
> +++ b/config.mak.uname
> @@ -108,6 +108,12 @@ ifeq ($(uname_S),Darwin)
>   ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 
> && echo 1),1)
>   HAVE_GETDELIM = YesPlease
>   endif
> + ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 15 
> && echo 1),1)
> + ifndef DARWIN_OPENSSL
> + NO_OPENSSL = YesPlease
> + APPLE_COMMON_CRYPTO=YesPlease
> + endif
> + endif

This is in config.mak.uname, which gets sourced before config.mak (and
ifndef is evaluated at the time of parsing). So it would work to do:

  make DARWIN_OPENSSL=Yep

but not:

  echo DARWIN_OPENSSL=Yep >>config.mak
  make

I think you'd have to set a flag in config.mak.uname, and then resolve
it in the Makefile proper like:

  ifdef DARWIN_OPENSSL
# Overrides AUTO_AVOID_OPENSSL, do nothing.
  else ifdef AUTO_AVOID_OPENSSL
NO_OPENSSL = YesPlease
APPLE_COMMON_CRYPTO = YesPlease
  endif

but that's totally untested.

-Peff