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