summaryrefslogtreecommitdiffstats
path: root/configure
blob: 224b2b28db6b7915d267b7e8272c6380db114d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#! /bin/sh

CC="gcc"
CXX="g++"
CCFLAGS="$CCFLAGS -Wall -g"
OPTIM="$OPTIM -O3 -funroll-loops"
LINKLIBS="-lz -lbz2"
MAKE=make

# System-specific flags
SYSTEM=`uname -s`
case $SYSTEM in
  BeOS)
    CCFLAGS="$CCFLAGS -Wno-multichar"
    DEFINES="$DEFINES SYS_BEOS"
    LINKLIBS="$LINKLIBS -lbe -ltracker"

    RELEASE=`uname -r`
    case $RELEASE in
      6.0|5.0.4) # Zeta or R5 / BONE beta 7
        SYSTEM="$SYSTEM / BONE"
        LINKLIBS="$LINKLIBS -lbind -lsocket"
        ;;
      5.0*)      # R5 / net_server
        SYSTEM="$SYSTEM / net_server"
        DEFINES="$DEFINES BEOS_NETSERVER"
        LINKLIBS="$LINKLIBS -lnet"
        ;;
      *)
        echo "Unsupported BeOS version"
        exit 1 ;;
    esac
    ;;

  Darwin)
    DEFINES="$DEFINES SYS_DARWIN USE_PTHREAD"
    LINKLIBS="$LINKLIBS -lpthread"
    ;;

  FreeBSD)
    DEFINES="$DEFINES SYS_FREEBSD USE_PTHREAD"
    LINKLIBS="$LINKLIBS -pthread"
    ;;

  NetBSD)
    DEFINES="$DEFINES SYS_NETBSD USE_PTHREAD"
    LINKLIBS="$LINKLIBS -lpthread"
    ;;

  Linux)
    DEFINES="$DEFINES SYS_LINUX USE_PTHREAD _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64"
    LINKLIBS="$LINKLIBS -lpthread -ldl"
    ;;

  CYGWIN*)
    DEFINES="$DEFINES SYS_CYGWIN USE_PTHREAD"
    LINKLIBS="$LINKLIBS -lpthread"
    ;;
  SunOS)
    DEFINES="$DEFINES SYS_SunOS USE_PTHREAD _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64"
    LINKLIBS="$LINKLIBS -lpthread -lsocket -lnsl"
    ;;

  *)
    echo "Unsupported operating system"
    exit 1 ;;
esac
echo
echo "System: $SYSTEM"

# Check for endianness (we need to define WORDS_BIGENDIAN for libdvdread)
cat > testconf.c << EOF
int main()
{
    int i = 1;
    return *( (char *) &i );
}
EOF
if ( $CC -o testconf testconf.c && ./testconf ) > /dev/null 2>&1
then
  echo "Endian: big"
  DEFINES="$DEFINES WORDS_BIGENDIAN"
else
  echo "Endian: little"
fi
rm -f testconf.c testconf

#
# Use Gnu make when available over the built in make
#
if ( make --version | grep GNU ) > /dev/null 2>&1
then
MAKE=make
elif ( gmake --version | grep GNU ) > /dev/null 2>&1
then
MAKE=gmake
else
MAKE=make
fi

# Unless the user wants a release build, configure for SVN snapshots
if test "$1" = "--release" || test "$2" = "--release"; then
    SNAPSHOT=0
else
    SNAPSHOT=1
fi

# We fought the law and the law won
if test "$1" = "--libdvdcss" || test "$2" = "--libdvdcss"; then
    CSS=1
else
    CSS=0
fi

# Generating the HB_BUILD and HB_VERSION for snapshots requires
# the build date, working path, and current SVN revision. 
BUILD_DATE=`date +%Y%m%d`
FULL_PATH=`pwd`
SVN_REV=`svnversion`

# Generate config.jam
rm -f config.jam
cat << EOF > config.jam
CC       = $CC ;
C++      = $CXX ;
LINK     = $CXX ;
CCFLAGS  = $CCFLAGS ;
C++FLAGS = $CCFLAGS ;
OPTIM    = $OPTIM ;
DEFINES  = $DEFINES ;
LINKLIBS = $LINKLIBS ;
MAKE     = $MAKE ;
SNAPSHOT = $SNAPSHOT ;
BUILD_DATE = $BUILD_DATE ;
FULL_PATH = $FULL_PATH ;
SVN_REV = $SVN_REV ;
CSS      = $CSS ;
EOF

echo
echo "Don't run configure by hand, make runs it automatically."
echo
echo "No, really. That's it. Just type 'make' and hit return."
echo
echo "You're supposed to be building with make, not jam."
echo "If you were going to use jam--which you shouldn't--you'd run:"
echo " './jam' on a Mac, or"
echo " 'jam' on Linux or Windows"
echo
echo "To make jam, boil fruit with sugar and an acid until pectins are released."
echo