12 rm -f config.mak
2>/dev
/null
16 printf "%s\n" "$1" >> config.mak
20 add_config
"CFLAGS += $1"
24 add_config
"LDFLAGS += $1"
27 get_pkgconf_cflags
() {
28 pkg-config
--cflags "$1" 2>/dev
/null
31 get_pkgconf_ldflags
() {
32 pkg-config
--libs "$1" 2>/dev
/null
35 add_pkgconf_cflags
() {
37 flags
=$
(get_pkgconf_cflags
"$1")
38 [ -z "$flags" ] && flags
="$fallback"
42 add_pkgconf_ldflags
() {
44 flags
=$
(get_pkgconf_ldflags
"$1")
45 [ -z "$flags" ] && flags
="$fallback"
50 add_pkgconf_cflags
"$1" "$2"
51 add_pkgconf_ldflags
"$1" "$3"
57 result
=$
(which "$program" 2>/dev
/null
)
58 if [ "$needed" = "1" ] && [ -z "$result" ] ; then
59 echo "error: needed program $program not found" >&2
62 printf "%s\n" "$program"
66 echo "supported arguments"
67 echo "--prefix=/path default: $prefix"
68 echo "--exec_prefix=/path default: $prefix/bin"
69 echo "--bindir=/path default: $prefix/bin"
70 echo "--libdir=/path default: $prefix/lib"
71 echo "--includedir=/path default: $prefix/include"
72 echo "--sysconfdir=/path default: $prefix/etc"
73 echo "--help : show this text"
78 uname
-s |
grep Darwin
>/dev
/null
82 uname
-s |
grep BSD
>/dev
/null
88 #alternatives echo "$arg" | cut -d= -f2-
89 # or echo "$arg" | sed 's/[^=]*=//'
94 --prefix=*) prefix
=`spliteq $1`;;
95 --exec_prefix=*) exec_prefix
=`spliteq $1`;;
96 --bindir=*) bindir
=`spliteq $1`;;
97 --libdir=*) libdir
=`spliteq $1`;;
98 --includedir=*) includedir
=`spliteq $1`;;
99 --sysconfdir=*) sysconfdir
=`spliteq $1`;;
106 -*) parsearg
"$1"; shift;;
111 [ -z "$exec_prefix" ] && exec_prefix
=$prefix
112 [ -z "$libdir" ] && libdir
=$prefix/lib
113 [ -z "$includedir" ] && includedir
=$prefix/include
114 [ -z "$sysconfdir" ] && sysconfdir
=$prefix/etc
115 [ -z "$bindir" ] && bindir
=$exec_prefix/bin
116 [ -z "$CC" ] && CC
=cc
120 add_config
"prefix = $prefix"
121 add_config
"exec_prefix = $exec_prefix"
122 add_config
"bindir = $bindir"
123 add_config
"libdir = $libdir"
124 add_config
"includedir = $includedir"
125 add_config
"sysconfdir = $sysconfdir"
127 add_config
"CC ?= $CC"
128 [ -z "$CPPFLAGS" ] || add_config
"CPPFLAGS ?= $CPPFLAGS"
129 [ -z "$CFLAGS" ] || add_config
"CFLAGS ?= $CFLAGS"
131 add_cflags
"-DXCHATLIBDIR=\\\"$libdir/xchat\\\""
132 add_cflags
"-DXCHATSHAREDIR=\\\"$prefix/share/xchat\\\""
133 add_cflags
"-DUSE_OPENSSL"
135 for lib
in $libs ; do add_lib
"$lib" ; done
136 add_lib openssl
"" "-lssl -lcrypto"
138 prog1
=$
(check_program
"gdk-pixbuf-csource" 1)
139 add_config
"PIXMAPCONVERT = $prog1"
145 perl
=$
(check_program
"perl" 0)
146 if [ -n "$perl" ] ; then
147 printf "perl detected, plugin activated\n"
148 PERL_CFLAGS
=`$perl -MExtUtils::Embed -e ccopts 2>/dev/null`
149 PERL_LDFLAGS
=`$perl -MExtUtils::Embed -e ldopts 2>/dev/null | sed 's/-lgdbm //'`
150 add_config
"PERL_CFLAGS = $PERL_CFLAGS"
151 add_config
"PERL_LDFLAGS = $PERL_LDFLAGS"
152 add_config
"PLUGINS += perl.so"
153 if [ -z "$use_plugin" ] ; then
154 add_cflags
"-DUSE_PLUGIN"
157 # there are actually 2 plugins, "old" and new, but all scripts i've seen only use old
158 add_cflags
"-DOLD_PERL"
161 python
=$
(check_program
"python" 0)
162 if [ -n "$python" ] ; then
163 printf "python detected, plugin activated\n"
164 printf "WARNING: python plugin needs environment variable PYTHONHOME\n"
165 printf " set to python's prefix.\n"
166 printf " lack of that environment variable will cause xchat exitting\n"
167 printf " when the plugin is loaded.\n"
168 printf " on sabotage linux, use \"PYTHONHOME=/ ixchat\"\n"
169 printf " to launch the program.\n"
171 PY_CFLAGS
=$
(get_pkgconf_cflags python
)
172 [ -z "$PY_CFLAGS" ] && PY_CFLAGS
=$
(get_pkgconf_cflags python-2.7
)
173 if [ -z "$PY_CFLAGS" ] ; then
174 for i
in "$prefix" /usr
/usr
/local
/ ; do
175 printf "searching Python.h in $i/include/python2.7 ... "
176 if [ -e "$i"/include
/python2.7
/Python.h
] ; then
177 PY_CFLAGS
=-I"$i"/include
/python2.7
185 PY_LDFLAGS
=$
(get_pkgconf_ldflags python
)
186 [ -z "$PY_LDFLAGS" ] && PY_LDFLAGS
=$
(get_pkgconf_ldflags python-2.7
)
187 [ -z "$PY_LDFLAGS" ] && PY_LDFLAGS
=-lpython2.7
188 if [ ! -z "$PY_CFLAGS" ] ; then
189 add_config
"PY_CFLAGS = $PY_CFLAGS"
190 add_config
"PY_LDFLAGS = $PY_LDFLAGS"
191 add_config
"PLUGINS += python.so"
192 if [ -z "$use_plugin" ] ; then
193 add_cflags
"-DUSE_PLUGIN"
197 printf "python not found, skipping plugin\n"
201 tcl
=$
(check_program
"tclsh" 0)
202 if [ -n "$tcl" ] ; then
203 printf "tcl detected, plugin activated\n"
204 TCL_CFLAGS
=$
(get_pkgconf_cflags tcl
)
205 TCL_LDFLAGS
=$
(get_pkgconf_ldflags tcl
)
207 # tcl 8.5 does not come with a pkgconfig file
208 # tcl 8.6. comes with a buggy one that fails to include its own library
209 # https://sourceforge.net/tracker/?func=detail&aid=3598298&group_id=10894&atid=110894
210 # hopefully tcl 8.7 will come with a *working* pkgconfig file ...
211 # until that happens, we need to fall back to its proprietary tclConfig system.
212 if [ -z "$TCL_LDFLAGS" ] ||
! echo "$TCL_LDFLAGS" |
grep "[-]ltcl" > /dev
/null
; then
214 for i
in "$libdir" "$prefix"/lib
/ "$prefix"/lib64
/ /lib
/lib64
/usr
/lib
/usr
/lib64
; do
215 printf "searching tclConfig.sh in $i ... "
216 if [ -e "$i"/tclConfig.sh
] ; then
218 TCL_LDFLAGS
="$TCL_LIB_SPEC $TCL_LIBS"
226 if [ -z "$tcl_found" ] ; then
227 echo "warning: tclConfig.sh not found and no pkgconfig entry available"
228 echo "disabling tcl plugin"
232 if [ -z "$tcl_error" ] ; then
233 add_config
"TCL_CFLAGS = $TCL_CFLAGS"
234 add_config
"TCL_LDFLAGS = $TCL_LDFLAGS"
235 add_config
"PLUGINS += tcl.so"
236 if [ -z "$use_plugin" ] ; then
237 add_cflags
"-DUSE_PLUGIN"
243 for i
in libsexy gtkspell-2.0
; do
244 spell_flags
=$
(get_pkgconf_cflags
$i)
245 if [ ! -z "$spell_flags" ] ; then
246 add_cflags
"$spell_flags"
247 spell_flags
=$
(get_pkgconf_ldflags
$i)
248 add_ldflags
"$spell_flags"
249 if [ "$i" = "libsexy" ] ; then
250 add_cflags
"-DUSE_LIBSEXY"
252 add_cflags
"-DUSE_GTKSPELL"
258 if isbsd || ismac
; then
259 add_config
"INSTALL_FLAGS=-m"
263 echo done, now run
make \
&\
& make install