configure.in 8.74 KB
Newer Older
1 2 3 4 5 6 7
dnl Process this file with autoconf to produce a configure script

dnl ------------------------------------------------
dnl Initialization
dnl ------------------------------------------------

AC_INIT(oggenc/encode.c)
8

9 10 11
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

12 13 14
dnl Apparently we need a newer version than we used to. 
AC_PREREQ(2.53)

15
AM_INIT_AUTOMAKE([vorbis-tools],[1.1.0])
calc's avatar
calc committed
16
AM_MAINTAINER_MODE
17

18 19
AC_CONFIG_HEADER(config.h)

20 21 22 23 24 25 26 27 28 29
dnl --------------------------------------------------  
dnl Check for programs
dnl --------------------------------------------------  

dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
dnl if $CFLAGS is blank
cflags_save="$CFLAGS"
AC_PROG_CC
CFLAGS="$cflags_save"

30
AC_PROG_LIBTOOL
31

32
ALL_LINGUAS="be cs da es fr hr hu nl ro ru sv uk"
Segher Boessenkool's avatar
Grrr.  
Segher Boessenkool committed
33
AM_GNU_GETTEXT
34 35 36 37 38

dnl --------------------------------------------------
dnl Set build flags based on environment
dnl --------------------------------------------------

Ralph Giles's avatar
Ralph Giles committed
39
cflags_save="$CFLAGS"
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
ldflags_save="$LDFLAGS"
if test -z "$GCC"; then
        case $host in
        *-*-irix*)
                DEBUG="-g -signed"
                CFLAGS="-O2 -w -signed"
                PROFILE="-p -g3 -O2 -signed"
                ;;
        sparc-sun-solaris*)
                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
        case $host in
        *-*-linux*)
                DEBUG="-g -Wall -fsigned-char"
                CFLAGS="-O20 -ffast-math -fsigned-char"
                PROFILE="-Wall -W -pg -g -O20 -ffast-math -fsigned-char"
                ;;
        sparc-sun-*)
                DEBUG="-g -Wall -fsigned-char -mv8"
                CFLAGS="-O20 -ffast-math -fsigned-char -mv8"
                PROFILE="-pg -g -O20 -fsigned-char -mv8"
                ;;
        *-*-darwin*)
                DEBUG="-fno-common -g -Wall -fsigned-char"
                CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math"
                PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math"
                ;;
        *)
                DEBUG="-g -Wall -fsigned-char"
                CFLAGS="-O20 -fsigned-char"
                PROFILE="-O20 -g -pg -fsigned-char"
                ;;
        esac
fi
CFLAGS="$CFLAGS $cflags_save"
DEBUG="$DEBUG $cflags_save"
PROFILE="$PROFILE $cflags_save"
LDFLAGS="$LDFLAGS $ldflags_save"
Michael Smith's avatar
 
Michael Smith committed
87

88 89 90 91 92 93 94
dnl --------------------------------------------------
dnl Allow tools to be selectively built
dnl --------------------------------------------------
AC_ARG_ENABLE(ogg123, [  --disable-ogg123   Skip building ogg123], build_ogg123="$enableval", build_ogg123="yes")
AC_ARG_ENABLE(oggdec, [  --disable-oggdec   Skip building oggdec], build_oggdec="$enableval", build_oggdec="yes")
AC_ARG_ENABLE(oggenc, [  --disable-oggenc   Skip building oggenc], build_oggenc="$enableval", build_oggenc="yes")
AC_ARG_ENABLE(ogginfo,[  --disable-ogginfo  Skip building ogginfo], build_ogginfo="$enableval", build_ogginfo="yes")
Michael Smith's avatar
Michael Smith committed
95
AC_ARG_ENABLE(vcut,   [  --disable-vcut     Skip building vcut], build_vcut="$enableval", build_vcut="no")
96
AC_ARG_ENABLE(vorbiscomment, [  --disable-vorbiscomment   Skip building vorbiscomment], build_vorbiscomment="$enableval", build_vorbiscomment="yes")
Stan Seibert's avatar
Stan Seibert committed
97
AC_ARG_WITH(flac,     [  --without-flac     Do not compile FLAC support], build_flac="$enableval", build_flac="yes")
98
AC_ARG_WITH(speex,    [  --without-speex    Do not compile Speex support], build_speex="$enableval", build_speex="yes")
99

100
dnl --------------------------------------------------
101
dnl Check for generally needed libraries
102 103
dnl --------------------------------------------------

104 105
XIPH_PATH_OGG(,AC_MSG_ERROR(Ogg needed!))
XIPH_PATH_VORBIS(,AC_MSG_ERROR(Vorbis needed!))
106

107 108 109 110 111
SHARE_LIBS='$(top_builddir)/share/libutf8.a $(top_builddir)/share/libgetopt.a'
SHARE_CFLAGS='-I$(top_srcdir)/include'

I18N_CFLAGS='-I$(top_srcdir)/intl'
I18N_LIBS=$INTLLIBS
112

113 114 115
SOCKET_LIBS=
AC_CHECK_LIB(socket, socket, SOCKET_LIBS="-lsocket")
AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="-lnsl $SOCKET_LIBS")
116

Ralph Giles's avatar
Ralph Giles committed
117

118
dnl --------------------------------------------------
Stan Seibert's avatar
Stan Seibert committed
119
dnl Check for ogg123 critical libraries and other optional libraries
120
dnl --------------------------------------------------
121

122 123
if test "x$build_ogg123" = xyes; then
  AC_MSG_RESULT([checking for ogg123 requirements])
124
  XIPH_PATH_AO(,build_ogg123=no; AC_MSG_WARN(libao missing))
125 126 127 128
  AM_PATH_CURL(,build_ogg123=no; AC_MSG_WARN(libcurl missing))

  ACX_PTHREAD(,build_ogg123=no; AC_MSG_WARN(POSIX threads missing))
fi
Stan Seibert's avatar
Stan Seibert committed
129

130 131
dnl -------------------- FLAC ----------------------

Ralph Giles's avatar
Ralph Giles committed
132 133 134 135 136 137 138 139
FLAC_LIBS=""
AC_CHECK_LIB(m,log,FLAC_LIBS="-lm")
AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single],
  [have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"],
  AC_MSG_WARN([libFLAC missing])
  have_libFLAC=no, [$FLAC_LIBS]
)
AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new],
140
  [FLAC_LIBS="-lOggFLAC $FLAC_LIBS $OGG_LIBS"],
Ralph Giles's avatar
Ralph Giles committed
141
  AC_MSG_WARN([libOggFLAC missing])
142
  have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS]
Stan Seibert's avatar
Stan Seibert committed
143 144 145 146 147 148 149
)
AC_CHECK_HEADER(FLAC/stream_decoder.h,,
  AC_MSG_WARN(libFLAC headers missing)
  have_libFLAC=no,[ ])

if test "x$have_libFLAC" = xyes; then
   if test "x$build_flac" = xyes; then
150
      AC_DEFINE(HAVE_LIBFLAC, 1, [Defined if we have libFLAC])
Stan Seibert's avatar
Stan Seibert committed
151 152 153
   fi
else
   build_flac="no"
Ralph Giles's avatar
Ralph Giles committed
154
   FLAC_LIBS=""
Stan Seibert's avatar
Stan Seibert committed
155
fi
156
AM_CONDITIONAL(HAVE_LIBFLAC, test "x$have_libFLAC" = "xyes")
Stan Seibert's avatar
Stan Seibert committed
157 158
AC_SUBST(FLAC_LIBS)

159 160
dnl ------------------- Speex ------------------------

Ralph Giles's avatar
Ralph Giles committed
161 162 163 164
SPEEX_LIBS=""
AC_CHECK_LIB(m,log,SPEEX_LIBS="-lm")
AC_CHECK_LIB(speex, [speex_decoder_init],
  [have_libspeex=yes; SPEEX_LIBS="-lspeex $SPEEX_LIBS"],
165
  AC_MSG_WARN(libspeex missing)
Ralph Giles's avatar
Ralph Giles committed
166
  have_libspeex=no, [$SPEEX_LIBS]
167 168 169 170 171 172 173
)
AC_CHECK_HEADER(speex.h,,
  AC_MSG_WARN(libspeex headers missing)
  have_libspeex=no,[ ])

if test "x$have_libspeex" = xyes; then
   if test "x$build_speex" = xyes; then
174
      AC_DEFINE(HAVE_LIBSPEEX, 1, [Defined if we have libspeex])
175 176 177
   fi
else
   build_speex="no"
Ralph Giles's avatar
Ralph Giles committed
178
   SPEEX_LIBS=""
179 180 181
fi
AC_SUBST(SPEEX_LIBS)

182 183 184 185
dnl --------------------------------------------------
dnl Check for library functions
dnl --------------------------------------------------

186
AC_FUNC_ALLOCA
187
AM_ICONV
188
AC_CHECK_FUNCS(atexit on_exit)
189
AM_LANGINFO_CODESET
190

191 192 193 194
dnl --------------------------------------------------
dnl Work around FHS stupidity
dnl --------------------------------------------------

195 196 197 198 199 200
if test -z "$mandir"; then
    if test "$prefix" = "/usr"; then
        MANDIR='$(datadir)/man'
    else
        MANDIR='$(prefix)/man'
    fi
201
else
202
    MANDIR=$mandir
203 204
fi
AC_SUBST(MANDIR)
205

206

207 208 209 210
dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------

Ralph Giles's avatar
Ralph Giles committed
211 212 213 214 215 216
# add optional subdirs to the build
OPT_SUBDIRS=""
if test "x$build_ogg123" = xyes; then
  OPT_SUBDIRS="$OPT_SUBDIRS ogg123"
  if test "x$have_libFLAC" = xyes; then
    OGG123_FLAC_OBJS='flac_format.$(OBJEXT) easyflac.$(OBJEXT)'
217
    OGGENC_FLAC_OBJS='flac.$(OBJEXT) easyflac.$(OBJEXT)'
Ralph Giles's avatar
Ralph Giles committed
218 219
  else
    OGG123_FLAC_OBJS=''
220
    OGGENC_FLAC_OBJS=''
Ralph Giles's avatar
Ralph Giles committed
221 222
  fi
  AC_SUBST(OGG123_FLAC_OBJS)
223
  AC_SUBST(OGGENC_FLAC_OBJS)
Ralph Giles's avatar
Ralph Giles committed
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
  if test "x$have_libspeex" = xyes; then
    OGG123_SPEEX_OBJS='speex_format.$(OBJEXT)'
  else
    OGG123_SPEEX_OBJS=''
  fi
  AC_SUBST(OGG123_SPEEX_OBJS)
fi
if test "x$build_oggenc" = xyes; then
  OPT_SUBDIRS="$OPT_SUBDIRS oggenc"
fi
if test "x$build_oggdec" = xyes; then
  OPT_SUBDIRS="$OPT_SUBDIRS oggdec"
fi
if test "x$build_ogginfo" = xyes; then
  OPT_SUBDIRS="$OPT_SUBDIRS ogginfo"
fi
if test "x$build_vcut" = xyes; then
  OPT_SUBDIRS="$OPT_SUBDIRS vcut"
fi
if test "x$build_vorbiscomment" = xyes; then
  OPT_SUBDIRS="$OPT_SUBDIRS vorbiscomment"
fi
AC_SUBST(OPT_SUBDIRS)
247

248 249
AC_SUBST(DEBUG)
AC_SUBST(PROFILE)
250
AC_SUBST(SOCKET_LIBS)
251
AC_SUBST(SHARE_CFLAGS)
252
AC_SUBST(SHARE_LIBS)
253 254
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)
Segher Boessenkool's avatar
Grrr.  
Segher Boessenkool committed
255 256
AC_SUBST(I18N_CFLAGS)
AC_SUBST(I18N_LIBS)
257

258
AC_OUTPUT(Makefile intl/Makefile po/Makefile.in include/Makefile share/Makefile win32/Makefile oggdec/Makefile oggenc/Makefile oggenc/man/Makefile ogg123/Makefile vorbiscomment/Makefile vcut/Makefile ogginfo/Makefile debian/Makefile)
259

260 261 262 263 264
if test "x$build_oggenc" = xyes -a "x$have_libFLAC" != xyes; then
    AC_MSG_WARN([FLAC and OggFLAC libraries or headers missing, oggenc 
will NOT be built with FLAC read support.])
fi

265 266
if test "x$build_ogg123" != xyes; then
    AC_MSG_WARN([Prerequisites for ogg123 not met, ogg123 will be skipped.
267 268 269 270 271 272 273 274 275
Please ensure that you have POSIX threads, libcurl and libao libraries and
headers present if you would like to build ogg123.])
else
    if test "x$have_libFLAC" != xyes; then
        AC_MSG_WARN([FLAC and OggFLAC libraries or headers missing, ogg123 
will NOT be built with FLAC read support.])
    fi
    if test "x$have_libspeex" != xyes; then
        AC_MSG_WARN([Speex libraries or headers missing, ogg123 will NOT be 
276
built with Speex read support.])
277
    fi         
278
fi