tmux/configure

311 lines
7.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# $Id: configure,v 1.56 2010-10-27 21:40:03 nicm Exp $
#
# Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
2009-05-14 00:34:25 +00:00
TMUX_PLATFORM=${TMUX_PLATFORM:-`uname -s`}
CONFIG_H=config.h
rm -f $CONFIG_H
echo "/* $TMUX_PLATFORM */" >$CONFIG_H
CONFIG_MK=config.mk
rm -f $CONFIG_MK
echo "# $TMUX_PLATFORM" >$CONFIG_MK
cat <<EOF >>$CONFIG_H
#undef HAVE_ASPRINTF
2009-09-02 12:30:56 +00:00
#undef HAVE_BROKEN_CMSG_FIRSTHDR
#undef HAVE_BROKEN_CURSES_H
#undef HAVE_BROKEN_KQUEUE
#undef HAVE_BROKEN_POLL
2009-08-20 12:25:17 +00:00
#undef HAVE_BZERO
2010-10-27 20:21:01 +00:00
#undef HAVE_CLOSEFROM
#undef HAVE_DAEMON
2010-10-27 20:21:01 +00:00
#undef HAVE_DIRFD
#undef HAVE_FCNTL_CLOSEM
#undef HAVE_FGETLN
#undef HAVE_FORKPTY
#undef HAVE_GETOPT
#undef HAVE_IMSG
#undef HAVE_LIBUTIL_H
#undef HAVE_PATHS_H
2010-10-27 20:21:01 +00:00
#undef HAVE_PROC_PID
#undef HAVE_PROGNAME
#undef HAVE_PTY_H
#undef HAVE_QUEUE_H
#undef HAVE_SETPROCTITLE
#undef HAVE_STDINT_H
2009-07-02 07:31:02 +00:00
#undef HAVE_STRCASESTR
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
2009-08-16 16:15:53 +00:00
#undef HAVE_STRSEP
#undef HAVE_STRTONUM
#undef HAVE_TREE_H
#undef HAVE_UTIL_H
2009-08-20 12:49:18 +00:00
#undef HAVE_U_INT
2009-06-25 20:27:32 +00:00
#undef HAVE_VIS
EOF
case $TMUX_PLATFORM in
# ------------------------------------------------------------------------------
OpenBSD)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_BITSTRING_H
2009-08-20 12:25:17 +00:00
#define HAVE_BZERO
2010-10-27 20:21:01 +00:00
#define HAVE_CLOSEFROM
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_IMSG
#define HAVE_PATHS_H
#define HAVE_PROGNAME
#define HAVE_QUEUE_H
#define HAVE_SETENV
#define HAVE_SETPROCTITLE
#define HAVE_STDINT_H
2009-07-02 07:31:02 +00:00
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
2009-08-16 16:15:53 +00:00
#define HAVE_STRSEP
#define HAVE_STRTONUM
#define HAVE_TREE_H
#define HAVE_UTIL_H
2009-08-20 12:49:18 +00:00
#define HAVE_U_INT
2009-06-25 20:27:32 +00:00
#define HAVE_VIS
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses -lutil -levent
SRCS+= osdep-openbsd.c
EOF
;;
# ------------------------------------------------------------------------------
Linux)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
2009-08-20 12:25:17 +00:00
#define HAVE_BZERO
#define HAVE_DAEMON
2010-10-27 20:21:01 +00:00
#define HAVE_DIRFD
#define HAVE_FORKPTY
#define HAVE_PATHS_H
2010-10-27 20:21:01 +00:00
#define HAVE_PROC_PID
#define HAVE_PROGNAME
#define HAVE_PTY_H
#define HAVE_SETENV
#define HAVE_STDINT_H
2009-07-02 07:31:02 +00:00
#define HAVE_STRCASESTR
2009-08-16 16:15:53 +00:00
#define HAVE_STRSEP
2009-08-20 12:49:18 +00:00
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
CFLAGS+= -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE
LIBS+= -lncurses -lutil -levent
SRCS+= osdep-linux.c \
2010-10-27 20:21:01 +00:00
compat/closefrom.c \
compat/fgetln.c \
compat/strlcat.c \
compat/strlcpy.c \
compat/strtonum.c \
2010-10-27 20:21:01 +00:00
compat/getopt.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
AIX)
cat <<EOF >>$CONFIG_H
2009-08-20 12:25:17 +00:00
#define HAVE_BZERO
#define HAVE_DAEMON
#define HAVE_SETENV
#define HAVE_STDINT_H
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses -levent
SRCS+= osdep-unknown.c \
compat/asprintf.c \
2010-10-27 20:21:01 +00:00
compat/closefrom.c \
compat/daemon.c \
compat/forkpty-aix.c \
2009-07-02 07:31:02 +00:00
compat/strcasestr.c \
compat/strlcat.c \
compat/strlcpy.c \
2009-08-16 16:15:53 +00:00
compat/strsep.c \
compat/strtonum.c \
compat/fgetln.c \
2009-06-25 20:27:32 +00:00
compat/getopt.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
SunOS)
cat <<EOF >>$CONFIG_H
2010-10-27 20:21:01 +00:00
#define HAVE_CLOSEFROM
#define HAVE_STRLCAT
#define HAVE_STRLCPY
EOF
cat <<EOF >>$CONFIG_MK
CFLAGS+= -D_XPG4_2 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
LIBS+= -lcurses -lsocket -lnsl -levent
SRCS+= osdep-sunos.c \
compat/asprintf.c \
compat/daemon.c \
compat/fgetln.c \
compat/forkpty-sunos.c \
compat/getopt.c \
compat/setenv.c \
2009-07-02 07:31:02 +00:00
compat/strcasestr.c \
2009-08-16 16:15:53 +00:00
compat/strsep.c \
2009-06-25 20:27:32 +00:00
compat/strtonum.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
2010-06-05 18:14:29 +00:00
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
Darwin)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
2009-09-02 12:30:56 +00:00
#define HAVE_BROKEN_CMSG_FIRSTHDR
#define HAVE_BROKEN_KQUEUE
#define HAVE_BROKEN_POLL
2009-08-20 12:25:17 +00:00
#define HAVE_BZERO
#define HAVE_DAEMON
2010-10-27 20:21:01 +00:00
#define HAVE_DIRFD
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_PATHS_H
2010-10-27 20:21:01 +00:00
#define HAVE_PROC_PID
#define HAVE_PROGNAME
#define HAVE_SETENV
2010-10-27 20:21:01 +00:00
#define HAVE_STDINT_H
2009-07-02 07:31:02 +00:00
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
2009-08-16 16:15:53 +00:00
#define HAVE_STRSEP
#define HAVE_UTIL_H
2009-08-20 12:49:18 +00:00
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
CPPFLAGS+= -I/opt/local/include
LDFLAGS+= -L/opt/local/lib
LIBS+= -lcurses -levent
SRCS+= osdep-darwin.c \
2010-10-27 20:21:01 +00:00
compat/closefrom.c \
2009-06-25 20:27:32 +00:00
compat/strtonum.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
FreeBSD|DragonFly)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
2010-04-05 22:28:25 +00:00
#define HAVE_BROKEN_KQUEUE
2009-08-20 12:25:17 +00:00
#define HAVE_BZERO
2010-10-27 20:21:01 +00:00
#define HAVE_CLOSEFROM
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
2009-05-13 23:45:26 +00:00
#define HAVE_LIBUTIL_H
#define HAVE_PATHS_H
#define HAVE_PROGNAME
#define HAVE_SETENV
#define HAVE_SETPROCTITLE
#define HAVE_STDINT_H
2009-07-02 07:31:02 +00:00
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
2009-08-16 16:15:53 +00:00
#define HAVE_STRSEP
2010-10-27 20:21:01 +00:00
#define HAVE_STRTONUM
2009-08-20 12:49:18 +00:00
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses -lutil -levent
SRCS+= osdep-freebsd.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
NetBSD)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
2009-08-20 12:25:17 +00:00
#define HAVE_BZERO
2010-10-27 20:21:01 +00:00
#define HAVE_CLOSEFROM
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_PATHS_H
#define HAVE_PROGNAME
#define HAVE_SETENV
2010-10-27 20:21:01 +00:00
#define HAVE_SETPROCTITLE
#define HAVE_STDINT_H
2009-07-02 07:31:02 +00:00
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
2009-08-16 16:15:53 +00:00
#define HAVE_STRSEP
#define HAVE_UTIL_H
2009-08-20 12:49:18 +00:00
#define HAVE_U_INT
EOF
# NetBSD-6 has its own terminfo implementation
if test -f /lib/libterminfo.so; then
cat <<EOF >>$CONFIG_MK
LIBS+= -lterminfo
EOF
else
cat <<EOF >>$CONFIG_MK
CPPFLAGS+= -I/usr/pkg/include
LDFLAGS+= -L/usr/pkg/lib
LIBS+= -lncurses
EOF
cat <<EOF >>$CONFIG_H
#define HAVE_BROKEN_CURSES_H
EOF
fi
cat <<EOF >>$CONFIG_MK
LIBS+= -lutil -levent
SRCS+= osdep-netbsd.c \
compat/strtonum.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
2009-05-14 00:34:25 +00:00
*)
echo Unable to configure for $TMUX_PLATFORM
2009-05-14 00:34:25 +00:00
exit 1
esac
echo Configured for $TMUX_PLATFORM
2009-05-14 00:34:25 +00:00
exit 0