1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | dnl |
---|
3 | dnl Written by Russ Allbery <rra@stanford.edu> |
---|
4 | dnl Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
---|
5 | dnl Board of Trustees, Leland Stanford Jr. University |
---|
6 | dnl |
---|
7 | dnl See LICENSE for licensing terms. |
---|
8 | |
---|
9 | AC_PREREQ([2.63]) |
---|
10 | AC_INIT([remctl], [2.14], [rra@stanford.edu]) |
---|
11 | AC_CONFIG_AUX_DIR([build-aux]) |
---|
12 | AC_CONFIG_LIBOBJ_DIR([portable]) |
---|
13 | AC_CONFIG_MACRO_DIR([m4]) |
---|
14 | AM_INIT_AUTOMAKE([1.10]) |
---|
15 | AM_MAINTAINER_MODE |
---|
16 | |
---|
17 | AC_PROG_CC |
---|
18 | AC_USE_SYSTEM_EXTENSIONS |
---|
19 | AM_PROG_CC_C_O |
---|
20 | AC_PROG_INSTALL |
---|
21 | AC_PROG_LIBTOOL |
---|
22 | |
---|
23 | AC_SEARCH_LIBS([gethostbyname], [nsl]) |
---|
24 | AC_SEARCH_LIBS([socket], [socket], , |
---|
25 | [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], , |
---|
26 | [-lsocket])]) |
---|
27 | RRA_LIB_GSSAPI |
---|
28 | AC_HEADER_STDBOOL |
---|
29 | AC_CHECK_HEADERS([sys/bitypes.h sys/filio.h sys/select.h sys/uio.h syslog.h]) |
---|
30 | AC_CHECK_DECLS([snprintf, vsnprintf]) |
---|
31 | AC_CHECK_DECLS([inet_aton, inet_ntoa], , , |
---|
32 | [#include <sys/types.h> |
---|
33 | #include <netinet/in.h> |
---|
34 | #include <arpa/inet.h>]) |
---|
35 | RRA_C_C99_VAMACROS |
---|
36 | RRA_C_GNU_VAMACROS |
---|
37 | AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , |
---|
38 | [#include <sys/types.h> |
---|
39 | #include <sys/socket.h>]) |
---|
40 | AC_CHECK_TYPES([long long]) |
---|
41 | AC_CHECK_TYPE([sig_atomic_t], , |
---|
42 | [AC_DEFINE([sig_atomic_t], [int], |
---|
43 | [Define to int if <signal.h> does not define.])], |
---|
44 | [#include <sys/types.h> |
---|
45 | #include <signal.h>]) |
---|
46 | AC_CHECK_TYPE([socklen_t], , |
---|
47 | [AC_DEFINE([socklen_t], [int], |
---|
48 | [Define to int if <sys/socket.h> does not define.])], |
---|
49 | [#include <sys/types.h> |
---|
50 | #include <sys/socket.h>]) |
---|
51 | AC_CHECK_TYPES([struct sockaddr_in6], |
---|
52 | [AC_DEFINE([HAVE_INET6], [1], |
---|
53 | [Define to 1 if IPv6 library interfaces are available.])], , |
---|
54 | [#include <sys/types.h> |
---|
55 | #include <netinet/in.h>]) |
---|
56 | AC_CHECK_TYPES([struct sockaddr_storage], |
---|
57 | [AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , , |
---|
58 | [#include <sys/types.h> |
---|
59 | #include <sys/socket.h>])], , |
---|
60 | [#include <sys/types.h> |
---|
61 | #include <sys/socket.h>]) |
---|
62 | RRA_MACRO_IN6_ARE_ADDR_EQUAL |
---|
63 | RRA_MACRO_SA_LEN |
---|
64 | RRA_FUNC_INET_NTOA |
---|
65 | RRA_FUNC_SNPRINTF |
---|
66 | AC_CHECK_FUNCS([getaddrinfo], |
---|
67 | [RRA_FUNC_GETADDRINFO_ADDRCONFIG], |
---|
68 | [AC_LIBOBJ([getaddrinfo])]) |
---|
69 | AC_CHECK_FUNCS([setrlimit setsid]) |
---|
70 | AC_REPLACE_FUNCS([asprintf daemon getnameinfo getopt inet_aton inet_ntop \ |
---|
71 | setenv strlcat strlcpy]) |
---|
72 | AC_TYPE_SIGNAL |
---|
73 | |
---|
74 | dnl Additional GSS-API portability checks. |
---|
75 | RRA_LIB_GSSAPI_SWITCH |
---|
76 | AC_CHECK_HEADERS([gssapi.h]) |
---|
77 | AC_CHECK_DECL([GSS_C_NT_USER_NAME], |
---|
78 | [AC_DEFINE([HAVE_GSS_RFC_OIDS], 1, |
---|
79 | [Define to 1 if the GSS-API library uses RFC-compliant OIDs.])], , |
---|
80 | [[ |
---|
81 | #if defined(HAVE_GSSAPI_H) |
---|
82 | # include <gssapi.h> |
---|
83 | #else |
---|
84 | # include <gssapi/gssapi.h> |
---|
85 | #endif |
---|
86 | ]]) |
---|
87 | AC_CHECK_DECLS([GSS_KRB5_MECHANISM], , |
---|
88 | [AC_CHECK_DECLS([gss_mech_krb5], , |
---|
89 | [AC_LIBOBJ([gssapi-mech])], |
---|
90 | [#include <gssapi/gssapi_krb5.h>])], |
---|
91 | [[ |
---|
92 | #if defined(HAVE_GSSAPI_H) |
---|
93 | # include <gssapi.h> |
---|
94 | #else |
---|
95 | # include <gssapi/gssapi.h> |
---|
96 | #endif |
---|
97 | ]]) |
---|
98 | RRA_LIB_GSSAPI_RESTORE |
---|
99 | |
---|
100 | dnl If and only if we're on a GNU system, use mapfile to do symbol versioning |
---|
101 | dnl of the libremctl library. libtool doesn't know how to do this itself. |
---|
102 | dnl This is supported on Solaris as well but we need to know if we're |
---|
103 | dnl the GNU linker or the Solaris linker. |
---|
104 | case "$host" in |
---|
105 | *-gnu*) |
---|
106 | VERSION_LDFLAGS='-Wl,--version-script=${srcdir}/client/mapfile' |
---|
107 | ;; |
---|
108 | *) |
---|
109 | VERSION_LDFLAGS="" |
---|
110 | ;; |
---|
111 | esac |
---|
112 | AC_SUBST([VERSION_LDFLAGS]) |
---|
113 | |
---|
114 | dnl Check for the CMU GPUT library. |
---|
115 | RRA_LIB_GPUT |
---|
116 | |
---|
117 | dnl Whether to build the Perl bindings. Put this late so that it shows up |
---|
118 | dnl near the bottom of the --help output. |
---|
119 | build_perl= |
---|
120 | AC_ARG_ENABLE([perl], |
---|
121 | [AC_HELP_STRING([--enable-perl], [Build Perl libremctl bindings])], |
---|
122 | [AS_IF([test x"$enableval" = xyes], [build_perl=yes])]) |
---|
123 | AM_CONDITIONAL([BUILD_PERL], [test x"$build_perl" = xyes]) |
---|
124 | |
---|
125 | dnl Whether to build the PHP bindings. The dance required to be able to run |
---|
126 | dnl phpize before AC_OUTPUT sucks like a sucking thing. |
---|
127 | build_php= |
---|
128 | AC_ARG_ENABLE([php], |
---|
129 | [AC_HELP_STRING([--enable-php], [Build remctl PECL extension for PHP])], |
---|
130 | [AS_IF([test x"$enableval" = xyes], |
---|
131 | [build_php=yes |
---|
132 | AC_ARG_VAR([PHPIZE], [Path to phpize]) |
---|
133 | AC_PATH_PROG([PHPIZE], [phpize])])]) |
---|
134 | AM_CONDITIONAL([BUILD_PHP], [test x"$build_php" = xyes]) |
---|
135 | |
---|
136 | dnl Whether to build the Python bindings. |
---|
137 | build_python= |
---|
138 | AC_ARG_ENABLE([python], |
---|
139 | [AC_HELP_STRING([--enable-python], [Build Python libremctl bindings])], |
---|
140 | [AS_IF([test x"$enableval" = xyes], [build_python=yes])]) |
---|
141 | AM_CONDITIONAL([BUILD_PYTHON], [test x"$build_python" = xyes]) |
---|
142 | |
---|
143 | AC_CONFIG_FILES([Makefile java/build.xml java/local.properties]) |
---|
144 | AS_IF([test x"$build_perl" = xyes], |
---|
145 | [AC_CONFIG_FILES([perl/Makefile.PL perl/Remctl.pm]) |
---|
146 | AC_CONFIG_FILES([perl/t/api.t], [chmod +x perl/t/api.t])]) |
---|
147 | AS_IF([test x"$build_php" = xyes], |
---|
148 | [AC_CONFIG_FILES([php/config.m4 php/php_remctl.h])]) |
---|
149 | AS_IF([test x"$build_python" = xyes], |
---|
150 | [AC_CONFIG_FILES([python/remctl.py python/setup.py]) |
---|
151 | AC_CONFIG_FILES([python/test_remctl.py])]) |
---|
152 | AC_CONFIG_HEADER([config.h]) |
---|
153 | AC_CONFIG_COMMANDS([docs], [test -d docs || mkdir docs]) |
---|
154 | AC_OUTPUT |
---|