summaryrefslogtreecommitdiff
blob: 91d9e848c12474674061b4b299ad884a81dcc239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
--- a/configure.in
+++ b/configure.in
@@ -20,8 +20,9 @@
 CPPFLAGS="${CPPFLAGS} -g"
 
 dnl fix freebsd's broken (?) libpthread
-AC_CHECK_LIB(c_r,pthread_creat,LDFLAGS="${LDFLAGS} -lc_r", [
-  AC_CHECK_LIB(pthread,pthread_create,LDFLAGS="${LDFLAGS} -lpthread") ])
+AC_CHECK_LIB(c_r,pthread_creat,THREAD_LIBS="-lc_r", [
+  AC_CHECK_LIB(pthread,pthread_create,THREAD_LIBS="-lpthread") ])
+AC_SUBST(THREAD_LIBS)
 
 AC_ARG_ENABLE(debug,[  --enable-debug          Enable debugging features],
 		       CPPFLAGS="${CPPFLAGS} -Wall")
@@ -35,26 +36,29 @@
 		      esac ])
 
 AC_ARG_ENABLE(efence,[  --enable-efence         Enable electric fence],
-			LDFLAGS="${LDFLAGS} -lefence")
+			EFENCE_LIBS="-lefence")
+AC_SUBST(EFENCE_LIBS)
 AC_ARG_ENABLE(nslu2,[  --enable-nslu2          Build for NSLU2/uNSLUng], 
 		       CFLAGS="${CFLAGS} -DNSLU2")
 
 AC_ARG_ENABLE(howl,[  --enable-howl       Use howl 0.9.2 or later],
 		      [ case "${enableval}" in
-                        yes) rend_howl=true; rend_posix=false; rend_avahi=false; LDFLAGS="${LDFLAGS} -lhowl";
+                        yes) rend_howl=true; rend_posix=false; rend_avahi=false; HOWL_LIBS="-lhowl";
 			CPPFLAGS="${CPPFLAGS} -DWITH_HOWL";;
 		        no)  rend_howl=false;;
 		        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-howl);;
 		      esac ])
+AC_SUBST(HOWL_LIBS)
 
 AC_ARG_ENABLE(avahi,[  --enable-avahi          Use avahi 0.6 or later],
 		      [ case "${enableval}" in
                         yes) PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ]);
-			rend_avahi=true; rend_howl=false; rend_posix=false; LDFLAGS="${LDFLAGS} $AVAHI_LIBS";
+			rend_avahi=true; rend_howl=false; rend_posix=false;
 			CPPFLAGS="${CPPFLAGS} $AVAHI_CFLAGS -DWITH_AVAHI";;
 		        no)  rend_avahi=false;;
 		        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-avahi);;
 		      esac ])
+AC_SUBST(AVAHI_LIBS)
 
 AC_ARG_ENABLE(oggvorbis,[  --enable-oggvorbis      Enable Ogg/Vorbis support],
                            use_oggvorbis=true;
@@ -82,7 +86,7 @@
 	CPPFLAGS="$CPPFLAGS -DNOT_HAVE_SA_LEN -D_XPG4_2"
 	CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME"
 	CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
-	LDFLAGS="$LDFLAGS -lnsl -lsocket";;	
+	EXTRA_LIBS="$EXTRA_LIBS -lnsl -lsocket";;
 *freebsd*)
 	CPPFLAGS="$CPPFLAGS -DFREEBSD";;
 *linux*)
@@ -98,6 +102,8 @@
 	AM_CONDITIONAL(COND_REND_POSIX,false);;
 esac
 
+AC_SUBST(EXTRA_LIBS)
+
 dnl Checks for libraries.
 AC_ARG_WITH(static-libs,
 	[--with-static-libs[[=DIR]]            use static libs in DIR],[
@@ -154,12 +160,13 @@
 AC_CHECK_LIB(gdbm,gdbm_open,echo "Have gdbm", echo "Must have gdbm";exit)
 
 if test "$STATIC_LIBS" != "no"; then
-  LDFLAGS="${LDFLAGS} ${STATIC_LIBS}/libgdbm.a"
+  GDBM_LIBS="${STATIC_LIBS}/libgdbm.a"
   echo "Adding static libgdbm"
 else
-  LDFLAGS="${LDFLAGS} -lgdbm"
+  GDBM_LIBS="-lgdbm"
   echo "Adding dynamic libgdbm"
 fi
+AC_SUBST(GDBM_LIBS)
 
 AC_CHECK_HEADERS(id3tag.h,, [
  AC_MSG_ERROR([id3tag.h not found... try --with-id3tag=dir])])
@@ -170,12 +177,14 @@
 AC_CHECK_LIB(id3tag,id3_file_open,echo "Have id3tag",echo "Must have libid3tag";exit)
 
 if test "$STATIC_LIBS" != "no"; then
-  LDFLAGS="${LDFLAGS} ${STATIC_LIBS}/libid3tag.a -lz"
+  ID3_LIBS="${STATIC_LIBS}/libid3tag.a -lz"
   echo "Adding static libid3tag"
 else
-  LDFLAGS="${LDFLAGS} -lid3tag -lz"
+  ID3_LIBS="-lid3tag -lz"
   echo "Adding dynamic libid3tag"
 fi
+AC_SUBST([ID3_LIBS])
+
 CFLAGS=$oldcflags
 
 if test x$use_oggvorbis = xtrue; then
@@ -184,22 +193,23 @@
   AC_CHECK_LIB(ogg,ogg_sync_init,echo "Have ogg",echo "Must have libogg for Ogg/Vorbis support";exit)
 
   if test x"$STATIC_LIBS" != x"no"; then
-    LDFLAGS="${LDFLAGS} ${STATIC_LIBS}/libogg.a"
+    OGG_LIBS="${STATIC_LIBS}/libogg.a"
     echo "Adding static libogg"
   else
-    LDFLAGS="${LDFLAGS} -logg"
+    OGG_LIBS="-logg"
     echo "Adding dynamic libogg"
   fi
+  AC_SUBST(OGG_LIBS)
 
   AC_CHECK_HEADERS(vorbis/codec.h,, [
    AC_MSG_ERROR([vorbis/codec.h not found... Must have libvorbis installed for Ogg/Vorbis support])])
   AC_CHECK_LIB(vorbis,vorbis_info_init,echo "Have vorbis",echo "Must have libvorbis for Ogg/Vorbis support";exit)
 
   if test x"$STATIC_LIBS" != x"no"; then
-    LDFLAGS="${LDFLAGS} ${STATIC_LIBS}/libvorbis.a"
+    OGG_LIBS="${OGG_LIBS} ${STATIC_LIBS}/libvorbis.a"
     echo "Adding static libvorbis"
   else
-    LDFLAGS="${LDFLAGS} -lvorbis"
+    OGG_LIBS="${OGG_LIBS} -lvorbis"
     echo "Adding dynamic libvorbis"
   fi
 fi
diff -ur mt-daapd-0.2.4.1.orig/src/Makefile.am mt-daapd-0.2.4.1/src/Makefile.am
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,6 +34,9 @@
 	redblack.c redblack.h dynamic-art.c dynamic-art.h query.c query.h \
 	$(PRENDSRC) $(ORENDSRC) $(HRENDSRC) $(OGGVORBISSRC) $(ARENDSRC)
 
+mt_daapd_LDADD = $(GDBM_LIBS) $(ID3_LIBS) $(OGG_LIBS) $(THREAD_LIBS) \
+	$(EFENCE_LIBS) $(HOWL_LIBS) $(AVAHI_LIBS) $(EXTRA_LIBS)
+
 EXTRA_DIST = mDNS.c mDNSClientAPI.h mDNSDebug.h mDNSPosix.c \
 	mDNSUNP.c mDNSPlatformFunctions.h mDNSPosix.h mDNSUNP.h \
 	rend-howl.c rend-posix.c rend-osx.c db-memory.c \