summaryrefslogtreecommitdiff
path: root/devel/SDL/patches/patch-am
blob: c8f7b1d131add9e8b4e0a5d1702822526a476679 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
$NetBSD: patch-am,v 1.17 2005/05/31 17:37:50 wiz Exp $

--- configure.orig	2004-12-13 10:04:51.000000000 +0100
+++ configure
@@ -463,7 +463,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SDL_MAJOR_VERSION SDL_MINOR_VERSION SDL_MICRO_VERSION SDL_INTERFACE_AGE SDL_BINARY_AGE SDL_VERSION LT_RELEASE LT_CURRENT LT_REVISION LT_AGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ALLOCA ASFLAGS CCAS CCASFLAGS am__fastdepOBJC_TRUE am__fastdepOBJC_FALSE ALSA_CFLAGS ALSA_LIBS alsa_lib ESD_CONFIG ESD_CFLAGS ESD_LIBS esd_lib ARTSCCONFIG arts_lib NASM NASMFLAGS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS PKG_CONFIG DIRECTFB_CFLAGS DIRECTFB_LIBS OSMESA_CONFIG PTH_CONFIG ARCH TARGET_LINUX_TRUE TARGET_LINUX_FALSE TARGET_QTOPIA_TRUE TARGET_QTOPIA_FALSE TARGET_SOLARIS_TRUE TARGET_SOLARIS_FALSE TARGET_IRIX_TRUE TARGET_IRIX_FALSE TARGET_BSDI_TRUE TARGET_BSDI_FALSE TARGET_FREEBSD_TRUE TARGET_FREEBSD_FALSE TARGET_NETBSD_TRUE TARGET_NETBSD_FALSE TARGET_OPENBSD_TRUE TARGET_OPENBSD_FALSE TARGET_AIX_TRUE TARGET_AIX_FALSE TARGET_WIN32_TRUE TARGET_WIN32_FALSE TARGET_BEOS_TRUE TARGET_BEOS_FALSE TARGET_MACOS_TRUE TARGET_MACOS_FALSE TARGET_MACOSX_TRUE TARGET_MACOSX_FALSE TARGET_QNX_TRUE TARGET_QNX_FALSE TARGET_MINT_TRUE TARGET_MINT_FALSE USE_DIRECTX_TRUE USE_DIRECTX_FALSE USE_CLONE_TRUE USE_CLONE_FALSE HAVE_NASM_TRUE HAVE_NASM_FALSE ENABLE_SHARED_TRUE ENABLE_SHARED_FALSE ENABLE_STATIC_TRUE ENABLE_STATIC_FALSE AUDIO_SUBDIRS AUDIO_DRIVERS VIDEO_SUBDIRS VIDEO_DRIVERS JOYSTICK_SUBDIRS JOYSTICK_DRIVERS CDROM_SUBDIRS CDROM_DRIVERS SDL_EXTRADIRS SDL_EXTRALIBS SDL_CFLAGS SDL_LIBS SDL_STATIC_LIBS SDL_RLD_FLAGS STATIC_SYSTEM_LIBS SHARED_SYSTEM_LIBS SYSTEM_LIBS OBJC OBJCFLAGS OBJCDEPMODE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SDL_MAJOR_VERSION SDL_MINOR_VERSION SDL_MICRO_VERSION SDL_INTERFACE_AGE SDL_BINARY_AGE SDL_VERSION LT_RELEASE LT_CURRENT LT_REVISION LT_AGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ALLOCA ASFLAGS CCAS CCASFLAGS am__fastdepOBJC_TRUE am__fastdepOBJC_FALSE ALSA_CFLAGS ALSA_LIBS alsa_lib ESD_CONFIG ESD_CFLAGS ESD_LIBS esd_lib ARTSCCONFIG arts_lib NASM NASMFLAGS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS PKG_CONFIG DIRECTFB_CFLAGS DIRECTFB_LIBS AALIB_CONFIG OSMESA_CONFIG PTHREAD_CONFIG ARCH TARGET_LINUX_TRUE TARGET_LINUX_FALSE TARGET_QTOPIA_TRUE TARGET_QTOPIA_FALSE TARGET_SOLARIS_TRUE TARGET_SOLARIS_FALSE TARGET_IRIX_TRUE TARGET_IRIX_FALSE TARGET_BSDI_TRUE TARGET_BSDI_FALSE TARGET_FREEBSD_TRUE TARGET_FREEBSD_FALSE TARGET_NETBSD_TRUE TARGET_NETBSD_FALSE TARGET_OPENBSD_TRUE TARGET_OPENBSD_FALSE TARGET_AIX_TRUE TARGET_AIX_FALSE TARGET_WIN32_TRUE TARGET_WIN32_FALSE TARGET_BEOS_TRUE TARGET_BEOS_FALSE TARGET_MACOS_TRUE TARGET_MACOS_FALSE TARGET_MACOSX_TRUE TARGET_MACOSX_FALSE TARGET_QNX_TRUE TARGET_QNX_FALSE TARGET_MINT_TRUE TARGET_MINT_FALSE USE_DIRECTX_TRUE USE_DIRECTX_FALSE USE_CLONE_TRUE USE_CLONE_FALSE HAVE_NASM_TRUE HAVE_NASM_FALSE ENABLE_SHARED_TRUE ENABLE_SHARED_FALSE ENABLE_STATIC_TRUE ENABLE_STATIC_FALSE AUDIO_SUBDIRS AUDIO_DRIVERS VIDEO_SUBDIRS VIDEO_DRIVERS JOYSTICK_SUBDIRS JOYSTICK_DRIVERS CDROM_SUBDIRS CDROM_DRIVERS SDL_EXTRADIRS SDL_EXTRALIBS SDL_CFLAGS SDL_LIBS SDL_STATIC_LIBS SDL_RLD_FLAGS STATIC_SYSTEM_LIBS SHARED_SYSTEM_LIBS SYSTEM_LIBS OBJC OBJCFLAGS OBJCDEPMODE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1592,9 +1592,9 @@ SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINO
 
 # libtool versioning
 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
-LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
-LT_REVISION=$SDL_INTERFACE_AGE
-LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
+LT_CURRENT=$SDL_INTERFACE_AGE
+LT_REVISION=$SDL_BINARY_AGE
+LT_AGE=0
 
 
 
@@ -21907,6 +21907,8 @@ rm -f conftest.err conftest.$ac_objext c
 echo "${ECHO_T}$have_oss" >&6
         if test x$have_oss = xyes; then
             CFLAGS="$CFLAGS -DOSS_SUPPORT"
+	    LDFLAGS="$LDFLAGS $LIBOSSAUDIO"
+	    SDL_LIBS="$SDL_LIBS $LIBOSSAUDIO"
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
             AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
@@ -22844,9 +22846,9 @@ fi;
         echo "$as_me:$LINENO: checking for NAS audio support" >&5
 echo $ECHO_N "checking for NAS audio support... $ECHO_C" >&6
         have_nas=no
-        if test -r /usr/X11R6/include/audio/audiolib.h; then
+        if true; then
             have_nas=yes
-            CFLAGS="$CFLAGS -DNAS_SUPPORT -I/usr/X11R6/include/"
+            CFLAGS="$CFLAGS -DNAS_SUPPORT"
             SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
             AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
@@ -23112,7 +23114,7 @@ fi
                   NASMFLAGS="-f aoutb"
                   ;;
               *)
-                  NASMFLAGS="-f elf"
+                  test -n "$NASMFLAGS" || NASMFLAGS="-f elf"
                   ;;
             esac
 
@@ -25643,63 +25645,58 @@ else
   enable_video_aalib=no
 fi;
     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
-        echo "$as_me:$LINENO: checking for AAlib support" >&5
-echo $ECHO_N "checking for AAlib support... $ECHO_C" >&6
-        video_aalib=no
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-         #include <aalib.h>
-
-int
-main ()
-{
-
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+        # Extract the first word of "aalib-config", so it can be a program name with args.
+set dummy aalib-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_AALIB_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $AALIB_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AALIB_CONFIG="$AALIB_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_AALIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
 
-        video_aalib=yes
+  ;;
+esac
+fi
+AALIB_CONFIG=$ac_cv_path_AALIB_CONFIG
 
+if test -n "$AALIB_CONFIG"; then
+  echo "$as_me:$LINENO: result: $AALIB_CONFIG" >&5
+echo "${ECHO_T}$AALIB_CONFIG" >&6
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+        echo "$as_me:$LINENO: checking for AAlib support" >&5
+echo $ECHO_N "checking for AAlib support... $ECHO_C" >&6
+        if test x$AALIB_CONFIG = x; then
+        video_aalib=no
+	else
+            AALIB_LIBS=`$AALIB_CONFIG --libs`
+        video_aalib=yes
+        fi
         echo "$as_me:$LINENO: result: $video_aalib" >&5
 echo "${ECHO_T}$video_aalib" >&6
         if test x$video_aalib = xyes; then
             CFLAGS="$CFLAGS -DENABLE_AALIB"
-            SYSTEM_LIBS="$SYSTEM_LIBS -laa"
+            SYSTEM_LIBS="$SYSTEM_LIBS $AALIB_LIBS"
 
             VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
             VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
@@ -26714,16 +26711,17 @@ else
   enable_pth=yes
 fi;
     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
-        # Extract the first word of "pth-config", so it can be a program name with args.
-set dummy pth-config; ac_word=$2
+        # Use the libpthread version of the pth library.
+        # Extract the first word of "pthread-config", so it can be a program name with args.
+set dummy pthread-config; ac_word=$2
 echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_PTH_CONFIG+set}" = set; then
+if test "${ac_cv_path_PTHREAD_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $PTH_CONFIG in
+  case $PTHREAD_CONFIG in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_PTH_CONFIG="$PTH_CONFIG" # Let the user override the test with a path.
+  ac_cv_path_PTHREAD_CONFIG="$PTHREAD_CONFIG" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -26733,32 +26731,32 @@ do
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
   if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PTH_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_PTHREAD_CONFIG="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
 
-  test -z "$ac_cv_path_PTH_CONFIG" && ac_cv_path_PTH_CONFIG="no"
+  test -z "$ac_cv_path_PTHREAD_CONFIG" && ac_cv_path_PTHREAD_CONFIG="no"
   ;;
 esac
 fi
-PTH_CONFIG=$ac_cv_path_PTH_CONFIG
+PTHREAD_CONFIG=$ac_cv_path_PTHREAD_CONFIG
 
-if test -n "$PTH_CONFIG"; then
-  echo "$as_me:$LINENO: result: $PTH_CONFIG" >&5
-echo "${ECHO_T}$PTH_CONFIG" >&6
+if test -n "$PTHREAD_CONFIG"; then
+  echo "$as_me:$LINENO: result: $PTHREAD_CONFIG" >&5
+echo "${ECHO_T}$PTHREAD_CONFIG" >&6
 else
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-        if test "$PTH_CONFIG" = "no"; then
+        if test "$PTHREAD_CONFIG" = "no"; then
             use_pth=no
         else
-            PTH_CFLAGS=`$PTH_CONFIG --cflags`
-            PTH_LIBS=`$PTH_CONFIG --libs --all`
+            PTH_CFLAGS=`$PTHREAD_CONFIG --cflags`
+            PTH_LIBS=`$PTHREAD_CONFIG --libs --all`
             SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
             SDL_LIBS="$SDL_LIBS $PTH_LIBS"
             CFLAGS="$CFLAGS -DENABLE_PTH"
@@ -26806,9 +26804,13 @@ fi;
             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
             pthread_lib="-pthread"
             ;;
+	*-*-dragonfly*)
+            pthread_cflags="-D_REENTRANT"
+            pthread_lib="-pthread"
+            ;;
         *-*-netbsd*)
-            pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
-            pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
+            pthread_cflags="-D_REENTRANT"
+            pthread_lib="-lpthread"
             ;;
         *-*-openbsd*)
             pthread_cflags="-D_REENTRANT"
@@ -28637,93 +28639,21 @@ if test $ac_cv_lib_usbhid_hid_init = yes
   have_libusbhid=yes
 fi
 
-        echo "$as_me:$LINENO: checking for hid_init in -lusb" >&5
-echo $ECHO_N "checking for hid_init in -lusb... $ECHO_C" >&6
-if test "${ac_cv_lib_usb_hid_init+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lusb  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char hid_init ();
-int
-main ()
-{
-hid_init ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_usb_hid_init=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_usb_hid_init=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_usb_hid_init" >&5
-echo "${ECHO_T}$ac_cv_lib_usb_hid_init" >&6
-if test $ac_cv_lib_usb_hid_init = yes; then
-  have_libusb=yes
-fi
-
         if test x$have_libusbhid = xyes; then
             SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
-        fi
-        if test x$have_libusb = xyes; then
-            SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
-        fi
 
-        if test "${ac_cv_header_usb_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for usb.h" >&5
-echo $ECHO_N "checking for usb.h... $ECHO_C" >&6
-if test "${ac_cv_header_usb_h+set}" = set; then
+            if test "${ac_cv_header_usbhid_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for usbhid.h" >&5
+echo $ECHO_N "checking for usbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_usbhid_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5
-echo "${ECHO_T}$ac_cv_header_usb_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_usbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_usbhid_h" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking usb.h usability" >&5
-echo $ECHO_N "checking usb.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking usbhid.h usability" >&5
+echo $ECHO_N "checking usbhid.h usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28731,7 +28661,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <usb.h>
+#include <usbhid.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -28767,15 +28697,15 @@ echo "$as_me:$LINENO: result: $ac_header
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking usb.h presence" >&5
-echo $ECHO_N "checking usb.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking usbhid.h presence" >&5
+echo $ECHO_N "checking usbhid.h presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <usb.h>
+#include <usbhid.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -28809,25 +28739,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: usb.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: usbhid.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: usbhid.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: usb.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: usb.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usb.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: usb.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usb.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: usb.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usb.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: usb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: usb.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usb.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: usb.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: usbhid.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: usbhid.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: usbhid.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: usbhid.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: usbhid.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usbhid.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: usbhid.h: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
 ## ------------------------------------------ ##
@@ -28838,34 +28768,34 @@ _ASBOX
       sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-echo "$as_me:$LINENO: checking for usb.h" >&5
-echo $ECHO_N "checking for usb.h... $ECHO_C" >&6
-if test "${ac_cv_header_usb_h+set}" = set; then
+echo "$as_me:$LINENO: checking for usbhid.h" >&5
+echo $ECHO_N "checking for usbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_usbhid_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_usb_h=$ac_header_preproc
+  ac_cv_header_usbhid_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5
-echo "${ECHO_T}$ac_cv_header_usb_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_usbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_usbhid_h" >&6
 
 fi
-if test $ac_cv_header_usb_h = yes; then
-  have_usb_h=yes
+if test $ac_cv_header_usbhid_h = yes; then
+  have_usbhid_h=yes
 fi
 
 
-        if test "${ac_cv_header_usbhid_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for usbhid.h" >&5
-echo $ECHO_N "checking for usbhid.h... $ECHO_C" >&6
-if test "${ac_cv_header_usbhid_h+set}" = set; then
+            if test "${ac_cv_header_libusbhid_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for libusbhid.h" >&5
+echo $ECHO_N "checking for libusbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_libusbhid_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_usbhid_h" >&5
-echo "${ECHO_T}$ac_cv_header_usbhid_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_libusbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_libusbhid_h" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking usbhid.h usability" >&5
-echo $ECHO_N "checking usbhid.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking libusbhid.h usability" >&5
+echo $ECHO_N "checking libusbhid.h usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28873,7 +28803,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <usbhid.h>
+#include <libusbhid.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -28909,15 +28839,15 @@ echo "$as_me:$LINENO: result: $ac_header
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking usbhid.h presence" >&5
-echo $ECHO_N "checking usbhid.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking libusbhid.h presence" >&5
+echo $ECHO_N "checking libusbhid.h presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <usbhid.h>
+#include <libusbhid.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -28951,25 +28881,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: usbhid.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: usbhid.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usbhid.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: usbhid.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libusbhid.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libusbhid.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: usbhid.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: usbhid.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usbhid.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: usbhid.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usbhid.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: usbhid.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usbhid.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: usbhid.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usbhid.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: usbhid.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: usbhid.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: usbhid.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libusbhid.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libusbhid.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libusbhid.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libusbhid.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libusbhid.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusbhid.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libusbhid.h: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
 ## ------------------------------------------ ##
@@ -28980,34 +28910,112 @@ _ASBOX
       sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-echo "$as_me:$LINENO: checking for usbhid.h" >&5
-echo $ECHO_N "checking for usbhid.h... $ECHO_C" >&6
-if test "${ac_cv_header_usbhid_h+set}" = set; then
+echo "$as_me:$LINENO: checking for libusbhid.h" >&5
+echo $ECHO_N "checking for libusbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_libusbhid_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_usbhid_h=$ac_header_preproc
+  ac_cv_header_libusbhid_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_usbhid_h" >&5
-echo "${ECHO_T}$ac_cv_header_usbhid_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_libusbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_libusbhid_h" >&6
 
 fi
-if test $ac_cv_header_usbhid_h = yes; then
-  have_usbhid_h=yes
+if test $ac_cv_header_libusbhid_h = yes; then
+  have_libusbhid_h=yes
 fi
 
 
-        if test "${ac_cv_header_libusb_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for libusb.h" >&5
-echo $ECHO_N "checking for libusb.h... $ECHO_C" >&6
-if test "${ac_cv_header_libusb_h+set}" = set; then
+            if test x$have_usbhid_h = xyes; then
+                CFLAGS="$CFLAGS -DHAVE_USBHID_H"
+            fi
+            if test x$have_libusbhid_h = xyes; then
+                CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
+        fi
+	else
+            echo "$as_me:$LINENO: checking for hid_init in -lusb" >&5
+echo $ECHO_N "checking for hid_init in -lusb... $ECHO_C" >&6
+if test "${ac_cv_lib_usb_hid_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lusb  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char hid_init ();
+int
+main ()
+{
+hid_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_usb_hid_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_usb_hid_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_usb_hid_init" >&5
+echo "${ECHO_T}$ac_cv_lib_usb_hid_init" >&6
+if test $ac_cv_lib_usb_hid_init = yes; then
+  have_libusb=yes
+fi
+
+        if test x$have_libusb = xyes; then
+            SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
+
+        if test "${ac_cv_header_usb_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for usb.h" >&5
+echo $ECHO_N "checking for usb.h... $ECHO_C" >&6
+if test "${ac_cv_header_usb_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libusb_h" >&5
-echo "${ECHO_T}$ac_cv_header_libusb_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5
+echo "${ECHO_T}$ac_cv_header_usb_h" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking libusb.h usability" >&5
-echo $ECHO_N "checking libusb.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking usb.h usability" >&5
+echo $ECHO_N "checking usb.h usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -29015,7 +29023,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <libusb.h>
+#include <usb.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -29051,15 +29059,15 @@ echo "$as_me:$LINENO: result: $ac_header
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking libusb.h presence" >&5
-echo $ECHO_N "checking libusb.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking usb.h presence" >&5
+echo $ECHO_N "checking usb.h presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <libusb.h>
+#include <usb.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -29093,25 +29101,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: libusb.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: libusb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusb.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: libusb.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: usb.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: libusb.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: libusb.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusb.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: libusb.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusb.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: libusb.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusb.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: libusb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusb.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: libusb.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusb.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: libusb.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: usb.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: usb.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: usb.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: usb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: usb.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: usb.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: usb.h: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
 ## ------------------------------------------ ##
@@ -29122,34 +29130,34 @@ _ASBOX
       sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-echo "$as_me:$LINENO: checking for libusb.h" >&5
-echo $ECHO_N "checking for libusb.h... $ECHO_C" >&6
-if test "${ac_cv_header_libusb_h+set}" = set; then
+echo "$as_me:$LINENO: checking for usb.h" >&5
+echo $ECHO_N "checking for usb.h... $ECHO_C" >&6
+if test "${ac_cv_header_usb_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_libusb_h=$ac_header_preproc
+  ac_cv_header_usb_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libusb_h" >&5
-echo "${ECHO_T}$ac_cv_header_libusb_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5
+echo "${ECHO_T}$ac_cv_header_usb_h" >&6
 
 fi
-if test $ac_cv_header_libusb_h = yes; then
-  have_libusb_h=yes
+if test $ac_cv_header_usb_h = yes; then
+  have_usb_h=yes
 fi
 
 
-        if test "${ac_cv_header_libusbhid_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for libusbhid.h" >&5
-echo $ECHO_N "checking for libusbhid.h... $ECHO_C" >&6
-if test "${ac_cv_header_libusbhid_h+set}" = set; then
+        if test "${ac_cv_header_libusb_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for libusb.h" >&5
+echo $ECHO_N "checking for libusb.h... $ECHO_C" >&6
+if test "${ac_cv_header_libusb_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libusbhid_h" >&5
-echo "${ECHO_T}$ac_cv_header_libusbhid_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_libusb_h" >&5
+echo "${ECHO_T}$ac_cv_header_libusb_h" >&6
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking libusbhid.h usability" >&5
-echo $ECHO_N "checking libusbhid.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking libusb.h usability" >&5
+echo $ECHO_N "checking libusb.h usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -29157,7 +29165,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <libusbhid.h>
+#include <libusb.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -29193,15 +29201,15 @@ echo "$as_me:$LINENO: result: $ac_header
 echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-echo "$as_me:$LINENO: checking libusbhid.h presence" >&5
-echo $ECHO_N "checking libusbhid.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking libusb.h presence" >&5
+echo $ECHO_N "checking libusb.h presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <libusbhid.h>
+#include <libusb.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -29235,25 +29243,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: libusbhid.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: libusbhid.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libusb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libusb.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: libusbhid.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: libusbhid.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: libusbhid.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: libusbhid.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: libusbhid.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libusbhid.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: libusbhid.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libusb.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libusb.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libusb.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libusb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libusb.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libusb.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libusb.h: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
 ## ------------------------------------------ ##
@@ -29264,33 +29272,29 @@ _ASBOX
       sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-echo "$as_me:$LINENO: checking for libusbhid.h" >&5
-echo $ECHO_N "checking for libusbhid.h... $ECHO_C" >&6
-if test "${ac_cv_header_libusbhid_h+set}" = set; then
+echo "$as_me:$LINENO: checking for libusb.h" >&5
+echo $ECHO_N "checking for libusb.h... $ECHO_C" >&6
+if test "${ac_cv_header_libusb_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_libusbhid_h=$ac_header_preproc
+  ac_cv_header_libusb_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libusbhid_h" >&5
-echo "${ECHO_T}$ac_cv_header_libusbhid_h" >&6
+echo "$as_me:$LINENO: result: $ac_cv_header_libusb_h" >&5
+echo "${ECHO_T}$ac_cv_header_libusb_h" >&6
 
 fi
-if test $ac_cv_header_libusbhid_h = yes; then
-  have_libusbhid_h=yes
+if test $ac_cv_header_libusb_h = yes; then
+  have_libusb_h=yes
 fi
 
 
         if test x$have_usb_h = xyes; then
             CFLAGS="$CFLAGS -DHAVE_USB_H"
         fi
-        if test x$have_usbhid_h = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_USBHID_H"
-        fi
         if test x$have_libusb_h = xyes; then
             CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
         fi
-        if test x$have_libusbhid_h = xyes; then
-            CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
+            fi
         fi
 
         echo "$as_me:$LINENO: checking for usbhid" >&5
@@ -29307,8 +29311,13 @@ cat >>conftest.$ac_ext <<_ACEOF
           #if defined(HAVE_USB_H)
           #include <usb.h>
           #endif
+	  #ifdef __DragonFly__
+          #include <bus/usb/usb.h>
+          #include <bus/usb/usbhid.h>
+	  #else
           #include <dev/usb/usb.h>
           #include <dev/usb/usbhid.h>
+	  #endif
           #if defined(HAVE_USBHID_H)
           #include <usbhid.h>
           #elif defined(HAVE_LIBUSB_H)
@@ -29378,8 +29387,13 @@ cat >>conftest.$ac_ext <<_ACEOF
               #if defined(HAVE_USB_H)
               #include <usb.h>
               #endif
+	      #ifdef __DragonFly__
+              #include <bus/usb/usb.h>
+              #include <bus/usb/usbhid.h>
+	      #else
               #include <dev/usb/usb.h>
               #include <dev/usb/usbhid.h>
+	      #endif
               #if defined(HAVE_USBHID_H)
               #include <usbhid.h>
               #elif defined(HAVE_LIBUSB_H)
@@ -29450,8 +29464,13 @@ cat >>conftest.$ac_ext <<_ACEOF
               #if defined(HAVE_USB_H)
               #include <usb.h>
               #endif
+	      #ifdef __DragonFly__
+              #include <bus/usb/usb.h>
+              #include <bus/usb/usbhid.h>
+	      #else
               #include <dev/usb/usb.h>
               #include <dev/usb/usbhid.h>
+	      #endif
               #if defined(HAVE_USBHID_H)
               #include <usbhid.h>
               #elif defined(HAVE_LIBUSB_H)
@@ -29514,6 +29533,70 @@ echo "${ECHO_T}$have_usbhid_new" >&6
     fi
 }
 
+CheckMachineJoystick()
+{
+    if test x$enable_joystick = xyes; then
+        echo "$as_me:$LINENO: checking whether struct joystick is defined in machine/joystick.h" >&5
+echo $ECHO_N "checking whether struct joystick is defined in machine/joystick.h... $ECHO_C" >&6
+        have_machine_joystick=no
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+          #include <machine/joystick.h>
+
+int
+main ()
+{
+
+          struct joystick t;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+        have_machine_joystick=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+        echo "$as_me:$LINENO: result: $have_machine_joystick" >&5
+echo "${ECHO_T}$have_machine_joystick" >&6
+        if test x$have_machine_joystick = xyes; then
+            CFLAGS="$CFLAGS -DHAVE_MACHINE_JOYSTICK"
+        fi
+    fi
+}
+
 CheckAltivec()
 {
     echo "$as_me:$LINENO: checking for GCC Altivec instruction support" >&5
@@ -29743,7 +29826,7 @@ __EOF__
 
         fi
         ;;
-    *-*-freebsd*)
+    *-*-freebsd* | *-*-dragonfly*)
         ARCH=freebsd
         CheckDummyVideo
         CheckDiskAudio
@@ -29808,16 +29891,18 @@ __EOF__
         CheckESD
         CheckNAS
         CheckX11
+        CheckDGA
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
         CheckSIGACTION
         CheckUSBHID
+        CheckMachineJoystick
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
-            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
-            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
-            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
+            CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
+            AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
+            AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
         fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
@@ -29826,9 +29911,6 @@ __EOF__
         fi
         # Set up files for the thread library
         if test x$enable_threads = xyes; then
-            if test x$use_pthreads = xyes; then
-                CFLAGS="$CFLAGS -D_POSIX_THREAD_SYSCALL_SOFT=1"
-            fi
             CopyUnixThreadSource
         fi
         # Set up files for the timer library
@@ -31455,7 +31537,7 @@ fi
 
 # Set runtime shared library paths as needed
 
-if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
+if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi -o $ARCH = netbsd; then
   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
 fi
 if test $ARCH = solaris; then
@@ -32598,8 +32680,9 @@ s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
 s,@PKG_CONFIG@,$PKG_CONFIG,;t t
 s,@DIRECTFB_CFLAGS@,$DIRECTFB_CFLAGS,;t t
 s,@DIRECTFB_LIBS@,$DIRECTFB_LIBS,;t t
+s,@AALIB_CONFIG@,$AALIB_CONFIG,;t t
 s,@OSMESA_CONFIG@,$OSMESA_CONFIG,;t t
-s,@PTH_CONFIG@,$PTH_CONFIG,;t t
+s,@PTHREAD_CONFIG@,$PTHREAD_CONFIG,;t t
 s,@ARCH@,$ARCH,;t t
 s,@TARGET_LINUX_TRUE@,$TARGET_LINUX_TRUE,;t t
 s,@TARGET_LINUX_FALSE@,$TARGET_LINUX_FALSE,;t t