summaryrefslogtreecommitdiff
path: root/configure.ac
blob: defb3dec267888f8b939e38653108ed69b76da7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
dnl
dnl This file is part of ratpoison.
dnl
dnl ratpoison is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl ratpoison is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl $Id: configure.in,v 1.54 2006/12/19 22:13:07 sabetts Exp $


AC_INIT([ratpoison], [1.4.6-GIT], [ratpoison-devel@nongnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([-Wall -Werror gnu])

AC_CONFIG_HEADER(src/config.h)

dnl by default turn off debugging
AC_MSG_CHECKING(whether to enable debugging)
AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug],[build with extra debugging messages]),
	[if test "x$enableval" != "xno"; then
		AC_DEFINE_UNQUOTED(DEBUG, 1, Define this to enable debugging messages)
		AC_MSG_RESULT(yes)
		CFLAGS="$CFLAGS -g"
	else
		AC_MSG_RESULT(no)
	fi],[AC_MSG_RESULT(no)])

AC_ARG_WITH(xterm,AS_HELP_STRING([--with-xterm=PROG],[set the x terminal emulator used by ratpoison]),
term_prog=$withval, term_prog="xterm")
AC_DEFINE_UNQUOTED(TERM_PROG, "$term_prog", X terminal emulator to use)

XFT_CFLAGS=
XFT_LIBS=
AC_ARG_WITH(xft,AS_HELP_STRING([--without-xft],[Don't use the Xft library even if available]),
                xft=$withval, xft=default)
if test "x$xft" != "xno"; then
    dnl Configure Xft.
    PKG_CHECK_MODULES([XFT], [xft],,[noop=noop])
    AC_MSG_CHECKING(whether to use Xft)
    echo "pkg_failed is $pkg_failed" >&5
dnl pkg_failed can be yes, no or untried (if there is no pkg-config or that does not work).
    if test "$pkg_failed" = "no" ; then
       AC_DEFINE_UNQUOTED(USE_XFT_FONT, 1, [Define this to use Xft])
       AC_MSG_RESULT(yes)
    elif test "x$xft" != "xdefault" ; then
dnl if explicitly requested but not found, bail out:
    	AC_MSG_RESULT(no)
    	if test "$pkg_failed" = "untried" ; then
	    AC_MSG_ERROR([Not Xft library found (this needs a working pkg-config)!])
	else
	    AC_MSG_ERROR([No Xft library found!])
	fi
    else
    	AC_MSG_RESULT(no)
    fi
else
    AC_MSG_CHECKING(whether to use Xft)
    AC_MSG_RESULT(no)
fi
AC_SUBST(XFT_CFLAGS)
AC_SUBST(XFT_LIBS)

dnl Checks for programs.
AC_PROG_CC

if test "x$CC" = "xgcc"; then
	CFLAGS="-Wall $CFLAGS"
fi

dnl check for an x terminal emulator
AC_MSG_CHECKING(terminal emulator)
AC_MSG_RESULT($term_prog)

dnl Check for the X libs
AC_PATH_X
AC_PATH_XTRA

if test "x$no_x" = "xyes"; then
	AC_MSG_ERROR([*** Can't find X11 headers and libs])
fi


dnl Those who do not learn the lessons of history
dnl are doomed to delete it...  yuk yuk.  --ttn
AC_ARG_ENABLE(history,AS_HELP_STRING([--disable-history],[ignore libhistory (default: use it if available, only used for ! expansion)]),
  [ if test x${enableval} = xyes ; then
        check_for_libhistory=yes
    else
        check_for_libhistory=no
    fi],[check_for_libhistory=default])

HISTORY_LIBS=""
if test x$check_for_libhistory != xno ; then
  AC_CHECK_HEADERS([readline/history.h],
    AC_CHECK_LIB(history, add_history,
      [HISTORY_LIBS="-lhistory"
       AC_DEFINE_UNQUOTED(HAVE_HISTORY, 1, Define this to enable history)],
      if test x$check_for_libhistory = xyes ; then
      AC_MSG_ERROR([*** Can't find History lib. Install readline dev libs for history expansion.])
      fi),
    if test x$check_for_libhistory = xyes ; then
    AC_MSG_ERROR([*** Can't find History header. Install readline dev libs for history expansion.])
    fi)
fi
AC_SUBST(HISTORY_LIBS)

AC_CHECK_LIB(X11, XOpenDisplay, [X_LIBS="-lX11 $X_LIBS"],
	AC_MSG_ERROR([*** Can't find libX11]),$X_LIBS $X_EXTRA_LIBS)

mysavedCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [], [], [
#include <X11/Xlib.h>
])
CPPFLAGS="$mysavedCPPFLAGS"

AC_CHECK_LIB(Xext, XMissingExtension, [X_LIBS="-lXext $X_LIBS"],,$X_LIBS $X_EXTRA_LIBS)
AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [X_LIBS="-lXinerama $X_LIBS"; AC_DEFINE(HAVE_LIBXINERAMA,1,[Xinerama])],,$X_LIBS $X_EXTRA_LIBS)
AC_CHECK_LIB(Xtst, XTestFakeButtonEvent, [X_LIBS="-lXtst $X_LIBS"; AC_DEFINE(HAVE_LIBXTST,1,[Xtst])],,$X_LIBS $X_EXTRA_LIBS)

AC_SUBST(X_LIBS)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(X_CFLAGS)

dnl Check for electric fence library
dnl AC_CHECK_LIB(efence,malloc,,)

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(unistd.h stdarg.h)

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.
AC_CHECK_FUNCS(getline getopt getopt_long setenv setpgid setpgrp setsid)
AC_CHECK_FUNCS(unsetenv usleep vsnprintf)

AM_LANGINFO_CODESET

AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile])
AC_OUTPUT