configure.in 4.47 KB
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1
dnl Process this file with autoconf to produce a configure script.
2
AC_INIT([IceS], 2.0-Beta2, [icecast@xiph.org])
3
AC_PREREQ(2.52)
4
AC_CONFIG_SRCDIR(src/ices.c)
Jack Moffitt's avatar
Jack Moffitt committed
5

6
7
AM_INIT_AUTOMAKE(dist-bzip2)
AM_CONFIG_HEADER(config.h)
Jack Moffitt's avatar
Jack Moffitt committed
8
9
10
11
12
13

AC_PROG_CC
AM_PROG_LIBTOOL

dnl Set some options based on environment

14
15
16
17
18
19
20
21
dnl openbsd headers break when _XOPEN_SOURCE is defined but without it seems
dnl to be fine
case "$ac_cv_host" in
   *openbsd*)
   ;;
   *) AC_DEFINE(_XOPEN_SOURCE, 500, [Define if you have POSIX and XPG specifications])
   ;;
esac
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
case $host in 
*-*-irix*)
        DEBUG="-g -signed -D_REENTRANT" 
        XIPH_CFLAGS="-O2 -w -signed -D_REENTRANT"
        PROFILE="-p -g3 -O2 -signed -D_REENTRANT"
;;
*-*-solaris*)
        AC_DEFINE(__EXTENSIONS__, 1, [define to 1 for IPv6 functions on solaris])
        DEBUG="-v -g -D_REENTRANT"
        XIPH_CFLAGS="-xO4 -fast -w -fsimple -native -xcg92 -D_REENTRANT"
        PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc -D_REENTRANT"
;;
*)
        DEBUG="-g -D_REENTRANT"
        XIPH_CFLAGS="-O -D_REENTRANT"
        PROFILE="-g -p -D_REENTRANT" 
;;
esac
if test -n "$GCC"; then
41
42
43
44
        AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications])
        XIPH_CFLAGS="-ffast-math -fsigned-char"
        DEBUG="-g"
        PROFILE="-g -pg"
Jack Moffitt's avatar
Jack Moffitt committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
fi

dnl Checks for programs.

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC

dnl Check for OSS

AC_CHECK_HEADER(sys/soundcard.h, have_oss=yes, have_oss=no)
AC_CHECK_HEADER(machine/soundcard.h, have_oss=yes, )
AM_CONDITIONAL(HAVE_OSS,test "$have_oss" = yes)
if test "$have_oss" = yes; then
60
    AC_DEFINE(HAVE_OSS,,[Define to enable OSS input module])
Jack Moffitt's avatar
Jack Moffitt committed
61
62
63
64
65
66
67
68
fi

dnl Check for Sun audio

AC_CHECK_HEADER(sys/audioio.h, have_sun_audio=yes, have_sun_audio=no)
AM_CONDITIONAL(HAVE_SUN_AUDIO,test "$have_sun_audio" = yes)

if test "$have_sun_audio" = yes; then
69
    AC_DEFINE(HAVE_SUN_AUDIO,,[Define to enable sun audio input module])
Jack Moffitt's avatar
Jack Moffitt committed
70
71
fi

72
73
74
75
76
77
78
dnl Check for ALSA audio

AC_CHECK_HEADER(alsa/asoundlib.h, have_alsa=yes, have_alsa=no)
AM_CONDITIONAL(HAVE_ALSA,test "$have_alsa" = yes)

if test "$have_alsa" = yes; then
   ALSA_LIBS="-lasound"
79
   AC_DEFINE(HAVE_ALSA, ,[Define to enable ALSA input module])
80
81
fi

Jack Moffitt's avatar
Jack Moffitt committed
82
83
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
AC_CHECK_TYPES([socklen_t],,,[
#include <sys/types.h>
#include <sys/socket.h>
])
AH_BOTTOM([
#ifndef HAVE_SOCKLEN_T
      typedef int socklen_t
#endif
])

dnl needs to be checked early on, so that additional libraries
dnl don't trick the check
ACX_PTHREAD([
     LIBS="$PTHREAD_LIBS $LIBS"
     XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS"
     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     CC="$PTHREAD_CC"
])
Jack Moffitt's avatar
Jack Moffitt committed
102
103

dnl Check for types
104
AC_CHECK_TYPES([uint64_t],,AC_ERROR([could not find a uint64_t type]))
Jack Moffitt's avatar
Jack Moffitt committed
105
106
107

dnl Checks for library functions.

108
109
AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS",)
AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS",)
110
111
AC_CHECK_LIB(rt, nanosleep, LIBS="-lrt $LIBS",)
AC_CHECK_LIB(resolv, res_query, LIBS="-lresolv $LIBS",)
112

Jack Moffitt's avatar
Jack Moffitt committed
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
dnl -- configure options --

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
129
  XML_LIBS="`$XMLCONFIG --libs`"
130
  XML_CFLAGS="`$XMLCONFIG --cflags`"
131
  LIBS="$XML_LIBS $LIBS"
132
  XIPH_CFLAGS="$XIPH_CFLAGS $XML_CFLAGS"
Jack Moffitt's avatar
Jack Moffitt committed
133
134
135
136
137
  AC_CHECK_FUNC(xmlParseFile,, [AC_MSG_ERROR([There was a problem linking with libxml])])
else
  AC_MSG_ERROR([xml-config could not be found])
fi

138
AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
139
LIBS="$OGG_LIBS $LIBS"
140
141
XIPH_CFLAGS="$XIPH_CFLAGS $OGG_CFLAGS"

142
AM_PATH_VORBIS(, AC_MSG_ERROR(must have Vorbis installed!))
143
LIBS="$VORBIS_LIBS $VORBISENC_LIBS $LIBS"
144
145
XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS"

146
AM_PATH_SHOUT(, AC_MSG_ERROR(must have libshout installed!))
147
LIBS="$SHOUT_LIBS $LIBS"
148
XIPH_CFLAGS="$XIPH_CFLAGS $SHOUT_CFLAGS"
Jack Moffitt's avatar
Jack Moffitt committed
149
150
151

dnl Make substitutions

152
AC_SUBST(ICES_EXTRA_OBJS)
153
AC_SUBST(ALSA_LIBS)
Jack Moffitt's avatar
Jack Moffitt committed
154
155
AC_SUBST(XML_LIBS)
AC_SUBST(SHOUT_LIBS)
156
157
158
159
AC_SUBST(OGG_CFLAGS)
AC_SUBST(VORBIS_CFLAGS)
AC_SUBST(SHOUT_CLFAGS)
AC_SUBST(XML_CFLAGS)
Jack Moffitt's avatar
Jack Moffitt committed
160
161
162
163
164
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(PROFILE)
165
AC_SUBST(XIPH_CFLAGS)
166
AC_SUBST(PTHREAD_CFLAGS)
Jack Moffitt's avatar
Jack Moffitt committed
167

168
AC_OUTPUT(Makefile conf/Makefile src/Makefile src/avl/Makefile src/thread/Makefile src/net/Makefile src/log/Makefile src/timing/Makefile)