-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
103 lines (93 loc) · 3.44 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
# Define the package name and version
AC_INIT([koliseo], [0.4.6], [[email protected]])
# Verify automake version and enable foreign option
AM_INIT_AUTOMAKE([foreign -Wall])
# Detect the host system and set PACK_PREFIX accordingly
AC_CANONICAL_HOST
build_linux=no
build_windows=no
build_mac=no
echo "Host os: $host_os"
AC_ARG_ENABLE([locate],
[AS_HELP_STRING([--enable-locate], [Enable location signatures])],
[enable_locate=$enableval],
[enable_locate=no])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Enable debug build])],
[enable_debug=$enableval],
[enable_debug=no])
AC_ARG_ENABLE([gulp],
[AS_HELP_STRING([--enable-gulp], [Enable gulp header])],
[enable_gulp=$enableval],
[enable_gulp=no])
AC_ARG_ENABLE([region],
[AS_HELP_STRING([--enable-region], [Enable region feature])],
[enable_region=$enableval],
[enable_region=no])
AC_ARG_ENABLE([title],
[AS_HELP_STRING([--enable-title], [Enable title feature])],
[enable_title=$enableval],
[enable_title=no])
AC_ARG_ENABLE([exper],
[AS_HELP_STRING([--enable-exper], [Enable experimental features])],
[enable_exper=$enableval],
[enable_exper=no])
AM_CONDITIONAL([LOCATE_BUILD], [test "$enable_locate" = "yes"])
AM_CONDITIONAL([DEBUG_BUILD], [test "$enable_debug" = "yes"])
AM_CONDITIONAL([GULP_BUILD], [test "$enable_gulp" = "yes"])
AM_CONDITIONAL([REGION_BUILD], [test "$enable_region" = "yes"])
AM_CONDITIONAL([TITLE_BUILD], [test "$enable_title" = "yes"])
AM_CONDITIONAL([EXPER_BUILD], [test "$enable_exper" = "yes"])
# Define the include and library paths based on the host system
case "${host_os}" in
mingw*)
echo "Building for mingw32: [$host_cpu-$host_vendor-$host_os]"
# mingw32 specific flags
build_windows=yes
AC_SUBST([KOLISEO_CFLAGS], ["-I/usr/x86_64-w64-mingw32/include -static -fstack-protector"])
AC_SUBST([KOLISEO_LDFLAGS], ["-L/usr/x86_64-w64-mingw32/lib"])
AC_SUBST([CCOMP], ["/usr/bin/x86_64-w64-mingw32-gcc"])
AC_SUBST([OS], ["w64-mingw32"])
AC_SUBST([TARGET], ["demo.exe"])
AC_SUBST([SHARED_LIB], ["libkoliseo.dll"])
;;
darwin*)
echo "Building for macos: [$host_cpu-$host_vendor-$host_os]"
build_mac=yes
# macOS specific flags
AC_SUBST([KOLISEO_LDFLAGS], [""])
AC_SUBST([KOLISEO_CFLAGS], [""])
AC_SUBST([OS], ["darwin"])
AC_SUBST([TARGET], ["demo"])
AC_SUBST([SHARED_LIB], ["libkoliseo.so"])
;;
linux*)
echo "Building for Linux: [$host_cpu-$host_vendor-$host_os]"
build_linux=yes
# Linux specific flags
AC_SUBST([KOLISEO_LDFLAGS], [""])
AC_SUBST([KOLISEO_CFLAGS], [""])
AC_SUBST([OS], ["Linux"])
AC_SUBST([TARGET], ["demo"])
AC_SUBST([SHARED_LIB], ["libkoliseo.so"])
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
AM_CONDITIONAL([WINDOWS_BUILD], [test "$build_windows" = "yes"])
AM_CONDITIONAL([DARWIN_BUILD], [test "$build_mac" = "yes"])
AM_CONDITIONAL([LINUX_BUILD], [test "$build_linux" = "yes"])
# Set a default version number if not specified externally
AC_ARG_VAR([VERSION], [Version number])
if test -z "$VERSION"; then
VERSION="0.4.6"
fi
# Output variables to the config.h header
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number])
AC_CHECK_PROGS([CCOMP], [gcc clang])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_FUNCS([malloc calloc])
# Output the generated files (Makefile and config.h)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT