-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
134 lines (116 loc) · 3.17 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
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
AC_INIT(bp_ray, 0.2.8)
#to get the host call early or we get warning
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR(src/bp_ray.c)
AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE
AC_PROG_CC
#for lex and yacc we should actually check for flex
AM_PROG_LEX
AC_PROG_YACC
#need to check to see if we are building on mingw and set flags
# for future stages so that right ld will be chosen
case "$host" in
*-*-mingw*)
CC="$CC -mno-cygwin"
platform_win32=yes
AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
;;
*-*-linux*)
AC_DEFINE(PLATFORM_LINUX,1,[Platform is linux])
;;
esac
#libtool
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_SUBST([AM_LIBTOOLFLAGS], [--silent])
AC_ARG_ENABLE(simd,
[--enable-simd Enables the use of simd on this arch ],
[
case "x$enableval" in
xsse2)
AC_DEFINE(SSE,2,[Using sse2])
;;
xsse)
AC_DEFINE(SSE,1,[Using sse])
;;
esac
]
)
case "$host" in
*-*-mingw*)
#we already have a porperly built mingw dll in the lib directory
#we don't use AC_CHECK_LIB to find glu. opengl32 (a microsoft supplied library)
# cos they are defined __stdcall and so AC_CHECK_LIB willl fail
# FIX: --enable-stdcall-fixup might fix this
LIBS="$LIBS -lgd -lopengl32 -lglu32"
;;
*)
AC_CHECK_LIB(gd, gdFontGetGiant, [], [
AC_MSG_ERROR([Error! You need to have libgd around.])
])
AC_CHECK_LIB(GL, glMatrixMode, [], [
AC_MSG_ERROR([Error! You need to have opengl around.])
])
AC_CHECK_LIB(GLU, gluOrtho2D, [], [
AC_MSG_ERROR([Error! You need to have glu around.])
])
;;
esac
AC_PATH_PROG(PKG_CONFIG, [pkg-config], no)
if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
pkg-config --atleast-version=2.8 glib-2.0
if [[ "x$?" != "x0" ]] ; then
AC_MSG_ERROR([You need to have glib installed.])
fi
AC_CHECK_LIB(pthread, pthread_mutex_init,
,
[
AC_MSG_ERROR([You need to have pthreads installed.])
]
)
AC_ARG_ENABLE(more-warnings,
[ --enable-more-warnings Maximum compiler warnings],
set_more_warnings="$enableval",[
set_more_warnings=no
])
CFLAGS=" -std=c1x $(pkg-config --cflags glib-2.0) $CFLAGS"
LDFLAGS="$(pkg-config --libs glib-2.0) $LDFLAGS"
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
AC_MSG_RESULT(yes)
CFLAGS="\
-Wall \
-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wcast-align -Wsign-compare \
$CFLAGS"
for option in -Wno-strict-aliasing -Wno-sign-compare; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
if test $has_option = no; then
CFLAGS="$SAVE_CFLAGS"
fi
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CFLAGS
done
unset option
else
AC_MSG_RESULT(no)
fi
AC_OUTPUT([
Makefile src/Makefile doc/Makefile tests/Makefile
])
echo "
configuration result
LDFLAGS : $LDFLAGS
CFLAGS : $CFLAGS
LIBS : $LIBS
"