Skip to content

Commit 8dfafdd

Browse files
abstrakraftdsmith
authored and
dsmith
committed
Added config.h header and with-python configure option
git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@137 918edb2d-ff29-0410-9de2-eb38e7f22bc7
1 parent 1c06490 commit 8dfafdd

14 files changed

+216
-18
lines changed

ChangeLog

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org>
2+
configure.ac
3+
* added config.h header
4+
* added with-python argument and associated logic
5+
6+
lswm
7+
* added config.h include for sources requiring defs
8+
9+
wmgui
10+
* added config.h include for sources requiring defs
11+
12+
wminput
13+
* added config.h include for sources requiring defs
14+
* added HAVE_PYTHON tests around all python code
15+
116
2007-06-28 L. Donnie Smith <cwiid@abstrakraft.org>
217
libcwiid
318
* changed version

Makefile.in

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ include @top_builddir@/defs.mak
55
LIB_DIRS = libcwiid
66
BIN_DIRS = wmgui wminput lswm
77
DOC_DIRS = man doc
8+
ifdef PYTHON
89
BIND_DIRS = python
10+
endif
911

1012
SUB_DIRS = $(LIB_DIRS) $(BIN_DIRS) $(DOC_DIRS) $(BIND_DIRS) wmdemo
1113

@@ -38,7 +40,7 @@ $(CWIID_PLUGINS_DIR):
3840

3941
distclean:
4042
rm -rf Makefile config.log config.status autom4te.cache \
41-
defs.mak $(COMMON)/include/lib.mak
43+
defs.mak $(COMMON)/include/lib.mak $(COMMON)/include/config.h
4244

4345
uninstall:
4446
rm -r $(CWIID_PLUGINS_DIR); true

common/include/config.h.in

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* config.h.in. Generated from configure.ac by autoheader. */
2+
3+
/* Define to 1 if you have the <bluetooth/hci.h> header file. */
4+
#undef HAVE_BLUETOOTH_HCI_H
5+
6+
/* Define to 1 if you have the <bluetooth/l2cap.h> header file. */
7+
#undef HAVE_BLUETOOTH_L2CAP_H
8+
9+
/* Define to 1 if you have the <inttypes.h> header file. */
10+
#undef HAVE_INTTYPES_H
11+
12+
/* Define to 1 if you have the `bluetooth' library (-lbluetooth). */
13+
#undef HAVE_LIBBLUETOOTH
14+
15+
/* Define to 1 if you have the `dl' library (-ldl). */
16+
#undef HAVE_LIBDL
17+
18+
/* Define to 1 if you have the `pthread' library (-lpthread). */
19+
#undef HAVE_LIBPTHREAD
20+
21+
/* Define to 1 if you have the <memory.h> header file. */
22+
#undef HAVE_MEMORY_H
23+
24+
/* Define to 1 if python support is enabled */
25+
#undef HAVE_PYTHON
26+
27+
/* Define to 1 if you have the <stdint.h> header file. */
28+
#undef HAVE_STDINT_H
29+
30+
/* Define to 1 if you have the <stdlib.h> header file. */
31+
#undef HAVE_STDLIB_H
32+
33+
/* Define to 1 if you have the <strings.h> header file. */
34+
#undef HAVE_STRINGS_H
35+
36+
/* Define to 1 if you have the <string.h> header file. */
37+
#undef HAVE_STRING_H
38+
39+
/* Define to 1 if you have the <sys/stat.h> header file. */
40+
#undef HAVE_SYS_STAT_H
41+
42+
/* Define to 1 if you have the <sys/types.h> header file. */
43+
#undef HAVE_SYS_TYPES_H
44+
45+
/* Define to 1 if you have the <unistd.h> header file. */
46+
#undef HAVE_UNISTD_H
47+
48+
/* Define to the address where bug reports for this package should be sent. */
49+
#undef PACKAGE_BUGREPORT
50+
51+
/* Define to the full name of this package. */
52+
#undef PACKAGE_NAME
53+
54+
/* Define to the full name and version of this package. */
55+
#undef PACKAGE_STRING
56+
57+
/* Define to the one symbol short name of this package. */
58+
#undef PACKAGE_TARNAME
59+
60+
/* Define to the version of this package. */
61+
#undef PACKAGE_VERSION
62+
63+
/* Define to 1 if you have the ANSI C header files. */
64+
#undef STDC_HEADERS
65+
66+
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
67+
`char[]'. */
68+
#undef YYTEXT_POINTER

configure.ac

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# ChangeLog:
2+
# 2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org>
3+
# * added config.h header
4+
# * added with-python argument and associated logic
5+
#
26
# 2007-05-30 L. Donnie Smith <cwiid@abstrakraft.org>
37
# * added python/Makefile
48
# * added PYTHON_VERSION variable
@@ -21,6 +25,7 @@
2125
# * Check for stdint.h
2226

2327
AC_INIT(CWiid,0.6.00_rc2,cwiid@abstrakraft.org)
28+
AC_CONFIG_HEADER(common/include/config.h)
2429

2530
AC_PROG_CC
2631
AC_PROG_AWK
@@ -36,8 +41,36 @@ if test "$YACC" != "bison -y"; then
3641
AC_MSG_ERROR([bison not found])
3742
fi
3843

39-
PYTHON_VERSION=[`python -c 'import sys; print sys.version[:3]'`]
40-
AC_SUBST(PYTHON_VERSION)
44+
AC_ARG_WITH(
45+
[python],
46+
[AS_HELP_STRING([--without-python],[compile without python support])],
47+
[case $withval in
48+
yes)
49+
REQUIRE_PYTHON=1
50+
PYTHON_NAME=python
51+
;;
52+
no)
53+
REQUIRE_PYTHON=
54+
PYTHON_NAME=
55+
;;
56+
*)
57+
REQUIRE_PYTHON=1
58+
PYTHON_NAME=$withval
59+
;;
60+
esac],
61+
[REQUIRE_PYTHON=1; PYTHON_NAME=python])
62+
if test $REQUIRE_PYTHON; then
63+
AC_CHECK_PROGS([PYTHON],$PYTHON_NAME)
64+
if test $REQUIRE_PYTHON -a ! $PYTHON; then
65+
AC_MSG_ERROR([$PYTHON_NAME not found])
66+
fi
67+
fi
68+
AC_SUBST(PYTHON)
69+
if test $PYTHON; then
70+
PYTHON_VERSION=[`$PYTHON -c 'import sys; print sys.version[:3]'`]
71+
AC_SUBST(PYTHON_VERSION)
72+
AC_DEFINE([HAVE_PYTHON],1,[Define to 1 if python support is enabled])
73+
fi
4174

4275
AC_CHECK_LIB([pthread], [pthread_create],,
4376
AC_MSG_ERROR([pthread library not found]))

defs.mak.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CC = @CC@
2020
AWK = @AWK@
2121
LEX = @LEX@
2222
YACC = @YACC@
23+
PYTHON = @PYTHON@
2324

2425
COMMON = @abs_top_builddir@/common
2526

@@ -32,4 +33,4 @@ CWIID_PLUGINS_DIR = $(ROOTDIR)@CWIID_PLUGINS_DIR@
3233

3334
DEBUGFLAGS = -g
3435
WARNFLAGS = -Wall -W
35-
CFLAGS = $(DEBUGFLAGS) $(WARNFLAGS)
36+
CFLAGS = $(DEBUGFLAGS) $(WARNFLAGS) @DEFS@ -I$(COMMON)/include

lswm/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APP_NAME = lswm
66

77
SOURCES = lswm.c
88

9-
CFLAGS += -I@top_builddir@/libcwiid -DCWIID_VERSION=\"${PACKAGE_VERSION}\"
9+
CFLAGS += -I@top_builddir@/libcwiid
1010
LDFLAGS += -L@top_builddir@/libcwiid
1111
LDLIBS += -lcwiid
1212
INST_DIR = @bindir@

lswm/lswm.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
*
1717
* ChangeLog:
18+
* 2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org>
19+
* * added config.h include
20+
* * use PACKAGE_VERSION from config.h instead of CWIID_VERSION
21+
*
1822
* 2007-06-01 Nick <nickishappy@gmail.com>
1923
* * reworked command-line options (added standard options, long options)
2024
*
@@ -28,6 +32,10 @@
2832
* * created file
2933
*/
3034

35+
#ifdef HAVE_CONFIG_H
36+
#include "config.h"
37+
#endif
38+
3139
#include <stdint.h>
3240
#include <stdio.h>
3341
#include <stdlib.h>
@@ -90,7 +98,7 @@ int main(int argc, char *argv[])
9098
long_format = 1;
9199
break;
92100
case 'v':
93-
printf("CWiid Version %s\n", CWIID_VERSION);
101+
printf("CWiid Version %s\n", PACKAGE_VERSION);
94102
return 0;
95103
break;
96104
case 'q':

python/Makefile.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ ifdef ROOTDIR
77
endif
88

99
all:
10-
python setup.py build_ext $(DEBUGFLAGS) -I@top_builddir@/libcwiid -L@top_builddir@/libcwiid -lcwiid
10+
$(PYTHON) setup.py build_ext $(DEBUGFLAGS) -I@top_builddir@/libcwiid -L@top_builddir@/libcwiid -lcwiid
1111

1212
install:
13-
python setup.py install --prefix=${prefix} $(SET_ROOT_DIR)
13+
$(PYTHON) setup.py install --prefix=${prefix} $(SET_ROOT_DIR)
1414

1515
uninstall:
1616
rm -f $(ROOTDIR)${prefix}/lib/python@PYTHON_VERSION@/site-packages/cwiid.so

wmgui/Makefile.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ APP_NAME = wmgui
66

77
SOURCES = main.c interface.c support.c
88

9-
CFLAGS += @GTK_CFLAGS@ -I@top_builddir@/libcwiid \
10-
-DCWIID_VERSION=\"${PACKAGE_VERSION}\"
9+
CFLAGS += @GTK_CFLAGS@ -I@top_builddir@/libcwiid
1110
LDFLAGS += -L@top_builddir@/libcwiid
1211
LDLIBS += @GTK_LIBS@ -lm -lcwiid
1312
INST_DIR = @bindir@

wmgui/main.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
*
1717
* ChangeLog:
18+
* 2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org>
19+
* * added config.h include
20+
* * use PACKAGE_VERSION from config.h instead of CWIID_VERSION
21+
*
1822
* 2007-05-16 L. Donnie Smith <cwiid@abstrakraft.org>
1923
* * changed cwiid_{connect,disconnect,command} to
2024
* cwiid_{open,close,request_status|set_led|set_rumble|set_rpt_mode}
@@ -43,7 +47,12 @@
4347
* * type audit (stdint, const, char booleans)
4448
*/
4549

50+
#ifdef HAVE_CONFIG_H
51+
#include "config.h"
52+
#endif
53+
4654
#define APP_NAME "CWiid wmgui"
55+
#define APP_VERSION PACKAGE_VERSION
4756
#define APP_COPYRIGHT "Copyright (C) 2007 L. Donnie Smith " \
4857
"<cwiid@abstrakraft.org>"
4958
#define APP_COMMENTS "Wiimote GUI"
@@ -696,7 +705,7 @@ void menuAbout_activate(void)
696705
{
697706
gtk_show_about_dialog(GTK_WINDOW(winMain),
698707
"name", APP_NAME,
699-
"version", CWIID_VERSION,
708+
"version", APP_VERSION,
700709
"copyright", APP_COPYRIGHT,
701710
"comments", APP_COMMENTS,
702711
NULL);

wminput/Makefile.in

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,30 @@ include @top_builddir@/defs.mak
44

55
APP_NAME = wminput
66

7-
SOURCES = main.c conf.c c_plugin.c py_plugin.c uinput.c action_enum.c parser.c \
8-
lexer.c util.c
7+
SOURCES = main.c conf.c c_plugin.c uinput.c action_enum.c util.c
8+
#kludge to make sure YACC/LEX sources are listed last, otherwise we get errors
9+
#when building dependencies
10+
LAST_SOURCES = parser.c lexer.c
911

1012
WMINPUT_CONFIG_DIR = $(CWIID_CONFIG_DIR)/wminput
11-
CFLAGS += -I@top_builddir@/libcwiid -I/usr/include/python@PYTHON_VERSION@ \
13+
CFLAGS += -I@top_builddir@/libcwiid \
1214
-DWMINPUT_CONFIG_DIR=\"$(WMINPUT_CONFIG_DIR)\" \
13-
-DCWIID_PLUGINS_DIR=\"$(CWIID_PLUGINS_DIR)\" \
14-
-DCWIID_VERSION=\"${PACKAGE_VERSION}\"
15-
LDLIBS += -lcwiid -ldl -lpython@PYTHON_VERSION@
15+
-DCWIID_PLUGINS_DIR=\"$(CWIID_PLUGINS_DIR)\"
16+
17+
LDLIBS += -lcwiid -ldl
1618
LDFLAGS += -L@top_builddir@/libcwiid -rdynamic
1719
INST_DIR = @bindir@
1820

1921
YFLAGS += -d
2022

23+
ifdef PYTHON
24+
SOURCES += py_plugin.c
25+
CFLAGS += -I/usr/include/python@PYTHON_VERSION@
26+
LDLIBS += -lpython@PYTHON_VERSION@
27+
endif
28+
29+
SOURCES += $(LAST_SOURCES)
30+
2131
include $(COMMON)/include/app.mak
2232

2333
all install clean distclean uninstall: make_plugins

wminput/conf.c

+18
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
*
1717
* ChangeLog:
18+
* 2007-07-28 L. Donnie Smith <cwiid@abstrakraft.org>
19+
* * added config.h include
20+
* * added HAVE_PYTHON tests around all python code
21+
*
1822
* 2007-06-18 L. Donnie Smith <cwiid@abstrakraft.org>
1923
* * revised error messages
2024
*
@@ -40,6 +44,10 @@
4044
* * type audit (stdint, const, char booleans)
4145
*/
4246

47+
#ifdef HAVE_CONFIG_H
48+
#include "config.h"
49+
#endif
50+
4351
#include <stdint.h>
4452
#include <stdio.h>
4553
#include <stdlib.h>
@@ -49,7 +57,9 @@
4957
#include "util.h"
5058
#include "y.tab.h"
5159
#include "c_plugin.h"
60+
#ifdef HAVE_PYTHON
5261
#include "py_plugin.h"
62+
#endif
5363

5464
extern FILE *yyin;
5565
extern int yyparse();
@@ -98,9 +108,11 @@ int conf_unload(struct conf *conf)
98108
case PLUGIN_C:
99109
c_plugin_close(&conf->plugins[i]);
100110
break;
111+
#ifdef HAVE_PYTHON
101112
case PLUGIN_PYTHON:
102113
py_plugin_close(&conf->plugins[i]);
103114
break;
115+
#endif
104116
}
105117
}
106118
}
@@ -345,11 +357,13 @@ int conf_plugin_param_int(struct conf *conf, const char *name,
345357
return -1;
346358
}
347359
break;
360+
#ifdef HAVE_PYTHON
348361
case PLUGIN_PYTHON:
349362
if (py_plugin_param_int(plugin, i, value)) {
350363
return -1;
351364
}
352365
break;
366+
#endif
353367
}
354368

355369
return 0;
@@ -384,11 +398,13 @@ int conf_plugin_param_float(struct conf *conf, const char *name,
384398
return -1;
385399
}
386400
break;
401+
#ifdef HAVE_PYTHON
387402
case PLUGIN_PYTHON:
388403
if (py_plugin_param_float(plugin, i, value)) {
389404
return -1;
390405
}
391406
break;
407+
#endif
392408
}
393409

394410
return 0;
@@ -595,10 +611,12 @@ struct plugin *get_plugin(struct conf *conf, const char *name)
595611
plugin_found = 1;
596612
break;
597613
}
614+
#ifdef HAVE_PYTHON
598615
if (!py_plugin_open(plugin, conf->plugin_search_dirs[i])) {
599616
plugin_found = 1;
600617
break;
601618
}
619+
#endif
602620
}
603621

604622
if (!plugin_found) {

0 commit comments

Comments
 (0)