1 dnl Process this file with autoconf to produce a configure script.
2 dnl Minimum Autoconf version required.
3 AC_INIT([bbkeys], [1.0.0git], [http://bbkeys.sourceforge.net])
5 AC_CONFIG_SRCDIR([src/main.cpp])
8 AC_PREFIX_DEFAULT([/usr/local])
10 AC_CHECK_PROGS(regex_cmd, sed)
11 if test x$regex_cmd = "x"; then
12 AC_MSG_ERROR([error. sed is required to build the default bbtoolsrc file.])
15 dnl get the debug values right
16 AC_DEFUN([AC_SET_DEBUG],
18 _CFLAGS="-g -Wall -DDEBUG"
19 _CXXFLAGS="-g -Wall -DDEBUG"
23 dnl On solaris, we get a ton of multiply-defined errors if we don't include
25 _LDFLAGS="$_LDFLAGS -z muldefs"
28 test "$CFLAGS" = "" && CFLAGS=$_CFLAGS
29 test "$CXXFLAGS" = "" && CXXFLAGS=$_CXXFLAGS
30 test "$LDFLAGS" = "" && LDFLAGS=$_LDFLAGS
33 AC_DEFUN([AC_SET_NODEBUG],
41 _CXXFLAGS="$_CXXFLAGS -O"
42 dnl On solaris, we get a ton of multiply-defined errors if we don't include
44 _LDFLAGS="$_LDFLAGS -z muldefs"
47 _CFLAGS="$_CFLAGS -O2"
48 _CXXFLAGS="$_CXXFLAGS -O2"
51 test "$CFLAGS" = "" && CFLAGS=$_CFLAGS
52 test "$CXXFLAGS" = "" && CXXFLAGS=$_CXXFLAGS
53 test "$LDFLAGS" = "" && LDFLAGS=$_LDFLAGS
56 AC_ARG_ENABLE([debug],
57 [AS_HELP_STRING([--enable-debug],
58 [create debugging code @<:@default=no@:>@])],
60 if test $enableval = "no";
67 dnl Checks for programs.
76 dnl minimum version we can live with
78 dnl check for perl for our command-line configurator
79 AC_PATH_PROGS(PERL, $PERL perl5 perl )
80 if test -z "$PERL" || test "$PERL" = ":"; then
81 AC_MSG_ERROR([perl not found in \$PATH])
84 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
85 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
87 AC_MSG_RESULT([$_perl_version])
89 if test "$_perl_res" != 0; then
90 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
93 AC_MSG_CHECKING([for full perl installation])
94 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
96 if test "$_perl_res" != 0; then
98 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
104 # Checks for header files.
108 AC_CHECK_HEADERS(ctype.h strings.h fcntl.h libgen.h locale.h process.h signal.h stdio.h time.h errno.h unistd.h sys/signal.h sys/param.h sys/select.h sys/stat.h sys/time.h sys/types.h sys/wait.h stdlib.h string.h malloc.h)
110 # Checks for typedefs, structures, and compiler characteristics.
116 # Checks for library functions.
121 AC_CHECK_FUNCS(setlocale sigaction strftime gettimeofday memset strcasecmp strchr strcspn strdup strncasecmp select strstr)
123 dnl these have to be here for X tests...
124 CFLAGS="$CFLAGS $X_CFLAGS"
125 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
126 LDFLAGS="$LDFLAGS $X_LIBS $X_PRE_LIBS"
129 dnl Checks for X libraries.
130 AC_CHECK_LIB(X11, XOpenDisplay, LIBS="-lX11",
131 AC_MSG_ERROR(XOpenDisplay not found in -lX11))
133 dnl Checks for Xextension
134 AC_CHECK_LIB(Xext, XMissingExtension, LIBS="$LIBS -lXext",
135 AC_MSG_ERROR(XMissingExtension not found in -lXext))
137 dnl pkgconfig checks for blackbox library
138 PKG_CHECK_MODULES(LIBBT, libbt)
139 CXXFLAGS="$CXXFLAGS $LIBBT_CFLAGS"
140 LIBS="$LIBS $LIBBT_LIBS"
142 dnl generate the config header
143 AC_CONFIG_HEADERS([config.h])
160 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
162 AC_MSG_RESULT([Using '$prefix' for installation.])
163 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
164 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
165 AC_MSG_RESULT([Building with '$LDFLAGS' for linker flags.])
166 AC_MSG_RESULT([Building with '$LIBS' libraries.])