summaryrefslogtreecommitdiff
path: root/multimedia/x264-devel/patches/patch-configure
blob: ef2edaca6f2fb51e1d1edd2036df7875c91c2b29 (plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
$NetBSD: patch-configure,v 1.5 2021/07/14 13:19:42 schmonz Exp $

Add support for DragonFly.
Use 'amd64' as a synonym for 'x86_64'.
Avoid endian test failure for -flto.
Do not force compiler optimisations.
If we fail an assembly test, continue as if --disable-asm
was passed.
Apply upstream eb95c29 to fix macOS M1 build.

--- configure.orig	2021-07-14 13:16:59.000000000 +0000
+++ configure
@@ -630,6 +630,10 @@ case $host_os in
         SYS="FREEBSD"
         libm="-lm"
         ;;
+    dragonfly*)
+        SYS="DRAGONFLY"
+        LDFLAGS="$LDFLAGS -lm"
+        ;;
     kfreebsd*-gnu)
         SYS="FREEBSD"
         define HAVE_MALLOC_H
@@ -730,7 +734,7 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f elf32"
         fi
         ;;
-    x86_64)
+    x86_64|amd64)
         ARCH="X86_64"
         AS="${AS-nasm}"
         AS_EXT=".asm"
@@ -759,14 +763,15 @@ case $host_cpu in
         fi
         ;;
     powerpc*)
-        ARCH="PPC"
         if [ $asm = auto ] ; then
             define HAVE_ALTIVEC
             AS="${AS-${CC}}"
             AS_EXT=".c"
             if [ $SYS = MACOSX ] ; then
+                ARCH="POWERPC"
                 CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
             else
+                ARCH="PPC"
                 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
                 define HAVE_ALTIVEC_H
             fi
@@ -788,6 +793,18 @@ case $host_cpu in
         AS="${AS-${CC}}"
         AS_EXT=".c"
         ;;
+    aarch64|arm64*)
+        ARCH="AARCH64"
+        stack_alignment=16
+        if [ "$SYS" = MACOSX ] ; then
+            AS="${AS-${CC}}"
+            ASFLAGS="$ASFLAGS -DPREFIX -DPIC"
+        elif [ "$SYS" = WINDOWS ] && [ "$compiler" = CL ] ; then
+            AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch aarch64 -as-type armasm -- armasm64 -nologo}"
+        else
+            AS="${AS-${CC}}"
+        fi
+        ;;
     arm*)
         ARCH="ARM"
         if [ "$SYS" = MACOSX ] ; then
@@ -806,18 +823,6 @@ case $host_cpu in
             AS="${AS-${CC}}"
         fi
         ;;
-    aarch64)
-        ARCH="AARCH64"
-        stack_alignment=16
-        if [ "$SYS" = MACOSX ] ; then
-            AS="${AS-${CC}}"
-            ASFLAGS="$ASFLAGS -DPREFIX -DPIC"
-        elif [ "$SYS" = WINDOWS ] && [ "$compiler" = CL ] ; then
-            AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch aarch64 -as-type armasm -- armasm64 -nologo}"
-        else
-            AS="${AS-${CC}}"
-        fi
-        ;;
     s390|s390x)
         ARCH="S390"
         ;;
@@ -944,8 +949,8 @@ if [ $asm = auto -a $ARCH = ARM ] ; then
         ASFLAGS="$ASFLAGS -c"
     else
         echo "You specified a pre-ARMv6 or Thumb-1 CPU in your CFLAGS."
-        echo "If you really want to run on such a CPU, configure with --disable-asm."
-        exit 1
+	echo "Disabling asm"
+	asm="no"
     fi
 fi
 
@@ -957,8 +962,8 @@ if [ $asm = auto -a $ARCH = AARCH64 ] ; 
         ASFLAGS="$ASFLAGS -c"
     else
         echo "no NEON support, try adding -mfpu=neon to CFLAGS"
-        echo "If you really want to run on such a CPU, configure with --disable-asm."
-        exit 1
+	echo "Disabling asm"
+	asm="no"
     fi
 fi
 
@@ -976,8 +981,8 @@ if [ $asm = auto -a $ARCH = MIPS ] ; the
         define HAVE_MSA
     else
         echo "You specified a pre-MSA CPU in your CFLAGS."
-        echo "If you really want to run on such a CPU, configure with --disable-asm."
-        exit 1
+	echo "Disabling asm"
+	asm="no"
     fi
 fi
 
@@ -994,7 +999,7 @@ ASFLAGS="$ASFLAGS -DSTACK_ALIGNMENT=$sta
 CPU_ENDIAN="little-endian"
 if [ $compiler = GNU ]; then
     echo "int i[2] = {0x42494745,0}; double f[2] = {0x1.0656e6469616ep+102,0};" > conftest.c
-    $CC $CFLAGS conftest.c -c -o conftest.o 2>/dev/null || die "endian test failed"
+    $CC $CPPFLAGS conftest.c -c -o conftest.o 2>/dev/null || die "endian test failed"
     if (${cross_prefix}strings -a conftest.o | grep -q BIGE) && (${cross_prefix}strings -a conftest.o | grep -q FPendian) ; then
         define WORDS_BIGENDIAN
         CPU_ENDIAN="big-endian"
@@ -1016,7 +1021,7 @@ fi
 
 # autodetect options that weren't forced nor disabled
 
-libpthread=""
+libpthread="$PTHREAD_LDFLAGS $PTHREAD_LIBS"
 if [ "$SYS" = "WINDOWS" -a "$thread" = "posix" ] ; then
     if [ "$gpl" = "no" ] ; then
         echo "Warning: pthread-win32 is LGPL and is therefore not supported with --disable-gpl"
@@ -1255,7 +1260,7 @@ if [ "$pic" = "yes" ] ; then
     [ "$SYS" != WINDOWS -a "$SYS" != CYGWIN ] && CFLAGS="$CFLAGS -fPIC"
     [[ "$ASFLAGS" != *"-DPIC"* ]] && ASFLAGS="$ASFLAGS -DPIC"
     # resolve textrels in the x86 asm
-    cc_check stdio.h "-shared -Wl,-Bsymbolic" && SOFLAGS="$SOFLAGS -Wl,-Bsymbolic"
+    cc_check stdio.h "-Wl,-Bsymbolic" && LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
     [ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text"
 fi
 
@@ -1271,7 +1276,6 @@ if [ "$debug" = "yes" ]; then
     CFLAGS="-O1 -g $CFLAGS"
     RCFLAGS="$RCFLAGS -DDEBUG"
 else
-    CFLAGS="-O3 -ffast-math $CFLAGS"
     if [ "$lto" = "auto" ] && [ $compiler = GNU ] && cc_check "" "-flto" ; then
         lto="yes"
         CFLAGS="$CFLAGS -flto"