2 # Process this file with autoconf to produce a configure script.
5 AC_INIT(ou, 0, oleh_derevenko@users.sourceforge.net)
6 AC_CONFIG_SRCDIR([src/ou/atomic.cpp])
7 # AC_CONFIG_HEADER([config.h])
9 AC_USE_SYSTEM_EXTENSIONS
10 AM_INIT_AUTOMAKE(foreign)
14 AC_MSG_CHECKING([target OS])
17 targetos=_OU_TARGET_OS_WINDOWS
18 CXXFLAGS="-mthreads $CXXFLAGS"
19 AC_MSG_RESULT([win32])
22 targetos=_OU_TARGET_OS_QNX
26 targetos=_OU_TARGET_OS_MAC
27 AC_MSG_RESULT([darwin])
30 targetos=_OU_TARGET_OS_SUNOS
31 AC_MSG_RESULT([sunos])
34 targetos=_OU_TARGET_OS_AIX
38 targetos=_OU_TARGET_OS_GENUNIX
44 #echo "host OS name: $host_os"
45 #TODO: _OU_TARGET_BITS ?
49 # Checks for programs.
61 # Checks for libraries.
62 AC_CHECK_LIB([c], main) # needed for sunos?
63 AC_CHECK_LIB([pthread], [main])
64 AC_DEFINE(_REENTRANT,1,[enable thread-safe functions])
68 # Checks for header files.
70 AC_CHECK_HEADERS([inttypes.h malloc.h stddef.h stdlib.h string.h])
72 # Checks for typedefs, structures, and compiler characteristics.
86 AC_CHECK_TYPES([ptrdiff_t])
88 # Checks for library functions.
89 AC_CHECK_FUNCS([memset])
91 if test $targetos = _OU_TARGET_OS_MAC
94 AC_CHECK_FUNC([OSAtomicAdd32Barrier], [MAC_OS_X_VERSION=1040])
95 AC_CHECK_FUNC([OSAtomicAnd32OrigBarrier], [MAC_OS_X_VERSION=1050])
96 AC_DEFINE_UNQUOTED(MAC_OS_X_VERSION, $MAC_OS_X_VERSION, [Mac OS X version])
99 if test $targetos = _OU_TARGET_OS_SUNOS
101 AC_CHECK_FUNC(atomic_inc_32_nv, [],
102 [targetos=_OU_TARGET_OS_GENUNIX])
105 AC_DEFINE_UNQUOTED(_OU_TARGET_OS, $targetos)
108 AC_ARG_VAR([OU_NAMESPACE], [which namespace OU will be compiled in])
109 AC_ARG_WITH([namespace],
110 AC_HELP_STRING([--with-namespace=name],[sets the namespace for compiled code]),
111 [OU_NAMESPACE=$withval])
112 if test x$OU_NAMESPACE = xno -o x$OU_NAMESPACE = x
116 CPPFLAGS="$CPPFLAGS -D_OU_NAMESPACE=$OU_NAMESPACE"
118 AC_ARG_VAR([OU_FEATURE_SET], [feature set to be compiled within the OU])
119 AC_ARG_WITH([feature-set],
120 AC_HELP_STRING([--feature-set=_OU_FEATURE_SET_BASICS|_OU_FEATURE_SET_ATOMICS|_OU_FEATURE_SET_TLS|_OU_FEATURE_SET__MAX],[sets the feature set to be enabled]),
121 [OU_FEATURE_SET=$withval])
122 if test x$OU_FEATURE_SET = xno -o x$OU_FEATURE_SET = x
124 OU_NAMESPACE=_OU_FEATURE_SET__MAX
126 CPPFLAGS="$CPPFLAGS -D_OU_FEATURE_SET=$OU_FEATURE_SET"
128 AC_ARG_ENABLE([asserts],
129 AS_HELP_STRING([--disable-asserts],
130 [disables debug error checking]),
131 asserts=$enableval,asserts=yes)
132 if test x$asserts = xno
134 CPPFLAGS="$CPPFLAGS -DNDEBUG"
137 AC_CONFIG_FILES([Makefile
143 echo "OU namespace: $OU_NAMESPACE"
144 echo "OU feature set: $OU_FEATURE_SET"