$OpenBSD: patch-configure,v 1.25 2018/09/16 06:37:15 ajacoutot Exp $

Index: configure
--- configure.orig
+++ configure
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
 cat <<EOF
@@ -734,11 +734,11 @@ case $host_cpu in
         ARCH="X86_64"
         AS="${AS-nasm}"
         AS_EXT=".asm"
-        ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
+        ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -DPIC -I\$(SRCPATH)/common/x86/"
         stack_alignment=16
         [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
         if [ "$SYS" = MACOSX ]; then
-            ASFLAGS="$ASFLAGS -f macho64 -DPIC -DPREFIX"
+            ASFLAGS="$ASFLAGS -f macho64 -DPREFIX"
             if cc_check '' "-arch x86_64"; then
                 CFLAGS="$CFLAGS -arch x86_64"
                 LDFLAGS="$LDFLAGS -arch x86_64"
@@ -1253,16 +1253,12 @@ cc_check "stdint.h" "" "uint32_t test_vec __attribute_
 
 if [ "$pic" = "yes" ] ; then
     [ "$SYS" != WINDOWS -a "$SYS" != CYGWIN ] && CFLAGS="$CFLAGS -fPIC"
-    ASFLAGS="$ASFLAGS -DPIC"
+    [[ "$ASFLAGS" != *"-DPIC"* ]] && ASFLAGS="$ASFLAGS -DPIC"
     # resolve textrels in the x86 asm
     cc_check stdio.h "-shared -Wl,-Bsymbolic" && SOFLAGS="$SOFLAGS -Wl,-Bsymbolic"
     [ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text"
 fi
 
-if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
-    CFLAGS="$CFLAGS -fomit-frame-pointer"
-fi
-
 if [ "$strip" = "yes" ]; then
     LDFLAGS="$LDFLAGS -s"
 fi
@@ -1271,11 +1267,11 @@ if [ "$debug" = "yes" ]; then
     CFLAGS="-O1 -g $CFLAGS"
     RCFLAGS="$RCFLAGS -DDEBUG"
 else
-    CFLAGS="-O3 -ffast-math $CFLAGS"
+    CFLAGS="-ffast-math $CFLAGS"
     if [ "$lto" = "auto" ] && [ $compiler = GNU ] && cc_check "" "-flto" ; then
         lto="yes"
         CFLAGS="$CFLAGS -flto"
-        LDFLAGS="$LDFLAGS -O3 -flto"
+        LDFLAGS="$LDFLAGS -flto"
     fi
 fi
 [ "$lto" = "auto" ] && lto="no"
@@ -1304,10 +1300,6 @@ if cc_check '' -Wshadow ; then
     CFLAGS="-Wshadow $CFLAGS"
 fi
 
-if cc_check '' -Wmaybe-uninitialized ; then
-    CFLAGS="-Wno-maybe-uninitialized $CFLAGS"
-fi
-
 if [ $compiler = ICC -o $compiler = ICL ] ; then
     if cc_check 'extras/intel_dispatcher.h' '' 'x264_intel_dispatcher_override();' ; then
         define HAVE_INTEL_DISPATCHER
@@ -1485,7 +1477,6 @@ if [ "$cli" = "yes" ]; then
 fi
 
 if [ "$shared" = "yes" ]; then
-    API=$(grep '#define X264_BUILD' < ${SRCPATH}/x264.h | cut -f 3 -d ' ')
     if [ "$SYS" = "WINDOWS" -o "$SYS" = "CYGWIN" ]; then
         echo "SONAME=libx264-$API.dll" >> config.mak
         if [ $compiler_style = MS ]; then
@@ -1513,7 +1504,7 @@ if [ "$shared" = "yes" ]; then
     else
         echo "SOSUFFIX=so" >> config.mak
         echo "SONAME=libx264.so.$API" >> config.mak
-        echo "SOFLAGS=-shared -Wl,-soname,\$(SONAME) $SOFLAGS" >> config.mak
+        echo "SOFLAGS=-shared $SOFLAGS" >> config.mak
     fi
     echo 'default: lib-shared' >> config.mak
     echo 'install: install-lib-shared' >> config.mak
