adding fix for solaris compilation
[bbkeys.git] / configure.in
blobbe224855166de3c270949bcc7f610a837a709247
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/bbkeys.cc)
3 AM_INIT_AUTOMAKE(bbkeys, 0.8.6)
4 AC_REQUIRE([AC_CANONICAL_HOST])
5 AM_MAINTAINER_MODE
6 AC_PREFIX_DEFAULT(/usr/local)
8 AC_CHECK_PROGS(regex_cmd, sed)
9 if test x$regex_cmd = "x"; then
10  AC_MSG_ERROR([error. sed is required to build the default bbtoolsrc file.])
13 dnl get the debug values right
14 AC_DEFUN(AC_SET_DEBUG,
16   _CFLAGS="-g -Wall -DDEBUG"
17   _CXXFLAGS="-g -Wall -DDEBUG"
18   _LDFLAGS=""
19   case $host_os in
20   [*solaris*)]
21     dnl On solaris, we get a ton of multiply-defined errors if we don't include
22     dnl this parameter
23     _LDFLAGS="$_LDFLAGS -z muldefs"
24     ;;
25   esac
26   test "$CFLAGS" = "" && CFLAGS=$_CFLAGS
27   test "$CXXFLAGS" = "" && CXXFLAGS=$_CXXFLAGS
28   test "$LDFLAGS" = "" && LDFLAGS=$_LDFLAGS
31 AC_DEFUN(AC_SET_NODEBUG,
33   _CFLAGS="-DNDEBUG"
34   _CXXFLAGS="-DNDEBUG"
35   _LDFLAGS="-s"
36   case $host_os in
37   [*solaris*)]
38      _CFLAGS="$_CFLAGS -O"
39      _CXXFLAGS="$_CXXFLAGS -O"
40      dnl On solaris, we get a ton of multiply-defined errors if we don't include
41      dnl this parameter
42      _LDFLAGS="$_LDFLAGS -z muldefs"
43      ;;
44   [*)]
45      _CFLAGS="$_CFLAGS -O2"
46      _CXXFLAGS="$_CXXFLAGS -O2"
47      ;;
48   esac
49   test "$CFLAGS" = "" && CFLAGS=$_CFLAGS
50   test "$CXXFLAGS" = "" && CXXFLAGS=$_CXXFLAGS
51   test "$LDFLAGS" = "" && LDFLAGS=$_LDFLAGS
54 AC_ARG_ENABLE(debug,[  --enable-debug   create debugging code [default=no]],
56 if test $enableval = "no";
57  then AC_SET_NODEBUG
58  else AC_SET_DEBUG
61 AC_SET_NODEBUG)
63 dnl Check for Interlacing
64 INTERLACE=""
65 AC_MSG_CHECKING([whether to include interlacing image code])
66 AC_ARG_ENABLE(
67   interlace, [  --enable-interlace      include code for image interlacing[default=yes]],
68   if test x$enableval = "xyes"; then
69     AC_MSG_RESULT([yes])
70     INTERLACE="-DINTERLACE"
71   else
72     AC_MSG_RESULT([no])
73   fi,
74   AC_MSG_RESULT([yes])
75   INTERLACE="-DINTERLACE"
77 AC_SUBST(INTERLACE)
79 dnl Checks for programs.
80 AC_PROG_CC
81 AC_PROG_CXX
82 AC_PROG_CPP
83 AC_PROG_AWK
84 AC_PROG_INSTALL
85 AC_PROG_LN_S
86 AC_PROG_MAKE_SET
87 AC_PROG_RANLIB
89 dnl minimum version we can live with
90 PERL_VERSION=5.004
91 dnl check for perl for our command-line configurator
92 AC_PATH_PROGS(PERL, $PERL perl5 perl )
93 if test -z "$PERL" || test "$PERL" = ":"; then
94     AC_MSG_ERROR([perl not found in \$PATH])
97 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
98 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
99 _perl_res=$?
100 AC_MSG_RESULT([$_perl_version])
102 if test "$_perl_res" != 0; then
103     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
106 AC_MSG_CHECKING([for full perl installation])
107 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
108 _perl_res=$?
109 if test "$_perl_res" != 0; then
110     AC_MSG_RESULT([no])
111     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
112 else
113     AC_MSG_RESULT([yes])    
117 # Checks for header files.
118 AC_PATH_X
119 AC_PATH_XTRA
120 AC_HEADER_STDC
121 AC_HEADER_SYS_WAIT
122 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)
124 # Checks for typedefs, structures, and compiler characteristics.
125 AC_C_CONST
126 AC_C_INLINE
127 AC_HEADER_TIME
128 AC_STRUCT_TM
130 # Checks for library functions.
131 dnl AC_FUNC_FORK
132 dnl AC_FUNC_MALLOC
133 AC_TYPE_SIGNAL
134 dnl AC_FUNC_STAT
135 AC_CHECK_FUNCS(setlocale sigaction strftime gettimeofday memset strcasecmp strchr strcspn strdup strncasecmp select strstr)
138 CFLAGS="$CFLAGS $X_CFLAGS"
139 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
140 LDFLAGS="$LDFLAGS $X_LIBS $X_PRE_LIBS"
141 dnl Checks for X libraries.
142 AC_CHECK_LIB(X11, XOpenDisplay, LIBS="-lX11",
143              AC_MSG_ERROR(XOpenDisplay not found in -lX11))
145 LIBS="-lX11"
147 dnl generate the config header
148 AM_CONFIG_HEADER(config.h) 
150 AC_OUTPUT( \
151 version.h \
152 Makefile \
153 src/Makefile \
154 src/bbkeysconf.pl \
155 data/Makefile \
156 doc/Makefile \
157 doc/bbkeys.1 \
158 redhat/Makefile \
159 redhat/bbkeys.spec \