[Openvpn-devel,1/5] Conditionally add subdir-objects option to automake

Message ID 20230208001819.244694-2-arne@rfc2549.org
State Not Applicable
Headers show
Series Build and run unittests with mingw in Github actions | expand

Commit Message

Arne Schwabe Feb. 8, 2023, 12:18 a.m. UTC
From: Selva Nair <selva.nair@gmail.com>

- Eliminates repeated warnings such as
  warning: source file '$(openvpn_srcdir)/env_set.c' is in a subdirectory,
  but option 'subdir-objects' is disabled
- Enabled only for automake >= 1.16 as older versions have a buggy implementation
  of this option

Main side effect of this option is that object files like openvpnserv-blockdns.o
are now created in src/openvpn where block-dns.c resides instead of in
src/openvpnserv. Same for object files for sources from $(openvpn_srcdir) compiled
into test executables.

See also past discussion on this topic:
  https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00013.html

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 configure.ac | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Selva Nair Feb. 8, 2023, 12:40 a.m. UTC | #1
On Tue, Feb 7, 2023 at 7:18 PM Arne Schwabe <arne@rfc2549.org> wrote:

> From: Selva Nair <selva.nair@gmail.com>
>
> - Eliminates repeated warnings such as
>   warning: source file '$(openvpn_srcdir)/env_set.c' is in a subdirectory,
>   but option 'subdir-objects' is disabled
> - Enabled only for automake >= 1.16 as older versions have a buggy
> implementation
>   of this option
>
> Main side effect of this option is that object files like
> openvpnserv-blockdns.o
> are now created in src/openvpn where block-dns.c resides instead of in
> src/openvpnserv. Same for object files for sources from $(openvpn_srcdir)
> compiled
> into test executables.
>
> See also past discussion on this topic:
>
> https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00013.html
>
> Signed-off-by: Selva Nair <selva.nair@gmail.com>
> Signed-off-by: Arne Schwabe <arne@rfc2549.org>
>

I'm a bit confused here -- it seems you have made some edits to my patch
(signed-off), but not clear what has changed.

As for my original 3/3, I will add your fix for engine-test and submit as
v3 -- thanks for working on this.

I've no idea why libtool adds that wrong line break in its wrapper script
on OSX.

Selva
Arne Schwabe Feb. 8, 2023, 8:55 a.m. UTC | #2
Am 08.02.2023 um 01:40 schrieb Selva Nair:
>
>
> On Tue, Feb 7, 2023 at 7:18 PM Arne Schwabe <arne@rfc2549.org> wrote:
>
>     From: Selva Nair <selva.nair@gmail.com>
>
>     - Eliminates repeated warnings such as
>       warning: source file '$(openvpn_srcdir)/env_set.c' is in a
>     subdirectory,
>       but option 'subdir-objects' is disabled
>     - Enabled only for automake >= 1.16 as older versions have a buggy
>     implementation
>       of this option
>
>     Main side effect of this option is that object files like
>     openvpnserv-blockdns.o
>     are now created in src/openvpn where block-dns.c resides instead of in
>     src/openvpnserv. Same for object files for sources from
>     $(openvpn_srcdir) compiled
>     into test executables.
>
>     See also past discussion on this topic:
>     https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00013.html
>
>     Signed-off-by: Selva Nair <selva.nair@gmail.com>
>     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
>
>
> I'm a bit confused here -- it seems you have made some edits to my 
> patch (signed-off), but not clear what has changed.


I didn't make changes as I said in the cover letter. The signoff 
automatically happens since with patch sending.

Arne

Patch

diff --git a/configure.ac b/configure.ac
index 915000870..95d795c33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,9 +54,22 @@  m4_define([serial_tests], [
                 awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
     ])
 ])
+
+dnl Automake 1.14+ warns if sources are in sub-directories but subdir-objects
+dnl options is not enabled. However, automake before 1.15a has a bug that causes
+dnl variable expansion to fail in foo_SOURCES when this option is used.
+dnl As most of our build systems are now likely to use automake 1.16+ add a
+dnl work around to conditionally add subdir-objects option.
+m4_define([subdir_objects], [
+    m4_esyscmd([automake --version |
+                head -1 |
+                awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 16) { print "subdir-objects" }}'
+    ])
+])
+
 # This foreign option prevents autoreconf from overriding our COPYING and
 # INSTALL targets:
-AM_INIT_AUTOMAKE(foreign serial_tests 1.9) dnl NB: Do not [quote] this parameter.
+AM_INIT_AUTOMAKE(foreign serial_tests subdir_objects 1.9) dnl NB: Do not [quote] this parameter.
 AC_CANONICAL_HOST
 AC_USE_SYSTEM_EXTENSIONS