Fixed bug 2149 - Don't search for libusbhid except on BSD
authorSam Lantinga <slouken@libsdl.org>
Sun, 13 Oct 2013 19:49:45 -0700
changeset 78119dfcc6bad831
parent 7810 ab1b92bf0327
child 7812 c50a384be081
Fixed bug 2149 - Don't search for libusbhid except on BSD

Joseph Carter

There's a whole set of configure tests for BSD's libusbhid, and they only matter on BSD. However, if you have the library on Linux, it gets pulled in as library bloat. And it's bloat of the highest order since not a single function call to the library is ever made unless you're on a *BSD.
configure
configure.in
test/configure
     1.1 --- a/configure	Sun Oct 13 19:48:45 2013 -0700
     1.2 +++ b/configure	Sun Oct 13 19:49:45 2013 -0700
     1.3 @@ -21634,8 +21634,10 @@
     1.4  
     1.5  CheckUSBHID()
     1.6  {
     1.7 -    if test x$enable_joystick = xyes; then
     1.8 -        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5
     1.9 +    case "$host" in
    1.10 +        *-*-*bsd*)
    1.11 +            if test x$enable_joystick = xyes; then
    1.12 +                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5
    1.13  $as_echo_n "checking for hid_init in -lusbhid... " >&6; }
    1.14  if ${ac_cv_lib_usbhid_hid_init+:} false; then :
    1.15    $as_echo_n "(cached) " >&6
    1.16 @@ -21675,34 +21677,34 @@
    1.17    have_libusbhid=yes
    1.18  fi
    1.19  
    1.20 -        if test x$have_libusbhid = xyes; then
    1.21 -            ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default"
    1.22 +                if test x$have_libusbhid = xyes; then
    1.23 +                    ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default"
    1.24  if test "x$ac_cv_header_usbhid_h" = xyes; then :
    1.25    USB_CFLAGS="-DHAVE_USBHID_H"
    1.26  fi
    1.27  
    1.28  
    1.29 -            ac_fn_c_check_header_mongrel "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default"
    1.30 +                    ac_fn_c_check_header_mongrel "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default"
    1.31  if test "x$ac_cv_header_libusbhid_h" = xyes; then :
    1.32    USB_CFLAGS="-DHAVE_LIBUSBHID_H"
    1.33  fi
    1.34  
    1.35  
    1.36 -            USB_LIBS="$USB_LIBS -lusbhid"
    1.37 -        else
    1.38 -            ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
    1.39 +                    USB_LIBS="$USB_LIBS -lusbhid"
    1.40 +                else
    1.41 +                    ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
    1.42  if test "x$ac_cv_header_usb_h" = xyes; then :
    1.43    USB_CFLAGS="-DHAVE_USB_H"
    1.44  fi
    1.45  
    1.46  
    1.47 -            ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default"
    1.48 +                    ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default"
    1.49  if test "x$ac_cv_header_libusb_h" = xyes; then :
    1.50    USB_CFLAGS="-DHAVE_LIBUSB_H"
    1.51  fi
    1.52  
    1.53  
    1.54 -            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5
    1.55 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5
    1.56  $as_echo_n "checking for hid_init in -lusb... " >&6; }
    1.57  if ${ac_cv_lib_usb_hid_init+:} false; then :
    1.58    $as_echo_n "(cached) " >&6
    1.59 @@ -21742,196 +21744,198 @@
    1.60    USB_LIBS="$USB_LIBS -lusb"
    1.61  fi
    1.62  
    1.63 -        fi
    1.64 -
    1.65 -        save_CFLAGS="$CFLAGS"
    1.66 -        CFLAGS="$CFLAGS $USB_CFLAGS"
    1.67 -
    1.68 -        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5
    1.69 +                fi
    1.70 +
    1.71 +                save_CFLAGS="$CFLAGS"
    1.72 +                CFLAGS="$CFLAGS $USB_CFLAGS"
    1.73 +
    1.74 +                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5
    1.75  $as_echo_n "checking for usbhid... " >&6; }
    1.76 -        have_usbhid=no
    1.77 -        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.78 -/* end confdefs.h.  */
    1.79 -
    1.80 -          #include <sys/types.h>
    1.81 -          #if defined(HAVE_USB_H)
    1.82 -          #include <usb.h>
    1.83 -          #endif
    1.84 -          #ifdef __DragonFly__
    1.85 -          # include <bus/usb/usb.h>
    1.86 -          # include <bus/usb/usbhid.h>
    1.87 -          #else
    1.88 -          # include <dev/usb/usb.h>
    1.89 -          # include <dev/usb/usbhid.h>
    1.90 -          #endif
    1.91 -          #if defined(HAVE_USBHID_H)
    1.92 -          #include <usbhid.h>
    1.93 -          #elif defined(HAVE_LIBUSB_H)
    1.94 -          #include <libusb.h>
    1.95 -          #elif defined(HAVE_LIBUSBHID_H)
    1.96 -          #include <libusbhid.h>
    1.97 -          #endif
    1.98 -
    1.99 -int
   1.100 -main ()
   1.101 -{
   1.102 -
   1.103 -          struct report_desc *repdesc;
   1.104 -          struct usb_ctl_report *repbuf;
   1.105 -          hid_kind_t hidkind;
   1.106 -
   1.107 -  ;
   1.108 -  return 0;
   1.109 -}
   1.110 -_ACEOF
   1.111 -if ac_fn_c_try_compile "$LINENO"; then :
   1.112 -
   1.113 -        have_usbhid=yes
   1.114 -
   1.115 -fi
   1.116 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.117 -        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5
   1.118 +                have_usbhid=no
   1.119 +                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.120 +/* end confdefs.h.  */
   1.121 +
   1.122 +                  #include <sys/types.h>
   1.123 +                  #if defined(HAVE_USB_H)
   1.124 +                  #include <usb.h>
   1.125 +                  #endif
   1.126 +                  #ifdef __DragonFly__
   1.127 +                  # include <bus/usb/usb.h>
   1.128 +                  # include <bus/usb/usbhid.h>
   1.129 +                  #else
   1.130 +                  # include <dev/usb/usb.h>
   1.131 +                  # include <dev/usb/usbhid.h>
   1.132 +                  #endif
   1.133 +                  #if defined(HAVE_USBHID_H)
   1.134 +                  #include <usbhid.h>
   1.135 +                  #elif defined(HAVE_LIBUSB_H)
   1.136 +                  #include <libusb.h>
   1.137 +                  #elif defined(HAVE_LIBUSBHID_H)
   1.138 +                  #include <libusbhid.h>
   1.139 +                  #endif
   1.140 +
   1.141 +int
   1.142 +main ()
   1.143 +{
   1.144 +
   1.145 +                  struct report_desc *repdesc;
   1.146 +                  struct usb_ctl_report *repbuf;
   1.147 +                  hid_kind_t hidkind;
   1.148 +
   1.149 +  ;
   1.150 +  return 0;
   1.151 +}
   1.152 +_ACEOF
   1.153 +if ac_fn_c_try_compile "$LINENO"; then :
   1.154 +
   1.155 +                have_usbhid=yes
   1.156 +
   1.157 +fi
   1.158 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.159 +                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5
   1.160  $as_echo "$have_usbhid" >&6; }
   1.161  
   1.162 -        if test x$have_usbhid = xyes; then
   1.163 -            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5
   1.164 +                if test x$have_usbhid = xyes; then
   1.165 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5
   1.166  $as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; }
   1.167 -            have_usbhid_ucr_data=no
   1.168 -            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.169 -/* end confdefs.h.  */
   1.170 -
   1.171 -              #include <sys/types.h>
   1.172 -              #if defined(HAVE_USB_H)
   1.173 -              #include <usb.h>
   1.174 -              #endif
   1.175 -              #ifdef __DragonFly__
   1.176 -              # include <bus/usb/usb.h>
   1.177 -              # include <bus/usb/usbhid.h>
   1.178 -              #else
   1.179 -              # include <dev/usb/usb.h>
   1.180 -              # include <dev/usb/usbhid.h>
   1.181 -              #endif
   1.182 -              #if defined(HAVE_USBHID_H)
   1.183 -              #include <usbhid.h>
   1.184 -              #elif defined(HAVE_LIBUSB_H)
   1.185 -              #include <libusb.h>
   1.186 -              #elif defined(HAVE_LIBUSBHID_H)
   1.187 -              #include <libusbhid.h>
   1.188 -              #endif
   1.189 -
   1.190 -int
   1.191 -main ()
   1.192 -{
   1.193 -
   1.194 -              struct usb_ctl_report buf;
   1.195 -              if (buf.ucr_data) { }
   1.196 -
   1.197 -  ;
   1.198 -  return 0;
   1.199 -}
   1.200 -_ACEOF
   1.201 -if ac_fn_c_try_compile "$LINENO"; then :
   1.202 -
   1.203 -            have_usbhid_ucr_data=yes
   1.204 -
   1.205 -fi
   1.206 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.207 -            if test x$have_usbhid_ucr_data = xyes; then
   1.208 -                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
   1.209 -            fi
   1.210 -            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5
   1.211 +                    have_usbhid_ucr_data=no
   1.212 +                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.213 +/* end confdefs.h.  */
   1.214 +
   1.215 +                      #include <sys/types.h>
   1.216 +                      #if defined(HAVE_USB_H)
   1.217 +                      #include <usb.h>
   1.218 +                      #endif
   1.219 +                      #ifdef __DragonFly__
   1.220 +                      # include <bus/usb/usb.h>
   1.221 +                      # include <bus/usb/usbhid.h>
   1.222 +                      #else
   1.223 +                      # include <dev/usb/usb.h>
   1.224 +                      # include <dev/usb/usbhid.h>
   1.225 +                      #endif
   1.226 +                      #if defined(HAVE_USBHID_H)
   1.227 +                      #include <usbhid.h>
   1.228 +                      #elif defined(HAVE_LIBUSB_H)
   1.229 +                      #include <libusb.h>
   1.230 +                      #elif defined(HAVE_LIBUSBHID_H)
   1.231 +                      #include <libusbhid.h>
   1.232 +                      #endif
   1.233 +
   1.234 +int
   1.235 +main ()
   1.236 +{
   1.237 +
   1.238 +                      struct usb_ctl_report buf;
   1.239 +                      if (buf.ucr_data) { }
   1.240 +
   1.241 +  ;
   1.242 +  return 0;
   1.243 +}
   1.244 +_ACEOF
   1.245 +if ac_fn_c_try_compile "$LINENO"; then :
   1.246 +
   1.247 +                    have_usbhid_ucr_data=yes
   1.248 +
   1.249 +fi
   1.250 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.251 +                    if test x$have_usbhid_ucr_data = xyes; then
   1.252 +                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
   1.253 +                    fi
   1.254 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5
   1.255  $as_echo "$have_usbhid_ucr_data" >&6; }
   1.256  
   1.257 -            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5
   1.258 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5
   1.259  $as_echo_n "checking for new usbhid API... " >&6; }
   1.260 -            have_usbhid_new=no
   1.261 -            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.262 -/* end confdefs.h.  */
   1.263 -
   1.264 -              #include <sys/types.h>
   1.265 -              #if defined(HAVE_USB_H)
   1.266 -              #include <usb.h>
   1.267 -              #endif
   1.268 -              #ifdef __DragonFly__
   1.269 -              #include <bus/usb/usb.h>
   1.270 -              #include <bus/usb/usbhid.h>
   1.271 -              #else
   1.272 -              #include <dev/usb/usb.h>
   1.273 -              #include <dev/usb/usbhid.h>
   1.274 -              #endif
   1.275 -              #if defined(HAVE_USBHID_H)
   1.276 -              #include <usbhid.h>
   1.277 -              #elif defined(HAVE_LIBUSB_H)
   1.278 -              #include <libusb.h>
   1.279 -              #elif defined(HAVE_LIBUSBHID_H)
   1.280 -              #include <libusbhid.h>
   1.281 -              #endif
   1.282 -
   1.283 -int
   1.284 -main ()
   1.285 -{
   1.286 -
   1.287 -              report_desc_t d;
   1.288 -              hid_start_parse(d, 1, 1);
   1.289 -
   1.290 -  ;
   1.291 -  return 0;
   1.292 -}
   1.293 -_ACEOF
   1.294 -if ac_fn_c_try_compile "$LINENO"; then :
   1.295 -
   1.296 -            have_usbhid_new=yes
   1.297 -
   1.298 -fi
   1.299 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.300 -            if test x$have_usbhid_new = xyes; then
   1.301 -                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
   1.302 -            fi
   1.303 -            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5
   1.304 +                    have_usbhid_new=no
   1.305 +                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.306 +/* end confdefs.h.  */
   1.307 +
   1.308 +                      #include <sys/types.h>
   1.309 +                      #if defined(HAVE_USB_H)
   1.310 +                      #include <usb.h>
   1.311 +                      #endif
   1.312 +                      #ifdef __DragonFly__
   1.313 +                      #include <bus/usb/usb.h>
   1.314 +                      #include <bus/usb/usbhid.h>
   1.315 +                      #else
   1.316 +                      #include <dev/usb/usb.h>
   1.317 +                      #include <dev/usb/usbhid.h>
   1.318 +                      #endif
   1.319 +                      #if defined(HAVE_USBHID_H)
   1.320 +                      #include <usbhid.h>
   1.321 +                      #elif defined(HAVE_LIBUSB_H)
   1.322 +                      #include <libusb.h>
   1.323 +                      #elif defined(HAVE_LIBUSBHID_H)
   1.324 +                      #include <libusbhid.h>
   1.325 +                      #endif
   1.326 +
   1.327 +int
   1.328 +main ()
   1.329 +{
   1.330 +
   1.331 +                      report_desc_t d;
   1.332 +                      hid_start_parse(d, 1, 1);
   1.333 +
   1.334 +  ;
   1.335 +  return 0;
   1.336 +}
   1.337 +_ACEOF
   1.338 +if ac_fn_c_try_compile "$LINENO"; then :
   1.339 +
   1.340 +                    have_usbhid_new=yes
   1.341 +
   1.342 +fi
   1.343 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.344 +                    if test x$have_usbhid_new = xyes; then
   1.345 +                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
   1.346 +                    fi
   1.347 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5
   1.348  $as_echo "$have_usbhid_new" >&6; }
   1.349  
   1.350 -            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5
   1.351 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5
   1.352  $as_echo_n "checking for struct joystick in machine/joystick.h... " >&6; }
   1.353 -            have_machine_joystick=no
   1.354 -            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.355 -/* end confdefs.h.  */
   1.356 -
   1.357 -              #include <machine/joystick.h>
   1.358 -
   1.359 -int
   1.360 -main ()
   1.361 -{
   1.362 -
   1.363 -              struct joystick t;
   1.364 -
   1.365 -  ;
   1.366 -  return 0;
   1.367 -}
   1.368 -_ACEOF
   1.369 -if ac_fn_c_try_compile "$LINENO"; then :
   1.370 -
   1.371 -            have_machine_joystick=yes
   1.372 -
   1.373 -fi
   1.374 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.375 -            if test x$have_machine_joystick = xyes; then
   1.376 +                    have_machine_joystick=no
   1.377 +                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.378 +/* end confdefs.h.  */
   1.379 +
   1.380 +                      #include <machine/joystick.h>
   1.381 +
   1.382 +int
   1.383 +main ()
   1.384 +{
   1.385 +
   1.386 +                      struct joystick t;
   1.387 +
   1.388 +  ;
   1.389 +  return 0;
   1.390 +}
   1.391 +_ACEOF
   1.392 +if ac_fn_c_try_compile "$LINENO"; then :
   1.393 +
   1.394 +                    have_machine_joystick=yes
   1.395 +
   1.396 +fi
   1.397 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   1.398 +                    if test x$have_machine_joystick = xyes; then
   1.399  
   1.400  $as_echo "#define SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H 1" >>confdefs.h
   1.401  
   1.402 -            fi
   1.403 -            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5
   1.404 +                    fi
   1.405 +                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5
   1.406  $as_echo "$have_machine_joystick" >&6; }
   1.407  
   1.408  
   1.409  $as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h
   1.410  
   1.411 -            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
   1.412 -            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
   1.413 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
   1.414 -            have_joystick=yes
   1.415 -        fi
   1.416 -        CFLAGS="$save_CFLAGS"
   1.417 -    fi
   1.418 +                    SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
   1.419 +                    EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
   1.420 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
   1.421 +                    have_joystick=yes
   1.422 +                fi
   1.423 +                CFLAGS="$save_CFLAGS"
   1.424 +            fi
   1.425 +        ;;
   1.426 +    esac
   1.427  }
   1.428  
   1.429  CheckClockGettime()
     2.1 --- a/configure.in	Sun Oct 13 19:48:45 2013 -0700
     2.2 +++ b/configure.in	Sun Oct 13 19:49:45 2013 -0700
     2.3 @@ -2189,138 +2189,142 @@
     2.4  dnl Check for the usbhid(3) library on *BSD
     2.5  CheckUSBHID()
     2.6  {
     2.7 -    if test x$enable_joystick = xyes; then
     2.8 -        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
     2.9 -        if test x$have_libusbhid = xyes; then
    2.10 -            AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
    2.11 -            AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
    2.12 -            USB_LIBS="$USB_LIBS -lusbhid"
    2.13 -        else
    2.14 -            AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
    2.15 -            AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
    2.16 -            AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
    2.17 -        fi
    2.18 -            
    2.19 -        save_CFLAGS="$CFLAGS"
    2.20 -        CFLAGS="$CFLAGS $USB_CFLAGS"
    2.21 +    case "$host" in
    2.22 +        *-*-*bsd*)
    2.23 +            if test x$enable_joystick = xyes; then
    2.24 +                AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
    2.25 +                if test x$have_libusbhid = xyes; then
    2.26 +                    AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
    2.27 +                    AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
    2.28 +                    USB_LIBS="$USB_LIBS -lusbhid"
    2.29 +                else
    2.30 +                    AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
    2.31 +                    AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
    2.32 +                    AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
    2.33 +                fi
    2.34 +                    
    2.35 +                save_CFLAGS="$CFLAGS"
    2.36 +                CFLAGS="$CFLAGS $USB_CFLAGS"
    2.37  
    2.38 -        AC_MSG_CHECKING(for usbhid)
    2.39 -        have_usbhid=no
    2.40 -        AC_TRY_COMPILE([
    2.41 -          #include <sys/types.h>
    2.42 -          #if defined(HAVE_USB_H)
    2.43 -          #include <usb.h>
    2.44 -          #endif
    2.45 -          #ifdef __DragonFly__
    2.46 -          # include <bus/usb/usb.h>
    2.47 -          # include <bus/usb/usbhid.h>
    2.48 -          #else
    2.49 -          # include <dev/usb/usb.h>
    2.50 -          # include <dev/usb/usbhid.h>
    2.51 -          #endif
    2.52 -          #if defined(HAVE_USBHID_H)
    2.53 -          #include <usbhid.h>
    2.54 -          #elif defined(HAVE_LIBUSB_H)
    2.55 -          #include <libusb.h>
    2.56 -          #elif defined(HAVE_LIBUSBHID_H)
    2.57 -          #include <libusbhid.h>
    2.58 -          #endif
    2.59 -        ],[
    2.60 -          struct report_desc *repdesc;
    2.61 -          struct usb_ctl_report *repbuf;
    2.62 -          hid_kind_t hidkind;
    2.63 -        ],[
    2.64 -        have_usbhid=yes
    2.65 -        ])
    2.66 -        AC_MSG_RESULT($have_usbhid)
    2.67 +                AC_MSG_CHECKING(for usbhid)
    2.68 +                have_usbhid=no
    2.69 +                AC_TRY_COMPILE([
    2.70 +                  #include <sys/types.h>
    2.71 +                  #if defined(HAVE_USB_H)
    2.72 +                  #include <usb.h>
    2.73 +                  #endif
    2.74 +                  #ifdef __DragonFly__
    2.75 +                  # include <bus/usb/usb.h>
    2.76 +                  # include <bus/usb/usbhid.h>
    2.77 +                  #else
    2.78 +                  # include <dev/usb/usb.h>
    2.79 +                  # include <dev/usb/usbhid.h>
    2.80 +                  #endif
    2.81 +                  #if defined(HAVE_USBHID_H)
    2.82 +                  #include <usbhid.h>
    2.83 +                  #elif defined(HAVE_LIBUSB_H)
    2.84 +                  #include <libusb.h>
    2.85 +                  #elif defined(HAVE_LIBUSBHID_H)
    2.86 +                  #include <libusbhid.h>
    2.87 +                  #endif
    2.88 +                ],[
    2.89 +                  struct report_desc *repdesc;
    2.90 +                  struct usb_ctl_report *repbuf;
    2.91 +                  hid_kind_t hidkind;
    2.92 +                ],[
    2.93 +                have_usbhid=yes
    2.94 +                ])
    2.95 +                AC_MSG_RESULT($have_usbhid)
    2.96  
    2.97 -        if test x$have_usbhid = xyes; then
    2.98 -            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
    2.99 -            have_usbhid_ucr_data=no
   2.100 -            AC_TRY_COMPILE([
   2.101 -              #include <sys/types.h>
   2.102 -              #if defined(HAVE_USB_H)
   2.103 -              #include <usb.h>
   2.104 -              #endif
   2.105 -              #ifdef __DragonFly__
   2.106 -              # include <bus/usb/usb.h>
   2.107 -              # include <bus/usb/usbhid.h>
   2.108 -              #else
   2.109 -              # include <dev/usb/usb.h>
   2.110 -              # include <dev/usb/usbhid.h>
   2.111 -              #endif
   2.112 -              #if defined(HAVE_USBHID_H)
   2.113 -              #include <usbhid.h>
   2.114 -              #elif defined(HAVE_LIBUSB_H)
   2.115 -              #include <libusb.h>
   2.116 -              #elif defined(HAVE_LIBUSBHID_H)
   2.117 -              #include <libusbhid.h>
   2.118 -              #endif
   2.119 -            ],[
   2.120 -              struct usb_ctl_report buf;
   2.121 -              if (buf.ucr_data) { }
   2.122 -            ],[
   2.123 -            have_usbhid_ucr_data=yes
   2.124 -            ])
   2.125 -            if test x$have_usbhid_ucr_data = xyes; then
   2.126 -                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
   2.127 +                if test x$have_usbhid = xyes; then
   2.128 +                    AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
   2.129 +                    have_usbhid_ucr_data=no
   2.130 +                    AC_TRY_COMPILE([
   2.131 +                      #include <sys/types.h>
   2.132 +                      #if defined(HAVE_USB_H)
   2.133 +                      #include <usb.h>
   2.134 +                      #endif
   2.135 +                      #ifdef __DragonFly__
   2.136 +                      # include <bus/usb/usb.h>
   2.137 +                      # include <bus/usb/usbhid.h>
   2.138 +                      #else
   2.139 +                      # include <dev/usb/usb.h>
   2.140 +                      # include <dev/usb/usbhid.h>
   2.141 +                      #endif
   2.142 +                      #if defined(HAVE_USBHID_H)
   2.143 +                      #include <usbhid.h>
   2.144 +                      #elif defined(HAVE_LIBUSB_H)
   2.145 +                      #include <libusb.h>
   2.146 +                      #elif defined(HAVE_LIBUSBHID_H)
   2.147 +                      #include <libusbhid.h>
   2.148 +                      #endif
   2.149 +                    ],[
   2.150 +                      struct usb_ctl_report buf;
   2.151 +                      if (buf.ucr_data) { }
   2.152 +                    ],[
   2.153 +                    have_usbhid_ucr_data=yes
   2.154 +                    ])
   2.155 +                    if test x$have_usbhid_ucr_data = xyes; then
   2.156 +                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
   2.157 +                    fi
   2.158 +                    AC_MSG_RESULT($have_usbhid_ucr_data)
   2.159 +                    
   2.160 +                    AC_MSG_CHECKING(for new usbhid API)
   2.161 +                    have_usbhid_new=no
   2.162 +                    AC_TRY_COMPILE([
   2.163 +                      #include <sys/types.h>
   2.164 +                      #if defined(HAVE_USB_H)
   2.165 +                      #include <usb.h>
   2.166 +                      #endif
   2.167 +                      #ifdef __DragonFly__
   2.168 +                      #include <bus/usb/usb.h>
   2.169 +                      #include <bus/usb/usbhid.h>
   2.170 +                      #else
   2.171 +                      #include <dev/usb/usb.h>
   2.172 +                      #include <dev/usb/usbhid.h>
   2.173 +                      #endif
   2.174 +                      #if defined(HAVE_USBHID_H)
   2.175 +                      #include <usbhid.h>
   2.176 +                      #elif defined(HAVE_LIBUSB_H)
   2.177 +                      #include <libusb.h>
   2.178 +                      #elif defined(HAVE_LIBUSBHID_H)
   2.179 +                      #include <libusbhid.h>
   2.180 +                      #endif
   2.181 +                    ],[
   2.182 +                      report_desc_t d;
   2.183 +                      hid_start_parse(d, 1, 1);
   2.184 +                    ],[
   2.185 +                    have_usbhid_new=yes
   2.186 +                    ])
   2.187 +                    if test x$have_usbhid_new = xyes; then
   2.188 +                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
   2.189 +                    fi
   2.190 +                    AC_MSG_RESULT($have_usbhid_new)
   2.191 +
   2.192 +                    AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
   2.193 +                    have_machine_joystick=no
   2.194 +                    AC_TRY_COMPILE([
   2.195 +                      #include <machine/joystick.h>
   2.196 +                    ],[
   2.197 +                      struct joystick t;
   2.198 +                    ],[
   2.199 +                    have_machine_joystick=yes
   2.200 +                    ])
   2.201 +                    if test x$have_machine_joystick = xyes; then
   2.202 +                        AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
   2.203 +                    fi
   2.204 +                    AC_MSG_RESULT($have_machine_joystick)
   2.205 +
   2.206 +                    AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
   2.207 +                    SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
   2.208 +                    EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
   2.209 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
   2.210 +                    have_joystick=yes
   2.211 +                fi
   2.212 +                CFLAGS="$save_CFLAGS"
   2.213              fi
   2.214 -            AC_MSG_RESULT($have_usbhid_ucr_data)
   2.215 -            
   2.216 -            AC_MSG_CHECKING(for new usbhid API)
   2.217 -            have_usbhid_new=no
   2.218 -            AC_TRY_COMPILE([
   2.219 -              #include <sys/types.h>
   2.220 -              #if defined(HAVE_USB_H)
   2.221 -              #include <usb.h>
   2.222 -              #endif
   2.223 -              #ifdef __DragonFly__
   2.224 -              #include <bus/usb/usb.h>
   2.225 -              #include <bus/usb/usbhid.h>
   2.226 -              #else
   2.227 -              #include <dev/usb/usb.h>
   2.228 -              #include <dev/usb/usbhid.h>
   2.229 -              #endif
   2.230 -              #if defined(HAVE_USBHID_H)
   2.231 -              #include <usbhid.h>
   2.232 -              #elif defined(HAVE_LIBUSB_H)
   2.233 -              #include <libusb.h>
   2.234 -              #elif defined(HAVE_LIBUSBHID_H)
   2.235 -              #include <libusbhid.h>
   2.236 -              #endif
   2.237 -            ],[
   2.238 -              report_desc_t d;
   2.239 -              hid_start_parse(d, 1, 1);
   2.240 -            ],[
   2.241 -            have_usbhid_new=yes
   2.242 -            ])
   2.243 -            if test x$have_usbhid_new = xyes; then
   2.244 -                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
   2.245 -            fi
   2.246 -            AC_MSG_RESULT($have_usbhid_new)
   2.247 -
   2.248 -            AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
   2.249 -            have_machine_joystick=no
   2.250 -            AC_TRY_COMPILE([
   2.251 -              #include <machine/joystick.h>
   2.252 -            ],[
   2.253 -              struct joystick t;
   2.254 -            ],[
   2.255 -            have_machine_joystick=yes
   2.256 -            ])
   2.257 -            if test x$have_machine_joystick = xyes; then
   2.258 -                AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
   2.259 -            fi
   2.260 -            AC_MSG_RESULT($have_machine_joystick)
   2.261 -
   2.262 -            AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
   2.263 -            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
   2.264 -            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
   2.265 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
   2.266 -            have_joystick=yes
   2.267 -        fi
   2.268 -        CFLAGS="$save_CFLAGS"
   2.269 -    fi
   2.270 +        ;;
   2.271 +    esac
   2.272  }
   2.273  
   2.274  dnl Check for clock_gettime()
     3.1 --- a/test/configure	Sun Oct 13 19:48:45 2013 -0700
     3.2 +++ b/test/configure	Sun Oct 13 19:49:45 2013 -0700
     3.3 @@ -586,8 +586,8 @@
     3.4  LIBOBJS
     3.5  SDL_TTF_LIB
     3.6  XLIB
     3.7 +GLESLIB
     3.8  GLLIB
     3.9 -GLESLIB
    3.10  CPP
    3.11  XMKMF
    3.12  SDL_CONFIG
    3.13 @@ -3874,6 +3874,7 @@
    3.14  
    3.15  
    3.16  
    3.17 +
    3.18  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5
    3.19  $as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; }
    3.20  if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then :