19 printf "%s\n" "$1" >> config.mak
23 add_config
"CFLAGS += $1"
27 add_config
"LDFLAGS += $1"
30 get_pkgconf_cflags
() {
31 pkg-config
--cflags "$1" 2>/dev
/null
34 get_pkgconf_ldflags
() {
35 pkg-config
--libs "$1" 2>/dev
/null
38 add_pkgconf_cflags
() {
39 flags
=$
(get_pkgconf_cflags
"$1")
43 add_pkgconf_ldflags
() {
44 flags
=$
(get_pkgconf_ldflags
"$1")
49 add_pkgconf_cflags
"$1"
50 add_pkgconf_ldflags
"$1"
56 result
=$
(which "$program" 2>/dev
/null
)
57 if [ "$needed" = "1" ] && [ -z "$result" ] ; then
58 echo "error: needed program $program not found" >&2
61 printf "%s\n" "$program"
65 echo "supported arguments"
66 echo "--prefix=/path default: $prefix"
67 echo "--exec_prefix=/path default: $prefix/bin"
68 echo "--bindir=/path default: $prefix/bin"
69 echo "--libdir=/path default: $prefix/lib"
70 echo "--includedir=/path default: $prefix/include"
71 echo "--sysconfdir=/path default: $prefix/etc"
72 echo "--help : show this text"
79 #alternatives echo "$arg" | cut -d= -f2-
80 # or echo "$arg" | sed 's/[^=]*=//'
85 --prefix=*) prefix
=`spliteq $1`;;
86 --exec_prefix=*) exec_prefix
=`spliteq $1`;;
87 --bindir=*) bindir
=`spliteq $1`;;
88 --libdir=*) libdir
=`spliteq $1`;;
89 --includedir=*) includedir
=`spliteq $1`;;
90 --sysconfdir=*) sysconfdir
=`spliteq $1`;;
97 -*) parsearg
"$1"; shift;;
102 [ -z "$exec_prefix" ] && exec_prefix
=$prefix
103 [ -z "$libdir" ] && libdir
=$prefix/lib
104 [ -z "$includedir" ] && includedir
=$prefix/include
105 [ -z "$sysconfdir" ] && sysconfdir
=$prefix/etc
106 [ -z "$bindir" ] && bindir
=$exec_prefix/bin
107 [ -z "$CC" ] && CC
=cc
111 add_config
"prefix = $prefix"
112 add_config
"exec_prefix = $exec_prefix"
113 add_config
"bindir = $bindir"
114 add_config
"libdir = $libdir"
115 add_config
"includedir = $includedir"
116 add_config
"sysconfdir = $sysconfdir"
118 add_config
"CC ?= $CC"
119 [ -z "$CPPFLAGS" ] || add_config
"CPPFLAGS ?= $CPPFLAGS"
120 [ -z "$CFLAGS" ] || add_config
"CFLAGS ?= $CFLAGS"
122 add_cflags
"-DXCHATLIBDIR=\\\"$libdir/xchat\\\""
123 add_cflags
"-DXCHATSHAREDIR=\\\"$prefix/share/xchat\\\""
124 add_cflags
"-DUSE_OPENSSL"
126 for lib
in $libs ; do add_lib
"$lib" ; done
128 prog1
=$
(check_program
"gdk-pixbuf-csource" 1)
129 add_config
"PIXMAPCONVERT = $prog1"
135 perl
=$
(check_program
"perl" 0)
136 if [ -n "$perl" ] ; then
137 PERL_CFLAGS
=`$perl -MExtUtils::Embed -e ccopts 2>/dev/null`
138 PERL_LDFLAGS
=`$perl -MExtUtils::Embed -e ldopts 2>/dev/null | sed 's/-lgdbm //'`
139 add_config
"PERL_CFLAGS = $PERL_CFLAGS"
140 add_config
"PERL_LDFLAGS = $PERL_LDFLAGS"
141 add_config
"PLUGINS += perl.so"
142 if [ -z "$use_plugin" ] ; then
143 add_cflags
"-DUSE_PLUGIN"
146 # there are actually 2 plugins, "old" and new, but all scripts i've seen only use old
147 add_cflags
"-DOLD_PERL"
150 python
=$
(check_program
"python" 0)
151 if [ -n "$python" ] ; then
152 PY_CFLAGS
=$
(get_pkgconf_cflags python
)
153 PY_LDFLAGS
=$
(get_pkgconf_ldflags python
)
154 add_config
"PY_CFLAGS = $PY_CFLAGS"
155 add_config
"PY_LDFLAGS = $PY_LDFLAGS"
156 add_config
"PLUGINS += python.so"
157 if [ -z "$use_plugin" ] ; then
158 add_cflags
"-DUSE_PLUGIN"
163 tcl
=$
(check_program
"tclsh" 0)
164 if [ -n "$tcl" ] ; then
165 TCL_CFLAGS
=$
(get_pkgconf_cflags tcl
)
166 TCL_LDFLAGS
=$
(get_pkgconf_ldflags tcl
)
168 if [ -z "$TCL_LDFLAGS" ] ; then
170 for i
in "$libdir"/tclConfig.sh
"$prefix"/lib
/tclConfig.sh
"$prefix"/lib64
/tclConfig.sh
; do
171 if [ -e "$i" ] ; then
173 TCL_LDFLAGS
="$TCL_LIB_SPEC $TCL_LIBS"
177 if [ -z "$tcl_found" ] ; then
178 echo "warning: tclConfig.sh not found and no pkgconfig entry available"
179 echo "disabling tcl plugin"
183 if [ -z "$tcl_error" ] ; then
184 add_config
"TCL_CFLAGS = $TCL_CFLAGS"
185 add_config
"TCL_LDFLAGS = $TCL_LDFLAGS"
186 add_config
"PLUGINS += tcl.so"
187 if [ -z "$use_plugin" ] ; then
188 add_cflags
"-DUSE_PLUGIN"
195 echo done, now run
make \
&\
& make install