summaryrefslogtreecommitdiff
path: root/cpp/configure.ac
blob: 63ec993a56ea3c36a23d4fa76dff7e2f713dafd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
dnl Process this file with autoconf to produce a configure script.
dnl
dnl This file is free software; as a special exception the author gives
dnl unlimited permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

AC_INIT([qpidc], [0.2], [qpid-dev@incubator.apache.org])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])

# Minimum Autoconf version required.
AC_PREREQ(2.59)

AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_SRCDIR([qpidc.spec.in])

AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_USE_SYSTEM_EXTENSIONS
AC_LANG([C++])	

AM_MISSING_PROG([HELP2MAN], [help2man])

AC_ARG_ENABLE(warnings,
[  --enable-warnings   turn on lots of compiler warnings (recommended)],
[case "${enableval}" in
   yes|no) ;;
   *)      AC_MSG_ERROR([bad value ${enableval} for warnings option]) ;;
 esac],
 [enableval=yes])

# Warnings: Enable as many as possible, keep the code clean. Please
# do not disable warnings or remove -Werror without discussing on
# qpid-dev list.
#
# The following warnings are deliberately omitted, they warn on valid code.
# -Wunreachable-code -Wpadded -Winline
# -Wshadow - warns about boost headers.

if test "${enableval}" = yes; then
  gl_COMPILER_FLAGS(-Werror)
  gl_COMPILER_FLAGS(-pedantic)
  gl_COMPILER_FLAGS(-Wall)
  gl_COMPILER_FLAGS(-Wextra)
  gl_COMPILER_FLAGS(-Wno-shadow)
  gl_COMPILER_FLAGS(-Wpointer-arith)
  gl_COMPILER_FLAGS(-Wcast-qual)
  gl_COMPILER_FLAGS(-Wcast-align)
  gl_COMPILER_FLAGS(-Wno-long-long)
  gl_COMPILER_FLAGS(-Wvolatile-register-var)
  gl_COMPILER_FLAGS(-Winvalid-pch)
  gl_COMPILER_FLAGS(-Wno-system-headers)
  gl_COMPILER_FLAGS(-Woverloaded-virtual)	
  AC_SUBST([WARNING_CFLAGS], [$COMPILER_FLAGS])
  AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
  COMPILER_FLAGS=
fi

AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])

# For libraries (libcommon) that use dlopen, dlerror, etc.,
# test whether we need to link with -ldl.
gl_saved_libs=$LIBS
  AC_SEARCH_LIBS(dlopen, [dl],
		 [test "$ac_cv_search_dlopen" = "none required" ||
		  LIB_DLOPEN=$ac_cv_search_dlopen])
  AC_SUBST([LIB_DLOPEN])
LIBS=$gl_saved_libs

# Set the argument to be used in "libtool -version-info ARG".
QPID_CURRENT=1
QPID_REVISION=0
QPID_AGE=1
LIBTOOL_VERSION_INFO_ARG=$QPID_CURRENT:$QPID_REVISION:$QPID_AGE
AC_SUBST(LIBTOOL_VERSION_INFO_ARG)

gl_CLOCK_TIME

# Check for cppunit support.
CPPUNIT_MINIMUM_VERSION=1.10.2
AM_PATH_CPPUNIT([$CPPUNIT_MINIMUM_VERSION], , [CPPUNIT_LIBS=-lcppunit])
CPPUNIT_CXXFLAGS=$CPPUNIT_CFLAGS
AC_SUBST(CPPUNIT_LIBS)
AC_SUBST(CPPUNIT_CXXFLAGS)

AC_ARG_ENABLE([apr-netio],
  [AS_HELP_STRING([--enable-apr-netio],
    [use the Apache Portable Runtime library for network IO (default yes)])],
  [case $enableval in
    yes|no) enable_APR_NETIO=$enableval;;
    *) AC_MSG_ERROR([Invalid value for --enable-apr-netio: $enableval]);;
   esac],
  [enable_APR_NETIO=yes]
)
AM_CONDITIONAL([USE_APR_NETIO], [test x$enable_APR_NETIO = xyes])

AC_ARG_ENABLE([apr-platform],
  [AS_HELP_STRING([--enable-apr-platform],
    [use the Apache Portable Runtime library for platform (default yes)])],
  [case $enableval in
    yes|no) enable_APR_PLATFORM=$enableval;;
    *) AC_MSG_ERROR([Invalid value for --enable-apr-platform: $enableval]);;
   esac],
  [enable_APR_PLATFORM=yes]
)
AM_CONDITIONAL([USE_APR_PLATFORM], [test x$enable_APR_PLATFORM = xyes])

APR_MINIMUM_VERSION=1.2.2
AC_SUBST(APR_MINIMUM_VERSION)
AC_SUBST(APR_CXXFLAGS)
AC_SUBST(USE_APR_PLATFORM)

if test "$enable_APR_NETIO" = yes -o "$enable_APR_PLATFORM" = yes; then
  PKG_CHECK_MODULES([APR], [apr-1 >= $APR_MINIMUM_VERSION])
  APR_CXXFLAGS="$APR_CFLAGS"
  if test "$enable_APR_NETIO" = yes; then
	USE_APR_NETIO=1
  fi
  if test "$enable_APR_PLATFORM" = yes; then
  	APR_CXXFLAGS+=" -DUSE_APR_PLATFORM=1"
	USE_APR_PLATFORM=1
  fi
fi

AC_ARG_ENABLE([valgrind],
  [AS_HELP_STRING([--enable-valgrind],
    [run valgrind memory checker on tests, if available (default yes)])],
  [case $enableval in
    yes|no) enable_VALGRIND=$enableval;;
    *) AC_MSG_ERROR([Invalid value for --enable-valgrind: $enableval]);;
   esac],
  [enable_VALGRIND=yes]
)

# We use valgrind for the tests.  See if it's available.
# Check for it unconditionally, so we don't have to duplicate its
# use of AC_SUBST([VALGRIND]).
AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind])
test "$enable_VALGRIND" = no && VALGRIND=

# If rpmlint is availalbe we'll run it when building RPMs.
AC_CHECK_PROG([RPMLINT], [rpmlint], [rpmlint])
AM_CONDITIONAL([HAS_RPMLINT], [test -n "$RPMLINT"])

# URL and download URL for the package.
URL=http://rhm.et.redhat.com/qpidc
AC_SUBST(URL)
DOWNLOAD_URL=http://rhm.et.redhat.com/download
AC_SUBST(DOWNLOAD_URL)

# Check for headers from required devel kits.
missing=""
AC_CHECK_HEADERS([libdaemon/daemon.h],,[missing="$missing libdaemon"])
AC_CHECK_HEADERS([boost/shared_ptr.hpp],,[missing="$missing boost"])
AC_CHECK_HEADERS([uuid/uuid.h],,[missing="$missing libuuid"])
test -z "$missing" ||
    AC_MSG_ERROR([Missing required headers. Install the following packages or -devel rpms: $missing.])

# Enable/disable cluster functionality based on presence of usable openais
# and devel libs.
# cpg_local_get is not yet in a packaged release as of 2007-06-20
LDFLAGS_save=$LDFLAGS				
LDFLAGS="$LDFLAGS -L/usr/lib/openais -L/usr/lib64/openais"
AC_CHECK_LIB([cpg], [cpg_local_get], [libcpg=yes], [libcpg=no])
AC_CHECK_HEADER([openais/cpg.h],[cpg_h=yes],[cpg_h=no])
if test x$libcpg = xyes -a x$cpg_h = xyes; then
   AM_CONDITIONAL([CLUSTER], true)
   CPPFLAGS+=" -DCLUSTER"
else
  AM_CONDITIONAL([CLUSTER], false)	
  LDFLAGS=$LDFLAGS_save	   
fi
if test x$libcpg = xno -a x$cpg_h = xyes; then
   AC_MSG_WARN([Found cpg.h but libcpg is missing or does not contain cpg_local_get. Need build of openais whitetank branch head as of 2007-06-20])
fi
AC_CONFIG_FILES([
  qpidc.spec
  Makefile
  examples/Makefile
  perftest/Makefile
  src/Makefile
  src/tests/Makefile
  docs/man/Makefile
  docs/api/Makefile
  docs/api/user.doxygen
  docs/api/developer.doxygen
  ])
AC_OUTPUT