1dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.61)
3
4dnl This is the only place where the package name and version appear
5AC_INIT([QuakeForge], m4_esyscmd([config.d/git-version-gen --prefix '' .tarball-version]))
6AM_INIT_AUTOMAKE([foreign])
7
8dnl LT_INIT messes with CFLAGS (evil bastard)
9if test "x${CFLAGS-unset}" = xunset; then
10	CFLAGS=""
11fi
12saved_CFLAGS="$CFLAGS"
13dnl LT_INIT([win32-dll])
14AM_PROG_LIBTOOL
15CFLAGS="$saved_CFLAGS"
16
17AC_REVISION([$Revision$]) dnl
18
19AC_CONFIG_HEADERS([include/config.h])
20
21AC_CANONICAL_BUILD
22AC_CANONICAL_HOST
23
24m4_include(config.d/versions.m4)
25
26AC_LANG_C
27
28if test "$x{AR-unset}" = xunset; then
29	AR="ar"
30fi
31export AR
32AC_SUBST(AR)
33AC_SUBST(RANLIB)
34
35m4_include(config.d/windows.m4)
36m4_include(config.d/asm.m4)
37m4_include(config.d/programs.m4)
38m4_include(config.d/system_services.m4)
39m4_include(config.d/header_files.m4)
40m4_include(config.d/library_functions.m4)
41m4_include(config.d/typedefs_structs_compiler.m4)
42
43m4_include(config.d/cross_compile.m4)
44
45m4_include(config.d/pthread.m4)
46
47WINMM=""
48case "$host_os" in
49	cygwin*)
50		WINMM="-lwinmm"
51	;;
52	mingw32*)
53		WINMM="-lwinmm"
54	;;
55	*)
56		dnl Checks for working -lm
57		AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
58	;;
59esac
60
61m4_include(config.d/compression.m4)
62
63m4_include(config.d/mgl.m4)
64m4_include(config.d/fbdev.m4)
65m4_include(config.d/svga.m4)
66m4_include(config.d/x11.m4)
67m4_include(config.d/sdl.m4)
68
69m4_include(config.d/curses.m4)
70
71dnl ==================================================================
72dnl Checks for system type
73dnl ==================================================================
74
75dnl Checks for which system driver to use
76AC_MSG_CHECKING(for system driver)
77case "${host}" in
78	i?86-*-mingw32*|x86_64-w64-mingw32)
79		SYSTYPE=WIN32
80		AC_MSG_RESULT([Win32 driver])
81		WIN32_LIBS=' $(NET_LIBS)'
82		if test "x$host" != "x$build"; then
83			case "$build_os" in
84				cygwin*)
85					WIN32_LIBS=" -L/usr/lib/w32api $WIN32_LIBS"
86					;;
87			esac
88		fi
89
90		;;
91	i?86-*-cygwin*)
92		SYSTYPE=WIN32
93		AC_MSG_RESULT([Win32 driver])
94		WIN32_LIBS=' $(NET_LIBS)'
95		;;
96	*-openbsd*)
97		SYSTYPE=OPENBSD
98		AC_MSG_RESULT([OpenBSD driver])
99		WIN32_LIBS=''
100		;;
101	*)
102		SYSTYPE=POSIX
103		AC_MSG_RESULT([default POSIX driver])
104		WIN32_LIBS=''
105		;;
106esac
107AM_CONDITIONAL(SYSTYPE_WIN32, test "x$SYSTYPE" = "xWIN32")
108AC_SUBST(WIN32_LIBS)
109
110m4_include(config.d/sound.m4)
111m4_include(config.d/joystick.m4)
112m4_include(config.d/cdrom.m4)
113
114m4_include(config.d/networking.m4)
115
116m4_include(config.d/paths.m4)
117
118m4_include(config.d/build_control.m4)
119m4_include(config.d/qfcc.m4)
120m4_include(config.d/compiling.m4)
121
122AC_ARG_ENABLE(static-doc,
123	[  --enable-static-doc     Enable generation of doxygen docs for static]
124	[                          functions.])
125STATIC_DOC=NO
126if test "x$enable_static_doc" = xyes; then
127	STATIC_DOC=YES
128fi
129AC_SUBST(STATIC_DOC)
130
131AC_ARG_ENABLE(typecheck-progs,
132	[  --enable-typecheck-progs Enable type checking on progs field access])
133if test "x$enable_typecheck_progs" = xyes; then
134	AC_DEFINE(TYPECHECK_PROGS, 1, [Define this if you want progs typechecking])
135fi
136
137TOPSRC=`readlink -f ${srcdir}`
138AC_SUBST(TOPSRC)
139
140dnl Output files
141m4_include(config.d/rpm.m4)
142AC_CONFIG_FILES(m4_include(config.d/ac_config_files.m4))
143AC_OUTPUT
144
145m4_include(config.d/result.m4)
146