File: Configure

package info (click to toggle)
mtink 1.0.16-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,880 kB
  • sloc: ansic: 19,264; sh: 1,008; python: 626; xml: 444; makefile: 75
file content (583 lines) | stat: -rwxr-xr-x 16,133 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#!/bin/sh

# Changes: 07-MAR-2003 added /usr/local/... path for openMotif
#                      on Mac OS X
#

prefix=/usr/local
setUid=1
OS=`uname`

# set LANG if necessary
case $LANG in
   en*|de*|fr*|it*);; # known languages
   *) LANG=en;;       # default english
esac

prt()
{
   la=$1
   shift
   case $LANG in
     $la*) echo $*;;
   esac
}

pSyntax()
{
   echo Syntax `basename $0` '[-h|--help]'
   echo "      " `basename $0` '[-p|--prefix installPath] [-d devpkgprefix] [-n|--no-suid] [-x|--no-x] [-g]|--no-gimp] [-s|--no-strip]'
   echo
   prt en "Default install path: $prefix"
   prt fr "Chemin d'installation par default: $prefix"
   prt de "Default Installationspfad: $prefix"
   prt it "Percorso d'installazione di default: $prefix"
   echo
   prt en "The documentation files will be installed under:"
   prt fr "Les fichiers de documentation seront installes sous:"
   prt de "Die Dokumentaionsdateien werden installiert unter:"
   prt it "La Documentazione verr installata in:"
   echo $prefix/mtink
   echo
   prt en "If you want only the tty based version use the -x option."
   prt en
   prt en "This program require read write access to the device"
   prt en "files. You may install mtink with the set uid bit set"
   prt en "or change yourself the permissions to the device files."
   prt en "In this case you may enter the -n option."

   prt fr "Pour ne creer que la version de commande en ligne"
   prt fr "utilise l'option -x."
   prt fr
   prt fr "Le programme necessite les droit d'ecriture et de lecture"
   prt fr "pour les fichiers /dev/... . Vous pouvez installer mtink"
   prt fr "avec le bit set-uid ou modifier vous meme les droits"
   prt fr "d'acces aux fichiers concernes. Dans ce cas vous pouvez"
   prt fr "lancer `basename $0` avec l'option -n"

   prt de "Nur Konsole basierte Version erstellen: Option -x angeben."
   prt de
   prt de "Das Program benoetigt uneingeschraenkte Rechte auf die"
   prt de "Geraetedateien. Sie koennen mtink mit das 'set-uid' bit"
   prt de "installieren. Falls Sie es nicht wuenschen muessen Sie"
   prt de "die Rechte auf der Geraetedateien anpassen und `basename $0`"
   prt de "mit der Option -n aufrufen."

   prt it "Se si vuole solo la versione a linea di comando usare -x."
   prt it
   prt it "Questo programma richiede l'accesso in lettura e scrittura al"
   prt it "file dispositivo. Si pu installare mtink con il bit sed uid"
   prt it "attivato o cambiare i permessi al file dispositivo."
   prt it "In questo caso si pu usare l'opzione -n."
   echo
}

noX=0
noGimp=0
useUsbLib=0
Strip=1

# Check for args
while [ $# -ne 0 ]
do
   case $1 in
   -m)
      # simulation with libusb under Linux
      useUsbLib=1;;
   -h|--h*)
      pSyntax
      exit 0;;
   -n|--no-su*)
      setUid=0
      ;;
   -x|--no-x)
      noX=1
      ;;
   -g|--no-g*)
      noGimp=1
      ;;
   -p|--p*)
      shift
      if [ $# -ne 1 ]
      then
        pSyntax
        exit 1
      else
         prefix=$1
      fi;;
   -s|-nostrip|--no-st*)
      Strip=0
      ;;
   *)
      pSyntax
      exit 1;;
   esac
   shift
done

# checks for Motif library and include files.
# check first for 64 bit library (Nicola Fabiano on Fedora Core 2)
LIBDIRS='/usr/X11R6/lib64
/usr/OpenMotif/lib
/sw/lib
/usr/X11R6/lib
/usr/OpenMotif/lib
/usr/lib
/usr/X11/lib
/usr/openwin/lib
/usr/local/lib
/usr/dt/lib'
LIBDIRS="$LIBDIRS `${CC-gcc} -print-search-dirs 2>/dev/null |
                   awk '/^libraries:/{print $2}' | tr ':' ' '`"

# Add gimp-2.0 for fedora core 2
INCLDIRS='/usr/include/gimp-2.0/libgimp
/usr/OpenMotif/include
/sw/include
/usr/X11R6/include
/usr/OpenMotif/include
/usr/X11/include
/usr/include
/usr/openwin/include
/usr/local/include
/usr/dt/include'

mlibFound=0
mxpmheader=
mxpmlib=
for dir in $LIBDIRS
do
   if [ "`ls -c $dir/libXm.* 2>/dev/null`" != "" ]
   then
      mlibFound=1
      break
   fi
done

minclFound=0
for dir in $INCLDIRS
do
   if [ -f $dir/Xm/Xm.h ]
   then
      minclFound=1
      if [ -f $dir/Xm/XpmP.h ]
      then
         mxpmheader="-DMOTIF_XPM"
      fi
      break
   fi
done

xinclFound=0
for dir in $INCLDIRS
do
   if [ -f $dir/X11/X.h ]
   then
      xinclFound=1
      if [ "$mxpmheader" = "" ]
      then
         if [ -f $dir/X11/xpm.h ]
         then
            mxpmheader="-DXPM_XPM"
            mxpmlib="-lXpm"
         fi
      fi
      break
   fi
done

if [ $noX -eq 0 ]
then
   if [ $xinclFound -eq 0 -o $minclFound -eq 0 -o $mlibFound -eq 0 ]
   then
      if [ $mlibFound -eq 0 ]
      then
         prt en "The Motif libraries are not installed."
         prt en "Install Motif or Lesstif if your system"
         prt en "don't provide Motif."
         prt en "Please note that the motif package may be"
         prt en "called openmotif, motif or lesstif (Linux)."

         prt fr "La bibliotheque Motif n'est pas installee."
         prt fr "Installez Motif ou, si votre Systeme ne contient"
         prt fr "pas Motif / Openmotif installez Lesstif (Linux)."

         prt de "Die Motif Umgebung wurde nicht gefunden."
         prt de "Installieren Sie bitte Motif / Openmotif oder,"
         prt de "falls nicht vorhanden Lesstif (Linux)."

         prt it "Le librerie Motif non sono installate."
         prt it "Installare Motif o Lesstif se il sistema non"
         prt it "ha Motif."
         prt it "Notare che il paccehtto Motif pu aver"
         prt it "nome openmotif, motif o lesstif (Linux)."
         echo
      fi

      if [ $minclFound -eq 0 ]
      then
         prt en "Motif/Lesstif header file not found !"
         prt en "mtink require this, please install them."

         prt fr "Les fichiers includes Motif/Lesstif ne sont pas"
         prt fr "present! Installe Motif/Lesstif correctement."

         prt de "Die Motif/Lesstif Include-Dateien wurden nicht"
         prt de "gefunden! Installieren Sie bitte Motif/Lesstif"
         prt de "vollstaendig."

         prt it "Il file header di Motif/Lesstif non sono stati trovati !"
         prt it "mtink ne ha bisogno, si prega di installarlo."
         echo
         if [ "`uname`" = Linux ]
         then
            prt en "The Motif package is mostly called motif-devel"
            prt en "If you have installed Lesstif the package name"
            prt en "will probably be lesstif-devel"

            prt fr "Le paquetage est souvent nomme motif-devel"
            prt fr "Si vous avez installe Lesstif le nom du paquet"
            prt fr "manquant est certainement lesstif-devel"

            prt de "Sie muessen das Entwicklungspacket motif-devel Bzw."
            prt de "openmotif-devel installieren. Falls Lesstif zum"
            prt de "Einsatzkommen soll is das Packetname meistens"
            prt de "lesstif-devel"

            prt it "Il pacchetto Motif  spesso chiamato motif-devel"
            prt it "Se avessi installato Lesstif il nome del pacchetto"
            prt it "dovrebbe probabilmente essere lesstif-devel"
            echo
         fi
         echo
      fi

      if [ $xinclFound -eq 0 ]
      then
         prt en "X is not installed or the include pathes are stranges"

         prt fr "X n'est pas apparement pas installe ou les fichier 'include'"
         prt fr "se trouvent sous un repertoire non standard."

         prt de "X scheint nicht installiert zu sein. Moeglicherweise"
         prt de "befinden sich die Dateien unter einen nicht Standardpfad"

         prt it "X non e installato o i percorsi di inclusione non sono standard."

         if [ "`uname`" = Linux ]
         then
            prt en "The X development package is mostly called X-devel"

            prt fr "Les paquets de developement X ne sont pas installes."
            prt fr "Installez les, le non est generalement X-devel"

            prt de "Die X.Enticklungsumgebung muss installiert werden."
            prt de "Das Packetname ist meistens X-devel"

            prt it "Il pacchetto di sviluppo X  spesso chiamato X-devel."
         fi
         echo
      fi
      exit 1
   fi

   if [ "$MotifLib" != "" ]
   then
      mlCmd="s@^MOLIB.*@MOLIB = $MotifLib@"
   else
     mlCmd=
   fi
   if [ "$XmHPath" != "" ]
   then
      miCmd="s@^MOINC.*@MOINC = -I$XmHPath@"
   else
      miCmd=
   fi

   # Gimp part ################################################
   # check for gimp
   includeFileFound=0
   gimptoolFound=0
   gimpVersion=0

   if [ $noGimp -eq 0 ]
   then
     for dir in `echo $PATH | tr ':' '\012'`
     do
        if [ -x $dir/gimptool-2.0 ]
        then
           # and ask for the version
           gimpVersion=`$dir/gimptool-2.0 --version | sed 's/\(1\..\).*/\1/'`
           gimptoolFound=2
           break
        fi
        if [ -x $dir/gimptool ]
        then
           # and ask for the version
           gimpVersion=`$dir/gimptool --version | sed 's/\(1\..\).*/\1/'`
           gimptoolFound=1
           break
        fi
     done
   fi

   if [ $gimptoolFound -eq 0 ]
   then
      if [ $noGimp -eq 0 ]
      then
         prt en "Gimp development package not installed."
         prt en "Plugins will not be compiled"
         prt en "Please install the gimp package"
         prt en "if you want the gimp plugins."

         prt fr "Le paquet de developement gimp n'est pas installe,"
         prt fr "Le plugins ne sera pas genere."
         prt fr "Installez gimp et gimp-devel si vous souhaitez"
         prt fr "le plugins gimp."

         prt de "Das Gimp-Entwiclungs packet ist nicht installieert,"
         prt de "Das plugins wird nicht erzeugt."
         prt de "Installieren Sie, bitte, gimp-devel (Linux) Wenn Sie"
         prt de "das Gimp-Plugins erzeugen moechten."

         prt it "Il pacchetto di sviluppo Gimp non e installato."
         prt it "I plugin non verranno compilati."
         prt it "Installare il pacchetto gimp"
         prt it "se si vogliono i plugin gimp."
         echo
      fi
   else
      # Build MTINK_CFLAGS and LFLAGS
		if [ $gimptoolFound -eq 2 ]
		then
         MTINK_CFLAGS=`gimptool-2.0 --cflags`
         LFLAGS=`gimptool-2.0 --libs`
		else
         MTINK_CFLAGS=`gimptool --cflags`
         LFLAGS=`gimptool --libs`
      fi

      # Check for Header files libgimp/gimp.h
      includeFileFound=0
      for dir in `echo $MTINK_CFLAGS | tr ' ' '\012' | grep -- -I | sed 's/-I//'`\
                 /usr/include /usr/local/include
      do
         if [ -f $dir/libgimp/gimp.h ]
         then
            includeFileFound=1
            break
         fi
      done

      if [ $includeFileFound -eq 0 ]
      then
         prt en "Header file for gimp not found."
         prt en "Please install the gimp development package."

         prt fr "Les fichiers necessaire pour gimp ne sont pas installes."
         prt fr "Installez le paquet gimp-devel."

         prt de "Die notwendige Entwicklungsumgebung fuer gimp ist."
         prt de "nicht vorhanden. Packet gimp-devel bitte installieren."

         prt it "File header per gimp non trovato."
         prt it "Installare il pacchetto di sviluppo gimp."

      fi
   fi

   # Set a few variable according to OS and components found
   guiPrg=
   instGuiPrg=
   if [ $noX -eq 0 ]
   then
      guiPrg='mtink mtinkc'
      instGuiPrg=install-mtink
   fi

   if [ `uname` = "Linux" ]
   then
      otherPrg='mtinkd $(DETDIR)/askPrinter'
      installOther='install-askPrinter install-mtinkd install-start install-cups'
   fi

   if [ "$OS" = "Darwin" -o $useUsbLib -eq 1 ]
   then
      otherPrg=
      installOther=install-cups
   fi

   if [ $gimptoolFound -ge 1 ]
   then
      installOther="$installOther  install-plugins"
      otherPrg="$otherPrg gimp-mtink"
   fi
   prgs="$guiPrg ttink $otherPrg"

   instPrgs="$instGuiPrg install-ttink install-desc install-pyink $installOther"

   # build Makefile.

   cat Makefile.ORG |\
   if [ "$OS" != "Darwin" -a $useUsbLib -eq 0  ]
   then
      sed -e 's/^MACOS.*//'
   else
      if [ $useUsbLib -eq 1 ]
      then
         sed -e 's/^MACOSLDFLG=.*/MACOSLDFLG=-lusb -lpthread $(MACLB)/'
      else
         cat -
      fi
   fi |\
   if [ "$xplibFound" = 1 ]
   then
      sed  -e 's/LIBXP .*/LIBXP = -lXp/'
   else
      sed  -e 's/LIBXP .*/LIBXP =/'
   fi |\
   if [ "$mxpmheader" != "" ]
   then
      sed -e 's@^XPM_INC.*@XPM_INC = '$mxpmheader'@' \
          -e 's@^XPM_LIB.*@XPM_LIB = '$mxpmlib'@'
   else
      sed -e 's@^XPM_INC.*@XPM_INC =@' \
          -e 's@^XPM_INC.*@XPM_LIB =@'
   fi |\
   if [ "$gimptoolFound" -ge 1 ]
   then
      sed  -e "s@GIMP_INC .*@GIMP_INC = $MTINK_CFLAGS@" \
           -e "s@GIMP_LIB .*@GIMP_LIB = $LFLAGS@" \
           -e "s@^gimpVersion=.*@gimpVersion=$gimpVersion@"
   else
      cat -
   fi |\
   sed -e "s@PRG .*@PRG = $prgs@" \
       -e "s@^install:.*@install: $instPrgs@" |\
   if [ "$gimpVersion" = "1.0" ]
   then
      sed  -e 's@\(GIMP_INC .*\)@\1 -DGIMP_VERSION_1@'
   else
      if [ "$gimptoolFound" -gt 1 ]
      then
         sed  -e 's@\(GIMP_INC .*\)@\1 -DGIMP_VERSION_2@'
       else
         cat -
      fi
   fi  |\
   sed -e "s@PRG .*@PRG = $prgs@" \
       -e "s@^install:.*@install: $instPrgs@" |\
   if [ "$gimpVersion" = "1.0" ]
   then
      sed  -e 's@\(GIMP_INC .*\)@\1 -DGIMP_VERSION_1@'
   else
      if [ "$gimptoolFound" -gt 1 ]
      then
         sed -e 's@\(GIMP_INC .*\)@\1 -DGIMP_VERSION_2@'
      else
         cat -
      fi
   fi |\
   if [ "$Strip" = "0" ]
   then
      sed -e 's/^DBG.*/DBG = -g/'
   else
      cat -
   fi |\
   if [ $OS = Darwin ]
   then
       sed 's/^#\(MACIN.*\)/\1/'
   else
      cat -
   fi | sed -e "s@^prefix.*@prefix=$prefix@" \
            -e "s@^setUid.*@setUid=$setUid@" \
            -e "$mlCmd" -e "$miCmd"   > Makefile

   # and server install script
   sed -e 's@^PROG.*@PROG='$prefix'/sbin/mtinkd@' etc/mtink.ORG > etc/mtink

   if [ -d $prefix/doc ]
   then
      docDir=$prefix/doc
   else
      docDir=$prefix
   fi
   prt en "Binary path:"
   prt fr "Chemin d'installation de l'executable:"
   prt de "Installationspfad fuer das ausfuehrbares Programm:"
   prt it "Percorso di installazione dell'eseguibile:"
   echo $prefix/bin
   echo
   prt en "The documentation files will be installed under:"
   prt fr "Les fichiers de documentation seront installes sous:"
   prt de "Die Dokumentationsdateien werden installiert unter:"
   prt it "La Documentazione verr installata in:"
   echo $docDir/mtink
   echo

   if [ "$gimpVersion" != "" ]
   then
      echo Gimp version  $gimpVersion found / trouve / gefunden / trovato / tallva. | $CONV
      echo
   fi
else # no x file to build
   # build Makefile.
   # Set a few variable according to OS and components found
   guiPrg=
   instGuiPrg=

   if [ `uname` = "Linux" ]
   then
      otherPrg='mtinkd $(DETDIR)/askPrinter'
      installOther='install-askPrinter install-mtinkd install-start install-cups'
   fi

   if [ "$OS" = "Darwin" -o $useUsbLib -eq 1 ]
   then
      otherPrg=
      installOther=install-cups
   fi

   prgs="$guiPrg ttink $otherPrg"

   instPrgs="$instGuiPrg install-ttink install-desc install-pyink $installOther"

   cat Makefile.ORG |\
   if [ "$Strip" = "0" ]
   then
      sed -e 's/^DBG.*/DBG = -g/'
   else
      cat -
   fi |\
   if [ "$OS" != "Darwin" ]
   then
      sed -e 's/^MACOS.*//'
   else
      cat -
   fi |\
   sed -e "s@PRG .*@PRG = ttink $detectPrg $svrPrg@" |\
   sed -e "s@^prefix.*@prefix=$prefix@" \
       -e "s@^setUid.*@setUid=$setUid@" \
       -e "s@^install:.*@install: $instPrgs@" > Makefile
   # and server install script
   sed -e 's@^PROG.*@PROG='$prefix'/sbin@' etc/mtink.ORG > etc/mtink

   if [ -d $prefix/doc ]
   then
      docDir=$prefix/doc
   else
      docDir=$prefix
   fi
   prt en "Binary path:"
   prt fr "Chemin d'installation de l'executable:"
   prt de "Installationspfad fuer das ausfuehrbares Programm:"
   prt it "Percorso di installazione dell'eseguibile:"
   echo $prefix/bin
   echo
   prt en "The documentation files will be installed under:"
   prt fr "Les fichiers de documentation seront installes sous:"
   prt de "Die Dokumentationsdateien werden installiert unter:"
   prt it "La Documentazione verr installata in:"
   echo $docDir/mtink
   echo
fi