libftdi Archives

Subject: libftdi on FreeBSD

From: Joerg Wunsch <libftdi@xxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 8 Sep 2011 21:07:17 +0200
OK, this describes my observations when trying to compile the git
version of libftdi on FreeBSD.  (Before, I've only been using the
stable versions through the FreeBSD ports system, where someone else
"moderates" any build issues and the like.)

First, FreeBSD 8.x (and above) ships with a native libusb that is API
compatible to both, the old 0.1 as well as the 1.0 API.  All this is
in libusb.a/libusb.so.  However, there is no tool like libusb-config
configure.in relies on.

The FreeBSD port currently removes all the checks for libusb-config
and the libusb version, and then just sets

LIBS="$LIBS -lusb"

(and reruns the auto* tools)

Perhaps there could be a better way for that so FreeBSD doesn't have
to muck around with that?


Second, many of the examples use EXIT_SUCCESS and EXIT_FAILURE, yet
they don't #include <stdlib.h> where these constants are located,
according to the C standard.  The patch below fixes that.

diff -ur libftdi-e5fe881.orig/examples/baud_test.c 
libftdi-e5fe881/examples/baud_test.c
--- libftdi-e5fe881.orig/examples/baud_test.c   2011-07-08 13:45:56.000000000 
+0200
+++ libftdi-e5fe881/examples/baud_test.c        2011-09-05 22:12:20.000000000 
+0200
@@ -31,6 +31,7 @@
 
 #include <sys/time.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <ftdi.h>
 
diff -ur libftdi-e5fe881.orig/examples/bitbang.c 
libftdi-e5fe881/examples/bitbang.c
--- libftdi-e5fe881.orig/examples/bitbang.c     2011-07-08 13:45:56.000000000 
+0200
+++ libftdi-e5fe881/examples/bitbang.c  2011-09-05 22:11:06.000000000 +0200
@@ -1,6 +1,7 @@
 /* This program is distributed under the GPL, version 2 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef __WIN32__
 #define sleep(x) Sleep(x)
diff -ur libftdi-e5fe881.orig/examples/bitbang2.c 
libftdi-e5fe881/examples/bitbang2.c
--- libftdi-e5fe881.orig/examples/bitbang2.c    2011-07-08 13:45:56.000000000 
+0200
+++ libftdi-e5fe881/examples/bitbang2.c 2011-09-05 22:11:18.000000000 +0200
@@ -30,6 +30,7 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef __WIN32__
 #define usleep(x) Sleep((x+999)/1000)
diff -ur libftdi-e5fe881.orig/examples/bitbang_ft2232.c 
libftdi-e5fe881/examples/bitbang_ft2232.c
--- libftdi-e5fe881.orig/examples/bitbang_ft2232.c      2011-07-08 
13:45:56.000000000 +0200
+++ libftdi-e5fe881/examples/bitbang_ft2232.c   2011-09-05 22:11:34.000000000 
+0200
@@ -9,6 +9,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef __WIN32__
 #define sleep(x) _sleep(x)
diff -ur libftdi-e5fe881.orig/examples/find_all.c 
libftdi-e5fe881/examples/find_all.c
--- libftdi-e5fe881.orig/examples/find_all.c    2011-07-08 13:45:56.000000000 
+0200
+++ libftdi-e5fe881/examples/find_all.c 2011-09-05 22:11:49.000000000 +0200
@@ -6,6 +6,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ftdi.h>
 
 int main(void)
diff -ur libftdi-e5fe881.orig/examples/serial_read.c 
libftdi-e5fe881/examples/serial_read.c
--- libftdi-e5fe881.orig/examples/serial_read.c 2011-07-08 13:45:56.000000000 
+0200
+++ libftdi-e5fe881/examples/serial_read.c      2011-09-05 22:12:02.000000000 
+0200
@@ -6,6 +6,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <ftdi.h>
diff -ur libftdi-e5fe881.orig/examples/simple.c 
libftdi-e5fe881/examples/simple.c
--- libftdi-e5fe881.orig/examples/simple.c      2011-07-08 13:45:56.000000000 
+0200
+++ libftdi-e5fe881/examples/simple.c   2011-09-05 22:10:50.000000000 +0200
@@ -6,6 +6,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ftdi.h>
 
 int main(void)

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread