This is an automated email from Gerrit.

Jan Dakinevich (jan.dakinev...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/491

-- gerrit

commit e6d70a5d4daea1301e243f7373db22d564228ca6
Author: Jan Dakinevich <jan.dakinev...@gmail.com>
Date:   Mon Feb 27 19:00:18 2012 +0400

    build: fix for libusb1 under FreeBSD
    
    The configuration script checked for for existence of <libusb-1.0/libusb.h>
    header and tested linking with -lusb-1.0. This is not valid at a FreeBSD
    host.
    
    Change-Id: Ic48b5338d54ab05da2fa69370e27cdb2d2808b31
    Signed-off-by: Jan Dakinevich <jan.dakinev...@gmail.com>

diff --git a/configure.ac b/configure.ac
index ffab637..571cf36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,7 @@ is_cygwin=no
 is_mingw=no
 is_win32=no
 is_darwin=no
+is_freebsd=no
 
 # guess-rev.sh only exists in the repository, not in the released archives
 AC_MSG_CHECKING([whether to build a release])
@@ -563,6 +564,7 @@ case $host in
 
     AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
     AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
+    AC_DEFINE([IS_FREEBSD], [0], [0 if not building for FreeBSD.])
     ;;
   *-mingw*)
     is_mingw=yes
@@ -583,6 +585,7 @@ case $host in
     AC_DEFINE([IS_MINGW], [1], [1 if building for MinGW.])
     AC_DEFINE([IS_WIN32], [1], [1 if building for Win32.])
     AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
+    AC_DEFINE([IS_FREEBSD], [0], [0 if not building for FreeBSD.])
     ;;
   *darwin*)
     is_darwin=yes
@@ -595,6 +598,15 @@ case $host in
     AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
     AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
     AC_DEFINE([IS_DARWIN], [1], [1 if building for Darwin.])
+    AC_DEFINE([IS_FREEBSD], [0], [0 if not building for FreeBSD.])
+    ;;
+  *freebsd*)
+    is_freebsd=yes
+
+    AC_DEFINE([IS_CYGWIN], [0], [0 if not building for Cygwin.])
+    AC_DEFINE([IS_WIN32], [0], [0 if not building for Win32.])
+    AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.])
+    AC_DEFINE([IS_FREEBSD], [1], [1 if building for FreeBSD.])    
     ;;
   *)
     if test x$parport_use_giveio = xyes; then
@@ -1078,9 +1090,14 @@ use_libusb0=no
 use_libusb1=no
 if test $build_usb = yes -o $build_usb_ng = yes; then
   if test $check_libusb0 = no -a $build_usb_ng = yes; then
-       AC_CHECK_HEADER([libusb-1.0/libusb.h],
+    if test $is_freebsd = yes; then
+      libusb1_header="libusb.h"      
+    else
+      libusb1_header="libusb-1.0/libusb.h"
+    fi
+    AC_CHECK_HEADER([$libusb1_header],
                        [AC_DEFINE(HAVE_LIBUSB1, 1, [Define if you have 
libusb-1.0]) check_libusb0=no use_libusb1=yes ],
-                       [ check_libusb0=yes use_libusb1=no ])
+                       [ check_libusb0=yes use_libusb1=no ])  
   fi
 
   if test $check_libusb0 = yes -o $build_usb = yes; then
@@ -1126,6 +1143,7 @@ AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
 AM_CONDITIONAL([IS_MINGW], [test $is_mingw = ye]s)
 AM_CONDITIONAL([IS_WIN32], [test $is_win32 = ye]s)
 AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = ye]s)
+AM_CONDITIONAL([IS_FREEBSD], [test $is_freebsd = yes])
 AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
 
 AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = ye]s)
diff --git a/src/Makefile.am b/src/Makefile.am
index 3a92fff..bc9ab2f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,8 +83,12 @@ endif
 
 LIBUSB =
 if USE_LIBUSB1
+if IS_FREEBSD
+LIBUSB += -lusb
+else
 LIBUSB += -lusb-1.0
 endif
+endif
 
 if USE_LIBUSB0
 LIBUSB += -lusb
diff --git a/src/jtag/drivers/libusb1_common.h 
b/src/jtag/drivers/libusb1_common.h
index 2c570fa..a1ea3dd 100644
--- a/src/jtag/drivers/libusb1_common.h
+++ b/src/jtag/drivers/libusb1_common.h
@@ -23,7 +23,11 @@
 #define JTAG_LIBUSB_COMMON_H
 
 #include <helper/types.h>
-#include <libusb-1.0/libusb.h>
+#if IS_FREEBSD == 1
+#      include <libusb.h>
+#else
+#      include <libusb-1.0/libusb.h>
+#endif
 
 #define jtag_libusb_device                     libusb_device
 #define jtag_libusb_device_handle              libusb_device_handle

-- 

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to