summaryrefslogtreecommitdiff
path: root/src/configure.ac
blob: 8ef09d9420a0c6ac503a4926fef8406651fd364d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
dnl Process this file with autoconf to produce a configure script.
AC_INIT([cracklib], [2.9.11], [cracklib-devel@lists.sourceforge.net])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

dnl Set of available languages.
ALL_LINGUAS="as be bn_IN ca cs da de el es eu fi fr gu he hi hu id it ja kk kn ko lt ml mr nb nl or pa pl pt pt_BR ru sk sl sq sv ta te tr uk zh_CN zh_TW"

dnl Checks for programs.
LT_INIT
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(inttypes.h)
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(pthread.h)

AC_ARG_WITH([zlib],
   [AS_HELP_STRING([--without-zlib], [build without zlib support @<:@default=auto@:>@])])
AS_IF([test "$with_zlib" != "no"], [dnl
   found_zlib=yes
   AC_CHECK_HEADERS([zlib.h],
      [AC_DEFINE(HAVE_ZLIB_H, [], [found zlib])],
      [found_zlib=no])
   AC_SEARCH_LIBS([gzopen], [z], [], [found_zlib=no])
   AS_IF([test "$with_zlib$found_zlib" = "yesno"],
      [AC_MSG_ERROR([zlib not found])])
])

dnl Cygwin workaround
AC_MSG_CHECKING(if LINE_MAX is defined)
AC_EGREP_CPP(yes,
[#include <limits.h>
#ifdef LINE_MAX
yes
#endif
], line_max_defined=yes, line_max_defined=no)
AC_MSG_RESULT($line_max_defined)

if test "$line_max_defined" = "no"; then
   CFLAGS="$CFLAGS -DLINE_MAX=2048"
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Check for utility functions that may need to be replaced
AC_CHECK_FUNCS(strdup)
AC_CHECK_FUNCS(getpwuid_r)

dnl internationalization macros
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])

dnl Control default dictname
AC_MSG_CHECKING(default dict filename)
AC_ARG_WITH(default-dict,
AS_HELP_STRING([--with-default-dict],[Specify default dict filename]),
default_cracklib_dict=$withval,
default_cracklib_dict='$(pkgdatadir)/pw_dict')
AC_SUBST(DEFAULT_CRACKLIB_DICT, $default_cracklib_dict)
AC_MSG_RESULT($default_cracklib_dict)

dnl Check for python, unless we were told to not try to build a python module
AC_ARG_WITH(python,
AS_HELP_STRING([--without-python],[Build a python module @<:@default=auto@:>@]),
build_python=$withval,build_python=auto)
if test "$build_python" != no ; then
   AM_PATH_PYTHON(,,
                  [if test "$build_python" != yes ; then
                      AC_MSG_WARN([python was not found, continuing])
                      build_python=no
                   else
                      AC_MSG_ERROR([python was required but not found])
                   fi])
   if test "$build_python" != no ; then
      AC_CHECK_HEADERS(python${PYTHON_VERSION}/Python.h,,
		       [if test "$build_python" != yes ; then
		           AC_MSG_WARN([python headers not found, continuing])
			   build_python=no
			else
		           AC_MSG_ERROR([python headers not found])
			fi])
   fi
   if test "$build_python" != no ; then
      build_python=yes
   fi
fi
AM_CONDITIONAL(BUILD_PYTHON,[test "$build_python" = "yes"])

dnl Handle local dict compiling properly
AC_SUBST(CROSS_COMPILING, $cross_compiling)

AC_CONFIG_FILES([util/Makefile lib/Makefile doc/Makefile python/Makefile Makefile \
		python/setup.py \
		po/Makefile.in m4/Makefile dicts/Makefile cracklib.spec])
AC_OUTPUT