OSDN Git Service

Patch to make /etc/pointercal relative to systemconfdir
authorChris Larson <clarson@kergoth.com>
Tue, 24 Mar 2009 18:02:37 +0000 (18:02 +0000)
committerChris Larson <clarson@kergoth.com>
Tue, 24 Mar 2009 18:02:37 +0000 (18:02 +0000)
While /etc/ts.conf is always relative to systemconfdir (set during ./
configure), the /etc/pointercal file is hard-coded to /etc/pointercal.
For users who wish to prefix their installation this is troublesome,
and impossible if they cannot/do not which to modify the root /etc.
The patch below resolves this by making /etc/pointercal relative to
the systemconfdir set during ./configure (or defaults to prefix/etc as
it should). This mirrors the behavior of tslib's /etc/ts.conf file.

Signed-off-by: Daniel Jabbour <daniel@laptouchinc.com>
Signed-off-by: Chris Larson <clarson@kergoth.com>
configure.ac
plugins/Makefile.am
plugins/linear.c
tests/Makefile.am
tests/ts_calibrate.c

index ab43502..70e0589 100644 (file)
@@ -200,6 +200,9 @@ AC_SUBST(LIBFLAGS)
 TS_CONF='${sysconfdir}/ts.conf'
 AC_SUBST(TS_CONF)
 
+TS_POINTERCAL='${sysconfdir}/pointercal'
+AC_SUBST(TS_POINTERCAL)
+
 # Library versioning
 LT_RELEASE=1.0
 LT_CURRENT=0
index 4c4ef8b..93edb29 100644 (file)
@@ -9,7 +9,7 @@
 # $Id: Makefile.am,v 1.7 2005/02/28 23:44:12 kergoth Exp $
 #
 
-AM_CFLAGS              = $(DEBUGFLAGS) $(LIBFLAGS) $(VIS_CFLAGS)
+AM_CFLAGS              = -DTS_POINTERCAL=\"@TS_POINTERCAL@\" $(DEBUGFLAGS) $(LIBFLAGS) $(VIS_CFLAGS)
 LDADD          = -rpath $(PLUGIN_DIR)
 INCLUDES               = -I$(top_srcdir)/src
   
index a24916a..475b09f 100644 (file)
@@ -108,7 +108,6 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
        int index;
        char *tokptr;
        char *calfile=NULL;
-       char *defaultcalfile = "/etc/pointercal";
 
        lin = malloc(sizeof(struct tslib_linear));
        if (lin == NULL)
@@ -132,7 +131,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
        /*
         * Check calibration file
         */
-       if( (calfile = getenv("TSLIB_CALIBFILE")) == NULL) calfile = defaultcalfile;
+       if( (calfile = getenv("TSLIB_CALIBFILE")) == NULL) calfile = TS_POINTERCAL;
        if(stat(calfile,&sbuf)==0) {
                pcal_fd = open(calfile,O_RDONLY);
                read(pcal_fd,pcalbuf,200);
index 8308a45..6a4d369 100644 (file)
@@ -9,7 +9,7 @@
 # $Id: Makefile.am,v 1.4 2004/07/21 19:12:59 dlowder Exp $
 #
 
-AM_CFLAGS               = $(DEBUGFLAGS)
+AM_CFLAGS               = -DTS_POINTERCAL=\"@TS_POINTERCAL@\" $(DEBUGFLAGS)
 INCLUDES               = -I$(top_srcdir)/src
 
 bin_PROGRAMS           = ts_test ts_calibrate ts_print ts_print_raw ts_harvest
index 00e9580..2662dc7 100644 (file)
@@ -254,7 +254,7 @@ int main()
                        cal_fd = open (calfile, O_CREAT | O_RDWR,
                                       S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
                } else {
-                       cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR,
+                       cal_fd = open (TS_POINTERCAL, O_CREAT | O_RDWR,
                                       S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
                }
                sprintf (cal_buffer,"%d %d %d %d %d %d %d",