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