root/openwsman/trunk/configure.in

Revision 3036, 13.8 kB (checked in by nashif, 2 months ago)

check for CXX

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1  *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
4
5 AC_PREREQ(2.53)
6 AC_INIT(openwsman, 2.1.0)
7 AC_CONFIG_SRCDIR(src/server/wsmand.c)
8 AC_CANONICAL_HOST
9
10 dnl Package version information
11 PACKAGE=openwsman
12 VERSION_MAJOR=2
13 VERSION_MINOR=1
14 VERSION_RELEASE=0
15 VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}
16
17 AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
18
19 AM_CONFIG_HEADER(wsman_config.h)
20 AM_MAINTAINER_MODE
21 AC_PROG_MAKE_SET
22 AC_PROG_CXX
23
24 WSMAN_PKG=wsman
25 WSMAN_CLIENT_PKG=${WSMAN_PKG}_client
26 WSMAN_CLIENT_TRANSPORT_PKG=${WSMAN_PKG}_curl_client_transport
27 WSMAN_CLIENTPP_PKG=${WSMAN_PKG}_clientpp
28 WSMAN_SERVER_PKG=${WSMAN_PKG}_server
29
30 AC_SUBST(WSMAN_UTILS_PKG)
31 AC_SUBST(WSMAN_CLIENT_PKG)
32 AC_SUBST(WSMAN_CLIENT_TRANSPORT_PKG)
33 AC_SUBST(WSMAN_CLIENTPP_PKG)
34 AC_SUBST(WSMAN_SERVER_PKG)
35 AC_SUBST(WSMAN_PKG)
36
37 case "$host" in
38   *-*-solaris*)
39         solaris="yes"
40         ;;
41   *)
42         ;;
43 esac
44
45
46 dnl ***************************
47 dnl *** Set debugging flags ***
48 dnl ***************************
49
50 # Declare --enable-* args and collect ac_help strings
51 AC_ARG_ENABLE(debug, --enable-debug turn on debugging)
52
53 # Set the debug flags
54 if test "x$enable_debug" = "xyes"; then
55     test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
56 fi
57
58 # Set the debug flags
59 if test "x$enable_debug" = "xyes"; then
60     AC_DEFINE(WSMAN_DEBUG_VERBOSE, 1, [Defined if verbose debug logging is requested])
61 fi
62
63
64 eventing_default=yes
65 AC_ARG_ENABLE(eventing,
66                 [  --enable-eventing=[no/yes] turn on WS-Eventing [default=yes]],,
67               enable_eventing=$eventing_default)
68 if test "x$enable_eventing" = "xyes"; then
69     AC_DEFINE(ENABLE_EVENTING_SUPPORT, 1, [Defined if WS-Eventing wanted])
70 fi
71 AM_CONDITIONAL(ENABLE_EVENTING_SUPPORT, test "x$enable_eventing" = "xyes")
72
73 dnl copied from openwbem :)
74 use_pam=0       
75 AC_ARG_ENABLE(pam,
76 AC_HELP_STRING(--disable-pam,disable pam integration))
77 if test "$enable_pam" != no; then
78         use_pam=1
79         AC_CHECK_HEADERS(pam/pam_misc.h pam/pam_appl.h, true, use_pam=0)
80         if test x$use_pam = x0; then
81                 AC_CHECK_HEADERS(security/pam_misc.h security/pam_appl.h,
82                         use_pam=1, use_pam=0)
83         fi
84                
85         if test x$use_pam = x1; then
86                 AC_DEFINE([HAVE_PAM], [1], [Defined if pam support is available])
87                 PAM_LIB="-lpam"
88         else
89                 AC_MSG_WARN(*** No PAM headers found! The PAM authentication module ***)
90                 AC_MSG_WARN(*** will not be built. The config file defaults to      ***)
91                 AC_MSG_WARN(*** using PAM authentication.                           ***)
92                 AC_MSG_WARN(*** You must edit the config file and use a different   ***)
93                 AC_MSG_WARN(*** authentication module or else the daemon won't start***)
94         fi
95 fi                     
96 AC_SUBST(PAM_LIB)
97 AM_CONDITIONAL(USE_PAM, test x$use_pam = x1)
98
99
100 dnl ***************************
101 dnl *** Checks for programs ***
102 dnl ***************************
103 AC_PROG_CC
104 AM_PROG_CC_STDC
105 AC_PROG_INSTALL
106 # Initialize libtool
107 AM_PROG_LIBTOOL
108
109 # This isn't a program, but it doesn't fit anywhere else...
110 AC_FUNC_ALLOCA
111
112 AC_CHECK_FUNCS(strtok_r \
113 getpid \
114 strsep \
115 gettimeofday \
116 unlink \
117 syslog \
118 sleep \
119 fnmatch \
120 timegm \
121 daemon  \
122 va_copy \
123 memmove \
124 bcopy \
125 gmtime_r
126 )
127 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
128 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
129 AC_CHECK_FUNCS(inet_pton inet_ntop inet_aton getaddrinfo getnameinfo)
130 AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
131         AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
132 ])
133
134 # check for ssize_t
135 AC_CHECK_TYPE(ssize_t, int)
136
137 # Set STDC_HEADERS
138 AC_HEADER_STDC
139 AC_CHECK_HEADERS([inttypes.h stdlib.h])
140 AC_CHECK_HEADERS([net/if.h net/if_dl.h])
141 AC_CHECK_HEADERS([sys/ioctl.h sys/sockio.h])
142 AC_CHECK_HEADERS([crypt.h sys/ioctl.h dirent.h])
143 AC_CHECK_HEADERS([vararg.h stdarg.h pthread.h])
144 AC_CHECK_HEADERS([unistd.h sys/types.h sys/sendfile.h sys/signal.h])
145 AC_CHECK_HEADERS([ctype.h sys/resource.h sys/socket.h sys/select.h])
146 AC_CHECK_HEADERS([netinet/in.h], [], [],
147 [#if HAVE_SYS_TYPES_H
148 # include <sys/types.h>
149 #endif
150 ])
151
152 AC_HEADER_TIME
153 dnl Checks for types
154 AC_CHECK_TYPES([sa_family_t, in_port_t, in_addr_t], , ,
155 [
156 #if HAVE_SYS_TYPES_H
157 # include <sys/types.h>
158 #endif
159 #if HAVE_SYS_SOCKET_H
160 # include <sys/socket.h>
161 #endif
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
164 #endif
165 #if HAVE_ARPA_NAMESER_H
166 # include <arpa/nameser.h>
167 #endif
168 ])
169
170 AC_CHECK_SIZEOF(short)
171 AC_CHECK_SIZEOF(int)
172 AC_CHECK_SIZEOF(long)
173 AC_CHECK_SIZEOF(long long)
174 SIZEOF_SHORT=$ac_cv_sizeof_short
175 SIZEOF_INT=$ac_cv_sizeof_int
176 SIZEOF_LONG=$ac_cv_sizeof_long
177 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
178 AC_SUBST(SIZEOF_SHORT)
179 AC_SUBST(SIZEOF_INT)
180 AC_SUBST(SIZEOF_LONG)
181 AC_SUBST(SIZEOF_LONG_LONG)
182 AC_CHECK_FUNCS(srandom)
183 AC_CHECK_MEMBER(struct sockaddr.sa_len,
184        AC_DEFINE_UNQUOTED(HAVE_SA_LEN,
185        1,
186        [Define if struct sockaddr contains sa_len]),,
187        [#include <sys/typesDD.h>
188        #include <sys/socket.h>])
189
190 dnl *********************************
191 dnl *** Networking library checks ***
192 dnl *********************************
193
194 PKG_CHECK_MODULES(XML, libxml-2.0) AC_SUBST(XML_CFLAGS) AC_SUBST(XML_LIBS)
195 AC_PATH_PROG(CURL_CONFIG, curl-config, no)
196 if test "$CURL_CONFIG" = "no" ; then
197         AC_MSG_ERROR([the curl-config script installed by libcurl could not be found.  libcurl is required for tests.])
198 fi
199 CURL_CFLAGS=`curl-config --cflags`
200 CURL_LIBS=`curl-config --libs`
201 AC_SUBST(CURL_CFLAGS)
202 AC_SUBST(CURL_LIBS)
203
204 dnl Need libcurl version 7.12.0 or higher
205 CURLSTRVERSION="`curl-config --version`"
206 CURLNVERSION=`echo $CURLSTRVERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print ($1*10000) + ($2*100) + $3}'`
207 if test "$CURLNVERSION" -lt  71200 ; then
208         AC_MSG_ERROR([
209 Openwsman requires libcurl version 7.12.00 or higher, and you
210 are running "$CURLSTRVERSION".  You may be able to install a newer
211 version via your operating system update facility, or you can
212 retrieve it from:
213
214     http://curl.haxx.se/
215
216 and install it directly.]
217 )
218         exit
219 fi
220
221 examples_default=no
222 AC_ARG_WITH(examples,
223                 [  --with-examples=[no/yes] build examples [default=no]],,
224               with_examples=$examples_default)
225 AM_CONDITIONAL(BUILD_EXAMPLES, test "x$with_examples" = "xyes")
226 tests_default=no
227 AC_ARG_WITH(tests,
228                 [  --with-tests=[no/yes] build tests [default=no]],,
229               with_tests=$tests_default)
230 AM_CONDITIONAL(BUILD_TESTS, test "x$with_tests" = "xyes")
231
232 python_default=no
233 AC_ARG_ENABLE(python,
234                 [  --enable-python=[no/yes] build python bindings [default=no]],,
235               enable_python=$python_default)
236
237 if test "x$enable_python" = "xyes"; then
238 AM_PATH_PYTHON
239 AC_PROG_SWIG(1.3.17)
240 AC_CHECK_PROG(PYTHON_CONFIG, python-config,yes)
241 if test "$PYTHON_CONFIG" = "yes" ; then
242         PYTHON_CFLAGS=`python-config --cflags`
243         PYTHON_LIBS=`python-config --libs`
244         AC_SUBST(PYTHON_CFLAGS)
245         AC_SUBST(PYTHON_LIBS)
246 else
247         AM_PATH_PYTHON(2.2)
248         LIBS="$LIBS $PYTHON_LIB_FLAGS"
249         PYTHON_INCLUDE_FLAGS=`python -c "import os,sys; print '-I' + os.path.join(sys.prefix, 'include', 'python' + sys.version[[:3]])"`
250         if test $prefix = NONE; then
251                 pythondir=`python -c "import os,sys; print os.path.join(sys.prefix, 'lib', 'python' + sys.version[[:3]], 'site-packages')"`
252         fi
253         PYTHON_PREFIX=`python -c "import os,sys; print sys.prefix"`
254         PYTHON_EXEC_PREFIX=`python -c "import os,sys; print sys.exec_prefix"`
255         CFLAGS="$CFLAGS $PYTHON_INCLUDE_FLAGS"
256 fi
257 fi
258 AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" = "xyes")
259
260 ruby_default=no
261 AC_ARG_ENABLE(ruby,
262                 [  --enable-ruby=[no/yes] build Ruby bindings [default=no]],,
263               enable_ruby=$ruby_default)
264
265 if test "x$enable_ruby" = "xyes"; then
266   AC_PROG_SWIG(1.3.17)
267
268   dnl Check for Ruby, taken from http://vim.svn.sourceforge.net
269   AC_SUBST(vi_cv_path_ruby)
270   AC_PATH_PROG(vi_cv_path_ruby, ruby)
271   if test "X$vi_cv_path_ruby" != "X"; then
272     AC_MSG_CHECKING(Ruby version)
273     if `$vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1'` >/dev/null 2>/dev/null; then
274       AC_MSG_RESULT(OK)
275       AC_MSG_CHECKING(Ruby header files)
276       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir'` 2>/dev/null
277       if test "X$rubyhdrdir" != "X"; then
278         AC_MSG_RESULT($rubyhdrdir)
279         CFLAGS="$CFLAGS -I$rubyhdrdir"
280         rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
281         if test "X$rubylibs" != "X"; then
282           RUBY_LIBS="$rubylibs"
283         fi
284         librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
285         if test -f "$rubyhdrdir/$librubyarg"; then
286           librubyarg="$rubyhdrdir/$librubyarg"
287         else
288           rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
289           if test -f "$rubylibdir/$librubyarg"; then
290             librubyarg="$rubylibdir/$librubyarg"
291           elif test "$librubyarg" = "libruby.a"; then
292             dnl required on Mac OS 10.3 where libruby.a doesn't exist
293             librubyarg="-lruby"
294           else
295             librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./,%'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
296           fi
297         fi
298
299         if test "X$librubyarg" != "X"; then
300           RUBY_LIBS="$librubyarg $RUBY_LIBS"
301         fi
302         rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
303         if test "X$rubyldflags" != "X"; then
304           LDFLAGS="$rubyldflags $LDFLAGS"
305         fi
306       else
307         AC_MSG_WARN(not found - disabling Ruby; Try installing ruby-devel)
308       fi
309     else
310       AC_MSG_WARN(too old; need Ruby version 1.6.0 or later)
311     fi
312   fi
313 fi
314 AM_CONDITIONAL(BUILD_RUBY, test "x$enable_ruby" = "xyes")
315 AM_CONDITIONAL(BUILD_JAVA, test "x$enable_java" = "xyes")
316
317 AC_ARG_ENABLE(ssl, [  --enable-ssl             Turn on Secure Sockets Layer support [default=yes]],,
318               enable_ssl=auto)
319
320 if test "$enable_ssl" != "no"; then
321     PKG_CHECK_MODULES(OPENSSL, openssl , have_ssl="yes", have_ssl="no")
322     AC_SUBST(OPENSSL_CFLAGS)
323     AC_SUBST(OPENSSL_LIBS)
324     if test "$have_ssl" != "yes"; then
325         if test "$enable_ssl" = "auto"; then
326             AC_MSG_WARN(Disabling SSL support);
327             enable_ssl=no;
328         else
329             AC_MSG_ERROR(Could not configure SSL support);
330         fi
331     fi
332 fi
333
334 if test "$enable_ssl" != "no"; then
335     AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
336 fi
337 AM_CONDITIONAL(USE_OPENSSL, test "x$enable_ssl" != "xno")
338
339
340 AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
341 AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true")
342 if test -z "$HAVE_LIBC_CRYPT"; then
343        AC_CHECK_LIB(crypt, crypt,
344              CRYPT_LIBS="-lcrypt"
345              [AC_DEFINE(HAVE_LIBCRYPT)], ,)
346 fi
347
348 AC_SUBST(CRYPT_LIBS)
349
350 dnl
351 dnl Use built-in UUID generation if on Solaris
352 dnl
353
354 if test x"$solaris" = x"yes" ; then
355         LDFLAGS="$LDFLAGS -luuid"
356 fi
357
358 if test "$prefix" = "NONE"; then
359     prefix=$ac_default_prefix;
360 fi
361 SYSCONFDIR_TMP="`eval echo $sysconfdir`"
362 AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_FILE], ["${SYSCONFDIR_TMP}/openwsman/openwsman.conf"] , [Default config file])
363 SYSCONFDIR=${sysconfdir}/openwsman
364
365 test "$localstatedir" = '${prefix}/var' && localstatedir=/var || localstatedir=$localstatedir
366 dnl Subst PACKAGE_PLUGIN_DIR.
367 packagesubscriptiondir="${localstatedir}"/lib/${PACKAGE}/subscriptions
368 PACKAGE_SUBSCRIPTION_DIR="${packagesubscriptiondir}"
369 AC_SUBST(PACKAGE_SUBSCRIPTION_DIR)
370
371 dnl Subst PACKAGE_PLUGIN_DIR.
372 packageplugindir=$libdir/${PACKAGE}/plugins
373 PACKAGE_PLUGIN_DIR="${packageplugindir}"
374 AC_SUBST(PACKAGE_PLUGIN_DIR)
375
376 dnl Subst PACKAGE_AUTH_DIR.
377 packageauthdir=$libdir/${PACKAGE}/authenticators
378 PACKAGE_AUTH_DIR="${packageauthdir}"
379 AC_SUBST(PACKAGE_AUTH_DIR)
380
381 AC_SUBST(PACKAGE)
382 AC_SUBST(VERSION)
383 AC_SUBST(VERSION_MAJOR)
384 AC_SUBST(VERSION_MINOR)
385 AC_SUBST(VERSION_RELEASE)
386
387
388
389 AC_CHECK_LIB([cmpisfcc],  [cmciConnect], [have_sfcc="yes"],[have_sfcc="no"])
390 AM_CONDITIONAL(BUILD_LIBCIM, test "$have_sfcc" = "yes" )
391
392 have_cunit=no
393 AC_CHECK_HEADERS([CUnit/Basic.h], have_cunit="yes" )
394
395 AM_CONDITIONAL(BUILD_CUNIT_TESTS, test "$have_cunit" = "yes")
396
397 AC_ARG_ENABLE(server,
398 AC_HELP_STRING(--disable-server,disable server))
399
400 OWMAN_DISABLE_SERVER=0
401 if test "$enable_server" = no; then
402         OWMAN_DISABLE_SERVER=1
403 fi
404 AM_CONDITIONAL(DISABLE_SERVER, test x$OWMAN_DISABLE_SERVER = x1)
405
406 AC_ARG_ENABLE(plugins,
407 AC_HELP_STRING(--disable-plugins,disable plugins))
408
409 OWMAN_DISABLE_PLUGINS=0
410 if test "$enable_plugins" = no; then
411         OWMAN_DISABLE_PLUGINS=1
412 fi
413 AM_CONDITIONAL(DISABLE_PLUGINS, test x$OWMAN_DISABLE_PLUGINS = x1)
414
415 AC_ARG_ENABLE(more-warnings,
416               [  --disable-more-warnings  Inhibit compiler warnings],
417               set_more_warnings=no)
418
419 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
420         CFLAGS="$CFLAGS \
421                 -Wall -Wstrict-prototypes -Wmissing-declarations \
422                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
423                 -Wunused -Werror"
424 fi
425
426
427
428 dnl *************************
429 dnl *** Output Everything ***
430 dnl *************************
431 AC_SUBST(SYSCONFDIR)
432
433 AC_CONFIG_FILES([
434         openwsman.pc
435         openwsman++.pc
436         openwsman-server.pc
437         openwsman.spec])
438
439 AC_OUTPUT([
440         Doxyfile
441         Makefile
442         src/Makefile
443         src/server/Makefile
444         src/lib/Makefile
445         src/plugins/Makefile
446         src/plugins/cim/Makefile
447         src/plugins/identify/Makefile
448         src/plugins/wsman/Makefile
449         src/plugins/wsman/test/Makefile
450         src/authenticators/Makefile
451         src/authenticators/file/Makefile
452         src/authenticators/pam/Makefile
453         src/cpp/Makefile
454         include/Makefile
455         include/cim/Makefile
456         include/u/Makefile
457         doc/Makefile
458         doc/specs/Makefile
459         etc/Makefile
460         etc/owsmangencert.sh
461         etc/init/Makefile
462         etc/init/openwsmand.sh
463         tests/Makefile
464         tests/client/Makefile
465         tests/epr/Makefile
466         tests/filter/Makefile
467         tests/xml/Makefile
468         examples/Makefile
469         bindings/Makefile
470         bindings/python/Makefile
471         bindings/ruby/Makefile
472         bindings/java/Makefile
473         ])