[PD-dev] [patch] pd-0.40-test2 compiles and runs on FreeBSD 6.0

mal content artifact.one at googlemail.com
Fri Jun 2 12:40:42 CEST 2006


Should this go in the bug tracker? I don't know where I should be
submitting patches.

--- configure.in.orig	Thu Jun  1 11:29:43 2006
+++ configure.in	Fri Jun  2 11:23:16 2006
@@ -81,63 +81,161 @@

 dnl look for tcl 8.x... do I really have to go through all this!?

-foundit=no
-if test $foundit == "no";
+dnl need to modify CFLAGS and LDFLAGS on FreeBSD in order to search
+dnl /usr/local/*
+
+if test `uname -s` = FreeBSD;
+then
+  CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+  LDFLAGS="$LDFLAGS -L/usr/local/lib"
+  GUIFLAGS="-I/usr/X11R6/include "
+
+  dnl the tk headers require some quite incredible contortions to
+  dnl get any sort of test compilation working from autoconf.
+  dnl it seems to be easier just to check for the existance of tk.h
+  dnl instead of trying to get autoconf to do the right thing
+
+  foundtk=no
+  if test -f "/usr/local/include/tk8.7/tk.h"
+  then
+    GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.7"
+    foundtk=yes
+  fi
+  if test $foundtk == "no"
+  then
+    if test -f "/usr/local/include/tk8.6/tk.h"
+    then
+      GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.6"
+      foundtk=yes
+    fi
+  fi
+  if test $foundtk == "no"
+  then
+    if test -f "/usr/local/include/tk8.5/tk.h"
+    then
+      GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.5"
+      foundtk=yes
+    fi
+  fi
+  if test $foundtk == "no"
+  then
+    if test -f "/usr/local/include/tk8.4/tk.h"
+    then
+      GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.4"
+      foundtk=yes
+    fi
+  fi
+  if test $foundtk == "no"
+  then
+    if test -f "/usr/local/include/tk8.3/tk.h"
+    then
+      GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.3"
+      foundtk=yes
+    fi
+  fi
+  if test $foundtk == "no"
+  then
+    if test -f "/usr/local/include/tk8.2/tk.h"
+    then
+      GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.2"
+      foundtk=yes
+    fi
+  fi
+  if test $foundtk == "no"
+  then
+    if test -f "/usr/local/include/tk8.0/tk.h"
+    then
+      GUIFLAGS="$GUIFLAGS -I/usr/local/include/tk8.0"
+      foundtk=yes
+    fi
+  fi
+  if test $foundtk == "no"
+  then
+    echo no tk header found
+    exit -1
+  fi
+fi
+
+foundtcl=no
+if test $foundtcl == "no";
 then
-    AC_CHECK_HEADER(tcl.h,foundit=yes,)
+    AC_CHECK_HEADER(tcl.h,foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     AC_CHECK_HEADER(tcl8.7/tcl.h,
-    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.7";foundit=yes,)
+    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.7 \
+                -I/usr/include/tcl8.7";foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     AC_CHECK_HEADER(tcl8.6/tcl.h,
-    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.6";foundit=yes,)
+    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.6 \
+                -I/usr/include/tcl8.6";foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     AC_CHECK_HEADER(tcl8.5/tcl.h,
-    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.5";foundit=yes,)
+    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.5 \
+                -I/usr/include/tcl8.5";foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     AC_CHECK_HEADER(tcl8.4/tcl.h,
-    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.4";foundit=yes,)
+    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4 \
+                -I/usr/include/tcl8.4";foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     AC_CHECK_HEADER(tcl8.3/tcl.h,
-    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.3";foundit=yes,)
+    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.3 \
+                -I/usr/include/tcl8.3";foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     AC_CHECK_HEADER(tcl8.2/tcl.h,
-    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.2";foundit=yes,)
+    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.2 \
+                -I/usr/include/tcl8.2";foundtcl=yes,)
 fi
-if test $foundit == "no";
+if test $foundtcl == "no";
 then
     echo no tcl header found
     exit -1
 fi

+dnl FreeBSD has libtcl8X.so, not libtcl8.X.so
+
 AC_CHECK_LIB(tcl8.7, main,,
+AC_CHECK_LIB(tcl87, main,,
     AC_CHECK_LIB(tcl8.6, main,,
+  AC_CHECK_LIB(tcl86, main,,
 	AC_CHECK_LIB(tcl8.5, main,,
+   AC_CHECK_LIB(tcl85, main,,
 	    AC_CHECK_LIB(tcl8.4, main,,
+     AC_CHECK_LIB(tcl84, main,,
 		AC_CHECK_LIB(tcl8.3, main,,
+       AC_CHECK_LIB(tcl83, main,,
 		    AC_CHECK_LIB(tcl8.2, main,,
-        		AC_CHECK_LIB(tcl8.0, main,,echo no tcl library found || exit 1)))))))
+         AC_CHECK_LIB(tcl82, main,,
+           AC_CHECK_LIB(tcl8.0, main,,
+           AC_CHECK_LIB(tcl80, main,,echo no tcl library found ||
exit 1))))))))))))))
+
+dnl FreeBSD has libtk8X.so, not libtk8.X.so

 AC_CHECK_LIB(tk8.7, main,,
+AC_CHECK_LIB(tk87, main,,
     AC_CHECK_LIB(tk8.6, main,,
+  AC_CHECK_LIB(tk86, main,,
 	AC_CHECK_LIB(tk8.5, main,,
+    AC_CHECK_LIB(tk85, main,,
 	    AC_CHECK_LIB(tk8.4, main,,
+      AC_CHECK_LIB(tk84, main,,
 		AC_CHECK_LIB(tk8.3, main,,
+        AC_CHECK_LIB(tk83, main,,
 		    AC_CHECK_LIB(tk8.2, main,,
-        		AC_CHECK_LIB(tk8.0, main,,echo no tk library found || exit 1)))))))
-
+          AC_CHECK_LIB(tk82, main,,
+            AC_CHECK_LIB(tk8.0, main,,
+            AC_CHECK_LIB(tk80, main,, echo no tk library found ||
exit 1))))))))))))))

 if test `uname -s` = Linux;
 then
@@ -322,6 +420,38 @@
     then
         LDFLAGS=$LDFLAGS" -weak_framework Jack"
     fi
+fi
+
+if test `uname -s` = FreeBSD;
+then
+    EXT=pd_freebsd
+    MORECFLAGS="-DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD\
+      -DUSEAPI_OSS \
+      -I../portaudio/pa_common \
+      -I../portaudio/pablio -I../portaudio/portmidi-macosx \
+      -Werror -fno-strict-aliasing"
+    SYSSRC="s_audio_oss.c s_midi_oss.c "
+    if test x$portaudio == "xyes";
+    then
+      MORECFLAGS="$MORECFLAGS -DUSEAPI_PORTAUDIO "
+      SYSSRC=$SYSSRC"s_audio_pa.c \
+        ../portaudio/pa_common/pa_allocation.c  \
+        ../portaudio/pa_common/pa_converters.c  \
+        ../portaudio/pa_common/pa_cpuload.c     \
+        ../portaudio/pa_common/pa_dither.c      \
+        ../portaudio/pa_common/pa_front.c       \
+        ../portaudio/pa_common/pa_process.c     \
+        ../portaudio/pa_common/pa_skeleton.c    \
+        ../portaudio/pa_common/pa_stream.c      \
+        ../portaudio/pa_common/pa_trace.c       \
+        ../portaudio/pablio/pablio_pd.c         \
+        ../portaudio/pablio/ringbuffer_pd.c     \
+        ../portaudio/pa_unix/pa_unix_hostapis.c \
+        ../portaudio/pa_unix/pa_unix_util.c     \
+        ../portaudio/pa_unix_oss/pa_unix_oss.c "
+    fi
+    GUINAME="pd-gui"
+    OSNUMBER=0
 fi

 # support for jack, on either linux or darwin:
--- d_osc.c.orig	Thu Jun  1 12:42:15 2006
+++ d_osc.c	Thu Jun  1 13:13:54 2006
@@ -30,6 +30,11 @@
 #include <machine/endian.h>
 #endif

+#if defined(__FreeBSD__)
+#define __BYTE_ORDER _BYTE_ORDER
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#endif
+
 #ifdef __APPLE__
 #define __BYTE_ORDER BYTE_ORDER
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
--- makefile.in.orig	Fri Jun  2 11:25:07 2006
+++ makefile.in	Fri Jun  2 11:26:01 2006
@@ -99,9 +99,11 @@
 	cd ../obj;  $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
 	$(LIB)

+# why does LDFLAGS need to be specified here? why doesn't it carry
+# over from ./configure? the config.log says it should
 $(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
 	cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) \
-	$(GLIB)
+	$(LDFLAGS) $(GLIB)

 $(BIN_DIR)/pd.tk: u_main.tk
 	cp u_main.tk $(BIN_DIR)/pd.tk
--- s_audio_oss.c.orig	Thu Jun  1 12:22:20 2006
+++ s_audio_oss.c	Thu Jun  1 13:13:54 2006
@@ -5,7 +5,12 @@

 /* this file inputs and outputs audio using the OSS API available on linux. */

+/* OSS != Linux */
+#if defined(__FreeBSD__)
+#include <sys/soundcard.h>
+#else
 #include <linux/soundcard.h>
+#endif

 #include "m_pd.h"
 #include "s_stuff.h"
--- s_stuff.h.orig	Thu Jun  1 12:26:28 2006
+++ s_stuff.h	Thu Jun  1 13:13:54 2006
@@ -174,6 +174,10 @@
 #define API_DEFAULT API_OSS
 #define API_DEFSTRING "OSS"
 #endif
+#ifdef __FreeBSD__
+#define API_DEFAULT API_OSS
+#define API_DEFSTRING "OSS"
+#endif
 #ifdef MSW
 #define API_DEFAULT API_MMIO
 #define API_DEFSTRING "MMIO"
--- t_tkcmd.c.orig	Fri Jun  2 11:21:19 2006
+++ t_tkcmd.c	Fri Jun  2 11:21:34 2006
@@ -50,6 +50,10 @@
 #define STARTGUI
 #endif

+#ifdef __FreeBSD__
+#define STARTGUI
+#endif
+
 #define FIRSTPORTNUM 5600

 void tcl_mess(char *s);
--- x_list.c.orig	Thu Jun  1 12:40:36 2006
+++ x_list.c	Thu Jun  1 13:13:54 2006
@@ -4,10 +4,16 @@

 #include "m_pd.h"
 /* #include <string.h> */
+
 #ifdef MSW
 #include <malloc.h>
 #else
+/* stuff in malloc.h and alloca.h is in stdlib.h on FreeBSD */
+#if defined(__FreeBSD__)
+#include <stdlib.h>
+#else
 #include <alloca.h>
+#endif
 #endif

 extern t_pd *newest;




More information about the Pd-dev mailing list