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