Moving some function prototypes into the source files where they are found and out...
[freeglut] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_INIT([freeglut library], [2.6.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 AC_SUBST([GL_LIBS])
40 AC_SUBST([LIBXXF86VM])
41 AC_SUBST([LIBXI])
42 AC_SUBST([VERSION_INFO])
43 AC_SUBST([EXPORT_FLAGS])
44
45 AC_CHECK_LIB([usbhid], [hid_init],
46              [LIBUSBHID=-lusbhid], [LIBUSBHID=])
47 AC_SUBST(LIBUSBHID)
48
49 # Checks for header files.
50 AC_HEADER_STDC
51 save_CPPFLAGS="$CPPFLAGS"
52 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
53 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])
54 AC_HEADER_TIME
55 AC_CHECK_HEADERS([X11/extensions/xf86vmode.h], [], [], [#include <X11/Xlib.h>])
56 AC_CHECK_HEADERS([X11/extensions/Xrandr.h])
57 AC_CHECK_HEADERS([X11/extensions/XI.h X11/extensions/XInput.h])
58 AC_CHECK_HEADERS([X11/extensions/XInput2.h])
59 CPPFLAGS="$save_CPPFLAGS"
60
61 # Checks for library functions.
62 AC_PROG_GCC_TRADITIONAL
63 AC_FUNC_VPRINTF
64 AC_CHECK_LIBM
65 AC_SUBST([LIBM])
66 AC_CHECK_FUNCS([gettimeofday])
67 AC_CHECK_FUNCS([vfprintf])
68
69 # Build time configuration.
70 AC_ARG_ENABLE([replace-glut],
71 [AS_HELP_STRING([--enable-replace-glut],
72                 [be a replacement for GLUT @<:@default=yes@:>@])])
73 if test "x$enable_replace_glut" != xno; then
74   LIBRARY=glut
75   HEADER=glut.h
76 else
77   LIBRARY=freeglut
78   HEADER=
79 fi
80 AC_SUBST([LIBRARY])
81 AC_SUBST([HEADER])
82
83 AC_ARG_ENABLE([warnings],
84 [AS_HELP_STRING([--enable-warnings],
85                 [use all gcc compiler warnings @<:@default=yes@:>@])])
86 if test "x$enable_warnings" != xno -a "x$GCC" = xyes; then
87   CFLAGS="$CFLAGS -Wall -pedantic"
88 fi
89
90 AC_ARG_ENABLE([warnings-as-errors],
91 [AS_HELP_STRING([--enable-warnings-as-errors],
92                 [make all warnings into errors @<:@default=no@:>@])])
93 if test "x$enable_warnings_as_errors" = xyes -a "x$GCC" = xyes; then
94   CFLAGS="$CFLAGS -Werror"
95 fi
96
97 AC_ARG_ENABLE([debug],
98 [AS_HELP_STRING([--enable-debug],
99                 [enable debugging code (for developers) @<:@default=no@:>@])])
100 if test "x$enable_debug" = xyes; then
101   AC_DEFINE([_DEBUG], [1], [Define to 1 if you want to include debugging code.])
102 fi
103
104 # Generate output.
105 AC_CONFIG_FILES([
106         Makefile
107         doc/Makefile
108         include/GL/Makefile
109         include/Makefile
110         progs/Makefile
111         progs/demos/CallbackMaker/Makefile
112         progs/demos/Fractals/Makefile
113         progs/demos/Fractals_random/Makefile
114         progs/demos/Lorenz/Makefile
115         progs/demos/Makefile
116         progs/demos/One/Makefile
117         progs/demos/shapes/Makefile
118         progs/demos/smooth_opengl3/Makefile
119         progs/demos/spaceball/Makefile
120         progs/demos/subwin/Makefile
121         src/Makefile
122 ])
123 AC_OUTPUT