--- configure.orig 2015-05-12 16:46:37.000000000 +0200 +++ configure 2017-06-15 11:02:54.000000000 +0200 @@ -446,7 +446,7 @@ # Configure compiler to use in further tests -cc="$bytecc -O $bytecclinkopts" +cc="$bytecc $bytecclinkopts" export cc cclibs verbose # Check C compiler @@ -688,9 +688,9 @@ mksharedlib="$flexlink" mkmaindll="$flexlink -maindll" shared_libraries_supported=true;; - *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*|*-*-openbsd*|*-*-netbsd*|*-*-gnu*|*-*-haiku*) + *-*-linux-gnu|*-*-linux|*-*-dragonfly*|*-*-bsdsunix*|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*|*-*-openbsd*|*-*-netbsd*|*-*-gnu*|*-*-haiku*) sharedcccompopts="-fPIC" - mksharedlib="$bytecc -shared" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -shared" bytecclinkopts="$bytecclinkopts -Wl,-E" byteccrpath="-Wl,-rpath," mksharedlibrpath="-Wl,-rpath," @@ -700,7 +700,7 @@ case "$bytecc" in *gcc*) sharedcccompopts="-fPIC" - mksharedlib="$bytecc -shared" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -shared" byteccrpath="-Wl,-rpath," mksharedlibrpath="-Wl,-rpath," shared_libraries_supported=true;; @@ -716,11 +716,11 @@ *gcc*) sharedcccompopts="-fPIC" if sh ./solaris-ld; then - mksharedlib="$bytecc -shared" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -shared" byteccrpath="-R" mksharedlibrpath="-R" else - mksharedlib="$bytecc -shared" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -shared" bytecclinkopts="$bytecclinkopts -Wl,-E" natdynlinkopts="-Wl,-E" byteccrpath="-Wl,-rpath," @@ -744,12 +744,12 @@ mksharedlibrpath="-rpath " shared_libraries_supported=true;; i[3456]86-*-darwin[89].*) - mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress -read_only_relocs suppress" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -bundle -flat_namespace -undefined suppress -read_only_relocs suppress" bytecccompopts="$dl_defs $bytecccompopts" dl_needs_underscore=false shared_libraries_supported=true;; *-apple-darwin*) - mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress -Wl,-no_compact_unwind" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -bundle -flat_namespace -undefined suppress -Wl,-no_compact_unwind" bytecccompopts="$dl_defs $bytecccompopts" dl_needs_underscore=false shared_libraries_supported=true;; @@ -759,7 +759,7 @@ shared_libraries_supported=false;; *-*-openbsd*) sharedcccompopts="-fPIC" - mksharedlib="$bytecc -shared" + mksharedlib="$bytecc $bytecclinkopts $bytecclinkopts $bytecclinkopts $bytecclinkopts -shared" bytecclinkopts="$bytecclinkopts -Wl,-E" natdynlinkopts="-Wl,-E" byteccrpath="-Wl,-rpath," @@ -790,11 +790,16 @@ fi;; x86_64-*-darwin*) natdynlink=true;; powerpc*-*-linux*) natdynlink=true;; + powerpc*-*-freebsd*) natdynlink=true;; + powerpc*-*-bsdsunix*) natdynlink=true;; sparc*-*-linux*) natdynlink=true;; i686-*-kfreebsd*) natdynlink=true;; x86_64-*-kfreebsd*) natdynlink=true;; + x86_64-*-dragonfly*) natdynlink=true;; i[3456]86-*-freebsd*) natdynlink=true;; + i[3456]86-*-bsdsunix*) natdynlink=true;; x86_64-*-freebsd*) natdynlink=true;; + x86_64-*-bsdsunix*) natdynlink=true;; i[3456]86-*-openbsd*) natdynlink=true;; x86_64-*-openbsd*) natdynlink=true;; i[3456]86-*-netbsd*) natdynlink=true;; @@ -803,6 +808,7 @@ i[3456]86-*-haiku*) natdynlink=true;; arm*-*-linux*) natdynlink=true;; arm*-*-freebsd*) natdynlink=true;; + arm*-*-bsdsunix*) natdynlink=true;; aarch64-*-linux*) natdynlink=true;; esac fi @@ -844,6 +850,8 @@ i[3456]86-*-gnu*) arch=i386; system=gnu;; i[3456]86-*-mingw*) arch=i386; system=mingw;; powerpc*-*-linux*) arch=power; model=ppc; system=elf;; + powerpc-*-freebsd*) arch=power; model=ppc; system=bsd_elf;; + powerpc-*-bsdsunxi*) arch=power; model=ppc; system=bsd_elf;; powerpc-*-netbsd*) arch=power; model=ppc; system=elf;; powerpc-*-openbsd*) arch=power; model=ppc; system=bsd_elf;; powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;; @@ -855,6 +863,7 @@ armv6t2*-*-linux-gnueabi) arch=arm; model=armv6t2; system=linux_eabi;; armv6*-*-linux-gnueabi) arch=arm; model=armv6; system=linux_eabi;; armv6*-*-freebsd*) arch=arm; model=armv6; system=freebsd;; + armv6*-*-bsdsunix*) arch=arm; model=armv6; system=bsdsunix;; armv5te*-*-linux-gnueabi) arch=arm; model=armv5te; system=linux_eabi;; armv5*-*-linux-gnueabi) arch=arm; model=armv5; system=linux_eabi;; arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;; @@ -862,7 +871,9 @@ zaurus*-*-openbsd*) arch=arm; system=bsd;; x86_64-*-linux*) arch=amd64; system=linux;; x86_64-*-gnu*) arch=amd64; system=gnu;; + x86_64-*-dragonfly*) arch=amd64; system=dragonfly;; x86_64-*-freebsd*) arch=amd64; system=freebsd;; + x86_64-*-bsdsunix*) arch=amd64; system=bsdsunix;; x86_64-*-netbsd*) arch=amd64; system=netbsd;; x86_64-*-openbsd*) arch=amd64; system=openbsd;; x86_64-*-darwin*) arch=amd64; system=macosx;; @@ -889,7 +900,7 @@ fi nativecccompopts='' -nativecclinkopts='' +nativecclinkopts="" # FIXME the naming of nativecclinkopts is broken: these are options for # ld (for shared libs), not for cc nativeccrpath="$byteccrpath" @@ -932,8 +943,14 @@ esac;; arm,freebsd) as="${TOOLPREF}cc -c" aspp="${TOOLPREF}cc -c";; + arm,bsdsunix) as="${TOOLPREF}cc -c" + aspp="${TOOLPREF}cc -c";; + *,dragonfly) as="${TOOLPREF}as" + aspp="${TOOLPREF}cc -c";; *,freebsd) as="${TOOLPREF}as" aspp="${TOOLPREF}cc -c";; + *,bsdsunix) as="${TOOLPREF}as" + aspp="${TOOLPREF}cc -c";; amd64,*|arm,*|arm64,*|i386,*|power,bsd*|sparc,*) as="${TOOLPREF}as" aspp="${TOOLPREF}gcc -c";; @@ -955,9 +972,13 @@ case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;; amd64,linux) profiling='prof';; amd64,openbsd) profiling='prof';; + amd64,dragonfly) profiling='prof';; amd64,freebsd) profiling='prof';; + amd64,bsdsunix) profiling='prof';; amd64,netbsd) profiling='prof';; amd64,gnu) profiling='prof';; + arm,freebsd) profiling='prof';; + arm,bsdsunix) profiling='prof';; arm,linux*) profiling='prof';; power,elf) profiling='prof';; power,bsd*) profiling='prof';; @@ -1415,8 +1436,12 @@ case "$target" in *-*-solaris*) pthread_link="-lpthread -lposix4" pthread_caml_link="-cclib -lpthread -cclib -lposix4";; + *-*-dragon*) pthread_link="-pthread" + pthread_caml_link="-cclib -pthread";; *-*-freebsd*) pthread_link="-pthread" pthread_caml_link="-cclib -pthread";; + *-*-bsdsunix*) pthread_link="-pthread" + pthread_caml_link="-cclib -pthread";; *-*-openbsd*) pthread_link="-pthread" pthread_caml_link="-cclib -pthread";; *-*-haiku*) pthread_link="" @@ -1431,7 +1456,7 @@ bytecccompopts="$bytecccompopts -D_REENTRANT" nativecccompopts="$nativecccompopts -D_REENTRANT" case "$target" in - *-*-freebsd*) + *-*-freebsd*|*-*-dragonfly*|*-*-bsdsunix*) bytecccompopts="$bytecccompopts -D_THREAD_SAFE" nativecccompopts="$nativecccompopts -D_THREAD_SAFE";; *-*-openbsd*) @@ -1601,6 +1626,7 @@ else x11_libs="-L$dir" case "$target" in + *-*-freebsd*|*-*-dragonfly*|*-*-bsdsunix*) x11_link="-L$dir -lX11";; *-kfreebsd*-gnu) x11_link="-L$dir -lX11";; *-*-*bsd*) x11_link="-R$dir -L$dir -lX11";; *) x11_link="-L$dir -lX11";; @@ -1644,10 +1670,10 @@ # Look for BFD library if sh ./hasgot -DPACKAGE=ocaml -i bfd.h && \ - sh ./hasgot -DPACKAGE=ocaml -lbfd -ldl -liberty -lz bfd_openr; then + sh ./hasgot -DPACKAGE=ocaml -lbfd $dllib -liberty -lz bfd_openr; then inf "BFD library found." echo "#define HAS_LIBBFD" >> s.h - echo "LIBBFD_LINK=-lbfd -ldl -liberty -lz" >> Makefile + echo "LIBBFD_LINK=-lbfd $dllib -liberty -lz" >> Makefile else wrn "BFD library not found, 'objinfo' will be unable to display info on .cmxs files." echo "LIBBFD_LINK=" >> Makefile @@ -1686,12 +1712,6 @@ echo "#define NO_NAKED_POINTERS" >> m.h fi -# Add Unix-style optimization flag -bytecccompopts="-O $bytecccompopts" -dllcccompopts="-O $dllcccompopts" -nativecccompopts="-O $nativecccompopts" -sharedcccompopts="-O $sharedcccompopts" - # Final twiddling of compiler options to work around known bugs nativeccprofopts="$nativecccompopts"