configure.in 4.83 KB
Newer Older
1
# Process this file with autoconf to produce a configure script.
2
# $Id: configure.in,v 1.67 2004/01/30 00:17:26 oddsock Exp $
Jack Moffitt's avatar
Jack Moffitt committed
3

4
5
6
7
m4_define(libshout_major, 2)
m4_define(libshout_minor, 0)
m4_define(libshout_micro, 0)
m4_define(libshout_version,
brendan's avatar
brendan committed
8
  m4_if(libshout_micro, 0, libshout_major.libshout_minor,
brendan's avatar
brendan committed
9
   libshout_major.libshout_minor.libshout_micro))
10

11
AC_INIT([libshout], libshout_version, [icecast-dev@xiph.org])
12
AC_PREREQ([2.54])
13
AC_CONFIG_SRCDIR([src/shout.c])
14
AM_CONFIG_HEADER(config.h)
15
16
17
18
# config.h guard
AH_TOP([#ifndef __CONFIG_H__
#define __CONFIG_H__ 1])
AH_BOTTOM([#endif])
19

20
21
22
AC_DEFINE([LIBSHOUT_MAJOR], libshout_major, [Shout library major version])
AC_DEFINE([LIBSHOUT_MINOR], libshout_minor, [Shout library minor version])
AC_DEFINE([LIBSHOUT_MICRO], libshout_micro, [Shout library patch version])
brendan's avatar
brendan committed
23

24
VERSION=libshout_version
25

26
AM_INIT_AUTOMAKE([libshout], libshout_version)
brendan's avatar
brendan committed
27
AM_MAINTAINER_MODE
Jack Moffitt's avatar
Jack Moffitt committed
28

29
30
31
32
dnl create our name mangling macro
dnl the prefix must be hardwired because of AH limitations
AH_VERBATIM([_mangle], [
/* name mangling to protect code we share with other libraries */
33
#define _mangle(proc) _shout_ ## proc
34
35
])

Jack Moffitt's avatar
Jack Moffitt committed
36
37
38
39
40
AC_PROG_CC
AM_PROG_LIBTOOL

dnl Set some options based on environment

41
42
43
dnl openbsd headers break when _XOPEN_SOURCE is defined but without it seems
dnl to be fine
case "$ac_cv_host" in
brendan's avatar
brendan committed
44
   *openbsd* | *solaris* | *irix*)
brendan's avatar
brendan committed
45
   ;;
46
   *) AC_DEFINE(_XOPEN_SOURCE, 600, [Define if you have POSIX and XPG specifications])
47
48
   ;;
esac
Jack Moffitt's avatar
Jack Moffitt committed
49
50
51
52
53
54
55
if test -z "$GCC"; then
        case $host in 
        *-*-irix*)
                DEBUG="-g -signed" 
                CFLAGS="-O2 -w -signed"
                PROFILE="-p -g3 -O2 -signed"
		;;
56
        sparc-sun-solaris*)
Jack Moffitt's avatar
Jack Moffitt committed
57
58
59
60
61
62
63
64
65
66
67
                DEBUG="-v -g"
                CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
                PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
		;;
        *)
                DEBUG="-g"
                CFLAGS="-O"
                PROFILE="-g -p" 
		;;
        esac
else
68
69
        XIPH_CFLAGS="-Wall -ffast-math -fsigned-char"
        AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications])
70
71
        DEBUG="-g"
        PROFILE="-pg -g"
Jack Moffitt's avatar
Jack Moffitt committed
72
73
74
75
76
77
fi

dnl Checks for programs.

dnl Checks for header files.
AC_HEADER_STDC
brendan's avatar
brendan committed
78
AC_CHECK_HEADERS([strings.h])
Jack Moffitt's avatar
Jack Moffitt committed
79
80
81

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
brendan's avatar
brendan committed
82
XIPH_C99_INTTYPES
83

Jack Moffitt's avatar
Jack Moffitt committed
84
dnl Checks for library functions.
brendan's avatar
brendan committed
85
86
87
AC_SEARCH_LIBS([nanosleep], [rt],
  [AC_DEFINE([HAVE_NANOSLEEP], [1],
    [Define if you have the nanosleep function])])
Jack Moffitt's avatar
Jack Moffitt committed
88

brendan's avatar
brendan committed
89
90
dnl Module checks
XIPH_NET
91

brendan's avatar
brendan committed
92
dnl Extra dependencies
93
94
AC_ARG_ENABLE([thread],
  AC_HELP_STRING([--disable-thread],[do not build with thread support even if it is available]))
95

brendan's avatar
brendan committed
96
SHOUT_THREADSAFE="0"
97
if test "$enable_thread" != "no"
98
99
100
then
  ACX_PTHREAD([
    LIBS="$LIBS $PTHREAD_LIBS"
brendan's avatar
brendan committed
101
    XIPH_CFLAGS="$XIPH_CFLAGS $PTHREAD_CFLAGS $PTHREAD_CPPFLAGS"
102
    CC="$PTHREAD_CC"
brendan's avatar
brendan committed
103
    SHOUT_THREADSAFE="1"
104
105
    ])
fi
brendan's avatar
brendan committed
106
107
108
AC_SUBST([SHOUT_THREADSAFE])
AM_CONDITIONAL([HAVE_THREAD], [test "$SHOUT_THREADSAFE" = "1"])
if test "$SHOUT_THREADSAFE" != "1"
109
110
111
then
  AC_DEFINE([NO_THREAD], 1, [Define if you don't want to use the thread library])
fi
112

113
XIPH_PATH_VORBIS
114
115
VORBIS_LIBS="$VORBIS_LDFLAGS $VORBIS_LIBS"
XIPH_CFLAGS="$XIPH_CFLAGS $VORBIS_CFLAGS"
116

117
118
119
120
121
dnl pkgconfig/shout-config.
dnl If pkgconfig is found, use it and disable shout-config, otherwise do the
dnl opposite, unless the user overrides.

AC_ARG_ENABLE([pkgconfig],
122
  AC_HELP_STRING([--disable-pkgconfig],[disable pkgconfig data files (auto)]),
123
  [dopkgconfig="$enableval"], [dopkgconfig="maybe"])
brendan's avatar
Typo    
brendan committed
124
if test "$dopkgconfig" = "maybe"
125
126
127
128
129
130
131
then
  AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes], [no])
else
  AC_MSG_CHECKING([whether pkgconfig should be used])
  PKGCONFIG="$dopkgconfig"
  AC_MSG_RESULT([$PKGCONFIG])
fi
132
133
AM_CONDITIONAL([HAVE_PKGCONFIG], [test "$PKGCONFIG" != "no"])

134
# Build shout-config, shout.pc
135
136
137
138
139
140
141
142
143
144

# I hate myself for doing this.
save_prefix="$prefix"
if test "$prefix" = "NONE"
then
  prefix="$ac_default_prefix"
fi
eval shout_includedir="$includedir"
prefix="$save_prefix"

145
SHOUT_VERSION="$VERSION"
146
147
SHOUT_CPPFLAGS="-I$shout_includedir $VORBIS_CFLAGS $PTHREAD_CPPFLAGS"
SHOUT_CFLAGS="$PTHREAD_CFLAGS"
148
SHOUT_LIBS="-lshout"
149

150
XIPH_CLEAN_CCFLAGS([$SHOUT_CPPFLAGS], [SHOUT_CPPFLAGS])
151
XIPH_CLEAN_CCFLAGS([$SHOUT_CFLAGS], [SHOUT_CFLAGS])
brendan's avatar
brendan committed
152
XIPH_CLEAN_CCFLAGS([$VORBIS_LIBS $PTHREAD_LIBS $LIBS], [SHOUT_LIBDEPS])
153
AC_SUBST(SHOUT_LIBDEPS)
154
AC_SUBST(SHOUT_CPPFLAGS)
155
AC_SUBST(SHOUT_CFLAGS)
156
157
AC_CONFIG_LIBCONFIG_IN_STATIC
AC_CONFIG_LIBCONFIG_IN([shout])
158

Jack Moffitt's avatar
Jack Moffitt committed
159
160
161
162
163
164
165
166
dnl Make substitutions

AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
167
AC_SUBST(XIPH_CFLAGS)
Karl Heyes's avatar
Karl Heyes committed
168
AC_SUBST(XIPH_CPPFLAGS)
Jack Moffitt's avatar
Jack Moffitt committed
169

keegan's avatar
keegan committed
170
AC_OUTPUT([Makefile debian/Makefile include/Makefile include/shout/Makefile
brendan's avatar
brendan committed
171
172
  include/shout/shout.h src/Makefile src/net/Makefile src/timing/Makefile
  src/thread/Makefile src/avl/Makefile src/httpp/Makefile doc/Makefile
173
  examples/Makefile win32/Makefile shout-config shout.pc])