Lucas Eckels | f869a6f | 2012-08-06 15:15:24 -0700 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | |
| 3 | AC_INIT(src/framing.c) |
| 4 | |
| 5 | AM_INIT_AUTOMAKE(libogg,1.2.0) |
| 6 | AM_MAINTAINER_MODE |
| 7 | |
| 8 | dnl Library versioning |
| 9 | |
| 10 | LIB_CURRENT=7 |
| 11 | LIB_REVISION=0 |
| 12 | LIB_AGE=7 |
| 13 | AC_SUBST(LIB_CURRENT) |
| 14 | AC_SUBST(LIB_REVISION) |
| 15 | AC_SUBST(LIB_AGE) |
| 16 | |
| 17 | AC_PROG_CC |
| 18 | AM_PROG_LIBTOOL |
| 19 | AM_PROG_CC_C_O |
| 20 | |
| 21 | dnl config.h |
| 22 | AM_CONFIG_HEADER(config.h) |
| 23 | |
| 24 | dnl Set some options based on environment |
| 25 | |
| 26 | cflags_save="$CFLAGS" |
| 27 | if test -z "$GCC"; then |
| 28 | case $host in |
| 29 | *-*-irix*) |
| 30 | DEBUG="-g -signed" |
| 31 | CFLAGS="-O2 -w -signed" |
| 32 | PROFILE="-p -g3 -O2 -signed" |
| 33 | ;; |
| 34 | sparc-sun-solaris*) |
| 35 | DEBUG="-v -g" |
| 36 | CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" |
| 37 | PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" |
| 38 | ;; |
| 39 | *) |
| 40 | DEBUG="-g" |
| 41 | CFLAGS="-O" |
| 42 | PROFILE="-g -p" |
| 43 | ;; |
| 44 | esac |
| 45 | else |
| 46 | case $host in |
| 47 | *-*-linux*) |
| 48 | DEBUG="-g -Wall -fsigned-char" |
| 49 | CFLAGS="-O20 -ffast-math -fsigned-char" |
| 50 | PROFILE="-Wall -W -pg -g -O20 -ffast-math -fsigned-char" |
| 51 | ;; |
| 52 | sparc-sun-*) |
| 53 | sparc_cpu="" |
| 54 | AC_MSG_CHECKING([if gcc supports -mv8]) |
| 55 | old_cflags="$CFLAGS" |
| 56 | CFLAGS="$CFLAGS -mv8" |
| 57 | AC_TRY_COMPILE(, [return 0;], [ |
| 58 | AC_MSG_RESULT([yes]) |
| 59 | sparc_cpu="-mv8" |
| 60 | ]) |
| 61 | CFLAGS="$old_cflags" |
| 62 | DEBUG="-g -Wall -fsigned-char $sparc_cpu" |
| 63 | CFLAGS="-O20 -ffast-math -fsigned-char $sparc_cpu" |
| 64 | PROFILE="-pg -g -O20 -fsigned-char $sparc_cpu" |
| 65 | ;; |
| 66 | *-*-darwin*) |
| 67 | DEBUG="-fno-common -g -Wall -fsigned-char" |
| 68 | CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math" |
| 69 | PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math" |
| 70 | ;; |
| 71 | *) |
| 72 | DEBUG="-g -Wall -fsigned-char" |
| 73 | CFLAGS="-O20 -fsigned-char" |
| 74 | PROFILE="-O20 -g -pg -fsigned-char" |
| 75 | ;; |
| 76 | esac |
| 77 | fi |
| 78 | CFLAGS="$CFLAGS $cflags_save" |
| 79 | DEBUG="$DEBUG $cflags_save" |
| 80 | PROFILE="$PROFILE $cflags_save" |
| 81 | |
| 82 | dnl Checks for programs. |
| 83 | |
| 84 | dnl Checks for libraries. |
| 85 | |
| 86 | dnl Checks for header files. |
| 87 | AC_HEADER_STDC |
| 88 | |
| 89 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 90 | AC_C_CONST |
| 91 | |
| 92 | dnl Check for types |
| 93 | |
| 94 | AC_MSG_CHECKING(for int16_t) |
| 95 | AC_CACHE_VAL(has_cv_int16_t, |
| 96 | [AC_TRY_RUN([ |
| 97 | #if defined __BEOS__ && !defined __HAIKU__ |
| 98 | #include <inttypes.h> |
| 99 | #endif |
| 100 | #include <sys/types.h> |
| 101 | int16_t foo; |
| 102 | int main() {return 0;} |
| 103 | ], |
| 104 | has_cv_int16_t=yes, |
| 105 | has_cv_int16_t=no, |
| 106 | has_cv_int16_t=no |
| 107 | )]) |
| 108 | AC_MSG_RESULT($has_cv_int16_t) |
| 109 | |
| 110 | AC_MSG_CHECKING(for int32_t) |
| 111 | AC_CACHE_VAL(has_cv_int32_t, |
| 112 | [AC_TRY_RUN([ |
| 113 | #if defined __BEOS__ && !defined __HAIKU__ |
| 114 | #include <inttypes.h> |
| 115 | #endif |
| 116 | #include <sys/types.h> |
| 117 | int32_t foo; |
| 118 | int main() {return 0;} |
| 119 | ], |
| 120 | has_cv_int32_t=yes, |
| 121 | has_cv_int32_t=no, |
| 122 | has_cv_int32_t=no |
| 123 | )]) |
| 124 | AC_MSG_RESULT($has_cv_int32_t) |
| 125 | |
| 126 | AC_MSG_CHECKING(for uint32_t) |
| 127 | AC_CACHE_VAL(has_cv_uint32_t, |
| 128 | [AC_TRY_RUN([ |
| 129 | #if defined __BEOS__ && !defined __HAIKU__ |
| 130 | #include <inttypes.h> |
| 131 | #endif |
| 132 | #include <sys/types.h> |
| 133 | uint32_t foo; |
| 134 | int main() {return 0;} |
| 135 | ], |
| 136 | has_cv_uint32_t=yes, |
| 137 | has_cv_uint32_t=no, |
| 138 | has_cv_uint32_t=no |
| 139 | )]) |
| 140 | AC_MSG_RESULT($has_cv_uint32_t) |
| 141 | |
| 142 | AC_MSG_CHECKING(for uint16_t) |
| 143 | AC_CACHE_VAL(has_cv_uint16_t, |
| 144 | [AC_TRY_RUN([ |
| 145 | #if defined __BEOS__ && !defined __HAIKU__ |
| 146 | #include <inttypes.h> |
| 147 | #endif |
| 148 | #include <sys/types.h> |
| 149 | uint16_t foo; |
| 150 | int main() {return 0;} |
| 151 | ], |
| 152 | has_cv_uint16_t=yes, |
| 153 | has_cv_uint16_t=no, |
| 154 | has_cv_uint16_t=no |
| 155 | )]) |
| 156 | AC_MSG_RESULT($has_cv_uint16_t) |
| 157 | |
| 158 | AC_MSG_CHECKING(for u_int32_t) |
| 159 | AC_CACHE_VAL(has_cv_u_int32_t, |
| 160 | [AC_TRY_RUN([ |
| 161 | #if defined __BEOS__ && !defined __HAIKU__ |
| 162 | #include <inttypes.h> |
| 163 | #endif |
| 164 | #include <sys/types.h> |
| 165 | u_int32_t foo; |
| 166 | int main() {return 0;} |
| 167 | ], |
| 168 | has_cv_u_int32_t=yes, |
| 169 | has_cv_u_int32_t=no, |
| 170 | has_cv_u_int32_t=no |
| 171 | )]) |
| 172 | AC_MSG_RESULT($has_cv_u_int32_t) |
| 173 | |
| 174 | AC_MSG_CHECKING(for u_int16_t) |
| 175 | AC_CACHE_VAL(has_cv_u_int16_t, |
| 176 | [AC_TRY_RUN([ |
| 177 | #if defined __BEOS__ && !defined __HAIKU__ |
| 178 | #include <inttypes.h> |
| 179 | #endif |
| 180 | #include <sys/types.h> |
| 181 | u_int16_t foo; |
| 182 | int main() {return 0;} |
| 183 | ], |
| 184 | has_cv_u_int16_t=yes, |
| 185 | has_cv_u_int16_t=no, |
| 186 | has_cv_u_int16_t=no |
| 187 | )]) |
| 188 | AC_MSG_RESULT($has_cv_u_int16_t) |
| 189 | |
| 190 | AC_MSG_CHECKING(for int64_t) |
| 191 | AC_CACHE_VAL(has_cv_int64_t, |
| 192 | [AC_TRY_RUN([ |
| 193 | #if defined __BEOS__ && !defined __HAIKU__ |
| 194 | #include <inttypes.h> |
| 195 | #endif |
| 196 | #include <sys/types.h> |
| 197 | int64_t foo; |
| 198 | int main() {return 0;} |
| 199 | ], |
| 200 | has_cv_int64_t=yes, |
| 201 | has_cv_int64_t=no, |
| 202 | has_cv_int64_t=no |
| 203 | )]) |
| 204 | AC_MSG_RESULT($has_cv_int64_t) |
| 205 | |
| 206 | AC_CHECK_SIZEOF(short,2) |
| 207 | AC_CHECK_SIZEOF(int,4) |
| 208 | AC_CHECK_SIZEOF(long,4) |
| 209 | AC_CHECK_SIZEOF(long long,8) |
| 210 | |
| 211 | |
| 212 | if test x$has_cv_int16_t = "xyes" ; then |
| 213 | SIZE16="int16_t" |
| 214 | else |
| 215 | case 2 in |
| 216 | $ac_cv_sizeof_short) SIZE16="short";; |
| 217 | $ac_cv_sizeof_int) SIZE16="int";; |
| 218 | esac |
| 219 | fi |
| 220 | |
| 221 | if test x$has_cv_int32_t = "xyes" ; then |
| 222 | SIZE32="int32_t" |
| 223 | else |
| 224 | case 4 in |
| 225 | $ac_cv_sizeof_short) SIZE32="short";; |
| 226 | $ac_cv_sizeof_int) SIZE32="int";; |
| 227 | $ac_cv_sizeof_long) SIZE32="long";; |
| 228 | esac |
| 229 | fi |
| 230 | |
| 231 | if test x$has_cv_uint32_t = "xyes" ; then |
| 232 | USIZE32="uint32_t" |
| 233 | else |
| 234 | if test x$has_cv_u_int32_t = "xyes" ; then |
| 235 | USIZE32="u_int32_t" |
| 236 | else |
| 237 | case 4 in |
| 238 | $ac_cv_sizeof_short) USIZE32="unsigned short";; |
| 239 | $ac_cv_sizeof_int) USIZE32="unsigned int";; |
| 240 | $ac_cv_sizeof_long) USIZE32="unsigned long";; |
| 241 | esac |
| 242 | fi |
| 243 | fi |
| 244 | |
| 245 | if test x$has_cv_uint16_t = "xyes" ; then |
| 246 | USIZE16="uint16_t" |
| 247 | else |
| 248 | if test x$has_cv_u_int16_t = "xyes" ; then |
| 249 | USIZE16="u_int16_t" |
| 250 | else |
| 251 | case 2 in |
| 252 | $ac_cv_sizeof_short) USIZE16="unsigned short";; |
| 253 | $ac_cv_sizeof_int) USIZE16="unsigned int";; |
| 254 | $ac_cv_sizeof_long) USIZE16="unsigned long";; |
| 255 | esac |
| 256 | fi |
| 257 | fi |
| 258 | |
| 259 | if test x$has_cv_int64_t = "xyes" ; then |
| 260 | SIZE64="int64_t" |
| 261 | else |
| 262 | case 8 in |
| 263 | $ac_cv_sizeof_int) SIZE64="int";; |
| 264 | $ac_cv_sizeof_long) SIZE64="long";; |
| 265 | $ac_cv_sizeof_long_long) SIZE64="long long";; |
| 266 | esac |
| 267 | fi |
| 268 | |
| 269 | if test -z "$SIZE16"; then |
| 270 | AC_MSG_ERROR(No 16 bit type found on this platform!) |
| 271 | fi |
| 272 | if test -z "$USIZE16"; then |
| 273 | AC_MSG_ERROR(No unsigned 16 bit type found on this platform!) |
| 274 | fi |
| 275 | if test -z "$SIZE32"; then |
| 276 | AC_MSG_ERROR(No 32 bit type found on this platform!) |
| 277 | fi |
| 278 | if test -z "$USIZE32"; then |
| 279 | AC_MSG_ERROR(No unsigned 32 bit type found on this platform!) |
| 280 | fi |
| 281 | if test -z "$SIZE64"; then |
| 282 | AC_MSG_WARN(No 64 bit type found on this platform!) |
| 283 | fi |
| 284 | |
| 285 | dnl Checks for library functions. |
| 286 | AC_FUNC_MEMCMP |
| 287 | |
| 288 | dnl Make substitutions |
| 289 | |
| 290 | AC_SUBST(LIBTOOL_DEPS) |
| 291 | AC_SUBST(SIZE16) |
| 292 | AC_SUBST(USIZE16) |
| 293 | AC_SUBST(SIZE32) |
| 294 | AC_SUBST(USIZE32) |
| 295 | AC_SUBST(SIZE64) |
| 296 | AC_SUBST(OPT) |
| 297 | AC_SUBST(LIBS) |
| 298 | AC_SUBST(DEBUG) |
| 299 | AC_SUBST(CFLAGS) |
| 300 | AC_SUBST(PROFILE) |
| 301 | |
| 302 | AC_OUTPUT([ |
| 303 | Makefile |
| 304 | src/Makefile |
| 305 | doc/Makefile doc/libogg/Makefile |
| 306 | include/Makefile include/ogg/Makefile include/ogg/config_types.h |
| 307 | libogg.spec |
| 308 | ogg.pc |
| 309 | ogg-uninstalled.pc |
| 310 | ]) |