-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
108 lines (82 loc) · 2.68 KB
/
configure.ac
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
AC_INIT([gcon], [m4_esyscmd([./version.sh])], [https://github.com/streaksu/gcon/issues], [gcon])
AC_PREREQ([2.69])
AC_CONFIG_AUX_DIR([build-aux])
SRCDIR="$(cd "$srcdir" && pwd -P)"
AC_SUBST([SRCDIR])
AC_CANONICAL_HOST
AC_DEFUN([PROG_ABSPATH], [
case "$$1" in
.*) $1="$(cd "$(dirname "$$1")" && pwd -P)/$(basename "$$1")" ;;
esac
])
test "x${CFLAGS+set}" = "x" && CFLAGS='-g -O2 -pipe'
AC_LANG([C])
AC_PROG_CC
PROG_ABSPATH([CC])
werror_state="no"
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror], [treat warnings as errors])],
[werror_state="$enableval"])
if test "$werror_state" = "yes"; then
AC_SUBST([WERROR_FLAG], [-Werror])
else
AC_SUBST([WERROR_FLAG], [-Wno-error])
fi
AC_PROG_MKDIR_P
PROG_ABSPATH([MKDIR_P])
AC_PROG_INSTALL
PROG_ABSPATH([INSTALL])
AC_CHECK_PROG([FIND_FOUND], [find], [yes])
if ! test "x$FIND_FOUND" = "xyes"; then
AC_MSG_ERROR([find not found, please install find before configuring])
fi
AC_ARG_VAR([STRIP], [strip command])
if ! test -z "$STRIP"; then
if test -x "$STRIP"; then
STRIP_USER_FOUND=yes
else
AC_CHECK_PROG([STRIP_USER_FOUND], [$STRIP], [yes])
fi
if ! test "x$STRIP_USER_FOUND" = "xyes"; then
AC_MSG_ERROR([$STRIP not found, please install $STRIP before configuring])
fi
else
STRIP="$($CC -dumpmachine)"-strip
AC_CHECK_PROG([STRIP_FOUND], [$STRIP], [yes])
if ! test "x$STRIP_FOUND" = "xyes"; then
STRIP=strip
AC_CHECK_PROG([STRIP_DEFAULT_FOUND], [$STRIP], [yes])
if ! test "x$STRIP_DEFAULT_FOUND" = "xyes"; then
AC_MSG_ERROR([$STRIP not found, please install $STRIP before configuring])
fi
fi
fi
AC_SUBST([STRIP])
PKGCONF_LIBS_LIST=""
PKG_PROG_PKG_CONFIG
PROG_ABSPATH([PKG_CONFIG])
for lib in $PKGCONF_LIBS_LIST; do
set -e
$PKG_CONFIG --exists --print-errors "$lib"
set +e
done
PKGCONF_CFLAGS="$($PKG_CONFIG --cflags-only-other $PKGCONF_LIBS_LIST 2>/dev/null)"
PKGCONF_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $PKGCONF_LIBS_LIST 2>/dev/null)"
PKGCONF_LIBS="$($PKG_CONFIG --libs $PKGCONF_LIBS_LIST 2>/dev/null)"
AC_SUBST([PKGCONF_CFLAGS])
AC_SUBST([PKGCONF_CPPFLAGS])
AC_SUBST([PKGCONF_LIBS])
OLD_CFLAGS="$CFLAGS"
OLD_CPPFLAGS="$CPPFLAGS"
OLD_LIBS="$LIBS"
CFLAGS="$CFLAGS $PKGCONF_CFLAGS"
CPPFLAGS="$PKGCONF_CPPFLAGS $CPPFLAGS"
LIBS="$LIBS $PKGCONF_LIBS"
AC_CHECK_HEADERS([stdio.h unistd.h pthread.h fcntl.h linux/fb.h sys/ttydefaults.h sys/syscall.h stdlib.h sys/mman.h sys/wait.h sys/ioctl.h termios.h ctype.h stdnoreturn.h pty.h],
[], [AC_MSG_ERROR([required header not found])])
CFLAGS="$OLD_CFLAGS"
CPPFLAGS="$OLD_CPPFLAGS"
LIBS="$OLD_LIBS"
AC_PREFIX_DEFAULT([/usr/local])
AC_CONFIG_FILES([GNUmakefile])
AC_OUTPUT