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