source: configure.ac @ 8505b8f

release-1.9
Last change on this file since 8505b8f was 8505b8f, checked in by Anders Kaseorg <andersk@mit.edu>, 10 years ago
BarnOwl 1.9 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Property mode set to 100644
File size: 6.8 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([BarnOwl],[1.9],[bug-barnowl@mit.edu])
3AM_INIT_AUTOMAKE([1.7.0 -Wall -Wno-portability foreign])
4m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
5
6AC_CONFIG_MACRO_DIR([m4])
7AC_CONFIG_HEADER([config.h])
8
9AC_PROG_CC
10AC_PROG_CC_C99
11
12AC_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'])
23AC_DEFINE_UNQUOTED(
24    [ZEPHYR_DEFAULT_FORMAT], ["$zephyr_default_format"],
25    [Value for the default format zephyrgram field]
26)
27
28AC_ARG_WITH([stack-protector],
29  [AS_HELP_STRING([--with-stack-protector],
30    [Enable gcc -fstack-protector])],
31  [],
32  [with_stack_protector=check])
33
34AS_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
42AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No libncursesw found.))
43AC_CHECK_LIB(panelw, update_panels,, AC_MSG_ERROR(No libpanelw found.))
44AC_SEARCH_LIBS([gethostbyname], [nsl])
45AC_SEARCH_LIBS([socket], [socket])
46AC_SEARCH_LIBS([res_search], [resolv])
47
48AC_ARG_WITH([zephyr],
49  [AS_HELP_STRING([--with-zephyr],
50    [Enable Zephyr support])],
51  [],
52  [with_zephyr=check])
53
54AC_ARG_WITH([krb4],
55  AS_HELP_STRING([--with-krb4],
56                 [Build with kerberos IV]))
57
58AS_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
100AC_CHECK_FUNCS([use_default_colors])
101AC_CHECK_FUNCS([resizeterm], [], [AC_MSG_ERROR([No resizeterm found])])
102AC_CHECK_FUNCS([des_string_to_key DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1])
103AC_CHECK_FUNCS([des_ecb_encrypt DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1])
104AC_CHECK_FUNCS([des_key_sched DES_key_sched], [HAVE_DES_KEY_SCHED=1])
105
106dnl Checks for header files.
107AC_HEADER_STDC
108AC_HEADER_SYS_WAIT
109AC_CHECK_HEADERS(stdbool.h strings.h sys/ioctl.h sys/filio.h unistd.h)
110
111dnl Add CFLAGS for embeded perl
112PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
113AC_MSG_NOTICE([Adding perl CFLAGS ${PERL_CFLAGS}])
114AM_CFLAGS="${AM_CFLAGS} ${PERL_CFLAGS}"
115
116dnl Find the location of perl XSUBPP
117AC_MSG_CHECKING(for the perl xsubpp precompiler)
118XSUBPPDIR="`(perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;') | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`"
119if test -n "${XSUBPPDIR}"; then
120   AC_MSG_RESULT(${XSUBPPDIR})
121else
122   AC_MSG_ERROR(not found)
123fi
124
125if test -f "${XSUBPPDIR}/typemap"; then
126   XSUBPPFLAGS="-typemap ${XSUBPPDIR}/typemap"
127else
128   XSUBPPFLAGS=""
129fi
130
131dnl Add LIBS for embedded perl
132FOO=`perl -MExtUtils::Embed -e ldopts`
133AC_MSG_NOTICE([Adding perl LIBS ${FOO}])
134LIBS=${LIBS}\ ${FOO}
135AC_CHECK_LIB([perl], [perl_alloc],, AC_MSG_ERROR([No libperl found]))
136
137AX_PROG_PERL_MODULES([AnyEvent],,
138                     [AC_MSG_ERROR([cannot find perl module AnyEvent.])])
139AX_PROG_PERL_MODULES([Class::Accessor::Fast],,
140                     [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])])
141AX_PROG_PERL_MODULES([Glib],,
142                     [AC_MSG_ERROR([cannot find perl module Glib.])])
143AX_PROG_PERL_MODULES([PAR],,
144                     [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])])
145
146dnl Add CFLAGS and LIBS for glib-2.0
147PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.16 gobject-2.0 gthread-2.0])
148
149AC_MSG_NOTICE([Adding glib-2.0 CFLAGS ${GLIB_CFLAGS}])
150AM_CFLAGS="${GLIB_CFLAGS} ${AM_CFLAGS}"
151AC_MSG_NOTICE([Adding glib-2.0 LIBS ${GLIB_LIBS}])
152LIBS="${GLIB_LIBS} ${LIBS}"
153
154if test "x${prefix}" = "xNONE"; then
155   prefix="${ac_default_prefix}"
156fi
157
158dnl Checks for typedefs, structures, and compiler characteristics.
159
160AX_CFLAGS_WARN_ALL([AM_CFLAGS])
161AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes -Wwrite-strings],[AM_CFLAGS])
162
163dnl Shut gcc up about zero-length format strings; the warning's apparently for
164dnl efficiency reasons, which is bogus for custom functions.
165AX_APPEND_COMPILE_FLAGS([-Wno-format-zero-length],[AM_CFLAGS])
166
167AX_APPEND_COMPILE_FLAGS([-Wno-pointer-sign -Wno-empty-body -Wno-unused-value],[LIBFAIM_CFLAGS])
168
169AM_CONDITIONAL([ENABLE_ZCRYPT], [test "$HAVE_DES_STRING_TO_KEY" && dnl
170                                 test "$HAVE_DES_KEY_SCHED" && dnl
171                                 test "$HAVE_DES_ECB_ENCRYPT"])
172
173AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600"
174dnl Define _BSD_SOURCE because zephyr needs caddr_t.
175AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE"
176dnl Define __EXTENSIONS__ for strcasecmp on Solaris.
177AM_CFLAGS="$AM_CFLAGS -D__EXTENSIONS__"
178dnl Define _XOPEN_SOURCE_EXTENDED for some features in ncurses,
179dnl including cchar_t.  This should not be necessary with
180dnl _XOPEN_SOURCE=600, but some versions of ncurses
181dnl apparently still need it.
182AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE_EXTENDED"
183
184AC_SUBST([AM_CFLAGS])
185AC_SUBST([LIBFAIM_CFLAGS])
186
187AC_SUBST(XSUBPPDIR)
188AC_SUBST(XSUBPPFLAGS)
189
190AC_PROG_INSTALL
191AC_PROG_RANLIB
192AC_CHECK_PROG([HAVE_ZIP], [zip], [yes], [no])
193if test "x${HAVE_ZIP}" = "xno"; then
194   AC_MSG_ERROR([cannot find a 'zip' binary.])
195fi
196
197AC_CONFIG_LIBOBJ_DIR([compat])
198AC_CHECK_DECLS([memrchr])
199AC_REPLACE_FUNCS([memrchr])
200
201AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile])
202AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.