[PATCH 3/6] makefiles: Allow using *_PE_LIBS to specify linker flags to external static libraries.

Zebediah Figura zfigura at codeweavers.com
Tue Oct 19 01:08:09 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
IMPORTS does not expect flags. That could be changed instead, however, as an
alternative to this patch.

 aclocal.m4                     | 5 ++++-
 configure.ac                   | 2 +-
 dlls/cabinet/Makefile.in       | 3 ++-
 dlls/dbghelp/Makefile.in       | 3 ++-
 dlls/opcservices/Makefile.in   | 3 ++-
 dlls/user32/Makefile.in        | 3 ++-
 dlls/windowscodecs/Makefile.in | 3 ++-
 dlls/wininet/Makefile.in       | 3 ++-
 tools/makedep.c                | 4 ++--
 9 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 2487df7a314..1682b2e0ec8 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -131,12 +131,15 @@ dnl
 AC_DEFUN([WINE_EXTLIB_FLAGS],
 [AS_VAR_PUSHDEF([ac_cflags],[[$1]_PE_CFLAGS])dnl
 AS_VAR_PUSHDEF([ac_libs],[[$1]_PE_LIBS])dnl
+AS_VAR_PUSHDEF([ac_imports],[[$1]_PE_IMPORTS])dnl
 AC_ARG_VAR(ac_cflags, [C compiler flags for the PE $2, overriding the bundled version])dnl
 AC_ARG_VAR(ac_libs, [Linker flags for the PE $2, overriding the bundled version])dnl
 AS_VAR_IF([ac_cflags],[],[ac_cflags=$4],[enable_$2=no])
-AS_VAR_IF([ac_libs],[],[ac_libs=$3],[enable_$2=no])
+AS_VAR_IF([ac_libs],[],[AC_SUBST(ac_imports,[$3])],[enable_$2=no])
 AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 cflags: $ac_cflags"]) >&AS_MESSAGE_LOG_FD
+AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 imports: $ac_imports"]) >&AS_MESSAGE_LOG_FD
 AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 libs: $ac_libs"]) >&AS_MESSAGE_LOG_FD
+AS_VAR_POPDEF([ac_imports])dnl
 AS_VAR_POPDEF([ac_libs])dnl
 AS_VAR_POPDEF([ac_cflags])])dnl
 
diff --git a/configure.ac b/configure.ac
index 2fb43fe2689..0dfe36c50b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2592,7 +2592,7 @@ AC_CONFIG_COMMANDS([include/stamp-h], [echo timestamp > include/stamp-h])
 AS_ECHO_N("creating Makefile rules...") >&AS_MESSAGE_FD
 
 AC_SUBST([ALL_VARS_RULES],
-"m4_set_foreach([_AC_SUBST_VARS],[var],[m4_if(m4_bregexp(m4_defn([var]),[\(_CFLAGS\|_LIBS\)$]),-1,,[var = $var
+"m4_set_foreach([_AC_SUBST_VARS],[var],[m4_if(m4_bregexp(m4_defn([var]),[\(_CFLAGS\|_LIBS\|_IMPORTS\)$]),-1,,[var = $var
 ])])")
 
 makedep_flags=""
diff --git a/dlls/cabinet/Makefile.in b/dlls/cabinet/Makefile.in
index 4ee406480ac..e4188b58f44 100644
--- a/dlls/cabinet/Makefile.in
+++ b/dlls/cabinet/Makefile.in
@@ -1,7 +1,8 @@
 MODULE    = cabinet.dll
 IMPORTLIB = cabinet
-IMPORTS   = $(ZLIB_PE_LIBS)
+IMPORTS   = $(ZLIB_PE_IMPORTS)
 EXTRAINCL = $(ZLIB_PE_CFLAGS)
+EXTRADLLFLAGS = $(ZLIB_PE_LIBS)
 
 C_SRCS = \
 	cabinet_main.c \
diff --git a/dlls/dbghelp/Makefile.in b/dlls/dbghelp/Makefile.in
index 22be2612eeb..bd656521f67 100644
--- a/dlls/dbghelp/Makefile.in
+++ b/dlls/dbghelp/Makefile.in
@@ -1,7 +1,8 @@
 MODULE    = dbghelp.dll
 IMPORTLIB = dbghelp
-IMPORTS   = $(ZLIB_PE_LIBS)
+IMPORTS   = $(ZLIB_PE_IMPORTS)
 EXTRAINCL = $(ZLIB_PE_CFLAGS)
+EXTRADLLFLAGS = $(ZLIB_PE_LIBS)
 EXTRADEFS = -D_IMAGEHLP_SOURCE_
 DELAYIMPORTS = version
 
diff --git a/dlls/opcservices/Makefile.in b/dlls/opcservices/Makefile.in
index 0867b1bd882..7eb5fe300d0 100644
--- a/dlls/opcservices/Makefile.in
+++ b/dlls/opcservices/Makefile.in
@@ -1,6 +1,7 @@
 MODULE    = opcservices.dll
-IMPORTS   = $(ZLIB_PE_LIBS) uuid ole32 advapi32 urlmon xmllite oleaut32
+IMPORTS   = $(ZLIB_PE_IMPORTS) uuid ole32 advapi32 urlmon xmllite oleaut32
 EXTRAINCL = $(ZLIB_PE_CFLAGS)
+EXTRADLLFLAGS = $(ZLIB_PE_LIBS)
 
 C_SRCS = \
 	compress.c \
diff --git a/dlls/user32/Makefile.in b/dlls/user32/Makefile.in
index 54feab3400f..aaded54e814 100644
--- a/dlls/user32/Makefile.in
+++ b/dlls/user32/Makefile.in
@@ -1,8 +1,9 @@
 EXTRADEFS = -D_USER32_ -D_WINABLE_
 MODULE    = user32.dll
 IMPORTLIB = user32
-IMPORTS   = $(PNG_PE_LIBS) setupapi gdi32 version sechost advapi32 kernelbase win32u
+IMPORTS   = $(PNG_PE_IMPORTS) setupapi gdi32 version sechost advapi32 kernelbase win32u
 EXTRAINCL = $(PNG_PE_CFLAGS)
+EXTRADLLFLAGS = $(PNG_PE_LIBS)
 DELAYIMPORTS = hid imm32
 
 C_SRCS = \
diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in
index 5a84ccbb9f2..d285efa0064 100644
--- a/dlls/windowscodecs/Makefile.in
+++ b/dlls/windowscodecs/Makefile.in
@@ -1,8 +1,9 @@
 MODULE    = windowscodecs.dll
 IMPORTLIB = windowscodecs
-IMPORTS   = $(PNG_PE_LIBS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32
+IMPORTS   = $(PNG_PE_IMPORTS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32
 EXTRAINCL = $(PNG_PE_CFLAGS) $(JPEG_CFLAGS) $(TIFF_CFLAGS)
 EXTRALIBS = $(APPLICATIONSERVICES_LIBS)
+EXTRADLLFLAGS = $(PNG_PE_LIBS)
 
 C_SRCS = \
 	bitmap.c \
diff --git a/dlls/wininet/Makefile.in b/dlls/wininet/Makefile.in
index 7e8111f811d..d1dd5ca2db0 100644
--- a/dlls/wininet/Makefile.in
+++ b/dlls/wininet/Makefile.in
@@ -1,7 +1,8 @@
 MODULE    = wininet.dll
 IMPORTLIB = wininet
-IMPORTS   = $(ZLIB_PE_LIBS) mpr shlwapi shell32 user32 ws2_32 advapi32
+IMPORTS   = $(ZLIB_PE_IMPORTS) mpr shlwapi shell32 user32 ws2_32 advapi32
 EXTRAINCL = $(ZLIB_PE_CFLAGS)
+EXTRADLLFLAGS = $(ZLIB_PE_LIBS)
 DELAYIMPORTS = secur32 crypt32 cryptui dhcpcsvc iphlpapi
 
 C_SRCS = \
diff --git a/tools/makedep.c b/tools/makedep.c
index 2a7cbcad051..fa848972ba6 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -3220,9 +3220,9 @@ static void output_module( struct makefile *make )
         output_filename( "-shared" );
         output_filename( spec_file );
     }
-    output_filenames( make->extradllflags );
     output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files );
     output_filenames_obj_dir( make, make->res_files );
+    output_filenames( make->extradllflags );
     if (debug_file) output_filename( strmake( "-Wl,--debug-file,%s", obj_dir_path( make, debug_file )));
     output_filenames( all_libs );
     output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" );
@@ -3448,9 +3448,9 @@ static void output_test_module( struct makefile *make )
     output_file = strmake( "%s%s", obj_dir_path( make, testmodule ), ext );
     output( "%s:\n", output_file );
     output_winegcc_command( make, make->is_cross );
-    output_filenames( make->extradllflags );
     output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files );
     output_filenames_obj_dir( make, make->res_files );
+    output_filenames( make->extradllflags );
     if ((debug_file = get_debug_file( make, testmodule )))
         output_filename( strmake( "-Wl,--debug-file,%s", obj_dir_path( make, debug_file )));
     output_filenames( all_libs );
-- 
2.33.0




More information about the wine-devel mailing list