--- configure.orig	2010-11-30 22:51:02.000000000 +0000
+++ configure	2014-09-13 06:33:34.000000000 +0000
@@ -975,7 +975,7 @@ cat > conftest.$ac_ext << EOF
 #line 976 "configure"
 #include "confdefs.h"
 
-main(){return(0);}
+int main(){return(0);}
 EOF
 if { (eval echo configure:981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
@@ -1461,7 +1461,7 @@ cat > conftest.$ac_ext <<EOF
 #include "confdefs.h"
 
 int main() {
-main()
+int main()
 ; return 0; }
 EOF
 if { (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
@@ -1504,7 +1504,7 @@ cat > conftest.$ac_ext <<EOF
 #include "confdefs.h"
 
 int main() {
-main()
+int main()
 ; return 0; }
 EOF
 if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
@@ -1547,7 +1547,7 @@ cat > conftest.$ac_ext <<EOF
 #include "confdefs.h"
 
 int main() {
-main()
+int main()
 ; return 0; }
 EOF
 if { (eval echo configure:1554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
@@ -2325,7 +2325,7 @@ else
   cat > conftest.$ac_ext <<EOF
 #line 2327 "configure"
 #include "confdefs.h"
-main () {
+int main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
   union
   {
@@ -2371,11 +2371,12 @@ else
 #line 2372 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-main()
+#include <stdlib.h>
+int main()
 {
   FILE *f=fopen("conftestval", "w");
   if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(int));
+  fprintf(f, "%zu\n", sizeof(int));
   exit(0);
 }
 EOF
@@ -2410,11 +2411,12 @@ else
 #line 2411 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-main()
+#include <stdlib.h>
+int main()
 {
   FILE *f=fopen("conftestval", "w");
   if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(long));
+  fprintf(f, "%zu\n", sizeof(long));
   exit(0);
 }
 EOF
@@ -2449,11 +2451,12 @@ else
 #line 2450 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-main()
+#include <stdlib.h>
+int main()
 {
   FILE *f=fopen("conftestval", "w");
   if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(long long));
+  fprintf(f, "%zu\n", sizeof(long long));
   exit(0);
 }
 EOF
@@ -2488,11 +2491,12 @@ else
 #line 2489 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-main()
+#include <stdlib.h>
+int main()
 {
   FILE *f=fopen("conftestval", "w");
   if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(void *));
+  fprintf(f, "%zu\n", sizeof(void *));
   exit(0);
 }
 EOF
@@ -2681,7 +2685,7 @@ cat > conftest.$ac_ext <<EOF
 #line 2682 "configure"
 #include "confdefs.h"
 
-main () {
+int main () {
     double e, u;
     /* 
      *	Check the smallest value such that 1.0 + x != 1.0.
@@ -3379,7 +3383,7 @@ else
 fi
 
 case $target in
-  *-sunos4*|*-*-netbsd|NetBSD-*|FreeBSD-*|OpenBSD-*|*-*-cygwin*|*-*-mingw*)
+  *-sunos4*|*-*-netbsd|NetBSD-*|*-dragonfly*|*-freebsd*|OpenBSD-*|*-*-cygwin*|*-*-mingw*)
     TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}"
     TK_LIB_NAME="tk${TK_MAJOR_VERSION}${TK_MINOR_VERSION}"
     ;;
@@ -3854,7 +3858,7 @@ SHLIB_RUNPATH="$TCL_LD_SEARCH_FLAGS"
 SHLIB_SUFFIX=".so"
 SHLIB_TARGET=""
 SHLIB_CFLAGS=""
-SHLIB_LIB_SPECS="${JPEG_LIB_SPEC}"
+SHLIB_LIB_SPECS="${JPEG_LIB_SPEC} ${TK_LIB_SPEC} ${TCL_LIB_SPEC}"
 SHLIB_TCL_ONLY_LIB_SPECS="${TCL_ONLY_LIB_SPECS}"
 SHLIB_TCL_ONLY_LIB_SPECS=""
 LDFLAGS=""
@@ -4072,7 +4076,7 @@ fi
     EXTRA_LIB_SPECS="-ldl"
     ;;
 
-  *-netbsd*|*-freebsd*|*-openbsd*)
+  *-netbsd*|*-dragonfly*|*-freebsd*|*-openbsd*)
     # Not available on all versions:  check for include file.
     ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
@@ -4110,8 +4114,8 @@ fi
 
     if test "$test_ok" = yes; then
       SHLIB_CFLAGS="-fpic"
-      SHLIB_LD="ld"
-      SHLIB_LD_FLAGS="-Bshareable -x"
+      SHLIB_LD="${CC}"
+      SHLIB_LD_FLAGS="-shared -Wl,-x"
     fi
     ;;
 
