configure
author James Callahan <james@chatid.com>
Mon, 03 Jun 2013 12:50:37 -0400
changeset 5641 92ffddd02c96
parent 5422 396072d62695
child 5935 a367bae38385
permissions -rwxr-xr-x
configure: Fix poor layout
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     2
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     3
# Defaults
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     4
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     5
PREFIX=/usr/local
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     6
SYSCONFDIR="$PREFIX/etc/prosody"
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
     7
DATADIR="$PREFIX/var/lib/prosody"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     8
LUA_SUFFIX=""
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     9
LUA_DIR="/usr"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    10
LUA_BINDIR="/usr/bin"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    11
LUA_INCDIR="/usr/include"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    12
LUA_LIBDIR="/usr/lib"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    13
IDN_LIB=idn
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
    14
ICU_FLAGS="-licui18n -licudata -licuuc"
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
    15
OPENSSL_LIB=crypto
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
    16
CC=gcc
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
    17
CXX=g++
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
    18
LD=gcc
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
    19
RUNWITH=lua
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    20
802
33c012048492 Add -Wall to default CFLAGS
Matthew Wild <mwild1@gmail.com>
parents: 798
diff changeset
    21
CFLAGS="-fPIC -Wall"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
    22
LDFLAGS="-shared"
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    23
3764
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
    24
IDN_LIBRARY=idn
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    25
# Help
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    26
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    27
show_help() {
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    28
cat <<EOF
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    29
Configure Prosody prior to building.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    30
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    31
--help                      This help.
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    32
--ostype=OS                 Use one of the OS presets.
3306
59d56fd49e38 configure: Add ostype preset for FreeBSD (thanks dersd and tobias (no, the other one))
Matthew Wild <mwild1@gmail.com>
parents: 3051
diff changeset
    33
                            May be one of: debian, macosx, linux, freebsd
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    34
--prefix=DIR                Prefix where Prosody should be installed.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    35
                            Default is $PREFIX
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    36
--sysconfdir=DIR            Location where the config file should be installed.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    37
                            Default is \$PREFIX/etc/prosody
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
    38
--datadir=DIR               Location where the server data should be stored.
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
    39
                            Default is \$PREFIX/var/lib/prosody
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    40
--lua-suffix=SUFFIX         Versioning suffix to use in Lua filenames.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    41
                            Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    42
--with-lua=PREFIX           Use Lua from given prefix.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    43
                            Default is $LUA_DIR
5421
a3f0fe9431cf configure: Add RUNWITH to --help
Kim Alvefur <zash@zash.se>
parents: 5401
diff changeset
    44
--runwith=BINARY            What Lua binary to set as runtime environment.
a3f0fe9431cf configure: Add RUNWITH to --help
Kim Alvefur <zash@zash.se>
parents: 5401
diff changeset
    45
                            Default is $RUNWITH
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    46
--with-lua-include=DIR      You can also specify Lua's includes dir.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    47
                            Default is \$LUA_DIR/include
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    48
--with-lua-lib=DIR          You can also specify Lua's libraries dir.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    49
                            Default is \$LUA_DIR/lib
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    50
--with-idn=LIB              The name of the IDN library to link with.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    51
                            Default is $IDN_LIB
5422
396072d62695 configure: Replaces tabs with spaces in --help
Kim Alvefur <zash@zash.se>
parents: 5421
diff changeset
    52
--idn-library=(idn|icu)     Select library to use for IDNA functionality.
396072d62695 configure: Replaces tabs with spaces in --help
Kim Alvefur <zash@zash.se>
parents: 5421
diff changeset
    53
                            idn: use GNU libidn (default)
396072d62695 configure: Replaces tabs with spaces in --help
Kim Alvefur <zash@zash.se>
parents: 5421
diff changeset
    54
                            icu: use ICU from IBM
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    55
--with-ssl=LIB              The name of the SSL to link with.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    56
                            Default is $OPENSSL_LIB
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    57
--cflags=FLAGS              Flags to pass to the compiler
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    58
                            Default is $CFLAGS
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
    59
--ldflags=FLAGS             Flags to pass to the linker
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
    60
                            Default is $LDFLAGS
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
    61
--c-compiler=CC             The C compiler to use when building modules.
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
    62
                            Default is $CC
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
    63
--linker=CC                 The linker to use when building modules.
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
    64
                            Default is $LD
4451
70275ab52ab2 configure: Add 'openbsd' preset (thanks xavier)
Matthew Wild <mwild1@gmail.com>
parents: 4444
diff changeset
    65
--require-config            Will cause Prosody to refuse to run when
70275ab52ab2 configure: Add 'openbsd' preset (thanks xavier)
Matthew Wild <mwild1@gmail.com>
parents: 4444
diff changeset
    66
                            it fails to find a configuration file
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    67
EOF
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    68
}
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    69
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    70
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    71
while [ "$1" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    72
do
3050
76f0d653b347 configure: Fix to allow option values containing '=' (thanks Jakub)
Matthew Wild <mwild1@gmail.com>
parents: 1081
diff changeset
    73
   value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    74
   if echo "$value" | grep -q "~"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    75
   then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    76
      echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    77
      echo '*WARNING*: the "~" sign is not expanded in flags.'
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    78
      echo 'If you mean the home directory, use $HOME instead.'
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    79
      echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    80
   fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    81
   case "$1" in
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    82
   --help)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    83
      show_help
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    84
      exit 0
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    85
      ;;
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    86
   --prefix=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    87
      PREFIX="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    88
      PREFIX_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    89
      ;;
1063
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
    90
   --sysconfdir=*)
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
    91
      SYSCONFDIR="$value"
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
    92
      SYSCONFDIR_SET=yes
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
    93
      ;;
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    94
   --ostype=*)
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    95
      OSTYPE="$value"
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
    96
      OSTYPE_SET=yes
5641
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
    97
      if [ "$OSTYPE" = "debian" ]; then
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
    98
        LUA_SUFFIX="5.1";
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
    99
      	LUA_SUFFIX_SET=yes
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   100
      	RUNWITH="lua5.1"
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   101
      	LUA_INCDIR=/usr/include/lua5.1;
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   102
      	LUA_INCDIR_SET=yes
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   103
      	CFLAGS="$CFLAGS -D_GNU_SOURCE"
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   104
    	fi
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   105
    	if [ "$OSTYPE" = "macosx" ]; then
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   106
        LUA_INCDIR=/usr/local/include;
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   107
      	LUA_INCDIR_SET=yes
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   108
      	LUA_LIBDIR=/usr/local/lib
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   109
      	LUA_LIBDIR_SET=yes
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   110
      	LDFLAGS="-bundle -undefined dynamic_lookup"
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   111
    	fi
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   112
      if [ "$OSTYPE" = "linux" ]; then
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   113
        LUA_INCDIR=/usr/local/include;
3352
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   114
        LUA_INCDIR_SET=yes
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   115
        LUA_LIBDIR=/usr/local/lib
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   116
        LUA_LIBDIR_SET=yes
5641
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   117
        CFLAGS="-Wall -fPIC -D_GNU_SOURCE"
3352
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   118
        LDFLAGS="-shared"
5641
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   119
      fi
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   120
      if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   121
        LUA_INCDIR="/usr/local/include/lua51"
3352
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   122
        LUA_INCDIR_SET=yes
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   123
        CFLAGS="-Wall -fPIC -I/usr/local/include"
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   124
        LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   125
        LUA_SUFFIX="-5.1"
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   126
        LUA_SUFFIX_SET=yes
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   127
        LUA_DIR=/usr/local
770e27bf11ea configure: Make it possible to override ostype presets with values specified later on the command-line
Matthew Wild <mwild1@gmail.com>
parents: 3351
diff changeset
   128
        LUA_DIR_SET=yes
5641
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   129
      fi
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   130
      if [ "$OSTYPE" = "openbsd" ]; then
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   131
        LUA_INCDIR="/usr/local/include";
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   132
      fi
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
   133
      ;;
1081
d41e88b07225 configure: Change --data-dir to --datadir to make consistent with help and other dir flags
Matthew Wild <mwild1@gmail.com>
parents: 1063
diff changeset
   134
   --datadir=*)
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   135
   	DATADIR="$value"
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   136
   	DATADIR_SET=yes
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   137
      ;;
4451
70275ab52ab2 configure: Add 'openbsd' preset (thanks xavier)
Matthew Wild <mwild1@gmail.com>
parents: 4444
diff changeset
   138
   --require-config)
70275ab52ab2 configure: Add 'openbsd' preset (thanks xavier)
Matthew Wild <mwild1@gmail.com>
parents: 4444
diff changeset
   139
      REQUIRE_CONFIG=yes
70275ab52ab2 configure: Add 'openbsd' preset (thanks xavier)
Matthew Wild <mwild1@gmail.com>
parents: 4444
diff changeset
   140
      ;;
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   141
   --lua-suffix=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   142
      LUA_SUFFIX="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   143
      LUA_SUFFIX_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   144
      ;;
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   145
   --with-lua=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   146
      LUA_DIR="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   147
      LUA_DIR_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   148
      ;;
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   149
   --with-lua-include=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   150
      LUA_INCDIR="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   151
      LUA_INCDIR_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   152
      ;;
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   153
   --with-lua-lib=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   154
      LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   155
      ;;
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   156
   --with-idn=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   157
      IDN_LIB="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   158
      ;;
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   159
	--idn-library=*)
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   160
		IDN_LIBRARY="$value"
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   161
		;;
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   162
   --with-ssl=*)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   163
      OPENSSL_LIB="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   164
      ;;
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
   165
   --cflags=*)
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
   166
      CFLAGS="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   167
      ;;
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   168
   --ldflags=*)
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   169
      LDFLAGS="$value"
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   170
      ;;
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
   171
   --c-compiler=*)
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
   172
      CC="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   173
      ;;
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
   174
   --linker=*)
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
   175
      LD="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   176
      ;;
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
   177
   --runwith=*)
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
   178
      RUNWITH="$value"
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
   179
      ;;
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   180
   *)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   181
      echo "Error: Unknown flag: $1"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   182
      exit 1
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   183
      ;;
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   184
   esac
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   185
   shift
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   186
done
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   187
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   188
if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   189
then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   190
   if [ "$PREFIX" = "/usr" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   191
   then SYSCONFDIR=/etc/prosody
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   192
   else SYSCONFDIR=$PREFIX/etc/prosody
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   193
   fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   194
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   195
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   196
if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   197
then
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   198
   if [ "$PREFIX" = "/usr" ]
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   199
   then DATADIR=/var/lib/prosody
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   200
   else DATADIR=$PREFIX/var/lib/prosody
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   201
   fi
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   202
fi
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   203
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   204
find_program() {
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   205
   path="$PATH"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   206
   item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   207
   path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   208
   found="no"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   209
   while [ "$item" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   210
   do
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   211
      if [ -e "$item/$1" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   212
      then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   213
         found="yes"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   214
         break
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   215
      fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   216
      item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   217
      path="`echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p'`"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   218
   done
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   219
   if [ "$found" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   220
   then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   221
      echo "$item"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   222
   else
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   223
      echo ""
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   224
   fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   225
}
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   226
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   227
if [ "$LUA_SUFFIX_SET" != "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   228
then
467
66f145f5c932 Update Makefile to now pass config paths to prosody. Update prosody, modulemanager and connectionlisteners to obey these paths.
Matthew Wild <mwild1@gmail.com>
parents: 463
diff changeset
   229
   for suffix in "5.1" "51" ""
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   230
   do
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   231
      LUA_SUFFIX="$suffix"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   232
      if [ "$LUA_DIR_SET" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   233
      then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   234
         if [ -e "$LUA_DIR/bin/lua$suffix" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   235
         then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   236
            find_lua="$LUA_DIR"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   237
         fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   238
      else
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   239
         find_lua=`find_program lua$suffix`
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   240
      fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   241
      if [ "$find_lua" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   242
      then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   243
         echo "Lua interpreter found: $find_lua/lua$suffix..."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   244
         break
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   245
      fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   246
   done
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   247
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   248
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   249
if ! [ "$LUA_DIR_SET" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   250
then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   251
   echo -n "Looking for Lua... "
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   252
   if [ ! "$find_lua" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   253
   then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   254
      find_lua=`find_program lua$LUA_SUFFIX`
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   255
      echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   256
   fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   257
   if [ "$find_lua" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   258
   then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   259
      LUA_DIR=`dirname $find_lua`
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   260
      LUA_BINDIR="$find_lua"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   261
   else
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   262
      echo "lua$LUA_SUFFIX not found in \$PATH."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   263
      echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   264
      exit 1
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   265
   fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   266
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   267
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   268
if ! [ "$LUA_INCDIR_SET" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   269
then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   270
   LUA_INCDIR="$LUA_DIR/include"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   271
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   272
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   273
if ! [ "$LUA_LIBDIR_SET" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   274
then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   275
   LUA_LIBDIR="$LUA_DIR/lib"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   276
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   277
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   278
if [ "$LUA_DIR_SET" = "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   279
then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   280
   LUA_BINDIR="$LUA_DIR/bin"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   281
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   282
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   283
if [ "$IDN_LIBRARY" = "icu" ]
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   284
then
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   285
	IDNA_LIBS="$ICU_FLAGS"
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   286
	CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   287
fi
5641
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
   288
if [ "$IDN_LIBRARY" = "idn" ]
3764
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
   289
then
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
   290
	IDNA_LIBS="-l$IDN_LIB"
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
   291
fi
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
   292
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   293
echo -n "Checking Lua includes... "
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   294
lua_h="$LUA_INCDIR/lua.h"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   295
if [ -e "$lua_h" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   296
then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   297
   echo "lua.h found in $lua_h"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   298
else
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   299
   echo "lua.h not found (looked in $lua_h)"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   300
   echo "You may want to use the flag --with-lua-include. See --help."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   301
   exit 1
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   302
fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   303
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   304
find_helper() {
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   305
   explanation="$1"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   306
   shift
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   307
   tried="$*"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   308
   while [ "$1" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   309
   do
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   310
      found=`find_program "$1"`
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   311
      if [ "$found" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   312
      then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   313
         echo "$1 found at $found"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   314
         HELPER=$1
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   315
         return
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   316
      fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   317
      shift
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   318
   done
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   319
   echo "Could not find a $explanation. Tried: $tried."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   320
   echo "Make sure one of them is installed and available in your PATH."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   321
   exit 1
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   322
}
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   323
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   324
# Write config
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   325
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   326
echo "Writing configuration..."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   327
echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   328
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   329
cat <<EOF > config.unix
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   330
# This file was automatically generated by the configure script.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   331
# Run "./configure --help" for details.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   332
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   333
PREFIX=$PREFIX
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   334
SYSCONFDIR=$SYSCONFDIR
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
   335
DATADIR=$DATADIR
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   336
LUA_SUFFIX=$LUA_SUFFIX
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   337
LUA_DIR=$LUA_DIR
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   338
LUA_INCDIR=$LUA_INCDIR
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   339
LUA_LIBDIR=$LUA_LIBDIR
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   340
LUA_BINDIR=$LUA_BINDIR
4451
70275ab52ab2 configure: Add 'openbsd' preset (thanks xavier)
Matthew Wild <mwild1@gmail.com>
parents: 4444
diff changeset
   341
REQUIRE_CONFIG=$REQUIRE_CONFIG
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   342
IDN_LIB=$IDN_LIB
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   343
IDNA_LIBS=$IDNA_LIBS
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   344
OPENSSL_LIB=$OPENSSL_LIB
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
   345
CFLAGS=$CFLAGS
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
   346
LDFLAGS=$LDFLAGS
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
   347
CC=$CC
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
   348
CXX=$CXX
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
   349
LD=$LD
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
   350
RUNWITH=$RUNWITH
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   351
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   352
EOF
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   353
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   354
echo "Installation prefix: $PREFIX"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   355
echo "Prosody configuration directory: $SYSCONFDIR"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   356
echo "Using Lua from: $LUA_DIR"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   357
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   358
make clean > /dev/null 2> /dev/null
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   359
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   360
echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   361
echo "Done. You can now run 'make' to build."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
   362
echo