source: configure.ac @ 1c22155

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