Merge
[ode.git] / ou / configure.ac
blobf78fc1a597e20936c0c9efb1813719f7a2b6f654
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
5 AC_INIT(ou, 0, oleh_derevenko@users.sourceforge.net)
6 AC_CONFIG_SRCDIR([src/ou/atomic.cpp])
7 # AC_CONFIG_HEADER([config.h])
8 AC_CANONICAL_HOST
9 AC_USE_SYSTEM_EXTENSIONS
10 AM_INIT_AUTOMAKE(foreign)
12 AC_LANG([C++])
14 AC_MSG_CHECKING([target OS])
15 case "$host_os" in
16   cygwin* | mingw*)
17     targetos=_OU_TARGET_OS_WINDOWS
18     CXXFLAGS="-mthreads $CXXFLAGS"
19     AC_MSG_RESULT([win32])
20     ;;
21   *qnx*)
22     targetos=_OU_TARGET_OS_QNX
23     AC_MSG_RESULT([qnx])
24     ;;
25   *apple* | *darwin*)
26     targetos=_OU_TARGET_OS_MAC
27     AC_MSG_RESULT([darwin])
28     ;;
29   *sunos*)
30     targetos=_OU_TARGET_OS_SUNOS
31     AC_MSG_RESULT([sunos])
32     ;;
33   *aix*)
34     targetos=_OU_TARGET_OS_AIX
35     AC_MSG_RESULT([aix])
36     ;;
37   *)
38     targetos=_OU_TARGET_OS_GENUNIX
39     AC_MSG_RESULT([unix])
40     ;;
41 esac
44 #echo "host OS name: $host_os"
45 #TODO: _OU_TARGET_BITS ?
49 # Checks for programs.
50 AC_PROG_CXX
51 AC_PROG_CC
52 AC_PROG_AWK
53 AC_PROG_INSTALL
54 AC_PROG_RANLIB
55 AC_PROG_CPP
56 AC_PROG_MKDIR_P
57 AC_LIBTOOL_WIN32_DLL
58 AC_PROG_LIBTOOL
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.
69 AC_HEADER_STDC
70 AC_CHECK_HEADERS([inttypes.h malloc.h stddef.h stdlib.h string.h])
72 # Checks for typedefs, structures, and compiler characteristics.
73 AC_HEADER_STDBOOL
74 AC_C_CONST
75 AC_C_INLINE
76 AC_TYPE_INT16_T
77 AC_TYPE_INT32_T
78 AC_TYPE_INT64_T
79 AC_TYPE_INT8_T
80 AC_TYPE_SIZE_T
81 AC_TYPE_UINT16_T
82 AC_TYPE_UINT32_T
83 AC_TYPE_UINT64_T
84 AC_TYPE_UINT8_T
85 AC_C_VOLATILE
86 AC_CHECK_TYPES([ptrdiff_t])
88 # Checks for library functions.
89 AC_CHECK_FUNCS([memset])
91 if test $targetos = _OU_TARGET_OS_MAC
92 then
93     MAC_OS_X_VERSION=1000
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
100 then
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
113 then
114     OU_NAMESPACE="ou"
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
123 then
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
133 then
134     CPPFLAGS="$CPPFLAGS -DNDEBUG"
137 AC_CONFIG_FILES([Makefile
138                  include/ou/Makefile
139                  src/ou/Makefile
140                  test/Makefile])
141 AC_OUTPUT
143 echo "OU namespace: $OU_NAMESPACE"
144 echo "OU feature set: $OU_FEATURE_SET"