-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.in
385 lines (339 loc) · 9.92 KB
/
configure.in
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# Copyright (C) 2008, Bertrand Mesot <http://www.objectif-securite.ch>
# 2008, Cedric Tissieres <http://www.objectif-securite.ch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13, USA
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.62)
AC_INIT(ophcrack, 3.6.0, http://ophcrack.sf.net)
AC_CONFIG_SRCDIR([src/table.h])
AC_CONFIG_HEADER([config.h])
AC_SUBST(MAJOR,[3])
AC_SUBST(MINOR,[6])
AC_SUBST(MAINT,[0])
m4_include([config/ax_path_qmake4.m4])
m4_include([config/ax_path_moc4.m4])
m4_include([config/check_ssl.m4])
m4_include([config/ax_count_cpus.m4])
m4_include([config/check_qwt.m4])
# Check host and system types
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[Enable debugging])],
,
[enable_debug=no])
AC_MSG_CHECKING(if debugging is enabled)
if test "x$enable_debug" = "xyes"; then
AC_MSG_RESULT(yes)
AM_CONDITIONAL(HAVE_DEBUG, true)
AC_DEFINE_UNQUOTED([DEBUG], 1, [DEBUG is enabled])
CFLAGS="-g"
CXXFLAGS="-g"
else
AC_MSG_RESULT(no)
AM_CONDITIONAL(HAVE_DEBUG, false)
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -O2 -DNDEBUG"
CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
else
CFLAGS="$CFLAGS -DNDEBUG"
CXXFLAGS="$CXXFLAGS -DNDEBUG"
fi
fi
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
#AX_COUNT_CPUS
AC_DEFINE([MY_CPU_COUNT],[1],[Number of CPUs => N+1 threads.])
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall -std=gnu9x -pedantic -I.."
CXXFLAGS="$CXXFLAGS -Wall -pedantic -fpermissive -Wno-long-long -I../.."
fi
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I.."
CXXFLAGS="$CXXFLAGS -I../.."
# Mac OS X, WIN32 and Solaris related
AC_MSG_CHECKING(for Mac OS X or WIN32 or Solaris)
case "${host_os}" in
*darwin* )
AC_MSG_RESULT(Mac OS X detected)
AM_CONDITIONAL(HAVE_OSX, true)
AM_CONDITIONAL(HAVE_WIN32, false)
CFLAGS="$CFLAGS -DOSX"
CXXFLAGS="$CXXFLAGS -DOSX"
QMAKE_ARG="-macx -spec macx-g++"
;;
*mingw* )
AC_MSG_RESULT(WIN32 detected)
enable_win32=yes
AM_CONDITIONAL(HAVE_WIN32, true)
AM_CONDITIONAL(HAVE_OSX, false)
CFLAGS="$CFLAGS -DWIN32"
CXXFLAGS="$CXXFLAGS -DWIN32"
LIBS_END="$LIBS_END -lwsock32 -lregex -lntdll -lmman"
QMAKE_ARG=""
;;
*solaris* | *sun*)
AC_MSG_RESULT(Solaris detected)
AM_CONDITIONAL(HAVE_OSX, false)
AM_CONDITIONAL(HAVE_WIN32, false)
LIBS="$LIBS -lkstat -lrt"
;;
* )
AC_MSG_RESULT(no)
AM_CONDITIONAL(HAVE_OSX, false)
AM_CONDITIONAL(HAVE_WIN32, false)
;;
esac
# Check for big or little endian
AC_C_BIGENDIAN(
[ac_c_bigendian=yes],
[ac_c_bigendian=no],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[typedef unsigned char uchar_t;
typedef unsigned short int uint16_t;]],
[[uchar_t x[2] = { 0x00, 0xff };
uint16_t y = *(uint16_t*)x;
if (y & x[1])
return 0;
else
return 1;]])],
[ac_c_bigendian=yes],
[ac_c_bigendian=no]
)]
)
if test $ac_c_bigendian = yes; then
AC_DEFINE([WORDS_BIGENDIAN], 1,
[Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first])
fi
# Checks for libraries.
with_pthread=no
AC_ARG_WITH(libpthread, AC_HELP_STRING(--with-libpthread=DIR,use libpthread in DIR),
[ AC_MSG_CHECKING(for libpthread)
case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
with_pthread=$withval
if test "x$enable_win32" = "xyes"; then
CFLAGS="$CFLAGS -I$with_pthread"
CXXFLAGS="$CXXFLAGS -I$with_pthread"
LIBS="$LIBS -L$with_pthread"
LIBS_END="$LIBS_END -lpthreadGC2"
else
CFLAGS="$CFLAGS -I$with_pthread/include"
CXXFLAGS="$CXXFLAGS -I$with_pthread/include"
LIBS="$LIBS -L$with_pthread/lib -lpthread"
fi
;;
esac ]
)
if test "x$with_pthread" = "xno"; then
AC_CHECK_LIB([pthread], [pthread_mutex_init], [], [AC_MSG_ERROR([ophcrack requires libpthread.])])
fi
AC_MSG_CHECKING(for libssl)
with_ssl=no
AC_ARG_WITH(libssl, AC_HELP_STRING(--with-libssl=DIR,use libssl in DIR),
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
with_ssl=$withval
if test "x$enable_win32" = "xyes"; then
CFLAGS="$CFLAGS -I$with_ssl/include"
CXXFLAGS="$CXXFLAGS -I$with_ssl/include"
LIBS="$LIBS -L$with_ssl/lib/MinGW"
LIBS_END="$LIBS_END -leay32"
else
CFLAGS="$CFLAGS -I$with_ssl/include"
CXXFLAGS="$CXXFLAGS -I$with_ssl/include"
LIBS="$LIBS -L$with_ssl/lib -lssl -lcrypto"
fi
;;
esac ]
)
if test "x$with_ssl" = "xno"; then
CHECK_SSL
fi
with_expat=no
AC_ARG_WITH(libexpat, AC_HELP_STRING(--with-libexpat=DIR,use libexpat in DIR),
[ AC_MSG_CHECKING(for libexpat)
case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
with_expat=$withval
if test "x$enable_win32" = "xyes"; then
CFLAGS="$CFLAGS -I$with_expat/lib"
CXXFLAGS="$CXXFLAGS -I$with_expat/lib"
LIBS="$LIBS -L$with_expat"
LIBS_END="$LIBS_END -lexpat"
else
CFLAGS="$CFLAGS -I$with_expat/include"
CXXFLAGS="$CXXFLAGS -I$with_expat/include"
LIBS="$LIBS -L$with_expat/lib -lexpat"
fi
;;
esac ]
)
if test "x$with_expat" = "xno"; then
AC_CHECK_LIB([expat], [XML_ParserCreate], [], [AC_MSG_ERROR([ophcrack requires libexpat.])])
fi
AC_CHECK_LIB([m], [sqrt], [], [AC_MSG_ERROR([ophcrack requires libmath.])])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h sys/param.h sys/time.h unistd.h sys/sysinfo.h sys/sysctl.h byteswap.h libkern/OSByteOrder.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_CHECK_TYPES([uchar_t, ulong_t])
AC_CHECK_TYPES([struct sysinfo],[], [], [[#include <sys/sysinfo.h>]])
AC_ARG_WITH(libqt4, AC_HELP_STRING(--with-libqt4=DIR,use libqt4 in DIR),
[ AC_MSG_CHECKING(for libqt4)
case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
with_qt=$withval
CXXFLAGS="$CXXFLAGS -I$with_qt/include"
LIBS="$LIBS -L$with_qt/lib"
;;
esac ]
)
AC_ARG_ENABLE(graph,
[AC_HELP_STRING([--enable-graph],
[Enables graph rendering in GUI with libqwt (enabled by default, use
--disable-graph to disable it)])],
,
[enable_graph=yes])
AC_MSG_CHECKING(if graph drawing is enabled)
if test "x$enable_graph" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AM_CONDITIONAL(HAVE_QWT, false)
AC_DEFINE_UNQUOTED([HAVE_QWT], 0, [QWT is disabled])
fi
if test "x$enable_graph" = "xyes"; then
AC_MSG_CHECKING(for libqwt)
with_qwt=no
AC_ARG_WITH(libqwt, AC_HELP_STRING(--with-libqwt=DIR,use libqwt in DIR),
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
with_qwt=$withval
if test "x$enable_win32" = "xyes"; then
CXXFLAGS="$CXXFLAGS -I$with_qwt/include"
LIBS="$LIBS -L$with_qwt/lib"
LIBS_END="$LIBS_END -lqwt5"
else
CXXFLAGS="$CXXFLAGS -I$with_qwt/include"
LIBS="$LIBS -L$with_qwt/lib -lqwt"
fi
;;
esac ]
)
if test "x$with_qwt" = "xno"; then
CHECK_QWT
else
printf "Qwt found in $with_qwt\n";
AM_CONDITIONAL(HAVE_QWT, true)
AC_DEFINE_UNQUOTED([HAVE_QWT], 1, [QWT is enabled])
fi
fi
# Sets GUI_TARGET and qt specific stuff
AC_ARG_ENABLE(gui,
[AC_HELP_STRING([--enable-gui],
[Builds gui frontend (enabled by default, use
--disable-gui to disable it)])],
,
[enable_gui=yes])
AC_MSG_CHECKING(whether we want to build ophcrack gui)
# Check QT environment if we want GUI
if test "x$enable_gui" = "xyes"; then
AC_MSG_RESULT(yes)
AX_PATH_QMAKE4
AX_PATH_MOC4
AC_DEFINE_UNQUOTED([HAVE_GUI], 1, [GUI is enabled])
AM_CONDITIONAL(HAVE_GUI, true)
else
AC_MSG_RESULT(no)
AM_CONDITIONAL(HAVE_GUI, false)
AM_CONDITIONAL(HAVE_QWT, false)
AC_DEFINE_UNQUOTED([HAVE_QWT], 0, [QWT is disabled])
enable_graph="no"
fi
# Dirty trick for win32 MinGW
LIBS="$LIBS ${LIBS_END}"
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([floor gettimeofday memchr memset munmap regcomp select sqrt strchr strdup strndup strtoul])
AC_CONFIG_FILES([Makefile
src/Makefile
src/test/Makefile
src/gui/qmake.sh
src/gui/gui.pro
src/gui/ophcrack_win32.rc
src/gui/Info.plist
src/ntproba/Makefile
src/samdump2/Makefile])
AC_OUTPUT
if test "x$enable_gui" = "xyes"; then
AC_MSG_NOTICE(Generating GUI Makefile with qmake)
cd ./src/gui
chmod +x qmake.sh
./qmake.sh $QMAKE_ARG gui.pro 2>&1
cd ../..
fi
echo
echo "===================================================="
echo "ophcrack has been successfully configured as follow"
echo "===================================================="
echo
echo " Install directory: "${prefix}
echo
echo " GUI: "${enable_gui}
echo " Graph display: "${enable_graph}
echo " Debugging: "${enable_debug}
echo
echo "===================================================="
echo
echo "Now enter 'make' to compile"
echo "followed by 'make install' to install"
echo