turn on openssl
[rofl0r-ixchat.git] / configure
blob2345d0024d090fffc9b798997e6aed4204134e8a
1 #!/bin/sh
3 prefix=/usr/local
5 libs=`cat << EOF
6 glib-2.0
7 gtk+-2.0
8 openssl
9 EOF
13 clear_config() {
14 rm config.mak
17 add_config() {
18 printf "%s\n" "$1" >> config.mak
21 add_cflags() {
22 add_config "CFLAGS += $1"
25 add_ldflags() {
26 add_config "LDFLAGS += $1"
29 add_pkgconf_cflags() {
30 flags=$(pkg-config --cflags "$1")
31 add_cflags "$flags"
34 add_pkgconf_ldflags() {
35 flags=$(pkg-config --libs "$1")
36 add_ldflags "$flags"
39 add_lib() {
40 add_pkgconf_cflags "$1"
41 add_pkgconf_ldflags "$1"
44 check_program() {
45 program="$1"
46 needed="$2"
47 result=$(which "$program" 2>/dev/null)
48 if [ "$needed" = "1" ] && [ -z "$result" ] ; then
49 echo "error: needed program $program not found"
50 exit 1
52 printf "%s\n" "$program"
55 usage() {
56 echo "supported arguments"
57 echo "--prefix=/path default: $prefix"
58 echo "--exec_prefix=/path default: $prefix/bin"
59 echo "--bindir=/path default: $prefix/bin"
60 echo "--libdir=/path default: $prefix/lib"
61 echo "--includedir=/path default: $prefix/include"
62 echo "--sysconfdir=/path default: $prefix/etc"
63 echo "--help : show this text"
64 exit 1
67 spliteq() {
68 arg=$1
69 echo "${arg#*=}"
70 #alternatives echo "$arg" | cut -d= -f2-
71 # or echo "$arg" | sed 's/[^=]*=//'
74 parsearg() {
75 case "$1" in
76 --prefix=*) prefix=`spliteq $1`;;
77 --exec_prefix=*) exec_prefix=`spliteq $1`;;
78 --bindir=*) bindir=`spliteq $1`;;
79 --libdir=*) libdir=`spliteq $1`;;
80 --includedir=*) includedir=`spliteq $1`;;
81 --sysconfdir=*) sysconfdir=`spliteq $1`;;
82 --help) usage;;
83 esac
86 while true ; do
87 case $1 in
88 -*) parsearg "$1"; shift;;
89 *) break ;;
90 esac
91 done
93 [ -z "$exec_prefix" ] && exec_prefix=$prefix
94 [ -z "$libdir" ] && libdir=$prefix/lib
95 [ -z "$includedir" ] && includedir=$prefix/include
96 [ -z "$sysconfdir" ] && sysconfdir=$prefix/etc
97 [ -z "$bindir" ] && bindir=$exec_prefix/bin
98 [ -z "$CC" ] && CC=cc
100 clear_config
102 add_config "prefix = $prefix"
103 add_config "exec_prefix = $exec_prefix"
104 add_config "bindir = $bindir"
105 add_config "libdir = $libdir"
106 add_config "includedir = $includedir"
107 add_config "sysconfdir = $sysconfdir"
109 add_config "CC ?= $CC"
110 [ -z "$CPPFLAGS" ] || add_config "CPPFLAGS ?= $CPPFLAGS"
111 [ -z "$CFLAGS" ] || add_config "CFLAGS ?= $CFLAGS"
113 add_cflags "-DXCHATLIBDIR=\\\"$libdir/xchat\\\""
114 add_cflags "-DXCHATSHAREDIR=\\\"$prefix/share/xchat\\\""
115 add_cflags "-DUSE_OPENSSL"
117 for lib in $libs ; do add_lib "$lib" ; done
119 prog1=$(check_program "gdk-pixbuf-csource" 1)
120 add_config "PIXMAPCONVERT = $prog1"
122 echo done, now run make \&\& make install