File: configure.ac

package info (click to toggle)
yapet 0.6-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 6,012 kB
  • ctags: 2,913
  • sloc: ansic: 13,661; cpp: 11,384; sh: 4,814; makefile: 847; yacc: 291; sed: 16
file content (259 lines) | stat: -rw-r--r-- 9,459 bytes parent folder | download
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# $Id: configure.ac 2896 2009-09-03 19:21:26Z rafi $
AC_PREREQ(2.61)
AC_INIT([YAPET],[0.6],[rafi@guengel.ch])
AM_INIT_AUTOMAKE([silent-rules check-news dist-bzip2 color-tests std-options])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])


AC_ARG_VAR([AR], [ar command])
AC_ARG_VAR([DOXYGEN],[doxygen command])
AC_ARG_VAR([LYNX], [lynx command])
AC_ARG_VAR([W3M], [w3m command])
AC_ARG_VAR([XSLTPROC], [xsltproc command])

# Progs
AC_MSG_NOTICE([Checking required programs])
AC_PROG_CC([cc gcc])
AC_PROG_CXX([CC c++ g++])
AC_PROG_INSTALL
AC_PROG_SED
AC_PROG_RANLIB
AC_CHECK_PROGS([AR], [ar gar], [AC_MSG_ERROR([Unable to find ar. You may set the AR environment variable to the file path of ar.])])
AC_PROG_MKDIR_P
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen], [no])
AC_CHECK_PROG([XSLTPROC], [xsltproc], [xsltproc], [no])
AC_CHECK_PROG([LYNX], [lynx], [lynx], [no])
AC_CHECK_PROG([W3M], [w3m], [w3m], [no])
AC_USE_SYSTEM_EXTENSIONS
AC_LANG([C++])

# Arguments
AC_ARG_WITH([curses-include],
	[AS_HELP_STRING([--with-curses-include],[directory for (n)curses header files])],
	[CPPFLAGS="-I$withval $CPPFLAGS"],
	[])
AC_ARG_WITH([curses-lib],
	[AS_HELP_STRING([--with-curses-lib],[directory for (n)curses libraries])],
	[LDFLAGS="-L$withval $LDFLAGS"],
	[])
AC_ARG_WITH([openssl-include],
	[AS_HELP_STRING([--with-openssl-include],[directory for openssl header files])],
	[CPPFLAGS="-I$withval $CPPFLAGS"],
	[])
AC_ARG_WITH([openssl-lib],
	[AS_HELP_STRING([--with-openssl-lib],[directory for openssl libraries])],
	[LDFLAGS="-L$withval $LDFLAGS"],
	[])
AC_SUBST([DOCBOOKXSL],[http://docbook.sourceforge.net/release/xsl/current])
AC_ARG_WITH([docbook-xsl],
	[AS_HELP_STRING([--with-docbook-xsl],[directory where to find the Docbook XSL])],
	[AC_SUBST([DOCBOOKXSL],[$withval])])

# "Enables"
AC_ARG_ENABLE([assert],
	[AS_HELP_STRING([--enable-assert],[enable assert statements for debugging purposes (Default: no)])],
	[my_assert=$enableval],
	[my_assert=no])
AC_ARG_ENABLE([build-doc],
	[AS_HELP_STRING([--enable-build-doc],[enable rebuild of documentation (Requires xsltproc, lynx; Default: no)])],
	[my_builddoc=$enableval],
	[my_builddoc=no])
AC_ARG_ENABLE([install-doc],
	[AS_HELP_STRING([--disable-install-doc],[disable installation of documentation (man pages, text and html files; Default: no)])],
	[if test x$enableval = xno ; then
	my_disableinstalldoc=yes
	else
	my_disableinstalldoc=no
	fi],
	[my_disableinstalldoc=no])
AC_ARG_ENABLE([source-doc],
	[AS_HELP_STRING([--enable-source-doc],[enable build of source code documentention (Requires doxygen; default: no)])],
	[my_buildsourcedoc=$enableval],
	[my_buildsourcedoc=no])
AC_ARG_ENABLE([terminal-title],
	[AS_HELP_STRING([--enable-terminal-title],[set the terminal title (Default: yes)])],
	[my_settitle=$enableval],
	[my_settitle=yes])
AC_ARG_ENABLE([csv2yapet],
	[AS_HELP_STRING([--disable-csv2yapet],[CSV file import utility will not be built (Default: no)])],
	[my_buildcsv2yapet=$enableval],
	[my_buildcsv2yapet=yes])
AC_ARG_ENABLE([pwgen],
	[AS_HELP_STRING([--disable-pwgen],[disable built-in password generator (Default: no)])],
	[my_enablepwgen=$enableval],
	[my_enablepwgen=yes])

if test x$my_settitle = xyes ; then
   AC_DEFINE([HAVE_TERMINALTITLE],[1], [Define if you want YAPET to set the terminal title])
fi

if test x$my_enablepwgen = xyes ; then
   AC_DEFINE([ENABLE_PWGEN],[1], [Define if you want to build support for the password generator])
fi

if ( test x$LYNX = xno && test x$W3M = xno ) || test x$XSLTPROC = xno ; then
   my_builddoc=no
fi

if test x$DOXYGEN = xno ; then
   my_buildsourcedoc=no
fi

# Libs
AC_MSG_NOTICE([Searching for required libraries])
AC_SEARCH_LIBS([initscr],[ncurses curses],[],AC_MSG_ERROR([curses not found]))
AC_SEARCH_LIBS([EVP_DigestInit_ex],[crypto],[],AC_MSG_ERROR([libcrypto not found]))

# Headers
AC_MSG_NOTICE([Checking C headers])
AC_CHECK_HEADERS([assert.h ctype.h dirent.h errno.h fcntl.h getopt.h limits.h locale.h pwd.h signal.h stdio.h string.h strings.h sys/param.h sys/resource.h termios.h unistd.h])

AC_CHECK_HEADER([ncurses.h],
	[AC_DEFINE([HAVE_NCURSES_H],[1],[Set to 1 if you have ncurses.h]) my_usencurses=yes],
	[AC_CHECK_HEADER([curses.h],
		[AC_DEFINE([HAVE_CURSES_H],[1],[Set to 1 if you have curses.h]) my_usencurses=no],
		[AC_MSG_ERROR([curses header not found])])]
)
AC_CHECK_HEADER([openssl/crypto.h], [AC_DEFINE([HAVE_CRYPTO_H],[1],[Set to 1 if you have openssl/crypto.h])])
AC_CHECK_HEADER([openssl/evp.h], [], AC_MSG_ERROR([OpenSSL evp header not found]))

AC_MSG_NOTICE([Checking C++ headers])
AC_CHECK_HEADERS([algorithm cmath exception fstream functional iostream iterator list memory sstream stdexcept string vector],
		       [],
		       [AC_MSG_ERROR([your system is missing a required C++ header file])])

# Types
AC_MSG_NOTICE([Checking types])
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T

# library functions
AC_MSG_NOTICE([Checking functions])
AC_FUNC_ALLOCA
AC_CHECK_FUNCS([access asctime fchmod fchown fflush floor fprintf fstat getcwd getenv getopt getopt_long getpwuid getuid isblank isdigit isspace localtime log10 lrand48 memset pathconf pow rand rename setrlimit sigaction srand srand48 strcasestr strchr strcmp strerror strlen strncasecmp strncmp strncpy strstr strtol tcgetattr tcsetattr time tolower])

AC_MSG_NOTICE([Checking (n)curses functions])
AC_CHECK_FUNCS([wresize mvwchgat termname])

# Some custom tests
AC_MSG_CHECKING([whether waddstr() use const char*])
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[
	#ifdef HAVE_NCURSES_H
	#include <ncurses.h>
	#else
	#include <curses.h>
	#endif
	const char teststr[] = "Const string";]],
				  [[initscr(); waddstr(stdscr, teststr); endwin();]])],
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no])
	AC_DEFINE([WADDSTR_USE_CHAR],[1],[Set to 1 if waddstr() doesn't use const char*])])

AC_MSG_CHECKING([whether mvwaddstr() use const char*])
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[
	#ifdef HAVE_NCURSES_H
	#include <ncurses.h>
	#else
	#include <curses.h>
	#endif
	const char teststr[] = "Const string";]],
				  [[initscr(); mvwaddstr(stdscr, 2, 1, teststr); endwin();]])],
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no])
	AC_DEFINE([MVWADDSTR_USE_CHAR],[1],[Set to 1 if mvwaddstr() doesn't use const char*])])

AC_MSG_CHECKING([whether mvwaddnstr() use const char*])
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[
	#ifdef HAVE_NCURSES_H
	#include <ncurses.h>
	#else
	#include <curses.h>
	#endif
	const char teststr[] = "Const string";]],
				  [[initscr(); mvwaddnstr(stdscr, 2, 1, teststr, 4); endwin();]])],
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no])
	AC_DEFINE([MVWADDNSTR_USE_CHAR],[1],[Set to 1 if mvwaddnstr() doesn't use const char*])])

AC_MSG_NOTICE([Checking encryption functions])
AC_CHECK_FUNCS([EVP_bf_cbc EVP_CIPHER_CTX_cleanup EVP_CIPHER_CTX_init EVP_CIPHER_CTX_set_key_length EVP_CipherInit_ex EVP_DigestFinal_ex EVP_DigestInit_ex EVP_DigestUpdate EVP_MD_CTX_cleanup EVP_MD_CTX_init EVP_md5 EVP_ripemd160 EVP_sha1],
	[],
	[AC_MSG_ERROR([You are missing a crucial function required for $PACKAGE_NAME])])
AC_MSG_NOTICE([Checking support functions])
AC_CHECK_FUNCS([SSLeay_version])

AC_MSG_NOTICE([Checking miscellaneous properties of platform])
AC_CHECK_SIZEOF([int *])
AC_C_BIGENDIAN
# Mainly used by the RNG test in tests/rng*
AC_CHECK_FILES([/dev/urandom /dev/random])

AC_MSG_NOTICE([Preparing NLS])
AM_GNU_GETTEXT

# Some conditionals for the makefileS
AM_CONDITIONAL([BUILDDOC], [test x$my_builddoc = xyes])
AM_CONDITIONAL([BUILDSOURCEDOC], [test x$my_buildsourcedoc = xyes])
AM_CONDITIONAL([HAVEDOXYGEN], [test x$DOXYGEN != xno])
AM_CONDITIONAL([HAVEXSLTPROC], [test x$XSLTPROC != xno && ( test x$LYNX != xno || test x$W3M != xno ) ])
AM_CONDITIONAL([HAVEW3M], [ test x$W3M != xno ])
AM_CONDITIONAL([USE_NLS], [test x$USE_NLS = xyes])
AM_CONDITIONAL([USE_INCLUDED_LIBINTL], [test x$USE_INCLUDED_LIBINTL = xyes])
AM_CONDITIONAL([BUILDCSV2YAPET], [test x$my_buildcsv2yapet = xyes])
AM_CONDITIONAL([BUILDPWGEN], [test x$my_enablepwgen = xyes])
AM_CONDITIONAL([DISABLEINSTALLDOC], [test x$my_disableinstalldoc = xyes])
AM_CONDITIONAL([DISABLE_ASSERT], [test x$my_assert = xno])
AC_CONFIG_FILES([Makefile
	intl/Makefile
	po/Makefile.in
	crypt/Makefile
	ui/Makefile
	yapet/Makefile
	yapet/pwgen/Makefile
	csv2yapet/Makefile
	tests/Makefile
	tests/testpaths.h
	doc/Makefile])
AC_OUTPUT

echo "******************************************************************"
echo ""
echo "Prefix              : $prefix"
echo "CPPFLAGS            : $CPPFLAGS"
echo "CFLAGS              : $CFLAGS"
echo "CXXFLAGS            : $CXXFLAGS"
echo "LDFLAGS             : $LDFLAGS"
echo "Use ncurses.h       : $my_usencurses"
echo ""
echo "Doxygen             : $DOXYGEN"
echo "xsltproc            : $XSLTPROC"
echo "Lynx                : $LYNX"
echo "w3m                 : $W3M"
echo "Docbook XSL         : $DOCBOOKXSL"
echo ""
echo "Enable assert       : $my_assert"
echo "Build Documentation : $my_builddoc"
echo "Disable install Doc.: $my_disableinstalldoc"
echo "Build Source Doc.   : $my_buildsourcedoc"
echo "Set Terminal Title  : $my_settitle"
echo "Build csv2yapet     : $my_buildcsv2yapet"
echo "Build with pwgen    : $my_enablepwgen"
echo ""
echo "Use NLS             : $USE_NLS"
echo "Use included libintl: $USE_INCLUDED_LIBINTL"
echo ""
echo "******************************************************************"
echo ""
echo "Looks good."
echo ""