1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | AC_INIT([BarnOwl],[1.9],[bug-barnowl@mit.edu]) |
---|
3 | AM_INIT_AUTOMAKE([1.7.0 -Wall -Wno-portability foreign]) |
---|
4 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
---|
5 | |
---|
6 | AC_CONFIG_MACRO_DIR([m4]) |
---|
7 | AC_CONFIG_HEADER([config.h]) |
---|
8 | |
---|
9 | AC_PROG_CC |
---|
10 | AC_PROG_CC_C99 |
---|
11 | |
---|
12 | AC_ARG_WITH([zephyr-default-format], |
---|
13 | [AS_HELP_STRING([--with-zephyr-default-format], |
---|
14 | [value for the default format zephyrgram field])], |
---|
15 | [ |
---|
16 | case $withval in |
---|
17 | yes) withval='Config error: see http://mit.edu/df';; |
---|
18 | no) withval='';; |
---|
19 | esac |
---|
20 | zephyr_default_format=$withval |
---|
21 | ], |
---|
22 | [zephyr_default_format='Config error: see http://mit.edu/df']) |
---|
23 | AC_DEFINE_UNQUOTED( |
---|
24 | [ZEPHYR_DEFAULT_FORMAT], ["$zephyr_default_format"], |
---|
25 | [Value for the default format zephyrgram field] |
---|
26 | ) |
---|
27 | |
---|
28 | AC_ARG_WITH([stack-protector], |
---|
29 | [AS_HELP_STRING([--with-stack-protector], |
---|
30 | [Enable gcc -fstack-protector])], |
---|
31 | [], |
---|
32 | [with_stack_protector=check]) |
---|
33 | |
---|
34 | AS_IF([test "x$with_stack_protector" != xno], |
---|
35 | [AX_CHECK_COMPILE_FLAG([-fstack-protector], |
---|
36 | [AM_CFLAGS="$AM_CFLAGS -fstack-protector"], |
---|
37 | [if test "x$with_stack_protector" != xcheck; then |
---|
38 | AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.]) |
---|
39 | fi |
---|
40 | ])]) |
---|
41 | |
---|
42 | AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No libncursesw found.)) |
---|
43 | AC_CHECK_LIB(panelw, update_panels,, AC_MSG_ERROR(No libpanelw found.)) |
---|
44 | AC_SEARCH_LIBS([gethostbyname], [nsl]) |
---|
45 | AC_SEARCH_LIBS([socket], [socket]) |
---|
46 | AC_SEARCH_LIBS([res_search], [resolv]) |
---|
47 | |
---|
48 | AC_ARG_WITH([zephyr], |
---|
49 | [AS_HELP_STRING([--with-zephyr], |
---|
50 | [Enable Zephyr support])], |
---|
51 | [], |
---|
52 | [with_zephyr=check]) |
---|
53 | |
---|
54 | AC_ARG_WITH([krb4], |
---|
55 | AS_HELP_STRING([--with-krb4], |
---|
56 | [Build with kerberos IV])) |
---|
57 | |
---|
58 | AS_IF([test "x$with_zephyr" != xno], |
---|
59 | [have_krb4=no |
---|
60 | |
---|
61 | AS_IF([test "x$with_krb4" != "xno"], |
---|
62 | [AC_MSG_CHECKING([for Kerberos IV]) |
---|
63 | AS_IF([krb5-config krb4 --libs >/dev/null 2>&1], |
---|
64 | [AC_MSG_RESULT([yes]) |
---|
65 | have_krb4=yes |
---|
66 | AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV]) |
---|
67 | AM_CFLAGS="${AM_CFLAGS} `krb5-config krb4 --cflags`" |
---|
68 | LIBS="${LIBS} `krb5-config krb4 --libs`" |
---|
69 | ], |
---|
70 | [AC_MSG_RESULT([no]) |
---|
71 | AS_IF([test "x$with_krb4" = "xyes"], |
---|
72 | [AC_MSG_ERROR([Kerberos IV requested but not found])])])]) |
---|
73 | |
---|
74 | AS_IF([test "x$have_krb4" != xyes], |
---|
75 | [PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], |
---|
76 | [AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}" |
---|
77 | LIBS="${LIBS} ${LIBCRYPTO_LIBS}" |
---|
78 | ], |
---|
79 | [PKG_CHECK_MODULES([OPENSSL], [openssl], |
---|
80 | [AM_CFLAGS="${AM_CFLAGS} ${OPENSSL_CFLAGS}" |
---|
81 | LIBS="${LIBS} ${OPENSSL_LIBS}" |
---|
82 | ])])]) |
---|
83 | |
---|
84 | AC_CHECK_LIB([zephyr], [ZGetSender], |
---|
85 | [LIBS="$LIBS -lzephyr" |
---|
86 | AC_DEFINE([HAVE_LIBZEPHYR], [1], |
---|
87 | [Define if you have libzephyr]) |
---|
88 | AC_CHECK_LIB([zephyr], [ZInitLocationInfo], |
---|
89 | AC_DEFINE([HAVE_LIBZEPHYR_ZINITLOCATIONINFO], [1], |
---|
90 | [Have ZInitLocationInfo]),) |
---|
91 | AC_CHECK_LIB([com_err], [com_err]) |
---|
92 | AC_CHECK_HEADERS([com_err.h]) |
---|
93 | ], |
---|
94 | [if test "x$with_zephyr" != xcheck; then |
---|
95 | AC_MSG_FAILURE( |
---|
96 | [--with-zephyr was given, but libzephyr does not seem to be available.]) |
---|
97 | fi |
---|
98 | ])]) |
---|
99 | |
---|
100 | AC_CHECK_FUNCS([use_default_colors]) |
---|
101 | AC_CHECK_FUNCS([resizeterm], [], [AC_MSG_ERROR([No resizeterm found])]) |
---|
102 | AC_CHECK_FUNCS([des_string_to_key DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1]) |
---|
103 | AC_CHECK_FUNCS([des_ecb_encrypt DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1]) |
---|
104 | AC_CHECK_FUNCS([des_key_sched DES_key_sched], [HAVE_DES_KEY_SCHED=1]) |
---|
105 | |
---|
106 | dnl Checks for header files. |
---|
107 | AC_HEADER_STDC |
---|
108 | AC_HEADER_SYS_WAIT |
---|
109 | AC_CHECK_HEADERS(stdbool.h strings.h sys/ioctl.h sys/filio.h unistd.h) |
---|
110 | |
---|
111 | dnl Add CFLAGS for embeded perl |
---|
112 | PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts` |
---|
113 | AC_MSG_NOTICE([Adding perl CFLAGS ${PERL_CFLAGS}]) |
---|
114 | AM_CFLAGS="${AM_CFLAGS} ${PERL_CFLAGS}" |
---|
115 | |
---|
116 | dnl Find the location of perl XSUBPP |
---|
117 | AC_MSG_CHECKING(for the perl xsubpp precompiler) |
---|
118 | XSUBPPDIR="`(perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;') | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`" |
---|
119 | if test -n "${XSUBPPDIR}"; then |
---|
120 | AC_MSG_RESULT(${XSUBPPDIR}) |
---|
121 | else |
---|
122 | AC_MSG_ERROR(not found) |
---|
123 | fi |
---|
124 | |
---|
125 | if test -f "${XSUBPPDIR}/typemap"; then |
---|
126 | XSUBPPFLAGS="-typemap ${XSUBPPDIR}/typemap" |
---|
127 | else |
---|
128 | XSUBPPFLAGS="" |
---|
129 | fi |
---|
130 | |
---|
131 | dnl Add LIBS for embedded perl |
---|
132 | FOO=`perl -MExtUtils::Embed -e ldopts` |
---|
133 | AC_MSG_NOTICE([Adding perl LIBS ${FOO}]) |
---|
134 | LIBS=${LIBS}\ ${FOO} |
---|
135 | AC_CHECK_LIB([perl], [perl_alloc],, AC_MSG_ERROR([No libperl found])) |
---|
136 | |
---|
137 | AX_PROG_PERL_MODULES([AnyEvent],, |
---|
138 | [AC_MSG_ERROR([cannot find perl module AnyEvent.])]) |
---|
139 | AX_PROG_PERL_MODULES([Class::Accessor::Fast],, |
---|
140 | [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])]) |
---|
141 | AX_PROG_PERL_MODULES([Glib],, |
---|
142 | [AC_MSG_ERROR([cannot find perl module Glib.])]) |
---|
143 | AX_PROG_PERL_MODULES([PAR],, |
---|
144 | [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])]) |
---|
145 | |
---|
146 | dnl Add CFLAGS and LIBS for glib-2.0 |
---|
147 | PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.16 gobject-2.0 gthread-2.0]) |
---|
148 | |
---|
149 | AC_MSG_NOTICE([Adding glib-2.0 CFLAGS ${GLIB_CFLAGS}]) |
---|
150 | AM_CFLAGS="${GLIB_CFLAGS} ${AM_CFLAGS}" |
---|
151 | AC_MSG_NOTICE([Adding glib-2.0 LIBS ${GLIB_LIBS}]) |
---|
152 | LIBS="${GLIB_LIBS} ${LIBS}" |
---|
153 | |
---|
154 | if test "x${prefix}" = "xNONE"; then |
---|
155 | prefix="${ac_default_prefix}" |
---|
156 | fi |
---|
157 | |
---|
158 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
159 | |
---|
160 | AX_CFLAGS_WARN_ALL([AM_CFLAGS]) |
---|
161 | AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes -Wwrite-strings],[AM_CFLAGS]) |
---|
162 | |
---|
163 | dnl Shut gcc up about zero-length format strings; the warning's apparently for |
---|
164 | dnl efficiency reasons, which is bogus for custom functions. |
---|
165 | AX_APPEND_COMPILE_FLAGS([-Wno-format-zero-length],[AM_CFLAGS]) |
---|
166 | |
---|
167 | AX_APPEND_COMPILE_FLAGS([-Wno-pointer-sign -Wno-empty-body -Wno-unused-value],[LIBFAIM_CFLAGS]) |
---|
168 | |
---|
169 | AM_CONDITIONAL([ENABLE_ZCRYPT], [test "$HAVE_DES_STRING_TO_KEY" && dnl |
---|
170 | test "$HAVE_DES_KEY_SCHED" && dnl |
---|
171 | test "$HAVE_DES_ECB_ENCRYPT"]) |
---|
172 | |
---|
173 | AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600" |
---|
174 | dnl Define _BSD_SOURCE because zephyr needs caddr_t. |
---|
175 | AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE" |
---|
176 | dnl Define __EXTENSIONS__ for strcasecmp on Solaris. |
---|
177 | AM_CFLAGS="$AM_CFLAGS -D__EXTENSIONS__" |
---|
178 | dnl Define _XOPEN_SOURCE_EXTENDED for some features in ncurses, |
---|
179 | dnl including cchar_t. This should not be necessary with |
---|
180 | dnl _XOPEN_SOURCE=600, but some versions of ncurses |
---|
181 | dnl apparently still need it. |
---|
182 | AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
---|
183 | |
---|
184 | AC_SUBST([AM_CFLAGS]) |
---|
185 | AC_SUBST([LIBFAIM_CFLAGS]) |
---|
186 | |
---|
187 | AC_SUBST(XSUBPPDIR) |
---|
188 | AC_SUBST(XSUBPPFLAGS) |
---|
189 | |
---|
190 | AC_PROG_INSTALL |
---|
191 | AC_PROG_RANLIB |
---|
192 | AC_CHECK_PROG([HAVE_ZIP], [zip], [yes], [no]) |
---|
193 | if test "x${HAVE_ZIP}" = "xno"; then |
---|
194 | AC_MSG_ERROR([cannot find a 'zip' binary.]) |
---|
195 | fi |
---|
196 | |
---|
197 | AC_CONFIG_LIBOBJ_DIR([compat]) |
---|
198 | AC_CHECK_DECLS([memrchr]) |
---|
199 | AC_REPLACE_FUNCS([memrchr]) |
---|
200 | |
---|
201 | AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile]) |
---|
202 | AC_OUTPUT |
---|