File: cross-configure.patch

package info (click to toggle)
firebird3.0 3.0.11.33637.ds4-2%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 40,836 kB
  • sloc: ansic: 374,403; cpp: 319,271; sql: 14,367; pascal: 14,244; yacc: 7,556; fortran: 5,645; sh: 5,206; makefile: 1,043; perl: 135; sed: 83; awk: 76; xml: 19; csh: 15
file content (111 lines) | stat: -rw-r--r-- 4,006 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From: Helmut Grohne <helmut@subdivi.de>
Subject: improve cross buildability

 * Rather than checking $build (the architecture we are building on), we should
   be checking $host. Unfortunately, $host tends to lack the vendor part, so we
   need a tricky sed expression for inserting it. For native builds, $host and
   $build are equal.
 * The check for whether sem_init works only aborts the build in case of
   failure. Since the check cannot be performed during cross building, the only
   sane way is to just assume sem_init to work.
 * Replace a pile of AC_RUN_IFELSE with AC_CHECK_SIZEOF and AC_CHECK_ALIGNOF.
   The latter macros have a slower fallback path for cross compilation that use
   compiler bisection to determine the values.

--- a/configure.ac
+++ b/configure.ac
@@ -85,7 +85,11 @@ STD_EDITLINE=false
 dnl Test for special ar options?
 AR_OPT_CHECK=false
 
-case "$build" in
+if test -z "$host" ; then host="$build"; fi
+
+host_quadruplet=$(echo "$host" | sed 's/^\(@<:@^-@:>@*\)-\(@<:@^-@:>@*\)-\(@<:@^-@:>@*\)$/\1-pc-\2-\3/')
+echo "considering >$build< >$host< >$host_quadruplet<"
+case "$host_quadruplet" in
   x*64-*-darwin*)
     MAKEFILE_PREFIX=darwin_x86_64
     MAKEFILE_POSTFIX=darwin
@@ -149,7 +153,7 @@ dnl CPU_TYPE=ppc64
 
   amd64-*-freebsd* | x86_64*-*-freebsd* | x86_64*-*-k*bsd*-gnu)
     MAKEFILE_PREFIX=freebsd_amd64
-    case "$build" in
+    case "$host_quadruplet" in
         x86_64*-*-k*bsd-gnu)      # Debian/kFreeBSD
             PLATFORM=GENTOOFREEBSD
             INSTALL_PREFIX=linux
@@ -498,7 +502,7 @@ dnl CPU_TYPE=ppc64
     ;;
 
   *)
-    AC_MSG_ERROR(unsupported platform ${build})
+    AC_MSG_ERROR(unsupported platform ${host_quadruplet})
     ;;
 esac
 
@@ -968,7 +972,8 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include
 		}
 	]])],[AC_DEFINE(WORKING_SEM_INIT,1,[Define this if sem_init() works on the platform])
 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
-AC_SEARCH_LIBS(sem_open, rt pthread)],[])
+AC_SEARCH_LIBS(sem_open, rt pthread)],[AC_DEFINE(WORKING_SEM_INIT,1)
+AC_MSG_RESULT([assuming yes (cross compiling)])])
 fi
 fi
 
@@ -993,12 +998,10 @@ AC_TYPE_SIZE_T
 AC_TYPE_UID_T
 AC_SYS_LARGEFILE
 if test "$ac_cv_sys_file_offset_bits" = "no"; then
-  AC_MSG_CHECKING(for native large file support)
-  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <unistd.h>
-    main () {
-    return !(sizeof(off_t) == 8);
-  }]])],[ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
-   AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)],[])
+  AC_CHECK_SIZEOF([off_t],[],[#include <unistd.h>])
+  if test "$ac_cv_sizeof_off_t" = 8; then
+    ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
+  fi
 fi
 
 AC_CHECK_SIZEOF(void *)
@@ -1031,27 +1034,17 @@ AC_CHECK_MEMBER([struct dirent.d_type],
 
 dnl EKU: try to determine the alignment of long and double
 dnl      replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h
-AC_MSG_CHECKING(alignment of long)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <semaphore.h>
-main () {
-  struct s {
-    char a;
-    union { long long x; sem_t y; } b;
-  };
-  return (int)&((struct s*)0)->b;
-}]])],[ac_cv_c_alignment=$ac_status],[ac_cv_c_alignment=$ac_status],[])
-AC_MSG_RESULT($ac_cv_c_alignment)
+AC_CHECK_ALIGNOF([long long])
+AC_CHECK_ALIGNOF([sem_t],[#include <semaphore.h>])
+if test "$ac_cv_alignof_long_long" -gt "$ac_cv_alignof_sem_t"; then
+	ac_cv_c_alignment=$ac_cv_alignof_long_long
+else
+	ac_cv_c_alignment=$ac_cv_alignof_sem_t
+fi
 AC_DEFINE_UNQUOTED(FB_ALIGNMENT, $ac_cv_c_alignment, [Alignment of long])
 
-AC_MSG_CHECKING(alignment of double)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[main () {
-  struct s {
-    char a;
-    double b;
-  };
-  return (int)&((struct s*)0)->b;
-}]])],[ac_cv_c_double_align=$ac_status],[ac_cv_c_double_align=$ac_status],[])
-AC_MSG_RESULT($ac_cv_c_double_align)
+AC_CHECK_ALIGNOF([double])
+ac_cv_c_double_align=$ac_cv_alignof_double
 AC_DEFINE_UNQUOTED(FB_DOUBLE_ALIGN, $ac_cv_c_double_align, [Alignment of double])
 
 dnl EKU: Add any platform specific tests below