2 # Process this file with autoconf to produce a configure script.
6 AC_INIT([gmyth-upnp],[0.7])
8 AC_CONFIG_SRCDIR([src/gmyth_upnp.c])
9 AC_CONFIG_HEADER(config.h)
11 dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode
13 dnl make aclocal work in maintainer mode
14 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
16 # Checks for programs.
18 # Make sure CFLAGS is defined to stop AC_PROC_CC adding -g
19 CFLAGS="$CFLAGS -Wall"
23 # Checks for libraries.
26 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
27 # Give error and exit if we don't have pkgconfig
28 if test "x$HAVE_PKGCONFIG" = "xno"; then
29 AC_MSG_ERROR(you need to have pkgconfig installed !)
32 # Checks for header files.
34 AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])
36 # Checks for typedefs, structures, and compiler characteristics.
43 # Checks for library functions.
46 AC_FUNC_SELECT_ARGTYPES
47 AC_PROG_GCC_TRADITIONAL
52 AC_CHECK_FUNCS([memset socket stime strstr strtoul gethostname inet_ntoa localtime_r select strrchr localtime strptime])
54 ##############################
55 # Checks for Network functions
56 ##############################
58 AC_CHECK_FUNCS([socket])
59 AC_CHECK_FUNCS([inet_ntoa])
60 AC_CHECK_HEADERS([ifaddrs.h])
61 AC_CHECK_FUNCS([getifaddrs])
62 AC_CHECK_FUNCS([time])
64 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
66 CFLAGS="$CFLAGS -I/usr/include"
67 LDFLAGS="$LDFLAGS -L/usr/lib"
69 # Checks required packages
71 dnl Test if --disable-debug given
73 AC_HELP_STRING([--disable-debug], [enable debugging mode]))
74 if test x"$enable_debug" != xno; then
75 CFLAGS="$CFLAGS -g -DGMYTH_USE_DEBUG"
77 CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS"
81 PKG_CHECK_MODULES(GLIB, glib-2.0, HAVE_GLIB=yes,HAVE_GLIB=no)
83 # Give error and exit if we don't have glib
84 if test "x$HAVE_GLIB" = "xno"; then
85 AC_MSG_ERROR(you need glib-2.0 installed)
88 # make GLIB_CFLAGS and GLIB_LIBS available
92 # Check for GObject2.0
93 PKG_CHECK_MODULES(GOBJECT,
95 HAVE_GOBJECT=yes, HAVE_GOBJECT=no)
97 # Give error and exit if we don't have gobject
98 if test "x$HAVE_GOBJECT" = "xno"; then
99 AC_MSG_ERROR(you need gobject-2.0 installed)
102 # make GOBJECT_CFLAGS and GOBJECT_LIBS available
103 AC_SUBST(GOBJECT_CFLAGS)
104 AC_SUBST(GOBJECT_LIBS)
106 ## Check for gmyth-0.7
107 PKG_CHECK_MODULES(LIBGMYTH, gmyth >= 0.7, HAVE_LIBGMYTH=yes,HAVE_LIBGMYTH=no)
109 # Give error and exit if we don't have gmyth-0.7
110 if test "x$HAVE_LIBGMYTH" = "xno"; then
111 AC_MSG_ERROR([you need gmyth installed])
114 # make LIBXML_CFLAGS and LIBXML_LIBS available
115 AC_SUBST(LIBGMYTH_CFLAGS)
116 AC_SUBST(LIBGMYTH_LIBS)
118 dnl ========== Check for Cyberlink UPnP Libraries
119 PKG_CHECK_MODULES(LIBUPNP, libupnp, HAVE_LIBUPNP=yes, HAVE_LIBUPNP=no)
121 if test "x$HAVE_LIBUPNP" = "xno"; then
122 AC_MSG_ERROR([you need libupnp installed])
125 AC_SUBST(LIBUPNP_CFLAGS)
126 AC_SUBST(LIBIPNP_LIBS)
134 if test "x$enable_debug" != "xno"; then
135 AC_MSG_NOTICE([Debug: Enabled])
137 AC_MSG_NOTICE([Debug: Disabled])