configure.in 7.0 KB

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