configure.ac 7.86 KB
Newer Older
andre's avatar
andre committed
1 2 3 4 5
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/liboggz/oggz.c])

AC_PREREQ(2.53)
conrad's avatar
conrad committed
6

andre's avatar
andre committed
7 8
AC_CANONICAL_TARGET

conrad's avatar
conrad committed
9
AM_INIT_AUTOMAKE(liboggz, 0.9.0)
andre's avatar
andre committed
10 11
AM_CONFIG_HEADER(config.h)

conrad's avatar
conrad committed
12
SHARED_VERSION_INFO="2:0:1"
andre's avatar
andre committed
13 14 15 16
SHLIB_VERSION_ARG=""

# Checks for programs.
AC_PROG_CC
conrad's avatar
conrad committed
17
AC_PROG_CPP
andre's avatar
andre committed
18
AC_PROG_INSTALL
conrad's avatar
conrad committed
19
AC_PROG_LN_S
andre's avatar
andre committed
20 21 22 23 24 25
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

AC_C_CONST
AC_C_BIGENDIAN

conrad's avatar
conrad committed
26 27 28 29 30 31 32 33 34 35
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h inttypes.h stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

# Checks for library functions.
AC_FUNC_REALLOC
36
AC_CHECK_FUNCS([memmove random])
conrad's avatar
conrad committed
37

38 39
# Check for pkg-config
AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
andre's avatar
andre committed
40 41 42 43 44 45 46 47 48

# Check for doxygen
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
if test $HAVE_DOXYGEN = "false"; then
             AC_MSG_WARN([*** doxygen not found, docs will not be built])
fi

# Check for docbook
conrad's avatar
conrad committed
49 50 51 52
AC_CHECK_PROG(HAVE_DOCBOOKTOMAN, docbook-to-man, true, false)
AM_CONDITIONAL(HAVE_DOCBOOKTOMAN,$HAVE_DOCBOOKTOMAN)
AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, true, false)
AM_CONDITIONAL(HAVE_DOCBOOK2HTML,$HAVE_DOCBOOK2HTML)
andre's avatar
andre committed
53

54
# Check for valgrind
55
ac_enable_valgrind=no
56
AC_ARG_ENABLE(valgrind-testing,
57 58
     [  --enable-valgrind-testing     enable running of tests inside Valgrind ],
     [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
59 60

if test "x${ac_enable_valgrind}" = xyes ; then
61 62 63 64 65 66 67 68
  if test "x${enable_shared}" = xyes ; then
    AC_MSG_WARN([
*** You have requested to test under valgrind, but have not disabled the
*** building of shared libraries. You usually need to do:
***   ./configure --disable-shared --enable-valgrind-testing
*** for Valgrind to produce useful output.])
  fi

69 70 71 72 73 74 75 76 77 78
  AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
  if test "x$HAVE_VALGRIND" = xyes ; then
    VALGRIND_ENVIRONMENT="valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
    AC_SUBST(VALGRIND_ENVIRONMENT)
    TESTS_INFO="'make check' test suite will be run under:
  ${VALGRIND_ENVIRONMENT}"
  else
    TESTS_INFO="'make check' to run test suite (Valgrind not found)"
  fi
else
79
  TESTS_INFO="'make check' to run test suite (Valgrind testing not enabled)"
80 81
fi

andre's avatar
andre committed
82 83 84
dnl Checks for libraries.
LIBS=""

conrad's avatar
conrad committed
85
# check for getopt in a separate library
andre's avatar
andre committed
86 87 88 89 90 91 92
HAVE_GETOPT=no
AC_CHECK_LIB(getopt, getopt, HAVE_GETOPT="yes")
if test "x$HAVE_GETOPT" = xyes ; then
  GETOPT_LIBS="-lgetopt"
  AC_SUBST(GETOPT_LIBS)
fi

conrad's avatar
conrad committed
93 94 95 96 97 98 99
# check for getopt_long in standard library
HAVE_GETOPT_LONG=no
AC_CHECK_FUNC(getopt_long, HAVE_GETOPT_LONG="yes")
if test "x$HAVE_GETOPT_LONG" = xyes ; then
  AC_DEFINE(HAVE_GETOPT_LONG, [], [Define to 1 if you have the 'getopt_long' function])
fi

andre's avatar
andre committed
100 101 102
dnl Overall configuration success flag
oggz_config_ok=yes

103 104 105
oggz_read_programs=""
oggz_rw_programs=""

andre's avatar
andre committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
dnl
dnl  Configuration option for building of experimental code.
dnl

ac_enable_experimental=no
AC_ARG_ENABLE(experimental,
     [  --enable-experimental   enable building of experimental code ],
     [ ac_enable_experimental=yes ])

if test "x${ac_enable_experimental}" = xyes ; then
    AC_DEFINE(OGGZ_CONFIG_EXPERIMENTAL, [], [Define to build experimental code])
fi

dnl
dnl  Configuration option for building of reading support.
dnl

ac_enable_read=yes
AC_ARG_ENABLE(read,
     [  --disable-read          disable building of reading support ],
     [ ac_enable_read=no ], [ ac_enable_read=yes] )

if test "x${ac_enable_read}" = xyes ; then
    AC_DEFINE(OGGZ_CONFIG_READ, [1], [Build reading support])
130
    oggz_read_programs="oggzdump oggzinfo"
andre's avatar
andre committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
else
    AC_DEFINE(OGGZ_CONFIG_READ, [0], [Do not build reading support]) 
fi
AM_CONDITIONAL(OGGZ_CONFIG_READ, test "x${ac_enable_read}" = xyes)

dnl
dnl  Configuration option for building of writing support.
dnl
  
ac_enable_write=yes
AC_ARG_ENABLE(write,
     [  --disable-write         disable building of writing support ],
     [ ac_enable_write=no ], [ ac_enable_write=yes] )

if test "x${ac_enable_write}" = xyes ; then
    AC_DEFINE(OGGZ_CONFIG_WRITE, [1], [Build writing support])
147 148 149
    if test "x${ac_enable_read}" = xyes ; then
      oggz_rw_programs="oggzrip oggzmerge"
    fi
andre's avatar
andre committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
else
    AC_DEFINE(OGGZ_CONFIG_WRITE, [0], [Do not build writing support])
fi
AM_CONDITIONAL(OGGZ_CONFIG_WRITE, test "x${ac_enable_write}" = xyes)

dnl
dnl  Check read/write option sanity
dnl
if test "x${ac_enable_read}" = xno && test "x${ac_enable_write}" = xno ; then
  AC_MSG_ERROR([
***
*** You have attempted to explicitly disable both writing and reading.
***
])
fi


dnl
dnl Detect Ogg
dnl

HAVE_OGG=no
172 173
if test "x$HAVE_PKG_CONFIG" = "xyes" ; then
  PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
andre's avatar
andre committed
174
fi
175 176 177 178 179 180 181 182 183

if test "x$HAVE_OGG" = "xno" ; then
  XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
  if test "x$HAVE_OGG" = xno ; then
    oggz_config_ok="no"
    AC_CHECK_LIB(ogg, ogg_stream_init, HAVE_OGG="maybe")
  fi
fi

andre's avatar
andre committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
AM_CONDITIONAL(HAVE_OGG, [test "x$HAVE_OGG" = "xyes"])

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

dnl Use -Wall if we have gcc.
dnl changequote(,)dnl
if test "x$ac_cv_prog_gcc" = xyes ; then
  CFLAGS="$CFLAGS -Wall -g"
fi
dnl changequote([,])dnl

case "$target_os" in
  darwin* | rhapsody*)
    dnl Disable -Wall and -pedantic for Apple Darwin/Rhapsody.
    dnl System headers on these systems are broken.
    temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//"`
    CFLAGS=$temp_CFLAGS
    ;;
  linux* | solaris*)
    SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
    ;;
  *)
    ;;
esac

# Checks for library functions.

dnl
dnl  Configuration tests complete -- provide summary of results.
dnl

if test $oggz_config_ok = no ; then

AC_MSG_RESULT([
**************************************************************

*** $PACKAGE $VERSION: Automatic configuration FAILED.

*** The file config.log has full details.

*** The following required libraries are missing or
*** misconfigured on your system:
])

if test "x$HAVE_OGG" != xyes ; then
    AC_MSG_RESULT(
[*** libogg, available from  http://www.xiph.org/ogg/])
fi
if test "x$HAVE_OGG" = xmaybe ; then
    AC_MSG_RESULT(
[      Development files missing: The libogg library binary seems to be
      installed, but building of a test program failed.
])
fi

AC_MSG_RESULT(
[*** If you install the required libraries from source, you
*** need to inform the dynamic linker of their location. If
*** you install them in a system-wide directory such as
*** /usr/local (the default), you must ensure that
*** /usr/local/lib is listed in /etc/ld.so.conf, then run
*** ldconfig to update the dynamic linking system.
*** Alternatively, you can set your LD_LIBRARY_PATH environment
*** variable to include the library installation directory.
])


AC_MSG_RESULT(
[**************************************************************
])


AC_MSG_ERROR([
***
*** After fixing the above problems, you must run ./configure again.
***
]) 

else

AC_SUBST(SHLIB_VERSION_ARG)
AC_SUBST(SHARED_VERSION_INFO)

AC_OUTPUT([
Makefile
doc/Makefile
doc/Doxyfile
include/Makefile
include/oggz/Makefile
src/Makefile
src/liboggz/Version_script
src/liboggz/Makefile
src/tools/Makefile
conrad's avatar
conrad committed
279
src/tools/oggzdiff
andre's avatar
andre committed
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
src/tests/Makefile
src/examples/Makefile
oggz.pc
])

AC_MSG_RESULT([
------------------------------------------------------------------------
  $PACKAGE $VERSION:  Automatic configuration OK.

  General configuration:

    Experimental code: ........... ${ac_enable_experimental}
    Reading support: ............. ${ac_enable_read}
    Writing support: ............. ${ac_enable_write}

295 296 297 298
  Tools:

    ${oggz_read_programs} ${oggz_rw_programs}

andre's avatar
andre committed
299 300 301
  Installation paths:

    liboggz: ..................... ${prefix}/lib
302
    Tools: ....................... ${prefix}/bin
andre's avatar
andre committed
303 304 305
    C header files: .............. ${prefix}/include/oggz
    Documentation: ............... ${prefix}/share/doc/$PACKAGE

306 307
  ${TESTS_INFO}

andre's avatar
andre committed
308 309 310 311 312 313
  Example programs will be built but not installed.
------------------------------------------------------------------------
])


fi