$OpenBSD: patch-configure,v 1.54 2017/08/31 08:32:36 ajacoutot Exp $

Index: configure
--- configure.orig
+++ configure
@@ -1686,7 +1686,7 @@ static __thread int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-if ! compile_prog "-Werror" "" ; then
+if ! compile_prog "-Werror" "-pthread" ; then
     error_exit "Your compiler does not support the __thread specifier for " \
 	"Thread-Local Storage (TLS). Please upgrade to a version that does."
 fi
@@ -3122,6 +3122,7 @@ if test "$curses" != "no" ; then
   fi
   curses_found=no
   cat > $TMPC << EOF
+#define _XOPEN_SOURCE_EXTENDED
 #include <locale.h>
 #include <curses.h>
 #include <wchar.h>
@@ -5002,10 +5003,6 @@ fi
 if test "$gcov" = "yes" ; then
   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
-elif test "$fortify_source" = "yes" ; then
-  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
-  CFLAGS="-O2 $CFLAGS"
 fi
 
 ##########################################
@@ -5161,7 +5158,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a 
     # Different host OS linkers have different ideas about the name of the ELF
     # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
     # variant; and Windows uses i386pe.
-    for emu in elf_i386 elf_i386_fbsd i386pe; do
+    for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
         if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
             ld_i386_emulation="$emu"
             roms="optionrom"
