Include xparsegeometry_repl.h header on non-X11 targets
[freeglut] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_INIT([freeglut library], [3.0.0], [freeglut-bugs@lists.sourceforge.net], [freeglut])
4 AM_INIT_AUTOMAKE
5 AC_PREREQ([2.56])
6 AC_CONFIG_SRCDIR([AUTHORS])
7 AC_CONFIG_HEADERS([config.h])
8
9 # Compatibility hack for older autoconf versions
10 m4_ifdef([AS_HELP_STRING], [], [AC_DEFUN([AS_HELP_STRING], [AC_HELP_STRING($][@)])])
11
12 # Checks for programs.
13 AC_PROG_CC
14 AM_PROG_CC_C_O
15 AC_C_CONST
16 AC_EXEEXT
17 AC_LIBTOOL_DLOPEN
18 AC_PROG_LIBTOOL
19 AC_SUBST([LIBTOOL_DEPS])
20
21 # Checks for libraries.
22 AC_PATH_XTRA
23
24 #if test "x$no_x" = xyes; then
25 #  GL_LIBS="-lopengl32 -lgdi32 -lwinmm"
26 #  LIBXXF86VM=
27 #  LIBXI=
28 #  VERSION_INFO=
29 #  EXPORT_FLAGS="-DFREEGLUT_EXPORTS"
30 #else
31 #  GL_LIBS="-lGL -lXext -lX11"
32 #  AC_CHECK_LIB([Xxf86vm], [XF86VidModeSwitchToMode])
33 #  AC_CHECK_LIB([Xrandr], [XRRQueryExtension])
34 #  AC_CHECK_LIB([Xi], [XISelectEvents])
35 #  LIBXI=-lXi
36 #  VERSION_INFO="-version-info 12:0:9"
37 #  EXPORT_FLAGS=
38 #fi
39 VERSION_INFO="-version-info 12:0:9"
40 AM_CONDITIONAL(TARGET_HOST_MS_WINDOWS, false)
41 AM_CONDITIONAL(TARGET_HOST_POSIX_X11, false)
42 AM_CONDITIONAL(TARGET_HOST_ANDROID, false)
43 case "${host}" in
44     *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
45         # Windows+Cygwin/MSYS, MinGW cross-compilation
46         GL_LIBS="-lopengl32 -lgdi32 -lwinmm"
47         LIBXXF86VM=
48         LIBXI=
49         CPPFLAGS="$CPPFLAGS -DFREEGLUT_EXPORTS"
50         AM_CONDITIONAL(TARGET_HOST_MS_WINDOWS, true)
51         ;;
52     *-*-linux-androideabi)
53         # Android
54         # e.g. arm-unknown-linux-androideabi
55         GL_LIBS="-lEGL -lGLESv2"
56         LIBXXF86VM=
57         LIBXI=
58         CPPFLAGS="$CPPFLAGS -DANDROID"
59         AM_CONDITIONAL(TARGET_HOST_ANDROID, true)
60         ;;
61     *)
62         # Unix/X11
63         GL_LIBS="-lGL -lXext -lX11"
64         AC_CHECK_LIB([Xxf86vm], [XF86VidModeSwitchToMode])
65         AC_CHECK_LIB([Xrandr], [XRRQueryExtension])
66         AC_CHECK_LIB([Xi], [XISelectEvents])
67         LIBXI=-lXi
68         AM_CONDITIONAL(TARGET_HOST_POSIX_X11, true)
69         ;;
70 esac
71
72 AC_SUBST([GL_LIBS])
73 AC_SUBST([LIBXXF86VM])
74 AC_SUBST([LIBXI])
75 AC_SUBST([VERSION_INFO])
76 AC_SUBST([EXPORT_FLAGS])
77
78 AC_CHECK_LIB([usbhid], [hid_init],
79              [LIBUSBHID=-lusbhid], [LIBUSBHID=])
80 AC_SUBST(LIBUSBHID)
81
82 # Checks for header files.
83 AC_HEADER_STDC
84 save_CPPFLAGS="$CPPFLAGS"
85 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
86 AC_CHECK_HEADERS([usbhid.h libusbhid.h errno.h GL/gl.h GL/glu.h GL/glx.h fcntl.h limits.h sys/ioctl.h sys/param.h sys/time.h])
87 AC_HEADER_TIME
88 AC_CHECK_HEADERS([X11/extensions/xf86vmode.h], [], [], [#include <X11/Xlib.h>])
89 AC_CHECK_HEADERS([X11/extensions/Xrandr.h])
90 AC_CHECK_HEADERS([X11/extensions/XI.h X11/extensions/XInput.h])
91 AC_CHECK_HEADERS([X11/extensions/XInput2.h])
92 CPPFLAGS="$save_CPPFLAGS"
93
94 # Checks for library functions.
95 AC_PROG_GCC_TRADITIONAL
96 AC_FUNC_VPRINTF
97 AC_CHECK_LIBM
98 AC_SUBST([LIBM])
99 AC_CHECK_FUNCS([gettimeofday])
100 AC_CHECK_FUNCS([vfprintf])
101
102 # Build time configuration.
103 AC_ARG_ENABLE([replace-glut],
104 [AS_HELP_STRING([--enable-replace-glut],
105                 [be a replacement for GLUT @<:@default=yes@:>@])])
106 if test "x$enable_replace_glut" != xno; then
107   LIBRARY=glut
108   HEADER=glut.h
109 else
110   LIBRARY=freeglut
111   HEADER=
112 fi
113 AC_SUBST([LIBRARY])
114 AC_SUBST([HEADER])
115
116 AC_ARG_ENABLE([warnings],
117 [AS_HELP_STRING([--enable-warnings],
118                 [use all gcc compiler warnings @<:@default=yes@:>@])])
119 if test "x$enable_warnings" != xno -a "x$GCC" = xyes; then
120   CFLAGS="$CFLAGS -Wall -pedantic"
121 fi
122
123 AC_ARG_ENABLE([warnings-as-errors],
124 [AS_HELP_STRING([--enable-warnings-as-errors],
125                 [make all warnings into errors @<:@default=no@:>@])])
126 if test "x$enable_warnings_as_errors" = xyes -a "x$GCC" = xyes; then
127   CFLAGS="$CFLAGS -Werror"
128 fi
129
130 AC_ARG_ENABLE([debug],
131 [AS_HELP_STRING([--enable-debug],
132                 [enable debugging code (for developers) @<:@default=no@:>@])])
133 if test "x$enable_debug" = xyes; then
134   AC_DEFINE([_DEBUG], [1], [Define to 1 if you want to include debugging code.])
135 fi
136
137 # Generate output.
138 AC_CONFIG_FILES([
139         Makefile
140         doc/Makefile
141         include/GL/Makefile
142         include/Makefile
143         progs/Makefile
144         progs/demos/CallbackMaker/Makefile
145         progs/demos/Fractals/Makefile
146         progs/demos/Fractals_random/Makefile
147         progs/demos/Lorenz/Makefile
148         progs/demos/Makefile
149         progs/demos/One/Makefile
150         progs/demos/shapes/Makefile
151         progs/demos/smooth_opengl3/Makefile
152         progs/demos/spaceball/Makefile
153         progs/demos/subwin/Makefile
154         src/Makefile
155 ])
156 AC_OUTPUT