source: configure.ac @ 736835d

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