[14] | 1 | ################################################################################ |
---|
| 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | ################################################################################ |
---|
| 4 | |
---|
| 5 | AC_INIT([freealut library], [1.1.0], [openal-devel@opensource.creative.com], [freealut]) |
---|
| 6 | AC_CONFIG_AUX_DIR([admin/autotools]) |
---|
| 7 | AM_INIT_AUTOMAKE |
---|
| 8 | AC_PREREQ([2.56]) |
---|
| 9 | AC_CONFIG_SRCDIR([AUTHORS]) |
---|
| 10 | AC_CONFIG_HEADERS([config.h]) |
---|
| 11 | |
---|
| 12 | # Compatibility hack for older autoconf versions |
---|
| 13 | m4_ifdef([AS_HELP_STRING], [], [AC_DEFUN([AS_HELP_STRING], [AC_HELP_STRING($][@)])]) |
---|
| 14 | |
---|
| 15 | ################################################################################ |
---|
| 16 | ## libtool shared library version. |
---|
| 17 | ################################################################################ |
---|
| 18 | |
---|
| 19 | # Some information from the libtool info pages and the autobook regarding how to |
---|
| 20 | # handle the library version info: |
---|
| 21 | # |
---|
| 22 | # 1. Start with version information of `0:0:0' for each libtool library. |
---|
| 23 | # |
---|
| 24 | # 2. Update the version information only immediately before a public release of |
---|
| 25 | # your software. More frequent updates are unnecessary, and only guarantee |
---|
| 26 | # that the current interface number gets larger faster. |
---|
| 27 | # |
---|
| 28 | # 3. If the library source code has changed at all since the last update, then |
---|
| 29 | # increment REVISION (`C:R:A' becomes `C:r+1:A'). This is a new revision of |
---|
| 30 | # the current interface. |
---|
| 31 | # |
---|
| 32 | # 4. If any interfaces have been added, removed, or changed since the last |
---|
| 33 | # update, increment CURRENT, and set REVISION to 0. This is the first |
---|
| 34 | # revision of a new interface. |
---|
| 35 | # |
---|
| 36 | # 5. If any interfaces have been added since the last public release, then |
---|
| 37 | # increment AGE. This release is backwards compatible with the previous |
---|
| 38 | # release. |
---|
| 39 | # |
---|
| 40 | # 6. If any interfaces have been removed since the last public release, then set |
---|
| 41 | # AGE to 0. This release has a new, but backwards incompatible interface. |
---|
| 42 | # |
---|
| 43 | # NEVER try to set the interface numbers so that they correspond to the release |
---|
| 44 | # number of your package. This is an abuse that only fosters misunderstanding of |
---|
| 45 | # the purpose of library versions. Furthermore, do not confuse those versions |
---|
| 46 | # with the version of the specification which is implemented. |
---|
| 47 | |
---|
| 48 | CURRENT=1 |
---|
| 49 | REVISION=0 |
---|
| 50 | AGE=1 |
---|
| 51 | |
---|
| 52 | AC_SUBST([VERSIONINFO], ["$CURRENT:$REVISION:$AGE"]) |
---|
| 53 | |
---|
| 54 | ################################################################################ |
---|
| 55 | # Checks for programs. |
---|
| 56 | ################################################################################ |
---|
| 57 | |
---|
| 58 | AC_PROG_CC |
---|
| 59 | AC_C_CONST |
---|
| 60 | ALUT_C__ATTRIBUTE__ |
---|
| 61 | |
---|
| 62 | # Note that -fvisibility=... support implies __attribute__((visibility(...))) |
---|
| 63 | # support. |
---|
| 64 | ALUT_CHECK_FLAG([-fvisibility=hidden], |
---|
| 65 | [AM_CFLAGS="$AM_CFLAGS -fvisibility=hidden" |
---|
| 66 | AC_DEFINE([HAVE_GCC_VISIBILITY], [1], |
---|
| 67 | [Define to 1 if we are using a GCC with symbol visibility support.])]) |
---|
| 68 | |
---|
| 69 | # test_suite/test_retrostuff tests deprecated functions, but we don't want to |
---|
| 70 | # get compiler warnings because of that. |
---|
| 71 | ALUT_CHECK_FLAG([-Wno-deprecated-declarations], |
---|
| 72 | [alut_wno_deprecated_declarations=yes], |
---|
| 73 | [alut_wno_deprecated_declarations=no]) |
---|
| 74 | AM_CONDITIONAL([WNO_DEPRECATED_DECLARATIONS], |
---|
| 75 | [test x"$alut_wno_deprecated_declarations" = xyes]) |
---|
| 76 | |
---|
| 77 | AC_EXEEXT |
---|
| 78 | AC_LIBTOOL_WIN32_DLL |
---|
| 79 | AC_PROG_LIBTOOL |
---|
| 80 | AC_SUBST([LIBTOOL_DEPS]) |
---|
| 81 | |
---|
| 82 | AC_DEFINE([ALUT_BUILD_LIBRARY], [1], [Define to 1 if you want to build the ALUT DLL.]) |
---|
| 83 | |
---|
| 84 | # Checks for libraries. (not perfect yet) |
---|
| 85 | AC_SEARCH_LIBS([pthread_self], [pthread]) |
---|
| 86 | AC_SEARCH_LIBS([alGetError], [openal32 openal]) |
---|
| 87 | |
---|
| 88 | ################################################################################ |
---|
| 89 | # Checks for header files. |
---|
| 90 | ################################################################################ |
---|
| 91 | |
---|
| 92 | # We could possibly need struct timespec and random(), which are not ANSI. |
---|
| 93 | AC_DEFINE([_XOPEN_SOURCE], [500], [Define to 500 if Single Unix conformance is wanted, 600 for sixth revision.]) |
---|
| 94 | |
---|
| 95 | # We might need nanosleep, which is a POSIX IEEE Std 1003.1b-1993 feature. |
---|
| 96 | AC_DEFINE([_POSIX_C_SOURCE], [199309], [Define to the POSIX version that should be used.]) |
---|
| 97 | |
---|
| 98 | # Without __NO_CTYPE tolower and friends are macros which introduce a GLIBC 2.3 |
---|
| 99 | # dependency. By defining this identifier we are currently backwards compatible |
---|
| 100 | # to GLIBC 2.1.3, which is a good thing. In addition, the macros lead to code |
---|
| 101 | # which triggers warnings with -Wunreachable-code. |
---|
| 102 | AC_DEFINE([__NO_CTYPE], [1], [Define to 1 if tolower and friends should not be macros.]) |
---|
| 103 | |
---|
| 104 | AC_HEADER_STDC |
---|
| 105 | AC_CHECK_HEADERS([AL/alc.h AL/al.h basetsd.h ctype.h math.h stdio.h time.h windows.h]) |
---|
| 106 | |
---|
| 107 | # Checks for library functions. |
---|
| 108 | ALUT_CHECK_FUNC([[@%:@include <time.h>]], |
---|
| 109 | [nanosleep], [[((struct timespec*)0, (struct timespec*)0)]]) |
---|
| 110 | |
---|
| 111 | ALUT_CHECK_FUNC([[@%:@include <unistd.h>]], |
---|
| 112 | [usleep], [[(0)]]) |
---|
| 113 | |
---|
| 114 | ALUT_CHECK_FUNC([[@%:@include <windows.h>]], |
---|
| 115 | [Sleep], [[(0)]]) |
---|
| 116 | |
---|
| 117 | ALUT_CHECK_FUNC([[@%:@include <sys/types.h> |
---|
| 118 | @%:@include <sys/stat.h> |
---|
| 119 | @%:@include <unistd.h>]], |
---|
| 120 | [stat], [[("", (struct stat*)0)]]) |
---|
| 121 | |
---|
| 122 | ALUT_CHECK_FUNC([[@%:@include <sys/types.h> |
---|
| 123 | @%:@include <sys/stat.h>]], |
---|
| 124 | [_stat], [[("", (struct _stat*)0)]]) |
---|
| 125 | |
---|
| 126 | AC_CHECK_LIBM |
---|
| 127 | AC_SUBST([LIBM]) |
---|
| 128 | |
---|
| 129 | ################################################################################ |
---|
| 130 | # Build time configuration. |
---|
| 131 | ################################################################################ |
---|
| 132 | |
---|
| 133 | AC_ARG_ENABLE([warnings], |
---|
| 134 | [AS_HELP_STRING([--enable-warnings], |
---|
| 135 | [enable pedantic compiler warnings @<:@default=yes@:>@])]) |
---|
| 136 | |
---|
| 137 | if test "x$enable_warnings" != xno; then |
---|
| 138 | # Doing it in two steps gives a nicer message... |
---|
| 139 | AX_CFLAGS_WARN_ALL_ANSI([flags]) |
---|
| 140 | AM_CFLAGS="$AM_CFLAGS $flags" |
---|
| 141 | fi |
---|
| 142 | |
---|
| 143 | AC_ARG_ENABLE([more-warnings], |
---|
| 144 | [AS_HELP_STRING([--enable-more-warnings], |
---|
| 145 | [enable even more compiler warnings @<:@default=no@:>@])]) |
---|
| 146 | |
---|
| 147 | if test "x$enable_more_warnings" = xyes; then |
---|
| 148 | if test "x$enable_warnings" = xno; then |
---|
| 149 | AC_MSG_WARN([--enable-more-warnings ignored because of --disable-warnings]) |
---|
| 150 | elif test "x$GCC" != xyes; then |
---|
| 151 | AC_MSG_WARN([--enable-more-warnings ignored because no GCC was detected]) |
---|
| 152 | else |
---|
| 153 | # The long list of warning options below contains every GCC warning option |
---|
| 154 | # which is not automatically enabled with -Wall. The only exceptions to this |
---|
| 155 | # rule are: |
---|
| 156 | # |
---|
| 157 | # -Wpadded: |
---|
| 158 | # Perhaps good for optimizing out data layout, but not in general. |
---|
| 159 | # |
---|
| 160 | # -Wconversion: |
---|
| 161 | # Passing e.g. float as an argument is fine, we always have prototypes. |
---|
| 162 | # |
---|
| 163 | # Note that some older GCC versions give false positives about unreachable |
---|
| 164 | # code. |
---|
| 165 | AM_CFLAGS="$AM_CFLAGS -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization -Wendif-labels -Wfloat-equal -Winline -Wlong-long -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wunreachable-code -Wwrite-strings" |
---|
| 166 | |
---|
| 167 | # Check for GCC 4.x-only warning options. |
---|
| 168 | ALUT_CHECK_FLAG([-Wdeclaration-after-statement], |
---|
| 169 | [AM_CFLAGS="$AM_CFLAGS -Wdeclaration-after-statement"]) |
---|
| 170 | ALUT_CHECK_FLAG([-Winvalid-pch], |
---|
| 171 | [AM_CFLAGS="$AM_CFLAGS -Winvalid-pch"]) |
---|
| 172 | ALUT_CHECK_FLAG([-Wmissing-field-initializers], |
---|
| 173 | [AM_CFLAGS="$AM_CFLAGS -Wmissing-field-initializers"]) |
---|
| 174 | # We cheat here a bit: The code generated by AC_LANG_PROGRAM triggers a |
---|
| 175 | # warning with -Wold-style-definition, so we assume that this flag is |
---|
| 176 | # supported whenever -Wvariadic-macros is. |
---|
| 177 | ALUT_CHECK_FLAG([-Wvariadic-macros], |
---|
| 178 | [AM_CFLAGS="$AM_CFLAGS -Wvariadic-macros -Wold-style-definition"]) |
---|
| 179 | fi |
---|
| 180 | fi |
---|
| 181 | |
---|
| 182 | AC_ARG_ENABLE([werror], |
---|
| 183 | [AS_HELP_STRING([--enable-werror], |
---|
| 184 | [enable failure on all warnings @<:@default=no@:>@])]) |
---|
| 185 | |
---|
| 186 | if test "x$enable_werror" = xyes; then |
---|
| 187 | if test "x$enable_warnings" = xno; then |
---|
| 188 | AC_MSG_WARN([--enable-werror ignored because of --disable-warnings]) |
---|
| 189 | elif test "x$GCC" != xyes; then |
---|
| 190 | AC_MSG_WARN([--enable-werror ignored because no GCC was detected]) |
---|
| 191 | else |
---|
| 192 | AM_CFLAGS="$AM_CFLAGS -Werror" |
---|
| 193 | fi |
---|
| 194 | fi |
---|
| 195 | |
---|
| 196 | AC_ARG_ENABLE([efence], |
---|
| 197 | [AS_HELP_STRING([--enable-efence], |
---|
| 198 | [enable Electric Fence support @<:@default=no@:>@])]) |
---|
| 199 | |
---|
| 200 | if test "x$enable_efence" = xyes; then |
---|
| 201 | alut_saved_LIBS=$LIBS |
---|
| 202 | LIBS="-lefence $LIBS" |
---|
| 203 | AC_LINK_IFELSE([AC_LANG_PROGRAM([extern int EF_ALIGNMENT;], [EF_ALIGNMENT = 8;])], |
---|
| 204 | [:], |
---|
| 205 | [AC_MSG_WARN([--enable-efence ignored because the Electric Fence library was not found.]) |
---|
| 206 | LIBS=$alut_saved_LIBS]) |
---|
| 207 | fi |
---|
| 208 | |
---|
| 209 | ################################################################################ |
---|
| 210 | # Generate output. |
---|
| 211 | ################################################################################ |
---|
| 212 | |
---|
| 213 | AC_SUBST([AM_CFLAGS]) |
---|
| 214 | |
---|
| 215 | # NOTE: Do not break the following line, otherwise we are into CR/LF vs. LF |
---|
| 216 | # trouble! This is a buglet in autoconf IMHO, but easy to work around. |
---|
| 217 | AC_CONFIG_FILES([Makefile admin/Makefile admin/pkgconfig/Makefile admin/pkgconfig/freealut-config admin/pkgconfig/freealut.pc admin/RPM/freealut.spec examples/Makefile include/Makefile src/Makefile test_suite/Makefile]) |
---|
| 218 | |
---|
| 219 | AC_OUTPUT |
---|