source: configure.ac @ 52bee9c

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