Debian Codegraph @

configure.in

raw
1 # Copyright (C) 2008, Bertrand Mesot <http://www.objectif-securite.ch>
2 # 2008, Cedric Tissieres <http://www.objectif-securite.ch>
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13, USA
17
18
19 # -*- Autoconf -*-
20 # Process this file with autoconf to produce a configure script.
21
22 AC_PREREQ(2.62)
23 AC_INIT(ophcrack, 3.8.0, http://ophcrack.sf.net)
24 AC_CONFIG_SRCDIR([src])
25 AC_CONFIG_HEADER([config.h])
26
27 AC_SUBST(MAJOR,[3])
28 AC_SUBST(MINOR,[8])
29 AC_SUBST(MAINT,[0])
30
31 m4_include([config/ax_path_qmake5.m4])
32 m4_include([config/check_qtcharts.m4])
33 m4_include([config/check_ssl.m4])
34
35 # Check host and system types
36 AC_CANONICAL_HOST
37
38 # Checks for programs.
39 AC_PROG_CXX
40 AC_PROG_CC
41
42 AC_ARG_ENABLE(debug,
43 [AS_HELP_STRING([--enable-debug],
44 [Enable debugging])],
45 ,
46 [enable_debug=no])
47
48 AC_MSG_CHECKING(if debugging is enabled)
49 if test "x$enable_debug" = "xyes"; then
50 AC_MSG_RESULT(yes)
51 AM_CONDITIONAL(HAVE_DEBUG, true)
52 AC_DEFINE_UNQUOTED([DEBUG], 1, [DEBUG is enabled])
53 CFLAGS="-g"
54 CXXFLAGS="-g"
55 else
56 AC_MSG_RESULT(no)
57 AM_CONDITIONAL(HAVE_DEBUG, false)
58 if test "$GCC" = "yes"; then
59 CFLAGS="$CFLAGS -DNDEBUG"
60 CXXFLAGS="$CXXFLAGS -DNDEBUG"
61 else
62 CFLAGS="$CFLAGS -DNDEBUG"
63 CXXFLAGS="$CXXFLAGS -DNDEBUG"
64 fi
65
66 fi
67
68 AC_PROG_INSTALL
69 AC_PROG_LN_S
70 AC_PROG_MAKE_SET
71 AC_PROG_RANLIB
72
73 if test "$GCC" = "yes"; then
74 CFLAGS="$CFLAGS -Wall -std=gnu9x -pedantic -I.."
75 CXXFLAGS="$CXXFLAGS -Wall -pedantic -fpermissive -Wno-long-long -I../.."
76 fi
77 CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I.."
78 CXXFLAGS="$CXXFLAGS -I../.."
79
80 # Mac OS X, WIN32 and Solaris related
81 AC_MSG_CHECKING(for Mac OS X or WIN32 or Solaris)
82 case "${host_os}" in
83 *darwin* )
84 AC_MSG_RESULT(Mac OS X detected)
85 AM_CONDITIONAL(HAVE_OSX, true)
86 AM_CONDITIONAL(HAVE_WIN32, false)
87 CFLAGS="$CFLAGS -DOSX"
88 CXXFLAGS="$CXXFLAGS -DOSX"
89 QMAKE_ARG="-macx -spec macx-g++"
90 ;;
91 *mingw* )
92 AC_MSG_RESULT(WIN32 detected)
93 enable_win32=yes
94 AM_CONDITIONAL(HAVE_WIN32, true)
95 AM_CONDITIONAL(HAVE_OSX, false)
96 CFLAGS="$CFLAGS -DWIN32"
97 CXXFLAGS="$CXXFLAGS -DWIN32"
98 LIBS_END="$LIBS_END -lwsock32 -lregex -lntdll -lmman"
99 QMAKE_ARG=""
100 ;;
101 *solaris* | *sun*)
102 AC_MSG_RESULT(Solaris detected)
103 AM_CONDITIONAL(HAVE_OSX, false)
104 AM_CONDITIONAL(HAVE_WIN32, false)
105 LIBS="$LIBS -lkstat -lrt"
106 ;;
107 * )
108 AC_MSG_RESULT(no)
109 AM_CONDITIONAL(HAVE_OSX, false)
110 AM_CONDITIONAL(HAVE_WIN32, false)
111 ;;
112 esac
113
114 # Check for big or little endian
115 AC_C_BIGENDIAN(
116 [ac_c_bigendian=yes],
117 [ac_c_bigendian=no],
118 [AC_COMPILE_IFELSE(
119 [AC_LANG_PROGRAM(
120 [[typedef unsigned char uchar_t;
121 typedef unsigned short int uint16_t;]],
122 [[uchar_t x[2] = { 0x00, 0xff };
123 uint16_t y = *(uint16_t*)x;
124
125 if (y & x[1])
126 return 0;
127 else
128 return 1;]])],
129
130 [ac_c_bigendian=yes],
131 [ac_c_bigendian=no]
132 )]
133 )
134
135 if test $ac_c_bigendian = yes; then
136 AC_DEFINE([WORDS_BIGENDIAN], 1,
137 [Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
138 significant byte first])
139 fi
140
141 # Checks for libraries.
142 with_pthread=no
143 AC_ARG_WITH(libpthread, AC_HELP_STRING(--with-libpthread=DIR,use libpthread in DIR),
144 [ AC_MSG_CHECKING(for libpthread)
145 case "$withval" in
146 no)
147 AC_MSG_RESULT(no)
148 ;;
149 *)
150 AC_MSG_RESULT(yes)
151 with_pthread=$withval
152 if test "x$enable_win32" = "xyes"; then
153 CFLAGS="$CFLAGS -I$with_pthread"
154 CXXFLAGS="$CXXFLAGS -I$with_pthread"
155 LIBS="$LIBS -L$with_pthread"
156 LIBS_END="$LIBS_END -lpthreadGC2"
157 else
158 CFLAGS="$CFLAGS -I$with_pthread/include"
159 CXXFLAGS="$CXXFLAGS -I$with_pthread/include"
160 LIBS="$LIBS -L$with_pthread/lib -lpthread"
161 fi
162 ;;
163 esac ]
164 )
165
166 if test "x$with_pthread" = "xno"; then
167 AC_CHECK_LIB([pthread], [pthread_mutex_init], [], [AC_MSG_ERROR([ophcrack requires libpthread.])])
168 fi
169
170
171 AC_MSG_CHECKING(for libssl)
172 with_ssl=no
173 AC_ARG_WITH(libssl, AC_HELP_STRING(--with-libssl=DIR,use libssl in DIR),
174 [ case "$withval" in
175 no)
176 AC_MSG_RESULT(no)
177 ;;
178 *)
179 AC_MSG_RESULT(yes)
180 with_ssl=$withval
181 CFLAGS="$CFLAGS -I$with_ssl/include"
182 CXXFLAGS="$CXXFLAGS -I$with_ssl/include"
183 LIBS="$LIBS -L$with_ssl/lib -lssl -lcrypto"
184 ;;
185 esac ]
186 )
187
188 if test "x$with_ssl" = "xno"; then
189 CHECK_SSL
190 fi
191
192 with_expat=no
193 AC_ARG_WITH(libexpat, AC_HELP_STRING(--with-libexpat=DIR,use libexpat in DIR),
194 [ AC_MSG_CHECKING(for libexpat)
195 case "$withval" in
196 no)
197 AC_MSG_RESULT(no)
198 ;;
199 *)
200 AC_MSG_RESULT(yes)
201 with_expat=$withval
202 if test "x$enable_win32" = "xyes"; then
203 CFLAGS="$CFLAGS -I$with_expat/lib"
204 CXXFLAGS="$CXXFLAGS -I$with_expat/lib"
205 LIBS="$LIBS -L$with_expat"
206 LIBS_END="$LIBS_END -lexpat"
207 else
208 CFLAGS="$CFLAGS -I$with_expat/include"
209 CXXFLAGS="$CXXFLAGS -I$with_expat/include"
210 LIBS="$LIBS -L$with_expat/lib -lexpat"
211 fi
212 ;;
213 esac ]
214 )
215
216 if test "x$with_expat" = "xno"; then
217 AC_CHECK_LIB([expat], [XML_ParserCreate], [], [AC_MSG_ERROR([ophcrack requires libexpat.])])
218 fi
219
220 AC_CHECK_LIB([m], [sqrt], [], [AC_MSG_ERROR([ophcrack requires libmath.])])
221
222 # Checks for header files.
223 AC_HEADER_STDC
224 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])
225
226 # Checks for typedefs, structures, and compiler characteristics.
227 AC_HEADER_STDBOOL
228 AC_C_CONST
229 AC_TYPE_SIZE_T
230 AC_HEADER_TIME
231 AC_TYPE_UINT16_T
232 AC_TYPE_UINT32_T
233 AC_TYPE_UINT64_T
234 AC_CHECK_TYPES([uchar_t, ulong_t])
235 AC_CHECK_TYPES([struct sysinfo],[], [], [[#include <sys/sysinfo.h>]])
236
237
238 # Sets GUI_TARGET and qt specific stuff
239 AC_ARG_ENABLE(gui,
240 [AC_HELP_STRING([--enable-gui],
241 [Builds gui frontend (enabled by default, use
242 --disable-gui to disable it)])],
243 ,
244 [enable_gui=yes])
245
246 AC_MSG_CHECKING(whether we want to build ophcrack gui)
247 # Check QT environment if we want GUI
248 if test "x$enable_gui" = "xyes"; then
249 AC_MSG_RESULT(yes)
250
251 AX_PATH_QMAKE5
252 CHECK_QTCHARTS
253
254 AC_DEFINE_UNQUOTED([HAVE_GUI], 1, [GUI is enabled])
255 AM_CONDITIONAL(HAVE_GUI, true)
256 else
257 AC_MSG_RESULT(no)
258 AM_CONDITIONAL(HAVE_GUI, false)
259 fi
260
261
262
263 # Dirty trick for win32 MinGW
264 LIBS="$LIBS ${LIBS_END}"
265
266 # Checks for library functions.
267 # AC_FUNC_MALLOC
268 AC_FUNC_MEMCMP
269 AC_FUNC_MMAP
270 AC_FUNC_SELECT_ARGTYPES
271 AC_CHECK_FUNCS([floor gettimeofday memchr memset munmap regcomp select sqrt strchr strdup strndup strtoul])
272
273
274 AC_CONFIG_FILES([
275 Makefile
276 src/Makefile
277 src/common.mk
278 src/core/Makefile
279 src/ntproba/Makefile
280 src/samdump2/Makefile
281 src/test/Makefile
282 src/gui/Makefile
283 src/gui/gui.pro
284 src/gui/ophcrack_win32.rc
285 src/gui/Info.plist
286 ])
287 AC_OUTPUT
288
289 echo
290 echo "===================================================="
291 echo "ophcrack has been successfully configured as follow"
292 echo "===================================================="
293 echo
294 echo " Install directory: "${prefix}
295 echo
296 echo " GUI: "${enable_gui}
297 echo " Debugging: "${enable_debug}
298 echo
299 echo "===================================================="
300 echo
301 echo "Now enter 'make' to compile"
302 echo "followed by 'make install' to install"
303 echo