Debian Codegraph @

build/m4/aircrack_ng_mac.m4

raw
1 dnl Aircrack-ng
2 dnl
3 dnl Copyright (C) 2017 Joseph Benden <[email protected]>
4 dnl
5 dnl Autotool support was written by: Joseph Benden <[email protected]>
6 dnl
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2 of the License, or
10 dnl (at your option) any later version.
11 dnl
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 dnl GNU General Public License for more details.
16 dnl
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 dnl
21 dnl In addition, as a special exception, the copyright holders give
22 dnl permission to link the code of portions of this program with the
23 dnl OpenSSL library under certain conditions as described in each
24 dnl individual source file, and distribute linked combinations
25 dnl including the two.
26 dnl
27 dnl You must obey the GNU General Public License in all respects
28 dnl for all of the code used other than OpenSSL.
29 dnl
30 dnl If you modify file(s) with this exception, you may extend this
31 dnl exception to your dnl version of the file(s), but you are not obligated
32 dnl to do so.
33 dnl
34 dnl If you dnl do not wish to do so, delete this exception statement from your
35 dnl version.
36 dnl
37 dnl If you delete this exception statement from all source files in the
38 dnl program, then also delete it here.
39
40 AC_DEFUN([AIRCRACK_NG_MAC],[
41 AX_REQUIRE_DEFINED([AC_CHECK_HEADER])[]dnl
42 AX_REQUIRE_DEFINED([AC_CHECK_FILE])[]dnl
43
44 AC_ARG_WITH(xcode,
45 [AS_HELP_STRING([--with-xcode], [enable XCode support])])
46
47 case "$host_os" in
48 DARWIN*|MACOS*|darwin*|macos*)
49 dnl
50 dnl Homebrew
51 dnl
52
53 AC_ARG_VAR([BREW],[Use this brew for macOS dependencies.])
54 dnl Allow env override but do not be fooled by 'BREW=t'.
55 test t = "$BREW" && unset BREW
56 AC_CHECK_PROG([BREW], [brew], [$as_dir/$ac_word$ac_exec_ext], [], [$BREW_PATH$PATH_SEPARATOR$PATH$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR/usr/local/bin])
57 AS_IF([test "x$BREW" = "x"],[
58 AC_MSG_WARN([Homebrew not found])
59 BREW_FOUND=no
60 ], [
61 BREW_FOUND=yes
62
63 AC_MSG_CHECKING([for openssl availability within Brew])
64 AS_IF([! $BREW --prefix --installed openssl 2>/dev/null], [
65 AC_MSG_RESULT([no])
66
67 AC_MSG_CHECKING([for [email protected] availability within Brew])
68 AS_IF([! $BREW --prefix --installed [email protected] 2>/dev/null], [
69 AC_MSG_RESULT([no])
70
71 AC_MSG_CHECKING([for openssl@3 availability within Brew])
72 AS_IF([! $BREW --prefix --installed openssl@3 2>/dev/null], [
73 AC_MSG_RESULT([no])
74 ], [
75 dnl AC_MSG_RESULT([yes])
76 CFLAGS="-Wno-deprecated-declarations -I$($BREW --prefix openssl@3)/include"
77 CXXFLAGS="-Wno-deprecated-declarations -I$($BREW --prefix openssl@3)/include"
78 CPPFLAGS="-Wno-deprecated-declarations -I$($BREW --prefix openssl@3)/include"
79 LDFLAGS="-L$($BREW --prefix openssl@3)/lib"
80 ])
81 ], [
82 dnl AC_MSG_RESULT([yes])
83 CFLAGS="-I$($BREW --prefix [email protected])/include"
84 CXXFLAGS="-I$($BREW --prefix [email protected])/include"
85 CPPFLAGS="-I$($BREW --prefix [email protected])/include"
86 LDFLAGS="-L$($BREW --prefix [email protected])/lib"
87 ])
88 ], [
89 dnl AC_MSG_RESULT([yes])
90 CFLAGS="-Wno-deprecated-declarations -I$($BREW --prefix openssl)/include"
91 CXXFLAGS="-Wno-deprecated-declarations -I$($BREW --prefix openssl)/include"
92 CPPFLAGS="-Wno-deprecated-declarations -I$($BREW --prefix openssl)/include"
93 LDFLAGS="-L$($BREW --prefix openssl)/lib"
94 ])
95 ])
96
97 AC_CHECK_FILE(/usr/local/Homebrew, [ CPPFLAGS="$CPPFLAGS -I/usr/local/include" ])
98
99 dnl MacPorts
100 AC_CHECK_FILE(/opt/local/include, [
101 CPPFLAGS="$CPPFLAGS -I/opt/local/include -I../.."
102 OSX_ALT_FLAGS=true
103 AC_CHECK_FILE(/opt/local/lib, [
104 LDFLAGS="$LDFLAGS -L/opt/local/lib"
105 ], [
106 AC_MSG_ERROR([MacPorts installation seems broken, have includes but no libs.])
107 ])
108 ])
109
110 dnl XCode
111 case $with_xcode in
112 yes | "")
113 AC_CHECK_FILE(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include, [
114 CPPFLAGS="$CPPFLAGS -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/ -D_XCODE -I../.."
115 OSX_ALT_FLAGS=true
116 ])
117 ;;
118 esac
119 ;;
120 esac
121 ])