1dnl Process this file with autoconf to produce a configure script 2 3dnl ------------------------------------------------ 4dnl Initialization 5dnl ------------------------------------------------ 6 7AC_INIT([vorbis-tools],[1.4.2],[vorbis-dev@xiph.org]) 8 9AC_CONFIG_SRCDIR(oggenc/encode.c) 10AC_CONFIG_MACRO_DIR([m4]) 11 12AC_CANONICAL_HOST 13 14AC_PREREQ(2.53) 15 16AM_INIT_AUTOMAKE 17AM_MAINTAINER_MODE([enable]) 18 19AC_USE_SYSTEM_EXTENSIONS 20 21dnl enable silent rules on automake 1.11 and later 22m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 23 24dnl -------------------------------------------------- 25dnl Check for programs 26dnl -------------------------------------------------- 27 28dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2" 29dnl if $CFLAGS is blank 30cflags_save="$CFLAGS" 31AC_PROG_CC 32CFLAGS="$cflags_save" 33 34AC_PROG_LIBTOOL 35 36ALL_LINGUAS="be cs da en_GB eo es fr hr hu nl pl ro ru sk sv uk vi" 37AM_GNU_GETTEXT 38 39dnl -------------------------------------------------- 40dnl System checks 41dnl -------------------------------------------------- 42 43AC_SYS_LARGEFILE 44AC_C_BIGENDIAN 45 46dnl -------------------------------------------------- 47dnl Set build flags based on environment 48dnl -------------------------------------------------- 49 50cflags_save="$CFLAGS" 51if test -z "$GCC"; then 52 case $host in 53 *-*-irix*) 54 DEBUG="-g -signed" 55 CFLAGS="-O2 -w -signed" 56 PROFILE="-p -g3 -O2 -signed" 57 ;; 58 sparc-sun-solaris*) 59 DEBUG="-v -g" 60 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" 61 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" 62 ;; 63 *) 64 DEBUG="-g" 65 CFLAGS="-O" 66 PROFILE="-g -p" 67 ;; 68 esac 69else 70 case $host in 71 *-*-linux*) 72 DEBUG="-g -Wall -fsigned-char" 73 CFLAGS="-O2 -Wall -ffast-math -fsigned-char" 74 PROFILE="-Wall -W -pg -g -O2 -ffast-math -fsigned-char" 75 ;; 76 sparc-sun-*) 77 DEBUG="-g -Wall -fsigned-char -mv8" 78 CFLAGS="-O20 -ffast-math -fsigned-char -mv8" 79 PROFILE="-pg -g -O20 -fsigned-char -mv8" 80 ;; 81 *-*-darwin*) 82 DEBUG="-fno-common -g -Wall -fsigned-char" 83 CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math" 84 PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math" 85 ;; 86 *) 87 DEBUG="-g -Wall -fsigned-char" 88 CFLAGS="-O2 -fsigned-char" 89 PROFILE="-O2 -g -pg -fsigned-char" 90 ;; 91 esac 92fi 93CFLAGS="$CFLAGS $cflags_save" 94DEBUG="$DEBUG $cflags_save" 95PROFILE="$PROFILE $cflags_save" 96 97dnl -------------------------------------------------- 98dnl Allow tools to be selectively built 99dnl -------------------------------------------------- 100AC_ARG_ENABLE(ogg123, [ --disable-ogg123 Skip building ogg123], build_ogg123="$enableval", build_ogg123="yes") 101AC_ARG_ENABLE(oggdec, [ --disable-oggdec Skip building oggdec], build_oggdec="$enableval", build_oggdec="yes") 102AC_ARG_ENABLE(oggenc, [ --disable-oggenc Skip building oggenc], build_oggenc="$enableval", build_oggenc="yes") 103AC_ARG_ENABLE(ogginfo,[ --disable-ogginfo Skip building ogginfo], build_ogginfo="$enableval", build_ogginfo="yes") 104AC_ARG_ENABLE(vcut, [ --disable-vcut Skip building vcut], build_vcut="$enableval", build_vcut="yes") 105AC_ARG_ENABLE(vorbiscomment, [ --disable-vorbiscomment Skip building vorbiscomment], build_vorbiscomment="$enableval", build_vorbiscomment="yes") 106AC_ARG_WITH(flac, [ --without-flac Do not compile FLAC support], build_flac="$withval", build_flac="yes") 107AC_ARG_WITH(speex, [ --without-speex Do not compile Speex support], build_speex="$withval", build_speex="yes") 108AC_ARG_WITH(kate, [ --without-kate Do not compile Kate support], build_kate="$withval", build_kate="yes") 109 110dnl -------------------------------------------------- 111dnl Check for generally needed libraries 112dnl -------------------------------------------------- 113 114HAVE_OGG=no 115dnl first check through pkg-config 116dnl check for pkg-config itself so we don't try the m4 macro without pkg-config 117AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes) 118if test "x$HAVE_PKG_CONFIG" = "xyes" 119then 120 PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no) 121fi 122if test "x$HAVE_OGG" = "xno" 123then 124 dnl fall back to the old school test 125 XIPH_PATH_OGG(,AC_MSG_ERROR(Ogg needed!)) 126 libs_save=$LIBS 127 LIBS="$OGG_LIBS $VORBIS_LIBS" 128 AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !)) 129 LIBS=$libs_save 130fi 131 132dnl check for Vorbis 133HAVE_VORBIS=no 134 135dnl first check through pkg-config since it's more flexible 136 137if test "x$HAVE_PKG_CONFIG" = "xyes" 138then 139 PKG_CHECK_MODULES(VORBIS, vorbis >= 1.3.0, HAVE_VORBIS=yes, HAVE_VORBIS=no) 140 dnl also set VORBISENC_LIBS since an examples needs it 141 dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS, 142 dnl so we do the same here. 143 VORBISENC_LIBS="-lvorbisenc" 144 VORBISFILE_LIBS="-lvorbisfile" 145 AC_SUBST(VORBISENC_LIBS) 146 AC_SUBST(VORBISFILE_LIBS) 147 libs_save=$LIBS 148 LIBS="$OGG_LIBS $VORBIS_LIBS $VORBISFILE_LIBS" 149 AC_CHECK_FUNC(ov_read_filter, have_ov_read_filter=yes, have_ov_read_filter=no) 150 LIBS=$libs_save 151 if test "x$have_ov_read_filter" = "xyes" 152 then 153 AC_DEFINE(HAVE_OV_READ_FILTER,1,[Defined if we have ov_read_filter()]) 154 fi 155fi 156if test "x$HAVE_VORBIS" = "xno" 157then 158 dnl fall back to the old school test 159 XIPH_PATH_VORBIS(,AC_MSG_ERROR(Vorbis needed!)) 160 AC_CHECK_DECL(OV_ECTL_COUPLING_SET, , , [#include <vorbis/vorbisenc.h>]) 161 if test "x$ac_cv_have_decl_OV_ECTL_COUPLING_SET" = "xno" 162 then 163 AC_MSG_ERROR([Vorbis >= 1.3.0 required !]) 164 HAVE_VORBIS=no 165 fi 166fi 167AM_CONDITIONAL(HAVE_OV_READ_FILTER, test "x$have_ov_read_filter" = "xyes") 168 169if test "x$HAVE_PKG_CONFIG" = "xyes" 170then 171 PKG_CHECK_MODULES(OPUSFILE, opusfile >= 0.2, HAVE_LIBOPUSFILE=yes, HAVE_LIBOPUSFILE=no) 172 AC_SUBST(OPUSFILE_LIBS) 173 if test "x$HAVE_LIBOPUSFILE" = xyes; then 174 AC_DEFINE(HAVE_LIBOPUSFILE, 1, [Defined if we have libopusfile]) 175 fi 176fi 177AM_CONDITIONAL(HAVE_LIBOPUSFILE, test "x$HAVE_LIBOPUSFILE" = "xyes") 178 179 180SHARE_LIBS='$(top_builddir)/share/libutf8.a $(top_builddir)/share/libgetopt.a' 181SHARE_CFLAGS='-I$(top_srcdir)/include' 182 183I18N_CFLAGS='-I$(top_srcdir)/intl' 184I18N_LIBS=$INTLLIBS 185 186SOCKET_LIBS= 187AC_CHECK_LIB(socket, socket, SOCKET_LIBS="-lsocket") 188AC_CHECK_LIB(network, socket, SOCKET_LIBS="-lnetwork") 189AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="-lnsl $SOCKET_LIBS") 190 191 192dnl -------------------------------------------------- 193dnl Check for ogg123 critical libraries and other optional libraries 194dnl -------------------------------------------------- 195 196dnl curl is an optional dependancy of ogg123 197if test "x$HAVE_PKG_CONFIG" = "xyes"; then 198 PKG_CHECK_MODULES(CURL, libcurl, HAVE_CURL=yes, HAVE_CURL=no) 199 if test "x$HAVE_CURL" = "xno"; then 200 AM_PATH_CURL(HAVE_CURL=yes, HAVE_CURL=no; AC_MSG_WARN(libcurl missing)) 201 fi 202else 203 AM_PATH_CURL(HAVE_CURL=yes, HAVE_CURL=no; AC_MSG_WARN(libcurl missing)) 204fi 205if test "x$HAVE_CURL" = "xyes"; then 206 AC_DEFINE(HAVE_CURL,1,[Defined if we have libcurl]) 207fi 208 209if test "x$build_ogg123" = xyes; then 210 AC_MSG_RESULT([checking for ogg123 requirements]) 211 PKG_CHECK_MODULES(AO, ao >= 1.0.0,,build_ogg123=no; AC_MSG_WARN(libao too old; >= 1.0.0 required)) 212 ACX_PTHREAD(,build_ogg123=no; AC_MSG_WARN(POSIX threads missing)) 213fi 214 215dnl -------------------- FLAC ---------------------- 216 217FLAC_LIBS="" 218if test "x$build_flac" = xyes; then 219 220 AC_CHECK_LIB(m,log,FLAC_LIBS="-lm") 221 222 dnl First check for libFLAC-1.1.3 or later. As of libFLAC 1.1.3, 223 dnl OggFLAC functionality has been rolled into libFLAC rather 224 dnl than being in a separate libOggFLAC library. 225 226 AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_init_ogg_stream], 227 have_libFLAC=yes, have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS]) 228 229 if test "x$have_libFLAC" = xyes; then 230 FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_LIBS" 231 else 232 dnl Check for libFLAC prior to 1.1.3 233 AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single], 234 [have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"], 235 AC_MSG_WARN([libFLAC missing]) 236 have_libFLAC=no, [$FLAC_LIBS] 237 ) 238 239 AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new], 240 [FLAC_LIBS="-lOggFLAC $FLAC_LIBS $OGG_LIBS"], 241 AC_MSG_WARN([libOggFLAC missing]) 242 have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS] 243 ) 244 fi 245 246 AC_CHECK_HEADER(FLAC/stream_decoder.h,, 247 AC_MSG_WARN(libFLAC headers missing) 248 have_libFLAC=no,[ ]) 249 250 if test "x$have_libFLAC" = xyes; then 251 AC_DEFINE(HAVE_LIBFLAC, 1, [Defined if we have libFLAC]) 252 else 253 build_flac="no" 254 FLAC_LIBS="" 255 fi 256fi 257AM_CONDITIONAL(HAVE_LIBFLAC, test "x$have_libFLAC" = "xyes") 258AC_SUBST(FLAC_LIBS) 259 260dnl ------------------- Speex ------------------------ 261 262SPEEX_LIBS="" 263if test "x$build_speex" = xyes; then 264 AC_CHECK_LIB(m,log,SPEEX_LIBS="-lm") 265 AC_CHECK_LIB(speex, [speex_decoder_init], 266 [have_libspeex=yes; SPEEX_LIBS="-lspeex $SPEEX_LIBS"], 267 AC_MSG_WARN(libspeex missing) 268 have_libspeex=no, [$SPEEX_LIBS] 269 ) 270 AC_CHECK_HEADER(speex/speex.h,, 271 AC_MSG_WARN(libspeex headers missing) 272 have_libspeex=no,[ ]) 273 274 if test "x$have_libspeex" = xyes; then 275 AC_DEFINE(HAVE_LIBSPEEX, 1, [Defined if we have libspeex]) 276 else 277 build_speex="no" 278 SPEEX_LIBS="" 279 fi 280fi 281AM_CONDITIONAL(HAVE_LIBSPEEX, test "x$have_libspeex" = "xyes") 282AC_SUBST(SPEEX_LIBS) 283 284dnl ------------------- Kate ------------------------- 285 286KATE_CFLAGS="" 287KATE_LIBS="" 288if test "x$build_kate" = xyes; then 289 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes) 290 if test "x$HAVE_PKG_CONFIG" = "xyes" 291 then 292 PKG_CHECK_MODULES(KATE, oggkate, HAVE_KATE=yes, HAVE_KATE=no) 293 fi 294 if test "x$HAVE_KATE" = "xno" 295 then 296 dnl fall back to the old school test 297 AC_CHECK_LIB(m,log,KATE_LIBS="-lm") 298 AC_CHECK_LIB(kate, [kate_decode_init], 299 [HAVE_KATE=yes; KATE_LIBS="-lkate $KATE_LIBS $OGG_LIBS"], 300 AC_MSG_WARN(libkate missing) 301 HAVE_KATE=no, [$KATE_LIBS $OGG_LIBS] 302 ) 303 AC_CHECK_LIB(oggkate, [kate_ogg_decode_headerin], 304 [HAVE_KATE=yes; KATE_LIBS="-loggkate $KATE_LIBS $OGG_LIBS"], 305 AC_MSG_WARN(libkate missing) 306 HAVE_KATE=no, [$KATE_LIBS $OGG_LIBS] 307 ) 308 AC_CHECK_HEADER(kate/kate.h,, 309 AC_MSG_WARN(libkate headers missing) 310 HAVE_KATE=no,[ ]) 311 AC_CHECK_HEADER(kate/oggkate.h,, 312 AC_MSG_WARN(liboggkate headers missing) 313 HAVE_KATE=no,[ ]) 314 315 fi 316 if test "x$HAVE_KATE" = xyes; then 317 AC_DEFINE(HAVE_KATE, 1, [Defined if we have libkate]) 318 else 319 build_kate="no" 320 KATE_CFLAGS="" 321 KATE_LIBS="" 322 fi 323fi 324AM_CONDITIONAL(HAVE_KATE, test "x$HAVE_KATE" = "xyes") 325AC_SUBST(KATE_CFLAGS) 326AC_SUBST(KATE_LIBS) 327 328dnl -------------------------------------------------- 329dnl Check for headers 330dnl -------------------------------------------------- 331 332AC_CHECK_HEADERS([fcntl.h unistd.h]) 333 334dnl -------------------------------------------------- 335dnl Check for library functions 336dnl -------------------------------------------------- 337 338AC_FUNC_ALLOCA 339AM_ICONV 340AC_CHECK_FUNCS(atexit on_exit fcntl select stat chmod alphasort scandir) 341AM_LANGINFO_CODESET 342 343dnl -------------------------------------------------- 344dnl Work around FHS stupidity 345dnl -------------------------------------------------- 346 347if test -z "$mandir"; then 348 if test "$prefix" = "/usr"; then 349 MANDIR='$(datadir)/man' 350 else 351 MANDIR='$(prefix)/man' 352 fi 353else 354 MANDIR=$mandir 355fi 356AC_SUBST(MANDIR) 357 358 359dnl -------------------------------------------------- 360dnl Do substitutions 361dnl -------------------------------------------------- 362 363# add optional subdirs to the build 364OPT_SUBDIRS="" 365if test "x$build_ogg123" = xyes; then 366 OPT_SUBDIRS="$OPT_SUBDIRS ogg123" 367fi 368if test "x$build_oggenc" = xyes; then 369 OPT_SUBDIRS="$OPT_SUBDIRS oggenc" 370fi 371if test "x$build_oggdec" = xyes; then 372 OPT_SUBDIRS="$OPT_SUBDIRS oggdec" 373fi 374if test "x$build_ogginfo" = xyes; then 375 OPT_SUBDIRS="$OPT_SUBDIRS ogginfo" 376fi 377if test "x$build_vcut" = xyes; then 378 OPT_SUBDIRS="$OPT_SUBDIRS vcut" 379fi 380if test "x$build_vorbiscomment" = xyes; then 381 OPT_SUBDIRS="$OPT_SUBDIRS vorbiscomment" 382fi 383AC_SUBST(OPT_SUBDIRS) 384 385AC_SUBST(DEBUG) 386AC_SUBST(PROFILE) 387AC_SUBST(SOCKET_LIBS) 388AC_SUBST(SHARE_CFLAGS) 389AC_SUBST(SHARE_LIBS) 390AC_SUBST(CURL_CFLAGS) 391AC_SUBST(CURL_LIBS) 392AC_SUBST(I18N_CFLAGS) 393AC_SUBST(I18N_LIBS) 394 395 396AC_CONFIG_FILES([ 397Makefile 398m4/Makefile 399po/Makefile.in 400intl/Makefile 401include/Makefile 402share/Makefile 403win32/Makefile 404oggdec/Makefile 405oggenc/Makefile 406oggenc/man/Makefile 407ogg123/Makefile 408vorbiscomment/Makefile 409vcut/Makefile 410ogginfo/Makefile 411]) 412 413AC_CONFIG_HEADERS([config.h]) 414 415AC_OUTPUT 416 417if test "x$build_oggenc" = xyes -a "x$have_libFLAC" != xyes; then 418 AC_MSG_WARN([FLAC and/or OggFLAC libraries or headers missing, oggenc 419will NOT be built with FLAC read support.]) 420fi 421 422if test "x$build_ogg123" != xyes; then 423 AC_MSG_WARN([Prerequisites for ogg123 not met, ogg123 will be skipped. 424Please ensure that you have POSIX threads, libao, and (optionally) libcurl 425libraries and headers present if you would like to build ogg123.]) 426else 427 if test "x$have_libFLAC" != xyes; then 428 AC_MSG_WARN([FLAC and/or OggFLAC libraries or headers missing, ogg123 429will NOT be built with FLAC read support.]) 430 fi 431 if test "x$have_libspeex" != xyes; then 432 AC_MSG_WARN([Speex libraries and/or headers missing, ogg123 433will NOT be built with Speex read support.]) 434 fi 435 if test "x$HAVE_CURL" != xyes; then 436 AC_MSG_WARN([curl libraries and/or headers missing, ogg123 437will NOT be built with http support.]) 438 fi 439 if test "x$HAVE_KATE" != xyes; then 440 AC_MSG_WARN([Kate libraries and/or headers missing, oggenc 441will NOT be built with Kate lyrics support.]) 442 fi 443fi 444