2
AC_INIT(Judy, 1.0.0, doug@sourcejudy.com)
6
dnl Turn on automake, and pass it the PACKAGE_NAME and PACKAGE_VERSION, too.
7
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
9
dnl Tell autoconf we want to keep our preprocessor defines in a header named
10
dnl config.h. This keeps automake from passing a zillion -D directives to
12
AM_CONFIG_HEADER([config.h])
14
dnl==========================================================================
15
dnl WARNING - WARNING - Shared Library Versioning - WARNING - WARNING
16
dnl==========================================================================
17
dnl This is the most dangerous part of this file--making a mistake here can
18
dnl cause massively painful chaos for libJudy developers, and potentially
19
dnl even end users. So PLEASE pay attention, and read up on the theory of
20
dnl shared library versioning. Tens of thousands of Linux users (and several
21
dnl QA departments) may thank you someday.
23
dnl There are two major concerns:
25
dnl 1) When changing the libJudy ABI (application binary interface),
26
dnl VERSION_INFO *must* be updated according to libtool's rules. Failure
27
dnl to do this will make applications using libJudy dump core, typically
28
dnl under obscure conditions on user systems. I won't attempt to
29
dnl explain these rules here; please see 'info libtool' for details.
31
dnl 2) When changing the libJudy ABI, it is also desirable to make libJudy
32
dnl "parallel installable". This means that it should be possible to
33
dnl install development headers and libraries for more than one version
34
dnl of libJudy at once. Failure to do this may cause problems for
35
dnl Linux distributions which include libJudy. (For example, it's
36
dnl impossible to switch between libpng2-dev and libpng3-dev on a
37
dnl Debian system without uninstalling and reinstalling both the Gnome
38
dnl and KDE SDKs.) For more information, do a Google search for
39
dnl "parallel installable".
41
dnl Right now, this package only provides the mechanisms to handle concern
42
dnl (1). Concern (2) is slightly more complicated, and will require some
43
dnl careful thinking. Fortunately, concern (2) doesn't become important
44
dnl until other SDKs rely on the libJudy SDK.
46
dnl Of course, it's safe to avoid changing the libJudy ABI. :-)
48
dnl The version scheme used by Libtool tracks interfaces, where an interface is
49
dnl the set of exported entry points into the library. All Libtool libraries
50
dnl start with -version-info set to 0:0:0 - this will be the default version
51
dnl number if you don't explicitly set it on the Libtool link command line. The
52
dnl meaning of these numbers (from left to right) is as follows:
55
dnl The number of the current interface exported by the library. A current
56
dnl value of 0, means that you are calling the interface exported by this
57
dnl library interface 0.
60
dnl The implementation number of the most recent interface exported by this
61
dnl library. In this case, a revision value of 0 means that this is the
62
dnl first implementation of the interface.
64
dnl If the next release of this library exports the same interface, but has
65
dnl different implementation (perhaps some bugs have been fixed), the
66
dnl revision number will be higher, but current number will be the same. In
67
dnl that case, when given a choice, the library with the highest revision
68
dnl will always be used by the runtime loader.
71
dnl The number of previous additional interfaces supported by this library.
72
dnl If age were 2, then this library can be linked into executables which
73
dnl were built with a release of this library that exported the current
74
dnl interface number, current, or any of the previous two interfaces.
76
dnl By definition age must be less than or equal to current. At the outset, only
77
dnl the first ever interface is implemented, so age can only be 0.
80
VERSION_INFO="-version-info 1:1:0"
81
AC_SUBST(VERSION_INFO)
83
dnl==========================================================================
85
dnl==========================================================================
86
dnl Judy can be compiled in one of three flavors: "product" (the default),
87
dnl "debug", or "cov". We allow the user to select flavors using
88
dnl --enable-debug and --enable-ccover arguments to automake, which is
89
dnl the typical way of doing things.
91
dnl Note how we perform string comparison:
93
dnl if test "x$enable_debug" = xyes; then
95
dnl We do several odd things here:
97
dnl 1) We use 'test' instead of '[ ]' for shell portability.
98
dnl 2) We prefix strings with 'x' when comparing them, to protect against
100
dnl 3) We ALWAYS quote user-supplied shell variables, to protect against
103
dnl The results of this test aren't used anywhere yet.
105
dnl Keep the user entertained.
106
AC_MSG_CHECKING(which flavor to build)
108
dnl Process our --enable-debug argument.
110
AC_HELP_STRING([--enable-debug],
111
[enable debugging features]),
113
if test "x$enable_debug" != xyes -a "x$enable_debug" != xno; then
114
AC_MSG_ERROR(You may not pass an argument to --enable-debug)
117
dnl Process our --enable-ccover argument.
118
AC_ARG_ENABLE(ccover,
119
AC_HELP_STRING([--enable-ccover],
120
[enable use of ccover code coverage tools]),
122
if test "x$enable_ccover" != xyes -a "x$enable_ccover" != xno; then
123
AC_MSG_ERROR(You may not pass an argument to --enable-ccover)
126
dnl Determine our flavor.
127
if test "x$enable_debug" = xyes -a "x$enable_ccover" = xyes; then
128
AC_MSG_ERROR(You may not use --enable-debug and --enable-ccover together)
129
elif test "x$enable_debug" = xyes; then
131
elif test "x$enable_ccover" = xyes; then
137
dnl Define FLAVOR in our makefiles.
140
dnl Tell the user what flavor we've decided to build.
141
AC_MSG_RESULT($FLAVOR)
144
dnl==========================================================================
145
dnl Checks for Programs
146
dnl==========================================================================
153
dnl==========================================================================
154
dnl Checks for Header Files
155
dnl==========================================================================
157
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h])
159
dnl==========================================================================
160
dnl Checks for Typedefs, Structures, and Compiler Characteristics
161
dnl==========================================================================
163
dnl Standard, boring stuff.
171
AC_CHECK_TYPES([ptrdiff_t])
173
dnl If we're compiling for a little-endian system, define JU_LITTLE_ENDIAN.
174
dnl If we can't tell what kind of system we're compling for, alert the
175
dnl user as described in 'info autoconf'.
176
AC_C_BIGENDIAN(, AC_DEFINE(JU_LITTLE_ENDIAN, 1,
177
[Define to 1 on little-endian systems.]))
180
AC_ARG_ENABLE(32-bit, [ --enable-32-bit Generate code for a 32-bit environment],
181
b32="$enableval", b32="no")
182
if test x"$b32" != "xno"; then
183
AC_MSG_RESULT(Building 32-bit)
184
CFLAGS="-UJU_64BIT $CFLAGS"
187
AC_ARG_ENABLE(64-bit, [ --enable-64-bit Generate code for a 64-bit environment],
188
b64="$enableval", b64="no")
189
if test x"$b64" != "xno"; then
190
AC_MSG_RESULT(Building 64-bit)
191
CFLAGS="-DJU_64BIT $CFLAGS"
194
if test x"$b32" = "xno"; then
195
if test x"$b64" = "xno"; then
196
AC_MSG_ERROR([You must run configure with either:
202
# dnl Determine whether or not we're compiling for a 64-bit system by looking
203
# dnl at the size of a 'long'. This will define SIZEOF_LONG in config.h. We
204
# dnl append some text to the bottom of config.h to set JU_64BIT appropriately.
205
# dnl we try to do the correct thing if the user doesn't chose for us.
206
# AC_CHECK_SIZEOF(long)
207
# AH_BOTTOM([/* Define JU_64BIT to 1 if we're on a 64-bit system. */
208
# if SIZEOF_LONG == 8
213
dnl==========================================================================
214
dnl Checks for Libraries
215
dnl==========================================================================
217
AC_FUNC_ERROR_AT_LINE
223
AC_CHECK_FUNCS([getpagesize gettimeofday memset munmap pow strchr strcspn strerror strstr strtoul uname])
225
dnl These must be called before AM_PROG_LIBTOOL, because it may want
226
dnl to call AC_CHECK_PROG.
227
AC_CHECK_TOOL(AR, ar)
228
AC_CHECK_TOOL(LD, ld)
229
AC_CHECK_TOOL(RANLIB, ranlib, :)
231
dnl Checks for libtool - this must be done after we set cflags (abi issues)
236
build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
237
AC_ARG_ENABLE([build-warnings],
238
[ --enable-build-warnings Enable build-time compiler warnings for gcc])
239
if test x"$build_warnings" = xyes; then
240
if test x"$GCC" = xyes; then
241
WARN_CFLAGS="${build_warnings}"
245
AC_SUBST(WARN_CFLAGS)
247
AC_CONFIG_FILES([Makefile
249
src/JudyCommon/Makefile