summaryrefslogtreecommitdiff
path: root/devel/SDL/patches/patch-aj
blob: 945289ef44687b2a9b0724f93325b9fdeff4bec3 (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
$NetBSD: patch-aj,v 1.12 2002/07/15 23:04:20 kristerw Exp $
--- configure.in.orig	Thu Nov  8 08:28:00 2001
+++ configure.in	Mon Jul 15 23:28:12 2002
@@ -374,10 +374,7 @@
                   , enable_nas=yes)
     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
         AC_MSG_CHECKING(for NAS audio support)
-        have_nas=no
-        if test -r /usr/X11R6/include/audio/audiolib.h; then
             have_nas=yes
-        fi
         AC_MSG_RESULT($have_nas)
         if test x$have_nas = xyes; then
             CFLAGS="$CFLAGS -DNAS_SUPPORT"
@@ -429,7 +426,7 @@
                   NASMFLAGS="-f win32"
                   ;;
               *)
-                  NASMFLAGS="-f elf"
+                  test -n "$NASMFLAGS" || NASMFLAGS="-f elf"
                   ;;
             esac
             AC_SUBST(NASMFLAGS)
@@ -999,8 +996,8 @@
             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"
@@ -1281,6 +1278,126 @@
     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
 }
 
+dnl Check for the usbhid(3) library on *BSD
+CheckUSBHID()
+{
+    if test x$enable_joystick = xyes; then
+        have_libusbhid=no
+        have_libusb=no
+        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
+        if test x$have_libusbhid = xyes; then
+            SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
+
+            AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
+            AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
+            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
+            AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
+            if test x$have_libusb = xyes; then
+                SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
+
+                AC_CHECK_HEADER(usb.h, have_usb_h=yes)
+                AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
+                if test x$have_usb_h = xyes; then
+                    CFLAGS="$CFLAGS -DHAVE_USB_H"
+                fi
+                if test x$have_libusb_h = xyes; then
+                    CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
+                fi
+            fi
+        fi
+
+        AC_MSG_CHECKING(for usbhid)
+        have_usbhid=no
+        AC_TRY_COMPILE([
+          #include <sys/types.h>
+          #if defined(HAVE_USB_H)
+          #include <usb.h>
+          #endif
+          #include <dev/usb/usb.h>
+          #include <dev/usb/usbhid.h>
+          #if defined(HAVE_USBHID_H)
+          #include <usbhid.h>
+          #elif defined(HAVE_LIBUSB_H)
+          #include <libusb.h>
+          #elif defined(HAVE_LIBUSBHID_H)
+          #include <libusbhid.h>
+          #endif
+        ],[
+          struct report_desc *repdesc;
+          struct usb_ctl_report *repbuf;
+          hid_kind_t hidkind;
+        ],[
+        have_usbhid=yes
+        ])
+        AC_MSG_RESULT($have_usbhid)
+
+        if test x$have_usbhid = xyes; then
+            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
+            have_usbhid_ucr_data=no
+            AC_TRY_COMPILE([
+              #include <sys/types.h>
+              #if defined(HAVE_USB_H)
+              #include <usb.h>
+              #endif
+              #include <dev/usb/usb.h>
+              #include <dev/usb/usbhid.h>
+              #if defined(HAVE_USBHID_H)
+              #include <usbhid.h>
+              #elif defined(HAVE_LIBUSB_H)
+              #include <libusb.h>
+              #elif defined(HAVE_LIBUSBHID_H)
+              #include <libusbhid.h>
+              #endif
+            ],[
+              struct usb_ctl_report buf;
+              if (buf.ucr_data) { }
+            ],[
+            have_usbhid_ucr_data=yes
+            ])
+            if test x$have_usbhid_ucr_data = xyes; then
+                CFLAGS="$CFLAGS -DUSBHID_UCR_DATA"
+            fi
+            AC_MSG_RESULT($have_usbhid_ucr_data)
+            
+	    AC_MSG_CHECKING(for new usbhid API)
+            have_usbhid_new=no
+            AC_TRY_COMPILE([
+              #include <sys/types.h>
+              #if defined(HAVE_USB_H)
+              #include <usb.h>
+              #endif
+              #include <dev/usb/usb.h>
+              #include <dev/usb/usbhid.h>
+              #if defined(HAVE_USBHID_H)
+              #include <usbhid.h>
+              #elif defined(HAVE_LIBUSB_H)
+              #include <libusb.h>
+              #elif defined(HAVE_LIBUSBHID_H)
+              #include <libusbhid.h>
+              #endif
+            ],[
+              report_desc_t d;
+	      hid_start_parse(d, 1, 1);
+            ],[
+            have_usbhid_new=yes
+            ])
+            if test x$have_usbhid_new = xyes; then
+                CFLAGS="$CFLAGS -DUSBHID_NEW"
+            fi
+            AC_MSG_RESULT($have_usbhid_new)
+
+            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
+            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
+        fi
+    fi
+}
+
 case "$target" in
     *-*-linux*)
         ARCH=linux
@@ -1465,14 +1582,17 @@
         CheckDummyVideo
         CheckDiskAudio
         CheckNASM
+        CheckOPENBSDAUDIO
         CheckOSS
         CheckARTSC
         CheckESD
         CheckNAS
         CheckX11
+        CheckDGA
         CheckAAlib
         CheckOpenGL
         CheckPTHREAD
+        CheckUSBHID
         # Set up files for the main() stub
         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
         # Set up files for the audio library
@@ -1481,12 +1601,6 @@
             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
         fi
-        # Set up files for the joystick library
-        # (No joystick support yet)
-        if test x$enable_joystick = xyes; then
-            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
-            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
-        fi
         # Set up files for the cdrom library
         if test x$enable_cdrom = xyes; then
             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
@@ -1770,7 +1884,11 @@
             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
+	    if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
+		COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
+	    else
             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
+	    fi
             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
@@ -2159,6 +2277,10 @@
   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
 fi
 
+if test $ARCH = netbsd; then
+  SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib -Wl,-rpath,${X11BASE}/lib"
+fi
+
 if test $ARCH = openbsd; then
   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib $SYSTEM_LIBS"
 fi
@@ -2277,6 +2399,7 @@
 src/joystick/Makefile
 src/joystick/amigaos/Makefile
 src/joystick/beos/Makefile
+src/joystick/bsd/Makefile
 src/joystick/darwin/Makefile
 src/joystick/dummy/Makefile
 src/joystick/linux/Makefile