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"
80 #alternatives echo "$arg" | cut -d= -f2-
81 # or echo "$arg" | sed 's/[^=]*=//'
86 --prefix=*) prefix
=`spliteq $1`;;
87 --exec_prefix=*) exec_prefix
=`spliteq $1`;;
88 --bindir=*) bindir
=`spliteq $1`;;
89 --libdir=*) libdir
=`spliteq $1`;;
90 --includedir=*) includedir
=`spliteq $1`;;
91 --sysconfdir=*) sysconfdir
=`spliteq $1`;;
98 -*) parsearg
"$1"; shift;;
103 [ -z "$exec_prefix" ] && exec_prefix
=$prefix
104 [ -z "$libdir" ] && libdir
=$prefix/lib
105 [ -z "$includedir" ] && includedir
=$prefix/include
106 [ -z "$sysconfdir" ] && sysconfdir
=$prefix/etc
107 [ -z "$bindir" ] && bindir
=$exec_prefix/bin
108 [ -z "$CC" ] && CC
=cc
112 add_config
"prefix = $prefix"
113 add_config
"exec_prefix = $exec_prefix"
114 add_config
"bindir = $bindir"
115 add_config
"libdir = $libdir"
116 add_config
"includedir = $includedir"
117 add_config
"sysconfdir = $sysconfdir"
119 add_config
"CC ?= $CC"
120 [ -z "$CPPFLAGS" ] || add_config
"CPPFLAGS ?= $CPPFLAGS"
121 [ -z "$CFLAGS" ] || add_config
"CFLAGS ?= $CFLAGS"
123 add_cflags
"-DXCHATLIBDIR=\\\"$libdir/xchat\\\""
124 add_cflags
"-DXCHATSHAREDIR=\\\"$prefix/share/xchat\\\""
125 add_cflags
"-DUSE_OPENSSL"
127 for lib
in $libs ; do add_lib
"$lib" ; done
128 add_lib openssl
"" "-lssl -lcrypto"
130 prog1
=$
(check_program
"gdk-pixbuf-csource" 1)
131 add_config
"PIXMAPCONVERT = $prog1"
137 perl
=$
(check_program
"perl" 0)
138 if [ -n "$perl" ] ; then
139 printf "perl detected, plugin activated\n"
140 PERL_CFLAGS
=`$perl -MExtUtils::Embed -e ccopts 2>/dev/null`
141 PERL_LDFLAGS
=`$perl -MExtUtils::Embed -e ldopts 2>/dev/null | sed 's/-lgdbm //'`
142 add_config
"PERL_CFLAGS = $PERL_CFLAGS"
143 add_config
"PERL_LDFLAGS = $PERL_LDFLAGS"
144 add_config
"PLUGINS += perl.so"
145 if [ -z "$use_plugin" ] ; then
146 add_cflags
"-DUSE_PLUGIN"
149 # there are actually 2 plugins, "old" and new, but all scripts i've seen only use old
150 add_cflags
"-DOLD_PERL"
153 python
=$
(check_program
"python" 0)
154 if [ -n "$python" ] ; then
155 printf "python detected, plugin activated\n"
156 printf "WARNING: python plugin needs environment variable PYTHONHOME set to python's prefix\n"
157 printf " lack of that environment variable will cause xchat exitting when the plugin is loaded\n"
158 printf " on sabotage linux, use \"PYTHONHOME=/ ixchat\" to launch the program.\n"
160 PY_CFLAGS
=$
(get_pkgconf_cflags python
)
161 PY_LDFLAGS
=$
(get_pkgconf_ldflags python
)
162 add_config
"PY_CFLAGS = $PY_CFLAGS"
163 add_config
"PY_LDFLAGS = $PY_LDFLAGS"
164 add_config
"PLUGINS += python.so"
165 if [ -z "$use_plugin" ] ; then
166 add_cflags
"-DUSE_PLUGIN"
171 tcl
=$
(check_program
"tclsh" 0)
172 if [ -n "$tcl" ] ; then
173 printf "tcl detected, plugin activated\n"
174 TCL_CFLAGS
=$
(get_pkgconf_cflags tcl
)
175 TCL_LDFLAGS
=$
(get_pkgconf_ldflags tcl
)
177 # tcl 8.5 does not come with a pkgconfig file
178 # tcl 8.6. comes with a buggy one that fails to include its own library
179 # https://sourceforge.net/tracker/?func=detail&aid=3598298&group_id=10894&atid=110894
180 # hopefully tcl 8.7 will come with a *working* pkgconfig file ...
181 # until that happens, we need to fall back to its proprietary tclConfig system.
182 if [ -z "$TCL_LDFLAGS" ] ||
! echo "$TCL_LDFLAGS" |
grep "[-]ltcl" > /dev
/null
; then
184 for i
in "$libdir" "$prefix"/lib
/ "$prefix"/lib64
/ /lib
/lib64
/usr
/lib
/usr
/lib64
; do
185 printf "searching tclConfig.sh in $i ... "
186 if [ -e "$i"/tclConfig.sh
] ; then
188 TCL_LDFLAGS
="$TCL_LIB_SPEC $TCL_LIBS"
196 if [ -z "$tcl_found" ] ; then
197 echo "warning: tclConfig.sh not found and no pkgconfig entry available"
198 echo "disabling tcl plugin"
202 if [ -z "$tcl_error" ] ; then
203 add_config
"TCL_CFLAGS = $TCL_CFLAGS"
204 add_config
"TCL_LDFLAGS = $TCL_LDFLAGS"
205 add_config
"PLUGINS += tcl.so"
206 if [ -z "$use_plugin" ] ; then
207 add_cflags
"-DUSE_PLUGIN"
214 echo done, now run
make \
&\
& make install