configure.ac 6.79 KB
Newer Older
1
AC_INIT([Icecast], [2.4.99.2], [icecast@xiph.org])
2

3
AC_PREREQ([2.54])
Marvin Scholz's avatar
Marvin Scholz committed
4

5
AC_CONFIG_SRCDIR([src/main.c])
6
AC_CONFIG_MACRO_DIR([m4])
Marvin Scholz's avatar
Marvin Scholz committed
7
AC_CONFIG_AUX_DIR([build-aux])
Jack Moffitt's avatar
Jack Moffitt committed
8 9

AC_PROG_CC
10

Marvin Scholz's avatar
Marvin Scholz committed
11 12
LT_INIT

13 14 15 16 17 18
AX_CHECK_COMPILE_FLAG([-std=c99], [
  AX_APPEND_FLAG([-std=c99])
], [
  AC_MSG_WARN([Compiler does not accept -std=c99 flag!])
])

Marvin Scholz's avatar
Marvin Scholz committed
19 20 21 22 23 24
AC_PROG_CC_C99

AS_IF([test "${ac_cv_prog_cc_c99}" = "no"], [
  AC_MSG_ERROR([No C99 compiler found!])
])

25 26 27
dnl With clang, we want an error for unknown flags instead of just warn
AX_APPEND_COMPILE_FLAGS([-Werror=unknown-warning-option -Werror=invalid-command-line-argument])

28 29
AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Wno-unused-parameter])

Karl Heyes's avatar
Karl Heyes committed
30
AC_SYS_LARGEFILE
Marvin Scholz's avatar
Marvin Scholz committed
31
AC_DEFINE([_GNU_SOURCE], 1, [Define to include GNU extensions to POSIX])
Jack Moffitt's avatar
Jack Moffitt committed
32

Marvin Scholz's avatar
Marvin Scholz committed
33 34 35
dnl Set build/host to default values
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
Jack Moffitt's avatar
Jack Moffitt committed
36

37 38 39 40 41 42
dnl Check for which host we are compiling
AS_CASE("${host_os}",
  [linux*], [SYS="linux"],
  [darwin*], [SYS="darwin"],
  [SYS="${host_os}"]
)
Jack Moffitt's avatar
Jack Moffitt committed
43

44
AM_INIT_AUTOMAKE([tar-ustar foreign dist-zip subdir-objects])
45
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Marvin Scholz's avatar
Marvin Scholz committed
46 47 48

AM_MAINTAINER_MODE([enable])

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
dnl Sanitizer flags

AC_ARG_WITH([sanitizer],
    [AS_HELP_STRING([--with-sanitizer=(address/memory/undefined/thread)],
        [build with sanitizer flags (default disabled)])],
     [],
     [with_sanitizer=no])

AS_VAR_IF(with_sanitizer, no, [], [
    AX_CHECK_COMPILE_FLAG([-fsanitize=${with_sanitizer}], [
        AX_APPEND_FLAG([-fsanitize=${with_sanitizer}])
        AX_APPEND_FLAG([-fsanitize=${with_sanitizer}], [LDFLAGS])
    ], [
        AC_MSG_ERROR(["-fsanitize=${with_sanitizer} not supported!"])
    ])
    AX_APPEND_FLAG([-g])

66 67 68 69 70
    AS_CASE("${with_sanitizer}",
      [address], [
        AX_APPEND_COMPILE_FLAGS([-fsanitize-address-use-after-scope -fno-omit-frame-pointer -fsanitize=pointer-compare -fsanitize=pointer-subtract])
      ],
      [memory], [
71
        AX_APPEND_COMPILE_FLAGS([-fPIE -pie])
72 73
      ],
      [thread], [
74
        AX_APPEND_COMPILE_FLAGS([-fPIE -pie])
75 76 77
      ],
      []
    )
78 79
])

80 81 82
dnl Check for attributes
AX_GCC_TYPE_ATTRIBUTE([transparent_union])

Jack Moffitt's avatar
Jack Moffitt committed
83
dnl Checks for header files.
84
AC_HEADER_ASSERT
Jack Moffitt's avatar
Jack Moffitt committed
85
AC_HEADER_STDC
86
AC_HEADER_TIME
Jack Moffitt's avatar
Jack Moffitt committed
87

Marvin Scholz's avatar
Marvin Scholz committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
AC_CHECK_HEADERS([stdint.h inttypes.h], [
  ice_found_int_headers="yes";
  break;
])

AS_IF([test "$ice_found_int_headers" != "yes"], [
  AC_MSG_ERROR([Unable to find the standard integers headers])
])

AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([pwd.h grp.h])

dnl Check for functions
AC_FUNC_FORK
AC_FUNC_CHOWN

106 107
AC_CHECK_FUNCS([setuid])
AC_CHECK_FUNCS([chroot])
108
AC_CHECK_FUNCS([strcasestr])
109
AC_CHECK_FUNCS([uname])
110
AC_CHECK_FUNCS([setenv])
111 112
AC_CHECK_FUNCS([setresuid])
AC_CHECK_FUNCS([setresgid])
Marvin Scholz's avatar
Marvin Scholz committed
113 114
AC_CHECK_FUNCS([localtime_r])

115 116 117 118 119
dnl Do not check for poll on Darwin, it is broken in some versions
AS_IF([test "${SYS}" != "darwin"], [
  AC_CHECK_FUNCS([poll])
])

Marvin Scholz's avatar
Marvin Scholz committed
120 121 122 123 124 125 126 127 128
dnl Checks for types and typedefs
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T

dnl Checks for required libraries

Marvin Scholz's avatar
Marvin Scholz committed
129
dnl
130
dnl igloo
Marvin Scholz's avatar
Marvin Scholz committed
131
dnl
132 133
PKG_CHECK_MODULES([IGLOO], [igloo], [], [
  AC_MSG_ERROR([${IGLOO_PKG_ERRORS}. igloo is required.])
Marvin Scholz's avatar
Marvin Scholz committed
134 135
])

136 137
CFLAGS="${CFLAGS} ${IGLOO_CFLAGS}"
LIBS="${LIBS} ${IGLOO_LIBS}"
Marvin Scholz's avatar
Marvin Scholz committed
138

Marvin Scholz's avatar
Marvin Scholz committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
dnl
dnl libxml2
dnl
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [], [
  AC_MSG_ERROR([${LIBXML2_PKG_ERRORS}. libxml2 is required.])
])

CFLAGS="${CFLAGS} ${LIBXML2_CFLAGS}"
LIBS="${LIBS} ${LIBXML2_LIBS}"


dnl
dnl libxslt
dnl
PKG_CHECK_MODULES([LIBXSLT], [libxslt], [], [
  AC_MSG_ERROR([${LIBXSLT_PKG_ERRORS}. libxslt is required.])
])

CFLAGS="${CFLAGS} ${LIBXSLT_CFLAGS}"
LIBS="${LIBS} ${LIBXSLT_LIBS}"


dnl
dnl libvorbis
dnl
PKG_CHECK_MODULES([VORBIS], [vorbis >= 1.0], [], [
  AC_MSG_ERROR([${VORBIS_PKG_ERRORS}. Must have libvorbis v1.0 or above installed.])
])

CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}"
LIBS="${LIBS} ${VORBIS_LIBS}"


dnl Checks for optional libraries

dnl
dnl libogg
dnl
PKG_HAVE_WITH_MODULES([OGG], [ogg], [
  CFLAGS="${CFLAGS} ${OGG_CFLAGS}"
  LIBS="${LIBS} ${OGG_LIBS}"
])

dnl
dnl libtheora
dnl
PKG_HAVE_WITH_MODULES([THEORA], [theora], [
  CFLAGS="${CFLAGS} ${THEORA_CFLAGS}"
  LIBS="${LIBS} ${THEORA_LIBS}"
])

dnl
dnl libspeex
dnl
PKG_HAVE_WITH_MODULES([SPEEX], [speex], [
  CFLAGS="${CFLAGS} ${SPEEX_CFLAGS}"
  LIBS="${LIBS} ${SPEEX_LIBS}"
])

dnl
dnl libcurl
dnl
201
PKG_HAVE_WITH_MODULES([CURL], [libcurl], [
Marvin Scholz's avatar
Marvin Scholz committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215
  CFLAGS="${CFLAGS} ${CURL_CFLAGS}"
  LIBS="${LIBS} ${CURL_LIBS}"
])

dnl
dnl openssl
dnl
PKG_HAVE_WITH_MODULES([OPENSSL], [openssl], [
  CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
  LIBS="${LIBS} ${OPENSSL_LIBS}"
])

dnl Check for library-specific functions
AC_CHECK_FUNCS([xsltSaveResultToString])
216

217 218 219
dnl we still use format_kate as it doesn't need libkate to work
#ICECAST_OPTIONAL="$ICECAST_OPTIONAL format_kate.o"

Marvin Scholz's avatar
Marvin Scholz committed
220
ACX_PTHREAD([], [AC_MSG_ERROR([POSIX threads missing])])
Jack Moffitt's avatar
Jack Moffitt committed
221

Marvin Scholz's avatar
Marvin Scholz committed
222 223 224
CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PTHREAD_CPPFLAGS}"
LIBS="${LIBS} ${PTHREAD_LIBS}"
Jack Moffitt's avatar
Jack Moffitt committed
225

226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
dnl Feature enable/disable arguments

AC_ARG_ENABLE([yp],
  AS_HELP_STRING([--enable-yp],
    [enable yellowpage directory listing support (default: auto)])
)

AS_IF([test "x$enable_yp" != "xno"], [
  AS_IF([test "x$have_curl" != "xyes"], [
    AS_IF([test "x$enable_yp" == "xyes"], [
      AC_MSG_ERROR([cURL is required for YP support])
    ])
    enable_yp="no"
  ], [
    AC_DEFINE([USE_YP], 1, [Define to compile in YP support code])
    enable_yp="yes"
  ])
])

245 246 247 248
AM_CONDITIONAL([ENABLE_YP],
               [test "x$enable_yp" = "xyes"])


249 250 251 252 253 254 255 256
AC_ARG_ENABLE([client-tests],
  AS_HELP_STRING([--enable-client-tests],
    [enable client tests module (default: disabled)])
)

AS_IF([test "x$enable_client_tests" == "xyes"], [
  AC_DEFINE([ENABLE_MODULE_CLIENT_TESTS], 1, [Define to compile client test module])
], [enable_client_tests="no"])
Marvin Scholz's avatar
Marvin Scholz committed
257

258 259 260
AM_CONDITIONAL([ENABLE_MODULE_CLIENT_TESTS],
               [test "x$enable_client_tests" = "xyes"])

261 262
AC_ARG_WITH([default-config],
  AS_HELP_STRING([--with-default-config=PATH],
263 264
    [Sets default Icecast configuration file (used when no configuration file is given)]),
  [], [with_default_config=no]
265 266 267 268 269 270 271 272 273 274 275 276
)

AS_IF([test "$with_default_config" != "no"], [

  AS_IF([test "$with_default_config" = "yes"], [
    AC_MSG_ERROR([You need to supply a path as value for --with-default-config])
  ])

  AC_DEFINE_UNQUOTED([ICECAST_DEFAULT_CONFIG], ["$with_default_config"], [Define to default config file path])
  
])

277 278
AC_CONFIG_HEADERS([config.h])

279 280 281 282 283 284 285 286 287 288 289 290 291
AC_CONFIG_FILES([
  Makefile
  conf/Makefile
  src/Makefile
  doc/Makefile
  web/Makefile
  admin/Makefile
  win32/Makefile
  examples/Makefile
  tests/Makefile
])

AC_OUTPUT
292

293
AS_ECHO(["
294 295
Icecast configuration
---------------------
296 297 298
Version        : ${VERSION}
cURL           : ${have_curl}
TLS (openSSL)  : ${have_openssl}
299 300

Format/Codec support:
301 302 303 304 305 306
  Ogg          : ${have_ogg}
  Theora       : ${have_theora}
  Speex        : ${have_speex}

Features:
  YP support   : ${enable_yp}
307
  Client tests : ${enable_client_tests}"])