tmux/configure
2009-05-18 19:18:41 +00:00

205 lines
4.3 KiB
Bash
Executable File

#!/bin/sh
# $Id: configure,v 1.13 2009-05-18 19:18:41 nicm Exp $
TMUX_PLATFORM=${TMUX_PLATFORM:-`uname -s`}
CONFIG_H=config.h
echo "/* $TMUX_PLATFORM */" >|$CONFIG_H
CONFIG_MK=config.mk
echo "# $TMUX_PLATFORM" >|$CONFIG_MK
cat <<EOF >>$CONFIG_H
#undef HAVE_ASPRINTF
#undef HAVE_CRYPT_H
#undef HAVE_DAEMON
#undef HAVE_FGETLN
#undef HAVE_FORKPTY
#undef HAVE_GETOPT
#undef HAVE_LIBUTIL_H
#undef HAVE_PATHS_H
#undef HAVE_POLL
#undef HAVE_PROGNAME
#undef HAVE_PTY_H
#undef HAVE_QUEUE_H
#undef HAVE_SETPROCTITLE
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
#undef HAVE_STRTONUM
#undef HAVE_TREE_H
#undef HAVE_UTIL_H
#undef HAVE_VSYSLOG
EOF
case $TMUX_PLATFORM in
# ------------------------------------------------------------------------------
OpenBSD)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_QUEUE_H
#define HAVE_SETPROCTITLE
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_STRTONUM
#define HAVE_TREE_H
#define HAVE_UTIL_H
#define HAVE_VSYSLOG
EOF
cat <<EOF >>$CONFIG_MK
SRCS+= osdep-openbsd.c
LIBS+= -lutil
EOF
;;
# ------------------------------------------------------------------------------
Linux)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_DAEMON
#define HAVE_FORKPTY
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_PTY_H
#define HAVE_VSYSLOG
EOF
cat <<EOF >>$CONFIG_MK
SRCS+= osdep-linux.c \
compat/fgetln.c \
compat/strlcat.c \
compat/strlcpy.c \
compat/strtonum.c \
compat/getopt.c
CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE
LIBS+= -lcrypt -lutil
EOF
;;
# ------------------------------------------------------------------------------
AIX)
cat <<EOF >>$CONFIG_H
#define HAVE_DAEMON
EOF
cat <<EOF >>$CONFIG_MK
CPPFLAGS+= -I/usr/local/include/ncurses
SRCS+= osdep-unknown.c \
compat/asprintf.c \
compat/bsd-poll.c \
compat/daemon.c \
compat/forkpty-aix.c \
compat/strlcat.c \
compat/strlcpy.c \
compat/strtonum.c \
compat/fgetln.c \
compat/getopt.c
EOF
;;
# ------------------------------------------------------------------------------
SunOS)
cat <<EOF >>$CONFIG_H
#define HAVE_CRYPT_H
#define HAVE_POLL
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_VSYSLOG
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
LDFLAGS+= -L/usr/gnu/lib \
-L/opt/csw/lib \
-L/opt/sfw/lib
LIBS+= -lsocket -lnsl
SRCS+= osdep-unknown.c \
compat/asprintf.c \
compat/daemon.c \
compat/fgetln.c \
compat/forkpty-sunos.c \
compat/getopt.c \
compat/strtonum.c
EOF
;;
# ------------------------------------------------------------------------------
Darwin)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_PATHS_H
#define HAVE_PROGNAME
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_UTIL_H
#define HAVE_VSYSLOG
EOF
cat <<EOF >>$CONFIG_MK
SRCS+= osdep-darwin.c \
compat/bsd-poll.c \
compat/strtonum.c
EOF
;;
# ------------------------------------------------------------------------------
FreeBSD|DragonFly)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_LIBUTIL_H
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_SETPROCTITLE
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_STRTONUM
#define HAVE_VSYSLOG
EOF
cat <<EOF >>$CONFIG_MK
SRCS+= osdep-freebsd.c
LIBS+= -lcrypt -lutil
EOF
;;
# ------------------------------------------------------------------------------
NetBSD)
cat <<EOF >>$CONFIG_H
#define HAVE_ASPRINTF
#define HAVE_DAEMON
#define HAVE_FGETLN
#define HAVE_FORKPTY
#define HAVE_GETOPT
#define HAVE_PATHS_H
#define HAVE_POLL
#define HAVE_PROGNAME
#define HAVE_SETPROCTITLE
#define HAVE_STRLCAT
#define HAVE_STRLCPY
#define HAVE_UTIL_H
#define HAVE_VSYSLOG
EOF
cat <<EOF >>$CONFIG_MK
SRCS+= osdep-netbsd.c \
compat/strtonum.c
LIBS+= -lcrypt -lutil
CPPFLAGS+= -I/usr/pkg/include
LDFLAGS+= -L/usr/pkg/lib
EOF
;;
# ------------------------------------------------------------------------------
*)
echo Unable to configure for $TMUX_PLATFORM
exit 1
esac
echo Configured for $TMUX_PLATFORM
exit 0