summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2011-05-24 10:55:25 (GMT)
committer Jaromil <jaromil@dyne.org>2011-05-24 10:55:25 (GMT)
commitdf005400b24eee6556108856fadf9e49762a11a7 (patch)
tree15f14bd5b0afdc758d707fce102daebd30376d49
parent5726b02979bc386f68b01a1a426ea1c86242877a (diff)
fixes for proper compilation with internal upnp library
-rw-r--r--configure.ac6
-rw-r--r--src/Makefile.am1
-rw-r--r--src/cmdline.c8
-rw-r--r--src/discover.c17
-rw-r--r--src/discover.h3
5 files changed, 14 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index 422bdeb..fd7332f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,22 +56,24 @@ AC_ARG_ENABLE(discovery,
[have_upnp=no])
AC_MSG_CHECKING([if compiling using external miniupnpc library])
UPNP_LIBS="upnp/libupnpc.a"
+UPNP_CPPFLAGS="-Iupnp"
if test x$have_upnp = xyes; then
# this is the default behaviour for --enable-upnp with no arguments
AC_MSG_RESULT(yes)
AC_DEFINE(USE_UPNP,1,[Define if building auto-detect for UPNP devices via miniupnp])
UPNP_LIBS="-lminiupnpc"
- UPNP_CFLAGS="-I /usr/include/miniupnpc"
+ UPNP_CPPFLAGS="-I /usr/include/miniupnpc"
elif test x$have_upnp != xno; then
# compile from indicated dir
AC_MSG_RESULT([yes, from $enableval])
AC_DEFINE(USE_UPNP,1,[Define if building auto-detect for UPNP devices via miniupnp])
UPNP_LIBS="$enableval/libminiupnpc.a"
- UPNP_CFLAGS="-I$enableval"
+ UPNP_CPPFLAGS="-I$enableval"
else
AC_MSG_RESULT(no)
fi
AC_SUBST(UPNP_LIBS)
+AC_SUBST(UPNP_CPPFLAGS)
dnl ==============================================================
diff --git a/src/Makefile.am b/src/Makefile.am
index efee6ea..7436873 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,4 +4,5 @@ bin_PROGRAMS = avremote
avremote_SOURCES = avremote.c avremote.h cmdline.c discover.c discover.h parsers.c parsers.h
avremote_LDADD = $(UPNP_LIBS)
+avremote_CPPFLAGS = $(UPNP_CPPFLAGS)
diff --git a/src/cmdline.c b/src/cmdline.c
index 9b0ea5a..52b9e86 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -74,9 +74,7 @@ void cmdline(int argc, char **argv) {
"\n"
"Commands:\n"
"\n"
-#ifdef USE_UPNP
- " discover search for upnp devices on the network\n"
-#endif
+ " discover scan for upnp devices on the network\n"
" load load a file and prepare it for playback\n"
" mode set playback mode (NORMAL or REPEAT_ONE)\n"
" play start playing the selected file\n"
@@ -166,14 +164,12 @@ int main(int argc, char **argv) {
cmdline(argc, argv);
-#ifdef USE_UPNP
if (discover)
{
- fprintf(stderr,"Performing upnp autodiscovery...\n");
+ fprintf(stderr,"Performing upnp discovery...\n");
upnp_discover();
exit(0);
}
-#endif
upnp = create_upnp();
diff --git a/src/discover.c b/src/discover.c
index 1802ea7..ee365d6 100644
--- a/src/discover.c
+++ b/src/discover.c
@@ -23,8 +23,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef USE_UPNP
-
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
@@ -43,14 +41,14 @@ int upnp_discover()
struct IGDdatas data;
int r, err;
- // damn programmers change API prototypes in headers without versioning
- // we'll use this define to detect
+ // damn programmers who change API prototypes in headers
+ // without versioning.
-#ifdef UPNPDISCOVER_SUCCESS
- devlist = upnpDiscover(1000, multicastif, minissdpdpath, 0, &err);
-#else
- devlist = upnpDiscover(1000, multicastif, minissdpdpath, 0);
-#endif
+/* #ifdef UPNPDISCOVER_SUCCESS */
+ devlist = upnpDiscover(1000, multicastif, minissdpdpath, 0, 0, &err);
+/* #else */
+/* devlist = upnpDiscover(1000, multicastif, minissdpdpath, 0); */
+/* #endif */
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
if (!r) {
@@ -97,4 +95,3 @@ int upnp_discover()
return(r);
}
-#endif
diff --git a/src/discover.h b/src/discover.h
index 40bd95d..caa18a1 100644
--- a/src/discover.h
+++ b/src/discover.h
@@ -18,8 +18,5 @@
*/
-#ifdef USE_UPNP
-
int upnp_discover();
-#endif