File: fix-cross-build.patch

package info (click to toggle)
csync2 2.0-42-g83b3644-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 868 kB
  • sloc: ansic: 6,878; sh: 849; yacc: 458; perl: 277; lex: 92; makefile: 92; cs: 73; sql: 42
file content (59 lines) | stat: -rw-r--r-- 2,879 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: Fix failing cross builds
 csync2 fails to cross build from source, because its configure.ac hard
 codes the build architecture pkg-config in a number of places.
Author: Helmut Grohne <helmut@subdivi.de>
Last-Update: 2022-11-19
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/configure.ac
+++ b/configure.ac
@@ -126,10 +126,10 @@
 		[enable/disable Postgres support (default is disabled)])],
 	[], [ enable_postgres=no ])
 
-if test "$enable_mysql" == yes
-then
+AS_IF([test "$enable_mysql" == yes],[
+	PKG_CHECK_MODULES([MYSQL],[mysqlclient])
 	# Check for mysql.
-	CFLAGS="$CFLAGS `pkg-config --cflags mysqlclient`"
+	CFLAGS="$CFLAGS $MYSQL_CFLAGS"
 
 	# Check MySQL development header
 	AC_CHECK_HEADERS([mysql.h], , [AC_MSG_ERROR([[mysql header not found; install mysql-devel and dependencies for MySQL Support]])])
@@ -137,24 +137,26 @@
 	AC_DEFINE([HAVE_MYSQL], 1, [Define if mysql support is wanted])
 
 	# [] quotes, or autofoo will strip the character class [] in sed, breaking the regex.
-	[LIBMYSQLCLIENT_SO=$( readlink $(pkg-config --variable=libdir mysqlclient)/libmysqlclient.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
+	[LIBMYSQLCLIENT_SO=$( readlink $($PKG_CONFIG --variable=libdir mysqlclient)/libmysqlclient.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
 	test -n "$LIBMYSQLCLIENT_SO" || AC_MSG_ERROR([Could not determine library name to be used in dlopen for mysql support])
-fi
+])
 AC_DEFINE_UNQUOTED([LIBMYSQLCLIENT_SO], ["$LIBMYSQLCLIENT_SO"], [library name to be used in dlopen for mysql support])
 
-if test "$enable_postgres" == yes
-then
-	CFLAGS="$CFLAGS `pkg-config --cflags libpq`"
+AS_IF([test "$enable_postgres" == yes],[
+	PKG_CHECK_MODULES([LIBPQ],[libpq])
+	CFLAGS="$CFLAGS $LIBPQ_CFLAGS"
         AC_CHECK_HEADERS([libpq-fe.h], , [AC_MSG_ERROR([[postgres header not found; install libpq-dev and dependencies for Postgres support]])])
 
 	AC_DEFINE([HAVE_POSTGRES], 1, [Define if postgres support is wanted])
 
-	# Hmpf. libdir not included in libpq.pc; use pg_config
-	# LIBPQ_SO=$( readlink $(pkg-config --variable=libdir libpq)/libpq.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')
+	LIBPQ_LIBDIR=`$PKG_CONFIG --variable=libdir libpq`
+	if test -z "$LIBPQ_LIBDIR"; then
+		LIBPQ_LIBDIR=`pg_config --libdir`
+	fi
 	# [] quotes, or autofoo will strip the character class [] in sed, breaking the regex.
-	[LIBPQ_SO=$( readlink $(pg_config --libdir)/libpq.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
+	[LIBPQ_SO=$( readlink $LIBPQ_LIBDIR/libpq.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
 	test -n "$LIBPQ_SO" || AC_MSG_ERROR([Could not determine library name to be used in dlopen for postgres support])
-fi
+])
 AC_DEFINE_UNQUOTED([LIBPQ_SO], ["$LIBPQ_SO"], [library name to be used in dlopen for postgres support])
 
 # at least one db backend must be configured.