tmux/configure
Nicholas Marriott 15b643fc11 Sync from OpenBSD:
==
Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
==

This should fix problems caused by glibc's broken ttydefaults.h file.
2009-09-16 12:36:28 +00:00

267 lines
5.6 KiB
Bash
Executable File

#!/bin/sh
# $Id: configure,v 1.37 2009-09-16 12:36:27 nicm Exp $
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
#undef HAVE_BROKEN_CMSG_FIRSTHDR
#undef HAVE_BZERO
#undef HAVE_CRYPT_H
#undef HAVE_DAEMON
#undef HAVE_FGETLN
#undef HAVE_FORKPTY
#undef HAVE_GETOPT
#undef HAVE_IMSG
#undef HAVE_LIBUTIL_H
#undef HAVE_LOGIN_CAP
#undef HAVE_PATHS_H
#undef HAVE_POLL
#undef HAVE_PROGNAME
#undef HAVE_PTY_H
#undef HAVE_QUEUE_H
#undef HAVE_SETPROCTITLE
#undef HAVE_STRCASESTR
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
#undef HAVE_STRSEP
#undef HAVE_STRTONUM
#undef HAVE_TREE_H
#undef HAVE_UTIL_H
#undef HAVE_U_INT
#undef HAVE_VIS
EOF
case $TMUX_PLATFORM in
# ------------------------------------------------------------------------------
OpenBSD)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_BITSTRING_H
#define HAVE_BZERO
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_LOGIN_CAP
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_QUEUE_H
#define HAVE_SETPROCTITLE
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_STRSEP
#define HAVE_STRTONUM
#define HAVE_TREE_H
#define HAVE_UTIL_H
#define HAVE_U_INT
#define HAVE_VIS
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses -lutil
SRCS+= osdep-openbsd.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
Linux)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_BZERO
#define HAVE_DAEMON
#define HAVE_FORKPTY
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_PTY_H
#define HAVE_STRCASESTR
#define HAVE_STRSEP
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
CFLAGS+= -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE
LIBS+= -lncurses -lcrypt -lutil
SRCS+= osdep-linux.c \
compat/fgetln.c \
compat/strlcat.c \
compat/strlcpy.c \
compat/strtonum.c \
compat/getopt.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
AIX)
cat <<EOF >>$CONFIG_H
#define HAVE_BZERO
#define HAVE_DAEMON
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses
SRCS+= osdep-unknown.c \
compat/asprintf.c \
compat/bsd-poll.c \
compat/daemon.c \
compat/forkpty-aix.c \
compat/strcasestr.c \
compat/strlcat.c \
compat/strlcpy.c \
compat/strsep.c \
compat/strtonum.c \
compat/fgetln.c \
compat/getopt.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
SunOS)
cat <<EOF >>$CONFIG_H
#define HAVE_CRYPT_H
#define HAVE_POLL
#define HAVE_STRLCAT
#define HAVE_STRLCPY
EOF
cat <<EOF >>$CONFIG_MK
CPPFLAGS+= -I/usr/local/include/ncurses \
-I/opt/csw/include -I/opt/csw/include/ncurses \
-I/opt/sfw/include -I/opt/sfw/include/ncurses
CFLAGS+= -D_XPG4_2 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
LDFLAGS+= -L/usr/gnu/lib \
-L/opt/csw/lib \
-L/opt/sfw/lib
LIBS+= -lcurses -lsocket -lnsl
SRCS+= osdep-unknown.c \
compat/asprintf.c \
compat/daemon.c \
compat/fgetln.c \
compat/forkpty-sunos.c \
compat/getopt.c \
compat/strcasestr.c \
compat/strsep.c \
compat/strtonum.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
Darwin)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_BROKEN_CMSG_FIRSTHDR
#define HAVE_BZERO
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_PATHS_H
#define HAVE_PROGNAME
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_STRSEP
#define HAVE_UTIL_H
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses
SRCS+= osdep-darwin.c \
compat/bsd-poll.c \
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
#define HAVE_BZERO
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_LIBUTIL_H
#define HAVE_LOGIN_CAP
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_SETPROCTITLE
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_STRTONUM
#define HAVE_STRSEP
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
LIBS+= -lcurses -lcrypt -lutil
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
#define HAVE_BZERO
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_LOGIN_CAP
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_SETPROCTITLE
#define HAVE_STRCASESTR
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_STRSEP
#define HAVE_UTIL_H
#define HAVE_U_INT
EOF
cat <<EOF >>$CONFIG_MK
CPPFLAGS+= -I/usr/pkg/include
LDFLAGS+= -L/usr/pkg/lib
LIBS+= -lncurses -lcrypt -lutil
SRCS+= osdep-netbsd.c \
compat/strtonum.c \
compat/vis.c \
compat/unvis.c \
compat/imsg-buffer.c \
compat/imsg.c
EOF
;;
# ------------------------------------------------------------------------------
*)
echo Unable to configure for $TMUX_PLATFORM
exit 1
esac
echo Configured for $TMUX_PLATFORM
exit 0