]> icculus.org git repositories - dana/openbox.git/blob - configure.ac
update configure.ac to newer rules
[dana/openbox.git] / configure.ac
1 AC_INIT([openbox], [2.90.0], [http://icculus.org/openbox])
2 AC_CONFIG_SRCDIR([src/blackbox.cc])
3 AM_INIT_AUTOMAKE
4
5 dnl Determine default prefix
6 test "$prefix" = "NONE" && prefix="$ac_default_prefix"
7
8 dnl We're in the C++ world
9 AC_LANG(C++)
10
11 AC_PROG_CC
12 AC_PROG_CXX
13 AC_PROG_INSTALL
14 AC_PROG_LIBTOOL
15
16 AC_CHECK_PROGS([regex_cmd], [sed])
17 if test x$regex_cmd = "x"; then
18   AC_MSG_ERROR([error. sed is required to build the default menu file.])
19 fi
20
21 dnl Check what compiler we are using
22 AC_MSG_CHECKING([for GCC])
23 if test "$GCC" = "yes"; then
24   AC_MSG_RESULT([yes])
25   CXXFLAGS="$CXXFLAGS -Wall -W -pedantic"
26 else
27   AC_MSG_RESULT([no, trying other compilers])
28   AC_MSG_CHECKING(for MIPSpro)
29   mips_pro_ver=`$CXX -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
30   if test -z "$mips_pro_ver"; then
31     AC_MSG_RESULT([no])
32   else
33     AC_MSG_RESULT([yes, version $mips_pro_ver.])
34     AC_MSG_CHECKING(for -LANG:std in CXXFLAGS)
35     lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
36     if test "x$lang_std_not_set" = "x"; then
37       AC_MSG_RESULT([not set, setting.])
38       CXXFLAGS="${CXXFLAGS} -LANG:std"
39     else
40       AC_MSG_RESULT([already set.])
41     fi
42   fi
43 fi
44
45 dnl Determine if maintainer portions of the Makefiles should be included.
46 AM_MAINTAINER_MODE
47
48 dnl Check for system header files
49 AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h stdlib.h string.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h)
50 AC_HEADER_TIME
51
52 dnl Determine the return type of signal handlers
53 AC_TYPE_SIGNAL
54
55 dnl Check whether to include debugging code
56 DEBUG=""
57 AC_MSG_CHECKING([whether to include verbose debugging code])
58 AC_ARG_ENABLE([debug],
59   [  --enable-debug          include verbose debugging code @<:@default=no@:>@],
60   if test "$enableval" = "yes"; then
61     AC_MSG_RESULT([yes])
62     if test "$GCC" = "yes"; then
63        DEBUG="-DDEBUG -fno-inline -g"
64     else
65        DEBUG="-DDEBUG"
66     fi
67   else
68     AC_MSG_RESULT([no])
69     DEBUG="-DNDEBUG"
70   fi,
71   AC_MSG_RESULT([no])
72   DEBUG="-DNDEBUG"
73 )
74 CXXFLAGS="$CXXFLAGS $DEBUG"
75
76 dnl Check for X headers and libraries
77 AC_PATH_X
78 AC_PATH_XTRA
79 test "$no_x" = "yes" && AC_MSG_ERROR([No Xlibs found.])
80 test -z "$x_includes" && x_includes="/usr/include"
81 test -z "$x_libraries" && x_libraries="/usr/lib"
82      
83 CXXFLAGS="$CXXFLAGS $X_CXXFLAGS"
84 LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
85 LDFLAGS="$LDFLAGS $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
86
87 dnl Check for required functions in -lX11
88 AC_CHECK_LIB([X11], [XOpenDisplay],
89   ,
90   AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
91 )
92
93 dnl Check for XShape extension support
94 AC_CHECK_LIB([Xext], [XShapeCombineShape],
95   AC_MSG_CHECKING([for X11/extensions/shape.h])
96   AC_TRY_LINK(
97     [
98       #include <X11/Xlib.h>
99       #include <X11/Xutil.h>
100       #include <X11/extensions/shape.h>
101     ],
102     [
103       long foo = ShapeSet
104     ],
105     [
106       AC_MSG_RESULT([yes])
107       SHAPE="yes"
108       AC_DEFINE([HAVE_SHAPE], [1], [Found the XShape extension])
109       LIBS="$LIBS -lXext"
110     ],
111     [ 
112       AC_MSG_RESULT([no])
113       SHAPE="no"
114     ]
115   )
116 )
117 AC_MSG_CHECKING([for the XShape extension])
118 if test "$SHAPE" = "yes"; then
119   AC_MSG_RESULT([yes])
120 else
121   AC_MSG_RESULT([no])
122 fi
123
124 dnl Check for Xinerama extension support
125 AC_MSG_CHECKING([whether to build support for the Xinerama extension])
126 XINERAMA="no"
127 AC_ARG_ENABLE([xinerama],
128 [  --enable-xinerama       enable support of the Xinerama extension @<:@default=no@:>@],
129   if test "$enableval" = "yes"; then
130         AC_MSG_RESULT([yes])
131
132         AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
133           [
134             AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
135             AC_TRY_LINK(
136               [
137                 #include <X11/Xlib.h>
138                 #include <X11/extensions/Xinerama.h>
139               ],
140               [
141                 XineramaScreenInfo foo
142               ],
143               [
144                 AC_MSG_RESULT([yes])
145                 XINERAMA="yes"
146                 AC_DEFINE([XINERAMA], [1],
147                           [Enable support of the Xinerama extension])
148                 LIBS="$LIBS -lXinerama"
149               ],
150               [
151                 AC_MSG_RESULT([no])
152               ]
153             )
154           ]
155         )
156
157     AC_MSG_CHECKING([for the Xinerama extension])
158     if test "$XINRERAMA" = "yes"; then
159       AC_MSG_RESULT([yes])
160     else
161       AC_MSG_RESULT([no])
162     fi
163   else
164         AC_MSG_RESULT([no])
165   fi,
166   AC_MSG_RESULT([no])
167 )
168
169 dnl Print results
170 AC_MSG_RESULT([])
171 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
172 AC_MSG_RESULT([])
173 AC_MSG_RESULT([Using '$prefix' for installation.])
174 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
175 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
176 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
177 AC_MSG_RESULT([])
178
179
180 dnl Output files
181 AM_CONFIG_HEADER(config.h)
182 AC_CONFIG_FILES([
183   Makefile
184   otk/Makefile
185   src/Makefile
186   util/Makefile
187   util/epist/Makefile
188   doc/Makefile
189   data/Makefile
190   data/styles/Makefile
191   version.h
192 ])
193 AC_OUTPUT