configure.in 6.93 KB
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/main.c)
brendan's avatar
brendan committed
3
AC_PREREQ(2.50)
Jack Moffitt's avatar
Jack Moffitt committed
4

5
AM_INIT_AUTOMAKE(icecast,2.0-alpha-2)
Jack Moffitt's avatar
Jack Moffitt committed
6 7 8 9 10 11 12

AC_PROG_CC
AC_CANONICAL_HOST
AM_PROG_LIBTOOL

dnl Set some options based on environment

Jack Moffitt's avatar
Jack Moffitt committed
13 14
SOCKET_LIBS=

15 16 17 18 19 20
case "$ac_cv_host" in
    *openbsd*)
    ;;
    *) AC_DEFINE(_XOPEN_SOURCE, 500, [Define if you have POSIX and XPG specifications])
    ;;
esac
Jack Moffitt's avatar
Jack Moffitt committed
21 22 23
if test -z "$GCC"; then
        case $host in 
        *-*-irix*)
Jack Moffitt's avatar
Jack Moffitt committed
24 25 26
                DEBUG="-g -signed -D_REENTRANT" 
                CFLAGS="-O2 -w -signed -D_REENTRANT"
                PROFILE="-p -g3 -O2 -signed -D_REENTRANT"
Jack Moffitt's avatar
Jack Moffitt committed
27
		;;
Jack Moffitt's avatar
Jack Moffitt committed
28
        *-*-solaris*)
29 30 31
                DEBUG="-v -g -D_REENTRANT"
                CFLAGS="-xO4 -fast -w -fsimple -native -xcg92 -D_REENTRANT"
                PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc -D_REENTRANT"
32
                SOCKET_LIBS="-lnsl -lsocket -lresolv"
Jack Moffitt's avatar
Jack Moffitt committed
33 34
		;;
        *)
Jack Moffitt's avatar
Jack Moffitt committed
35 36 37
                DEBUG="-g -D_REENTRANT"
                CFLAGS="-O -D_REENTRANT"
                PROFILE="-g -p -D_REENTRANT"
Jack Moffitt's avatar
Jack Moffitt committed
38 39 40 41 42 43 44 45 46
		;;
        esac
else
        case $host in 
        *-*-linux*)
                DEBUG="-g -Wall -fsigned-char -D_REENTRANT -D_GNU_SOURCE"
                CFLAGS="-O20 -ffast-math -fsigned-char -D_REENTRANT -D_GNU_SOURCE"
                PROFILE="-Wall -W -pg -g -O20 -ffast-math -fsigned-char -D_REENTRANT -D_GNU_SOURCE"
		;;
47
        sparc-sun-solaris*)
48 49 50
                DEBUG="-g -Wall -fsigned-char -mv8 -D_REENTRANT"
                CFLAGS="-O20 -ffast-math -fsigned-char -mv8 -D_REENTRANT"
                PROFILE="-pg -g -O20 -fsigned-char -mv8 -D_REENTRANT" 
51
                SOCKET_LIBS="-lnsl -lsocket -lresolv"
Jack Moffitt's avatar
Jack Moffitt committed
52
		;;
53
	    *-pc-solaris*)
54 55 56
                DEBUG="-g -Wall -fsigned-char -D_REENTRANT"
                CFLAGS="-O20 -ffast-math -fsigned-char -D_REENTRANT"
                PROFILE="-pg -g -O20 -fsigned-char -D_REENTRANT" 
57
                SOCKET_LIBS="-lnsl -lsocket -lresolv"
58 59
		;;
        *freebsd*)
60 61 62 63 64
                DEBUG="-g -Wall -fsigned-char"
                CFLAGS="-O20 -fsigned-char"
                PROFILE="-O20 -g -pg -fsigned-char" 
                ogg_prefix="/usr/local"
                vorbis_prefix="/usr/local"
65
		;;
Jack Moffitt's avatar
Jack Moffitt committed
66
        *)
67 68 69
                DEBUG="-g -Wall -fsigned-char"
                CFLAGS="-O20 -Wall -fsigned-char"
                PROFILE="-O20 -g -pg -Wall -fsigned-char" 
Jack Moffitt's avatar
Jack Moffitt committed
70 71 72 73 74 75 76 77 78
		;;
        esac
fi

dnl Checks for programs.

dnl Checks for libraries.

dnl IPV6
79 80
AC_SEARCH_LIBS(inet_pton, socket, 
  [AC_DEFINE([HAVE_INET_PTON], 1, [Define if you have the `inet_pton' function])])
Jack Moffitt's avatar
Jack Moffitt committed
81
AC_SEARCH_LIBS(getipnodebyname, nsl,
82 83
  [AC_DEFINE([HAVE_GETIPNODEBYNAME], 1,
    [Define if you have the `getipnodebyname' function])])
Jack Moffitt's avatar
Jack Moffitt committed
84 85 86 87

dnl Checks for header files.
AC_HEADER_STDC

88 89 90
AC_CHECK_HEADER(stdint.h, AC_DEFINE(HAVE_STDINT_H, 1, [Define if you have stdint.h]),,)
AC_CHECK_HEADER(pwd.h, AC_DEFINE(CHUID, 1, [Define if you have pwd.h]),,)
AC_CHECK_HEADER(unistd.h, AC_DEFINE(CHROOT, 1, [Define if you have unistd.h]),,)
91
AC_CHECK_HEADER(sys/uio.h, AC_DEFINE(HAVE_SYS_UIO_H, 1, [Define if you have sys/uio.h]),,)
92

Jack Moffitt's avatar
Jack Moffitt committed
93 94
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
95 96 97 98 99 100 101 102 103 104 105
AC_MSG_CHECKING([how to copy va_list])
    AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
            AC_MSG_RESULT([va_copy]),
            [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
            AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
                [ AC_DEFINE([va_copy], [__va_copy])
                AC_MSG_RESULT([__va_copy])],
                [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
                AC_MSG_RESULT([memcpy])]
                )
            ])
Jack Moffitt's avatar
Jack Moffitt committed
106 107

dnl Check for types
108
AC_CHECK_TYPE([socklen_t], int)
Jack Moffitt's avatar
Jack Moffitt committed
109 110

dnl Checks for library functions.
Michael Smith's avatar
Michael Smith committed
111
AC_CHECK_FUNCS(nanosleep)
112
AC_CHECK_FUNCS(poll)
Michael Smith's avatar
Michael Smith committed
113
AC_CHECK_FUNCS(sethostent endhostent)
114
AC_CHECK_FUNCS(getnameinfo getaddrinfo inet_aton)
Jack Moffitt's avatar
Jack Moffitt committed
115 116 117

dnl -- configure options --

118
AC_ARG_WITH(xslt-config,
brendan's avatar
brendan committed
119
  [  --with-xslt-config=PATH  use xslt-config in PATH to find libxslt ],
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
  [if ! test -x "$with_xslt_config"
   then
     AC_MSG_ERROR([$with_xslt_config cannot be executed])
   fi
   XSLTCONFIG="$with_xslt_config"]
)
if test -z "$XSLTCONFIG"
then
  AC_CHECK_PROGS(XSLTCONFIG, [xslt-config])
fi
if test -n "$XSLTCONFIG"
then
  XSLT_LIBS="`$XSLTCONFIG --libs`"
  XSLT_CFLAGS="`$XSLTCONFIG --cflags`"
  save_LIBS="$LIBS"
  save_CFLAGS="$CFLAGS"
  LIBS="$LIBS $XSLT_LIBS"
  CFLAGS="$CFLAGS $XSLT_CFLAGS"
  AC_CHECK_FUNC(xsltParseStylesheetFile,, [AC_MSG_ERROR([There was a problem linking with libxslt])])
  LIBS="$save_LIBS"
  CFLAGS="$save_CFLAGS"
  save_LIBS=
  save_CFLAGS=
else
  AC_MSG_ERROR([xslt-config could not be found])
fi

Jack Moffitt's avatar
Jack Moffitt committed
147 148 149 150 151 152 153 154 155 156 157 158 159 160
AC_ARG_WITH(xml-config,
  [  --with-xml-config=PATH  use xml-config in PATH to find libxml ],
  [if ! test -x "$with_xml_config"
   then
     AC_MSG_ERROR([$with_xml_config cannot be executed])
   fi
   XMLCONFIG="$with_xml_config"]
)
if test -z "$XMLCONFIG"
then
  AC_CHECK_PROGS(XMLCONFIG, [xml2-config xml-config])
fi
if test -n "$XMLCONFIG"
then
Jack Moffitt's avatar
Jack Moffitt committed
161
  XML_LIBS="`$XMLCONFIG --libs`"
Jack Moffitt's avatar
Jack Moffitt committed
162
  XML_CFLAGS="`$XMLCONFIG --cflags`"
163
  save_LIBS="$LIBS"
Jack Moffitt's avatar
Jack Moffitt committed
164
  save_CFLAGS="$CFLAGS"
165
  LIBS="$LIBS $XML_LIBS"
Jack Moffitt's avatar
Jack Moffitt committed
166
  CFLAGS="$CFLAGS $XML_CFLAGS"
Jack Moffitt's avatar
Jack Moffitt committed
167
  AC_CHECK_FUNC(xmlParseFile,, [AC_MSG_ERROR([There was a problem linking with libxml])])
168
  LIBS="$save_LIBS"
Jack Moffitt's avatar
Jack Moffitt committed
169
  CFLAGS="$save_CFLAGS"
170
  save_LIBS=
Jack Moffitt's avatar
Jack Moffitt committed
171
  save_CFLAGS=
Jack Moffitt's avatar
Jack Moffitt committed
172 173 174 175
else
  AC_MSG_ERROR([xml-config could not be found])
fi

176 177
AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!(Perhaps you need --with-ogg-prefix=/usr/local)))
AM_PATH_VORBIS(, AC_MSG_ERROR(must have Vorbis installed!(Perhaps you need --with-vorbis-prefix=/usr/local)))
brendan's avatar
brendan committed
178 179 180 181 182 183 184
ACX_PTHREAD(, AC_MSG_ERROR([POSIX threads missing]))

dnl -- YP support --
AC_ARG_ENABLE([yp],
  [  --disable-yp          disable YP directory support])
if test "x$enable_yp" != "xno"
then
185
AM_PATH_CURL([
brendan's avatar
brendan committed
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
  AC_CHECK_DECL([CURLOPT_NOSIGNAL], [
    AC_DEFINE([USE_YP], 1, [Define to compile in YP support code])
    ICECAST_OBJECTS="$ICECAST_OBJECTS geturl.o yp.o"
    ], [
    if test "x$enable_yp" != "xyes"
    then
      AC_MSG_NOTICE([Your curl dev files are too old (7.10 or above required), YP disabled])
    else
      AC_MSG_ERROR([Your curl dev files are too old (7.10 or above required)])
    fi
    ], [#include <curl/curl.h>])
  ], [
  if test "x$enable_yp" != "xyes"
  then
    AC_MSG_NOTICE([libcurl not found, YP disabled])
  else
    AC_MSG_ERROR([libcurl not found])
  fi
204
  ])
brendan's avatar
brendan committed
205
fi
Jack Moffitt's avatar
Jack Moffitt committed
206 207 208

dnl Make substitutions

209
AC_SUBST(XSLT_CFLAGS)
Jack Moffitt's avatar
Jack Moffitt committed
210 211 212
AC_SUBST(XML_CFLAGS)
AC_SUBST(OGG_CFLAGS)
AC_SUBST(VORBIS_CFLAGS)
213
AC_SUBST(XSLT_LIBS)
Jack Moffitt's avatar
Jack Moffitt committed
214 215 216 217
AC_SUBST(XML_LIBS)
AC_SUBST(OGG_LIBS)
AC_SUBST(VORBIS_LIBS)
AC_SUBST(SOCKET_LIBS)
Jack Moffitt's avatar
Jack Moffitt committed
218 219 220 221 222 223
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
224
AC_SUBST(XIPH_CFLAGS)
225
AC_SUBST(ICECAST_OBJECTS)
Jack Moffitt's avatar
Jack Moffitt committed
226

227
AC_OUTPUT(Makefile conf/Makefile src/Makefile src/avl/Makefile src/httpp/Makefile src/thread/Makefile src/log/Makefile src/net/Makefile src/timing/Makefile doc/Makefile web/Makefile admin/Makefile win32/Makefile win32/res/Makefile)