Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

433 lines
10 KiB

  1. dnl -*- m4 -*-
  2. dnl
  3. dnl libmad - MPEG audio decoder library
  4. dnl Copyright (C) 2000-2004 Underbit Technologies, Inc.
  5. dnl
  6. dnl This program is free software; you can redistribute it and/or modify
  7. dnl it under the terms of the GNU General Public License as published by
  8. dnl the Free Software Foundation; either version 2 of the License, or
  9. dnl (at your option) any later version.
  10. dnl
  11. dnl This program is distributed in the hope that it will be useful,
  12. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. dnl GNU General Public License for more details.
  15. dnl
  16. dnl You should have received a copy of the GNU General Public License
  17. dnl along with this program; if not, write to the Free Software
  18. dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. dnl
  20. AC_REVISION([$Id: configure.ac,v 1.9 2004/01/23 09:41:32 rob Exp $])dnl
  21. dnl Process this file with autoconf to produce a configure script.
  22. AC_INIT([MPEG Audio Decoder], [0.15.1b], [[email protected]], [libmad])
  23. AC_PREREQ(2.53)
  24. AC_CONFIG_SRCDIR([decoder.h])
  25. AM_INIT_AUTOMAKE
  26. AM_CONFIG_HEADER([config.h])
  27. dnl System type.
  28. AC_CANONICAL_HOST
  29. dnl Checks for programs.
  30. AC_PROG_CC
  31. AM_PROG_AS
  32. if test "$GCC" = yes
  33. then
  34. case "$host" in
  35. *-*-mingw*)
  36. case "$build" in
  37. *-*-cygwin*)
  38. CPPFLAGS="$CPPFLAGS -mno-cygwin"
  39. LDFLAGS="$LDFLAGS -mno-cygwin"
  40. ;;
  41. esac
  42. esac
  43. dnl case "$host" in
  44. dnl *-*-cygwin* | *-*-mingw*)
  45. dnl LDFLAGS="$LDFLAGS -no-undefined -mdll"
  46. dnl ;;
  47. dnl esac
  48. fi
  49. dnl Support for libtool.
  50. dnl AC_DISABLE_SHARED
  51. dnl AC_LIBTOOL_WIN32_DLL
  52. AC_PROG_LIBTOOL
  53. AC_SUBST(LIBTOOL_DEPS)
  54. dnl Compiler options.
  55. arch=""
  56. debug=""
  57. optimize=""
  58. profile=""
  59. set -- $CFLAGS
  60. CFLAGS=""
  61. if test "$GCC" = yes
  62. then
  63. CFLAGS="-Wall"
  64. fi
  65. while test $# -gt 0
  66. do
  67. case "$1" in
  68. -Wall)
  69. if test "$GCC" = yes
  70. then
  71. :
  72. else
  73. CFLAGS="$CFLAGS $1"
  74. fi
  75. shift
  76. ;;
  77. -g)
  78. debug="-g"
  79. shift
  80. ;;
  81. -mno-cygwin)
  82. shift
  83. ;;
  84. -m*)
  85. arch="$arch $1"
  86. shift
  87. ;;
  88. -O2)
  89. optimize="-O"
  90. shift
  91. ;;
  92. -fomit-frame-pointer)
  93. shift
  94. ;;
  95. -O*|-f*)
  96. optimize="$optimize $1"
  97. shift
  98. ;;
  99. *)
  100. CFLAGS="$CFLAGS $1"
  101. shift
  102. ;;
  103. esac
  104. done
  105. if test "$GCC" = yes
  106. then
  107. if test -z "$arch"
  108. then
  109. case "$host" in
  110. i386-*) ;;
  111. i?86-*) arch="-march=i486" ;;
  112. arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
  113. armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
  114. powerpc-*) ;;
  115. mips*-agenda-*) arch="-mcpu=vr4100" ;;
  116. mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
  117. esac
  118. fi
  119. case "$optimize" in
  120. -O|"-O "*)
  121. optimize="-O"
  122. optimize="$optimize -fforce-mem"
  123. optimize="$optimize -fforce-addr"
  124. : #x optimize="$optimize -finline-functions"
  125. : #- optimize="$optimize -fstrength-reduce"
  126. optimize="$optimize -fthread-jumps"
  127. optimize="$optimize -fcse-follow-jumps"
  128. optimize="$optimize -fcse-skip-blocks"
  129. : #x optimize="$optimize -frerun-cse-after-loop"
  130. : #x optimize="$optimize -frerun-loop-opt"
  131. : #x optimize="$optimize -fgcse"
  132. optimize="$optimize -fexpensive-optimizations"
  133. optimize="$optimize -fregmove"
  134. : #* optimize="$optimize -fdelayed-branch"
  135. : #x optimize="$optimize -fschedule-insns"
  136. optimize="$optimize -fschedule-insns2"
  137. : #? optimize="$optimize -ffunction-sections"
  138. : #? optimize="$optimize -fcaller-saves"
  139. : #> optimize="$optimize -funroll-loops"
  140. : #> optimize="$optimize -funroll-all-loops"
  141. : #x optimize="$optimize -fmove-all-movables"
  142. : #x optimize="$optimize -freduce-all-givs"
  143. : #? optimize="$optimize -fstrict-aliasing"
  144. : #* optimize="$optimize -fstructure-noalias"
  145. case "$host" in
  146. arm*-*)
  147. optimize="$optimize -fstrength-reduce"
  148. ;;
  149. mips*-*)
  150. optimize="$optimize -fstrength-reduce"
  151. optimize="$optimize -finline-functions"
  152. ;;
  153. i?86-*)
  154. optimize="$optimize -fstrength-reduce"
  155. ;;
  156. powerpc-apple-*)
  157. # this triggers an internal compiler error with gcc2
  158. : #optimize="$optimize -fstrength-reduce"
  159. # this is really only beneficial with gcc3
  160. : #optimize="$optimize -finline-functions"
  161. ;;
  162. *)
  163. # this sometimes provokes bugs in gcc 2.95.2
  164. : #optimize="$optimize -fstrength-reduce"
  165. ;;
  166. esac
  167. ;;
  168. esac
  169. fi
  170. case "$host" in
  171. mips*-agenda-*)
  172. AC_DEFINE(HAVE_MADD16_ASM, 1,
  173. [Define if your MIPS CPU supports a 2-operand MADD16 instruction.])
  174. ;;
  175. mips*-luxsonor-*)
  176. AC_DEFINE(HAVE_MADD_ASM, 1,
  177. [Define if your MIPS CPU supports a 2-operand MADD instruction.])
  178. ;;
  179. esac
  180. dnl Checks for header files.
  181. AC_HEADER_STDC
  182. AC_HEADER_SYS_WAIT
  183. AC_CHECK_HEADERS(assert.h limits.h unistd.h sys/types.h fcntl.h errno.h)
  184. dnl Checks for typedefs, structures, and compiler characteristics.
  185. AC_C_CONST
  186. AC_C_INLINE
  187. AC_C_BIGENDIAN
  188. AC_TYPE_PID_T
  189. AC_CHECK_SIZEOF(int, 2)
  190. AC_CHECK_SIZEOF(long, 4)
  191. AC_CHECK_SIZEOF(long long, 8)
  192. dnl Checks for library functions.
  193. AC_CHECK_FUNCS(waitpid fcntl pipe fork)
  194. dnl Other options.
  195. AC_SUBST(FPM)
  196. AC_SUBST(ASO)
  197. AC_SUBST(ASO_OBJS)
  198. dnl handle --enable and --disable options
  199. AC_CACHE_SAVE
  200. AC_MSG_CHECKING(whether to optimize for speed or for accuracy)
  201. AC_ARG_ENABLE(speed, AC_HELP_STRING([--enable-speed],
  202. [optimize for speed over accuracy]),
  203. [
  204. case "$enableval" in
  205. yes)
  206. optimize_for="speed"
  207. AC_DEFINE(OPT_SPEED, 1,
  208. [Define to optimize for speed over accuracy.])
  209. ;;
  210. esac
  211. ])
  212. AC_ARG_ENABLE(accuracy, AC_HELP_STRING([--enable-accuracy],
  213. [optimize for accuracy over speed]),
  214. [
  215. case "$enableval" in
  216. yes)
  217. if test "$optimize_for" = "speed"
  218. then
  219. optimize_for="both"
  220. else
  221. optimize_for="accuracy"
  222. fi
  223. AC_DEFINE(OPT_ACCURACY, 1,
  224. [Define to optimize for accuracy over speed.])
  225. ;;
  226. esac
  227. ])
  228. AC_MSG_RESULT(${optimize_for-default})
  229. if test "$optimize_for" = "both"
  230. then
  231. AC_MSG_ERROR(cannot optimize for both speed and accuracy)
  232. fi
  233. AC_MSG_CHECKING(for architecture-specific fixed-point math routines)
  234. AC_ARG_ENABLE(fpm, AC_HELP_STRING([--enable-fpm=ARCH],
  235. [use ARCH-specific fixed-point math routines
  236. (one of: intel, arm, mips, sparc, ppc, 64bit, default)]),
  237. [
  238. case "$enableval" in
  239. yes) ;;
  240. no|default|approx) FPM="DEFAULT" ;;
  241. intel|i?86) FPM="INTEL" ;;
  242. arm) FPM="ARM" ;;
  243. mips) FPM="MIPS" ;;
  244. sparc) FPM="SPARC" ;;
  245. ppc|powerpc) FPM="PPC" ;;
  246. 64bit) FPM="64BIT" ;;
  247. float) FPM="FLOAT" ;;
  248. *)
  249. AC_MSG_RESULT(failed)
  250. AC_MSG_ERROR([bad --enable-fpm option])
  251. ;;
  252. esac
  253. ])
  254. if test -z "$FPM" && test "$GCC" = yes
  255. then
  256. case "$host" in
  257. i?86-*) FPM="INTEL" ;;
  258. arm*-*) FPM="ARM" ;;
  259. mips*-*) FPM="MIPS" ;;
  260. sparc*-*) FPM="SPARC" ;;
  261. powerpc*-*) FPM="PPC" ;;
  262. # FIXME: need to test for 64-bit long long...
  263. esac
  264. fi
  265. AC_MSG_RESULT(${FPM=DEFAULT})
  266. if test "$FPM" = "DEFAULT"
  267. then
  268. AC_MSG_WARN([default fixed-point math will yield limited accuracy])
  269. fi
  270. FPM="-DFPM_$FPM"
  271. AC_ARG_ENABLE(sso, AC_HELP_STRING([--enable-sso],
  272. [use subband synthesis optimization]),
  273. [
  274. case "$enableval" in
  275. yes)
  276. AC_DEFINE(OPT_SSO, 1,
  277. [Define to enable a fast subband synthesis approximation optimization.])
  278. ;;
  279. esac
  280. ])
  281. AC_ARG_ENABLE(aso, AC_HELP_STRING([--disable-aso],
  282. [disable architecture-specific optimizations]),
  283. [], [enable_aso=yes])
  284. if test "$enable_aso" = yes
  285. then
  286. case "$host" in
  287. i?86-*)
  288. : #ASO="$ASO -DASO_INTERLEAVE1"
  289. ASO="$ASO -DASO_ZEROCHECK"
  290. : #not yet #ASO="$ASO -DASO_SYNTH"
  291. : #not yet #ASO_OBJS="synth_mmx.lo"
  292. ;;
  293. arm*-*)
  294. ASO="$ASO -DASO_INTERLEAVE1"
  295. ASO="$ASO -DASO_IMDCT"
  296. ASO_OBJS="imdct_l_arm.lo"
  297. ;;
  298. mips*-*)
  299. ASO="$ASO -DASO_INTERLEAVE2"
  300. ASO="$ASO -DASO_ZEROCHECK"
  301. ;;
  302. esac
  303. fi
  304. AC_MSG_CHECKING(for ISO/IEC interpretation)
  305. AC_ARG_ENABLE(strict-iso, AC_HELP_STRING([--enable-strict-iso],
  306. [use strict ISO/IEC interpretations]),
  307. [
  308. case "$enableval" in
  309. yes)
  310. AC_DEFINE(OPT_STRICT, 1,
  311. [Define to influence a strict interpretation of the ISO/IEC standards,
  312. even if this is in opposition with best accepted practices.])
  313. interpretation="strict"
  314. ;;
  315. esac
  316. ])
  317. AC_MSG_RESULT(${interpretation-best accepted practices})
  318. AC_MSG_CHECKING(whether to enable profiling)
  319. AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling],
  320. [generate profiling code]),
  321. [
  322. case "$enableval" in
  323. yes) profile="-pg" ;;
  324. esac
  325. ])
  326. AC_MSG_RESULT(${enable_profiling-no})
  327. AC_MSG_CHECKING(whether to enable debugging)
  328. AC_ARG_ENABLE(debugging, AC_HELP_STRING([--enable-debugging],
  329. [enable diagnostic debugging support])
  330. AC_HELP_STRING([--disable-debugging],
  331. [do not enable debugging and use more optimization]),
  332. [
  333. case "$enableval" in
  334. yes)
  335. AC_DEFINE(DEBUG, 1,
  336. [Define to enable diagnostic debugging support.])
  337. optimize=""
  338. ;;
  339. no)
  340. if test -n "$profile"
  341. then
  342. AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible)
  343. fi
  344. AC_DEFINE(NDEBUG, 1,
  345. [Define to disable debugging assertions.])
  346. debug=""
  347. if test "$GCC" = yes
  348. then
  349. optimize="$optimize -fomit-frame-pointer"
  350. fi
  351. ;;
  352. esac
  353. ])
  354. AC_MSG_RESULT(${enable_debugging-default})
  355. AC_MSG_CHECKING(whether to enable experimental code)
  356. AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
  357. [enable experimental code]),
  358. [
  359. case "$enableval" in
  360. yes)
  361. AC_DEFINE(EXPERIMENTAL, 1,
  362. [Define to enable experimental code.])
  363. ;;
  364. esac
  365. ])
  366. AC_MSG_RESULT(${enable_experimental-no})
  367. dnl Create output files.
  368. test -n "$arch" && CFLAGS="$CFLAGS $arch"
  369. test -n "$debug" && CFLAGS="$CFLAGS $debug"
  370. test -n "$optimize" && CFLAGS="$CFLAGS $optimize"
  371. test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
  372. dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'`
  373. dnl AC_SUBST(LTLIBOBJS)
  374. AC_CONFIG_FILES([Makefile msvc++/Makefile \
  375. libmad.list])
  376. AC_OUTPUT