1diff -urwN nxesd-orig/Makefile.am nxesd/Makefile.am
2--- nxesd-orig/Makefile.am	2007-05-29 12:06:31.000000000 +0200
3+++ nxesd/Makefile.am	2009-07-16 01:12:14.000000000 +0200
4@@ -8,8 +8,8 @@
5 INCLUDES = $(AUDIOFILE_CFLAGS) -DSYSCONFDIR=\"$(sysconfdir)\" \
6     -DSERVERDIR=\"$(ESD_DIR)\"
7
8-if BUILD_ESDDSP
9-ESDDSP = esddsp
10+if BUILD_NXESDDSP
11+NXESDDSP = nxesddsp
12 libesddsp_la = libesddsp.la
13 endif
14 if BUILD_ESDPLAY
15@@ -23,7 +23,7 @@
16 endif
17
18 bin_SCRIPTS = \
19-	$(ESDDSP)	\
20+	$(NXESDDSP)	\
21 	esd-config
22
23 lib_LTLIBRARIES = libesd.la $(libesddsp_la)
24@@ -72,7 +72,7 @@
25 esddir = @ESD_DIR@
26
27 esd_PROGRAMS = \
28-	esd
29+	nxesd
30
31 bin_PROGRAMS = \
32 	esdcat		\
33@@ -84,7 +84,7 @@
34 	esdloop		\
35 	$(ESDPLAY)
36
37-esd_SOURCES = 	\
38+nxesd_SOURCES = 	\
39 	esd.c 		\
40 	clients.c	\
41 	filter.c	\
42@@ -125,7 +125,7 @@
43
44 LDADD = libesd.la $(AUDIOFILE_LIBS)
45
46-esd_LDADD = $(WRAP_LIB) $(LDADD)
47+nxesd_LDADD = $(WRAP_LIB) $(LDADD)
48
49 m4datadir = $(datadir)/aclocal
50 m4data_DATA = esd.m4
51@@ -145,6 +145,7 @@
52 EXTRA_DIST = \
53 	$(getopt_extra)	\
54 	esddsp		\
55+	nxesddsp        \
56 	esound.pc.in	\
57 	esound.spec	\
58 	esound.spec.in	\
59@@ -160,4 +161,3 @@
60 	m4/as-arts.m4   \
61 	m4/as-compiler-flag.m4 \
62 	$(AUDIO_BACKENDS)
63-
64diff -urwN nxesd-orig/configure.ac nxesd/configure.ac
65--- nxesd-orig/configure.ac	2007-05-29 12:06:31.000000000 +0200
66+++ nxesd/configure.ac	2009-07-16 01:10:14.000000000 +0200
67@@ -7,7 +7,7 @@
68 ESD_VERSION=$ESD_MAJOR_VERSION.$ESD_MINOR_VERSION.$ESD_MICRO_VERSION
69
70 AC_CANONICAL_TARGET([])
71-AM_INIT_AUTOMAKE(1.6)
72+AM_INIT_AUTOMAKE([foreign no-dependencies])
73 AM_MAINTAINER_MODE
74
75 AM_CONFIG_HEADER(config.h)
76@@ -33,6 +33,17 @@
77 AC_LIBTOOL_WIN32_DLL
78 AM_PROG_LIBTOOL
79
80+dnl Try enabling universal binaries on MacOSX
81+case "$target_os" in
82+    darwin*)
83+        fe_CHECK_FLAG([C],[CFLAGS],[-arch i386])
84+        fe_CHECK_FLAG([C++],[CXXFLAGS],[-arch i386])
85+        fe_CHECK_FLAG([C],[CFLAGS],[-arch ppc])
86+        fe_CHECK_FLAG([C++],[CXXFLAGS],[-arch ppc])
87+        CXXFLAGS="$CXXFLAGS $ac_checked_CXXFLAGS"
88+        CFLAGS="$CFLAGS $ac_checked_CFLAGS"
89+        ;;
90+esac
91
92 dnl Check for tools
93
94@@ -445,7 +456,6 @@
95    NXESDDSP=nxesddsp
96    LIBESDDSP=libesddsp.la
97 fi
98-AM_CONDITIONAL(BUILD_ESDDSP, test "x$dsp_ok" = xyes)
99 AM_CONDITIONAL(BUILD_NXESDDSP, test "x$dsp_ok" = xyes)
100
101 AS_COMPILER_FLAG(-Wall, CFLAGS="$CFLAGS -Wall")
102diff -urwN nxesd-orig/m4/audiofile.m4 nxesd/m4/audiofile.m4
103--- nxesd-orig/m4/audiofile.m4	1970-01-01 01:00:00.000000000 +0100
104+++ nxesd/m4/audiofile.m4	2009-07-15 17:04:52.000000000 +0200
105@@ -0,0 +1,179 @@
106+# Configure paths for the Audio File Library
107+# Bertrand Guiheneuf 98-10-21
108+# stolen from esd.m4 in esound :
109+# Manish Singh    98-9-30
110+# stolen back from Frank Belew
111+# stolen from Manish Singh
112+# Shamelessly stolen from Owen Taylor
113+
114+dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
115+dnl Test for Audio File Library, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS.
116+dnl
117+AC_DEFUN([AM_PATH_AUDIOFILE],
118+[dnl
119+dnl Get compiler flags and libraries from the audiofile-config script.
120+dnl
121+AC_ARG_WITH(audiofile-prefix,[  --with-audiofile-prefix=PFX   Prefix where Audio File Library is installed (optional)],
122+            audiofile_prefix="$withval", audiofile_prefix="")
123+AC_ARG_WITH(audiofile-exec-prefix,[  --with-audiofile-exec-prefix=PFX Exec prefix where Audio File Library is installed (optional)],
124+            audiofile_exec_prefix="$withval", audiofile_exec_prefix="")
125+AC_ARG_ENABLE(audiofiletest, [  --disable-audiofiletest       Do not try to compile and run a test Audio File Library program], , enable_audiofiletest=yes)
126+
127+  if test x$audiofile_exec_prefix != x ; then
128+     audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix"
129+     if test x${AUDIOFILE_CONFIG+set} != xset ; then
130+        AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config
131+     fi
132+  fi
133+  if test x$audiofile_prefix != x ; then
134+     audiofile_args="$audiofile_args --prefix=$audiofile_prefix"
135+     if test x${AUDIOFILE_CONFIG+set} != xset ; then
136+        AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config
137+     fi
138+  fi
139+
140+  AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no)
141+  min_audiofile_version=ifelse([$1], ,0.2.5,$1)
142+  AC_MSG_CHECKING(for Audio File Library - version >= $min_audiofile_version)
143+  no_audiofile=""
144+  if test "$AUDIOFILE_CONFIG" = "no" ; then
145+    no_audiofile=yes
146+  else
147+    AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs`
148+    AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags`
149+    audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
150+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
151+    audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
152+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
153+    audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \
154+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
155+    if test "x$enable_audiofiletest" = "xyes" ; then
156+      AC_LANG_SAVE
157+      AC_LANG_C
158+      ac_save_CFLAGS="$CFLAGS"
159+      ac_save_LIBS="$LIBS"
160+      CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
161+      LIBS="$LIBS $AUDIOFILE_LIBS"
162+dnl
163+dnl Now check if the installed Audio File Library is sufficiently new.
164+dnl (Also checks the sanity of the results of audiofile-config to some extent.)
165+dnl
166+      rm -f conf.audiofiletest
167+      AC_TRY_RUN([
168+#include <stdio.h>
169+#include <stdlib.h>
170+#include <string.h>
171+#include <audiofile.h>
172+
173+char*
174+my_strdup (char *str)
175+{
176+  char *new_str;
177+
178+  if (str)
179+    {
180+      new_str = malloc ((strlen (str) + 1) * sizeof(char));
181+      strcpy (new_str, str);
182+    }
183+  else
184+    new_str = NULL;
185+
186+  return new_str;
187+}
188+
189+int main ()
190+{
191+  int major, minor, micro;
192+  char *tmp_version;
193+
194+  system ("touch conf.audiofiletest");
195+
196+  /* HP/UX 9 (%@#!) writes to sscanf strings */
197+  tmp_version = my_strdup("$min_audiofile_version");
198+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
199+     printf("%s, bad version string\n", "$min_audiofile_version");
200+     exit(1);
201+   }
202+
203+   if (($audiofile_major_version > major) ||
204+      (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) ||
205+      (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro)))
206+    {
207+      return 0;
208+    }
209+  else
210+    {
211+      printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version);
212+      printf("*** of the Audio File Library required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro);
213+      printf("*** best to upgrade to the required version.\n");
214+      printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n");
215+      printf("*** to point to the correct copy of audiofile-config, and remove the file\n");
216+      printf("*** config.cache before re-running configure\n");
217+      return 1;
218+    }
219+}
220+
221+],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
222+       CFLAGS="$ac_save_CFLAGS"
223+       LIBS="$ac_save_LIBS"
224+       AC_LANG_RESTORE
225+     fi
226+  fi
227+  if test "x$no_audiofile" = x ; then
228+     AC_MSG_RESULT(yes)
229+     ifelse([$2], , :, [$2])
230+  else
231+     AC_MSG_RESULT(no)
232+     if test "$AUDIOFILE_CONFIG" = "no" ; then
233+       cat <<END
234+*** The audiofile-config script installed by the Audio File Library could
235+*** not be found.  If the Audio File Library was installed in PREFIX, make
236+*** sure PREFIX/bin is in your path, or set the AUDIOFILE_CONFIG
237+*** environment variable to the full path to audiofile-config.
238+END
239+     else
240+       if test -f conf.audiofiletest ; then
241+        :
242+       else
243+          echo "*** Could not run Audio File Library test program; checking why..."
244+          AC_LANG_SAVE
245+          AC_LANG_C
246+          CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
247+          LIBS="$LIBS $AUDIOFILE_LIBS"
248+          AC_TRY_LINK([
249+#include <stdio.h>
250+#include <audiofile.h>
251+],      [ return 0; ],
252+        [ cat <<END
253+*** The test program compiled, but did not run.  This usually means that
254+*** the run-time linker is not finding Audio File Library or finding the
255+*** wrong version of Audio File Library.
256+***
257+*** If it is not finding Audio File Library, you'll need to set your
258+*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
259+*** to the installed location.  Also, make sure you have run ldconfig if
260+*** that is required on your system.
261+***
262+*** If you have an old version installed, it is best to remove it, although
263+*** you may also be able to get things to work by modifying
264+*** LD_LIBRARY_PATH.
265+END
266+        ],
267+        [ echo "*** The test program failed to compile or link. See the file config.log"
268+          echo "*** for the exact error that occured. This usually means the Audio File"
269+          echo "*** Library was incorrectly installed or that you have moved the Audio"
270+          echo "*** File Library since it was installed. In the latter case, you may want"
271+          echo "*** to edit the audiofile-config script: $AUDIOFILE_CONFIG" ])
272+          CFLAGS="$ac_save_CFLAGS"
273+          LIBS="$ac_save_LIBS"
274+          AC_LANG_RESTORE
275+       fi
276+     fi
277+     AUDIOFILE_CFLAGS=""
278+     AUDIOFILE_LIBS=""
279+     ifelse([$3], , :, [$3])
280+  fi
281+  AC_SUBST(AUDIOFILE_CFLAGS)
282+  AC_SUBST(AUDIOFILE_LIBS)
283+  rm -f conf.audiofiletest
284+])
285diff -urwN nxesd-orig/m4/flags.m4 nxesd/m4/flags.m4
286--- nxesd-orig/m4/flags.m4	1970-01-01 01:00:00.000000000 +0100
287+++ nxesd/m4/flags.m4	2009-07-16 01:08:57.000000000 +0200
288@@ -0,0 +1,33 @@
289+dnl
290+dnl $1 = language
291+dnl $2 = variable to change
292+dnl $2 = flag to test
293+dnl
294+AC_DEFUN([fe_CHECK_FLAG],[
295+  AC_REQUIRE([AC_LANG_PUSH])dnl
296+  AC_REQUIRE([AC_LANG_POP])dnl
297+  AC_REQUIRE([AC_PROG_CC])dnl
298+  AC_REQUIRE([AC_PROG_CXX])dnl
299+
300+  AC_MSG_CHECKING(whether compiler accepts $3)
301+  AC_LANG_PUSH($1)
302+  ac_save_$2="$$2"
303+  dnl Some flags are dependant, so we set all previously checked
304+  dnl flags when testing. Except for -Werror which we have to
305+  dnl check on its own, because some of our compiler flags cause
306+  dnl warnings from the autoconf test program!
307+  if test "$3" = "-Werror" ; then
308+    $2="$$2 $3"
309+  else
310+    $2="$$2 $ac_checked_$2 $3"
311+  fi
312+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int x;])],[optok=yes],[optok=no])
313+  $2="$ac_save_$2"
314+  AC_LANG_POP
315+  if test $optok = "no"; then
316+    AC_MSG_RESULT(no)
317+  else
318+    ac_checked_$2="$ac_checked_$2 $3"
319+    AC_MSG_RESULT(yes)
320+  fi
321+])
322