1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cboard, 0.7.5-dev, [Ben Kibbey <bjk@luxsci.net>])
4 AC_CONFIG_AUX_DIR(build)
6 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
7 AC_USE_SYSTEM_EXTENSIONS()
8 AM_CONFIG_HEADER([config.h])
9 AM_GNU_GETTEXT([external])
10 AM_GNU_GETTEXT_VERSION([0.19.8])
14 LDFLAGS="$LDFLAGS -flat_namespace -L/sw/lib"
15 CPPFLAGS="$CPPFLAGS -I/sw/include -L/sw/lib"
21 dnl Checks for programs.
31 dnl Checks for library functions.
37 AC_ARG_WITH(libperl, AC_HELP_STRING([--with-libperl], [PERL support.]),
38 want_libperl=yes, want_libperl=no)
40 AC_MSG_CHECKING([if PERL support is wanted])
41 AC_MSG_RESULT($want_libperl)
43 if test "$want_libperl" = "yes"; then
44 AC_CHECK_LIB(perl, perl_run, have_libperl=yes, have_libperl=no)
46 if test "$have_libperl" = "yes"; then
47 LIBPERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
49 if test $? -ne 0; then
50 AC_MSG_ERROR([Missing or incomplete PERL installation.])
53 AC_SUBST(LIBPERL_CFLAGS)
54 LIBPERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts`
55 AC_SUBST(LIBPERL_LDFLAGS)
56 AC_DEFINE([WITH_LIBPERL], 1, [Define if you want PERL support.])
58 AC_MSG_ERROR([Missing or incomplete PERL installation.])
62 AM_CONDITIONAL([WITH_LIBPERL], [test "$have_libperl" = "yes"])
63 dnl Checks for header files.
67 AC_CHECK_HEADERS([fcntl.h paths.h sys/socket.h limits.h sys/time.h unistd.h \
68 stdlib.h string.h strings.h wchar.h getopt.h sys/param.h \
69 regex.h stdarg.h paths.h])
70 AC_CHECK_HEADERS([err.h],, [AC_CHECK_FUNCS([fputs_unlocked putwc_unlocked \
73 AM_CONDITIONAL([NO_ERR_H], [test "x$ac_cv_header_err_h" = "xno"])
75 if test x"$ac_cv_header_err_h" = "xyes"; then
76 AC_MSG_CHECKING([for __progname])
77 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
80 extern char *__progname;
82 printf("%s\n", __progname);
83 ]])], [have_progname=yes], [have_progname=no])
84 AC_MSG_RESULT($have_progname)
85 if test x"$have_progname" = "xyes"; then
86 AC_DEFINE([HAVE_PROGNAME], 1, \
87 [Define if your system has __progname.])
91 AC_CHECK_HEADERS([glob.h])
92 if test x"$ac_cv_header_glob_h" = "xyes"; then
93 AC_MSG_CHECKING([if glob.h defines GLOB_NOMATCH])
94 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
98 ]])], [have_glob_nomatch=yes], [have_glob_nomatch=no])
99 AC_MSG_RESULT($have_glob_nomatch)
100 if test x"$have_glob_nomatch" = "xyes"; then
101 AC_DEFINE([HAVE_GLOB_NOMATCH], 1, \
102 [Define if glob.h defines GLOB_NOMATCH.])
106 dnl Checks for typedefs, structures, and compiler characteristics.
114 dnl Checks for library functions.
121 AC_FUNC_SELECT_ARGTYPES
125 AC_CHECK_FUNCS([bzero dup2 getcwd gethostbyname memset mkdir mkfifo regcomp \
126 select socket strcasecmp strdup strerror strrchr strstr \
127 vasprintf strsep strchr strncasecmp strpbrk putenv mkstemp])
129 AM_CONDITIONAL([NO_STRSEP], [test "x$ac_cv_func_strsep" = "xno"])
137 AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
138 [ac_cv_sys_debug=no])
139 AM_CONDITIONAL([WITH_DEBUG], [test "$ac_cv_sys_debug" = "yes"])
142 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
143 AC_DEBUG([$enableval]), AC_DEBUG)
145 AC_MSG_CHECKING([for Unix98 pty support])
146 if test -c "/dev/ptmx"; then
154 if test "x$have_ptmx" = "xyes"; then
156 AC_RUN_IFELSE([AC_LANG_SOURCE([[\
158 #include <sys/types.h>
159 #include <sys/stat.h>
166 if ((fd = open("/dev/ptmx", O_RDWR)) == -1)
169 if (ptsname(fd) == NULL)
174 ]])], [ptmx_works=yes], [ptmx_works=no])
176 if test "x$ptmx_works" = "xyes"; then
178 AC_DEFINE([UNIX98], 1, [Define if your system has Unix98 pty support.])
184 if test "x$have_ptmx" = "xno" -o "x$ptmx_works" = "xno"; then
185 # From the GNU Screen package.
186 AC_MSG_CHECKING([pty ranges])
187 if test -d /dev/ptym; then
193 ptys=`echo $pdir/pty??`
195 if test "$ptys" != "$pdir/pty??" ; then
196 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
197 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
199 AC_DEFINE_UNQUOTED([PTY_MAJOR], "$p0", [Pseudo tty ranges.])
200 AC_DEFINE_UNQUOTED([PTY_MINOR], "$p1", [Pseudo tty ranges.])
201 AC_MSG_RESULT($p0 $p1)
205 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile \
206 libchess/Makefile po/Makefile.in doc/cboard.6])