From fa949b6b7fa553547f26305d4227e8baa0091c1f Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 10 Sep 2010 05:14:00 +0000 Subject: [PATCH] Added initial Trinity version of BibleTime git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/bibletime@1173688 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- BibleTime.kdevelop | 247 + ChangeLog | 963 ++ INSTALL | 244 + INSTALL.in | 244 + LICENSE | 291 + Makefile.am | 80 + Makefile.cvs | 14 + README | 36 + README.in | 36 + acinclude.m4 | 12174 ++++++++++++++++ aclocal.m4 | 910 ++ autogen.sh | 2 + bibletime.desktop | 26 + bibletime.desktop.in | 26 + bibletime.lsm | 14 + bibletime.lsm.in | 14 + bibletime.m4 | 193 + bibletime.spec | 234 + bibletime.spec.in | 234 + bibletime/Makefile.am | 70 + bibletime/backend/Makefile.am | 44 + bibletime/backend/bt_gbfhtml.cpp | 303 + bibletime/backend/bt_gbfhtml.h | 60 + bibletime/backend/bt_osishtml.cpp | 621 + bibletime/backend/bt_osishtml.h | 66 + bibletime/backend/bt_plainhtml.cpp | 92 + bibletime/backend/bt_plainhtml.h | 41 + bibletime/backend/bt_thmlhtml.cpp | 395 + bibletime/backend/bt_thmlhtml.h | 56 + bibletime/backend/bt_thmlplain.cpp | 221 + bibletime/backend/bt_thmlplain.h | 40 + bibletime/backend/btstringmgr.cpp | 145 + bibletime/backend/btstringmgr.h | 57 + bibletime/backend/cbookdisplay.cpp | 144 + bibletime/backend/cbookdisplay.h | 45 + bibletime/backend/cchapterdisplay.cpp | 67 + bibletime/backend/cchapterdisplay.h | 39 + bibletime/backend/cdisplayrendering.cpp | 163 + bibletime/backend/cdisplayrendering.h | 40 + bibletime/backend/cdisplaytemplatemgr.cpp | 191 + bibletime/backend/cdisplaytemplatemgr.h | 100 + bibletime/backend/centrydisplay.cpp | 66 + bibletime/backend/centrydisplay.h | 53 + bibletime/backend/chtmlexportrendering.cpp | 236 + bibletime/backend/chtmlexportrendering.h | 60 + bibletime/backend/clanguagemgr.cpp | 499 + bibletime/backend/clanguagemgr.h | 172 + .../backend/cplaintextexportrendering.cpp | 58 + bibletime/backend/cplaintextexportrendering.h | 42 + bibletime/backend/creferencemanager.cpp | 434 + bibletime/backend/creferencemanager.h | 112 + bibletime/backend/cswordbackend.cpp | 692 + bibletime/backend/cswordbackend.h | 266 + bibletime/backend/cswordbiblemoduleinfo.cpp | 272 + bibletime/backend/cswordbiblemoduleinfo.h | 132 + bibletime/backend/cswordbookmoduleinfo.cpp | 75 + bibletime/backend/cswordbookmoduleinfo.h | 67 + .../backend/cswordcommentarymoduleinfo.cpp | 36 + .../backend/cswordcommentarymoduleinfo.h | 45 + bibletime/backend/cswordkey.cpp | 193 + bibletime/backend/cswordkey.h | 121 + bibletime/backend/cswordldkey.cpp | 130 + bibletime/backend/cswordldkey.h | 110 + bibletime/backend/cswordlexiconmoduleinfo.cpp | 183 + bibletime/backend/cswordlexiconmoduleinfo.h | 73 + bibletime/backend/cswordmoduleinfo.cpp | 888 ++ bibletime/backend/cswordmoduleinfo.h | 373 + bibletime/backend/cswordmodulesearch.cpp | 120 + bibletime/backend/cswordmodulesearch.h | 99 + bibletime/backend/cswordtreekey.cpp | 99 + bibletime/backend/cswordtreekey.h | 74 + bibletime/backend/cswordversekey.cpp | 320 + bibletime/backend/cswordversekey.h | 122 + bibletime/backend/ctextrendering.cpp | 278 + bibletime/backend/ctextrendering.h | 147 + bibletime/backend/osismorphsegmentation.cpp | 92 + bibletime/backend/osismorphsegmentation.h | 48 + bibletime/bibletime.cpp | 329 + bibletime/bibletime.h | 421 + bibletime/bibletime_dcop.cpp | 220 + bibletime/bibletime_init.cpp | 609 + bibletime/bibletime_slots.cpp | 570 + bibletime/bibletimeapp.cpp | 46 + bibletime/bibletimeapp.h | 33 + bibletime/bibletimeinterface.h | 111 + bibletime/bibletimeinterface_skel.cpp | 188 + bibletime/display-templates/Blue.tmpl | 349 + bibletime/display-templates/Crazy.tmpl | 326 + bibletime/display-templates/Green.tmpl | 328 + bibletime/display-templates/HighContrast.tmpl | 339 + bibletime/display-templates/Makefile.am | 13 + bibletime/display-templates/Simple.tmpl | 134 + .../display-templates/basic_template.txt | 203 + bibletime/display-templates/create_code.pl | 79 + bibletime/display-templates/names.conf | 5 + bibletime/display-templates/template-init.cpp | 1484 ++ bibletime/frontend/Makefile.am | 35 + bibletime/frontend/btinstallmgr.cpp | 318 + bibletime/frontend/btinstallmgr.h | 103 + bibletime/frontend/cbtconfig.cpp | 677 + bibletime/frontend/cbtconfig.h | 193 + bibletime/frontend/cdragdropmgr.cpp | 256 + bibletime/frontend/cdragdropmgr.h | 155 + bibletime/frontend/cexportmanager.cpp | 543 + bibletime/frontend/cexportmanager.h | 100 + bibletime/frontend/cinfodisplay.cpp | 462 + bibletime/frontend/cinfodisplay.h | 72 + bibletime/frontend/cinputdialog.cpp | 94 + bibletime/frontend/cinputdialog.h | 43 + bibletime/frontend/cmanageindiceswidget.cpp | 193 + bibletime/frontend/cmanageindiceswidget.h | 77 + bibletime/frontend/cmdiarea.cpp | 358 + bibletime/frontend/cmdiarea.h | 143 + bibletime/frontend/cmoduleindexdialog.cpp | 98 + bibletime/frontend/cmoduleindexdialog.h | 55 + bibletime/frontend/coptionsdialog.cpp | 1044 ++ bibletime/frontend/coptionsdialog.h | 214 + bibletime/frontend/cprinter.cpp | 130 + bibletime/frontend/cprinter.h | 56 + bibletime/frontend/cprofile.cpp | 397 + bibletime/frontend/cprofile.h | 102 + bibletime/frontend/cprofilemgr.cpp | 124 + bibletime/frontend/cprofilemgr.h | 69 + bibletime/frontend/cprofilewindow.cpp | 125 + bibletime/frontend/cprofilewindow.h | 126 + bibletime/frontend/crossrefrendering.cpp | 88 + bibletime/frontend/crossrefrendering.h | 36 + bibletime/frontend/cswordsetupdialog.cpp | 918 ++ bibletime/frontend/cswordsetupdialog.h | 150 + .../cswordsetupinstallsourcesdialog.cpp | 172 + .../cswordsetupinstallsourcesdialog.h | 34 + .../frontend/cswordsetupmodulelistview.cpp | 288 + .../frontend/cswordsetupmodulelistview.h | 67 + bibletime/frontend/display/Makefile.am | 24 + bibletime/frontend/display/cdisplay.cpp | 216 + bibletime/frontend/display/cdisplay.h | 189 + .../frontend/display/chtmlreaddisplay.cpp | 507 + bibletime/frontend/display/chtmlreaddisplay.h | 144 + .../frontend/display/chtmlwritedisplay.cpp | 266 + .../frontend/display/chtmlwritedisplay.h | 104 + .../frontend/display/cplainwritedisplay.cpp | 157 + .../frontend/display/cplainwritedisplay.h | 94 + bibletime/frontend/display/creaddisplay.cpp | 115 + bibletime/frontend/display/creaddisplay.h | 71 + bibletime/frontend/display/cwritedisplay.cpp | 23 + bibletime/frontend/display/cwritedisplay.h | 50 + bibletime/frontend/displaywindow/Makefile.am | 36 + .../displaywindow/cbiblereadwindow.cpp | 458 + .../frontend/displaywindow/cbiblereadwindow.h | 141 + .../displaywindow/cbookreadwindow.cpp | 176 + .../frontend/displaywindow/cbookreadwindow.h | 69 + bibletime/frontend/displaywindow/cbuttons.cpp | 218 + bibletime/frontend/displaywindow/cbuttons.h | 101 + .../displaywindow/ccommentaryreadwindow.cpp | 198 + .../displaywindow/ccommentaryreadwindow.h | 67 + .../frontend/displaywindow/cdisplaywindow.cpp | 498 + .../frontend/displaywindow/cdisplaywindow.h | 275 + .../displaywindow/chtmlwritewindow.cpp | 132 + .../frontend/displaywindow/chtmlwritewindow.h | 74 + .../displaywindow/clexiconreadwindow.cpp | 317 + .../displaywindow/clexiconreadwindow.h | 117 + .../displaywindow/cmodulechooserbar.cpp | 152 + .../displaywindow/cmodulechooserbar.h | 79 + .../displaywindow/cmodulechooserbutton.cpp | 276 + .../displaywindow/cmodulechooserbutton.h | 77 + .../displaywindow/cplainwritewindow.cpp | 176 + .../displaywindow/cplainwritewindow.h | 97 + .../frontend/displaywindow/creadwindow.cpp | 195 + .../frontend/displaywindow/creadwindow.h | 74 + .../frontend/displaywindow/cwritewindow.cpp | 176 + .../frontend/displaywindow/cwritewindow.h | 79 + bibletime/frontend/keychooser/Makefile.am | 28 + .../frontend/keychooser/cbiblekeychooser.cpp | 113 + .../frontend/keychooser/cbiblekeychooser.h | 73 + .../frontend/keychooser/cbookkeychooser.cpp | 288 + .../frontend/keychooser/cbookkeychooser.h | 99 + .../frontend/keychooser/cbooktreechooser.cpp | 321 + .../frontend/keychooser/cbooktreechooser.h | 112 + bibletime/frontend/keychooser/ckeychooser.cpp | 149 + bibletime/frontend/keychooser/ckeychooser.h | 114 + .../frontend/keychooser/ckeychooserwidget.cpp | 303 + .../frontend/keychooser/ckeychooserwidget.h | 179 + .../keychooser/ckeyreferencewidget.cpp | 210 + .../frontend/keychooser/ckeyreferencewidget.h | 89 + .../keychooser/clexiconkeychooser.cpp | 176 + .../frontend/keychooser/clexiconkeychooser.h | 79 + .../frontend/keychooser/crefselectdialog.cpp | 100 + .../frontend/keychooser/crefselectdialog.h | 56 + .../frontend/keychooser/cscrollbutton.cpp | 101 + bibletime/frontend/keychooser/cscrollbutton.h | 86 + .../keychooser/cscrollerwidgetset.cpp | 78 + .../frontend/keychooser/cscrollerwidgetset.h | 72 + bibletime/frontend/kstartuplogo.cpp | 115 + bibletime/frontend/kstartuplogo.h | 66 + bibletime/frontend/mainindex/Makefile.am | 18 + bibletime/frontend/mainindex/cindexitem.cpp | 1228 ++ bibletime/frontend/mainindex/cindexitem.h | 390 + bibletime/frontend/mainindex/cmainindex.cpp | 869 ++ bibletime/frontend/mainindex/cmainindex.h | 232 + bibletime/frontend/manageindicesform.cpp | 82 + bibletime/frontend/manageindicesform.ui | 114 + bibletime/frontend/searchdialog/Makefile.am | 28 + .../frontend/searchdialog/cmodulechooser.cpp | 303 + .../frontend/searchdialog/cmodulechooser.h | 117 + .../searchdialog/cmoduleresultview.cpp | 269 + .../frontend/searchdialog/cmoduleresultview.h | 135 + .../frontend/searchdialog/crangechooser.cpp | 287 + .../frontend/searchdialog/crangechooser.h | 106 + .../frontend/searchdialog/csearchanalysis.cpp | 587 + .../frontend/searchdialog/csearchanalysis.h | 222 + .../frontend/searchdialog/csearchdialog.cpp | 263 + .../frontend/searchdialog/csearchdialog.h | 138 + .../searchdialog/csearchdialogpages.cpp | 784 + .../searchdialog/csearchdialogpages.h | 292 + .../searchdialog/csearchresultview.cpp | 271 + .../frontend/searchdialog/csearchresultview.h | 112 + .../searchdialog/searchoptionsform.cpp | 119 + .../searchdialog/searchoptionsform.ui | 199 + .../searchdialog/searchresultsform.cpp | 88 + .../searchdialog/searchresultsform.ui | 196 + bibletime/frontend/util/Makefile.am | 16 + bibletime/frontend/util/csortlistviewitem.cpp | 84 + bibletime/frontend/util/csortlistviewitem.h | 58 + bibletime/main.cpp | 313 + bibletime/pics/16x16/Makefile.am | 7 + bibletime/pics/16x16/hi16-action-bt_bible.png | Bin 0 -> 821 bytes .../pics/16x16/hi16-action-bt_bible_add.png | Bin 0 -> 892 bytes .../16x16/hi16-action-bt_bible_locked.png | Bin 0 -> 866 bytes bibletime/pics/16x16/hi16-action-bt_book.png | Bin 0 -> 717 bytes .../pics/16x16/hi16-action-bt_book_add.png | Bin 0 -> 845 bytes .../pics/16x16/hi16-action-bt_book_locked.png | Bin 0 -> 827 bytes .../pics/16x16/hi16-action-bt_cascade.png | Bin 0 -> 670 bytes .../16x16/hi16-action-bt_cascade_auto.png | Bin 0 -> 815 bytes .../pics/16x16/hi16-action-bt_commentary.png | Bin 0 -> 812 bytes .../16x16/hi16-action-bt_commentary_add.png | Bin 0 -> 890 bytes .../hi16-action-bt_commentary_locked.png | Bin 0 -> 874 bytes .../16x16/hi16-action-bt_displayconfig.png | Bin 0 -> 877 bytes .../16x16/hi16-action-bt_displaytranslit.png | Bin 0 -> 749 bytes .../pics/16x16/hi16-action-bt_findstrongs.png | Bin 0 -> 772 bytes .../pics/16x16/hi16-action-bt_lexicon.png | Bin 0 -> 776 bytes .../pics/16x16/hi16-action-bt_lexicon_add.png | Bin 0 -> 907 bytes .../16x16/hi16-action-bt_lexicon_locked.png | Bin 0 -> 864 bytes .../pics/16x16/hi16-action-bt_startconfig.png | Bin 0 -> 916 bytes .../pics/16x16/hi16-action-bt_swordconfig.png | Bin 0 -> 837 bytes bibletime/pics/16x16/hi16-action-bt_sync.png | Bin 0 -> 896 bytes bibletime/pics/16x16/hi16-action-bt_tile.png | Bin 0 -> 590 bytes .../pics/16x16/hi16-action-bt_tile_auto.png | Bin 0 -> 739 bytes bibletime/pics/16x16/hi16-app-bibletime.png | Bin 0 -> 907 bytes bibletime/pics/22x22/Makefile.am | 7 + bibletime/pics/22x22/hi22-action-bt_bible.png | Bin 0 -> 1162 bytes .../pics/22x22/hi22-action-bt_bible_add.png | Bin 0 -> 1343 bytes .../22x22/hi22-action-bt_bible_locked.png | Bin 0 -> 1273 bytes bibletime/pics/22x22/hi22-action-bt_book.png | Bin 0 -> 1007 bytes .../pics/22x22/hi22-action-bt_book_add.png | Bin 0 -> 1247 bytes .../pics/22x22/hi22-action-bt_book_locked.png | Bin 0 -> 1188 bytes .../pics/22x22/hi22-action-bt_cascade.png | Bin 0 -> 838 bytes .../22x22/hi22-action-bt_cascade_auto.png | Bin 0 -> 1113 bytes .../pics/22x22/hi22-action-bt_commentary.png | Bin 0 -> 1192 bytes .../22x22/hi22-action-bt_commentary_add.png | Bin 0 -> 1340 bytes .../hi22-action-bt_commentary_locked.png | Bin 0 -> 1288 bytes .../22x22/hi22-action-bt_displayconfig.png | Bin 0 -> 1349 bytes .../22x22/hi22-action-bt_displaytranslit.png | Bin 0 -> 1098 bytes .../pics/22x22/hi22-action-bt_findstrongs.png | Bin 0 -> 1284 bytes .../pics/22x22/hi22-action-bt_lexicon.png | Bin 0 -> 1122 bytes .../pics/22x22/hi22-action-bt_lexicon_add.png | Bin 0 -> 1342 bytes .../22x22/hi22-action-bt_lexicon_locked.png | Bin 0 -> 1290 bytes .../pics/22x22/hi22-action-bt_parallel.png | Bin 0 -> 454 bytes .../pics/22x22/hi22-action-bt_startconfig.png | Bin 0 -> 1385 bytes .../pics/22x22/hi22-action-bt_swordconfig.png | Bin 0 -> 1247 bytes bibletime/pics/22x22/hi22-action-bt_sync.png | Bin 0 -> 1457 bytes bibletime/pics/22x22/hi22-action-bt_tile.png | Bin 0 -> 783 bytes .../pics/22x22/hi22-action-bt_tile_auto.png | Bin 0 -> 1055 bytes bibletime/pics/22x22/hi22-app-bibletime.png | Bin 0 -> 1336 bytes bibletime/pics/32x32/Makefile.am | 7 + bibletime/pics/32x32/hi32-action-bt_bible.png | Bin 0 -> 1875 bytes .../pics/32x32/hi32-action-bt_bible_add.png | Bin 0 -> 2201 bytes .../32x32/hi32-action-bt_bible_locked.png | Bin 0 -> 2060 bytes bibletime/pics/32x32/hi32-action-bt_book.png | Bin 0 -> 1586 bytes .../pics/32x32/hi32-action-bt_book_add.png | Bin 0 -> 2044 bytes .../pics/32x32/hi32-action-bt_book_locked.png | Bin 0 -> 1941 bytes .../pics/32x32/hi32-action-bt_cascade.png | Bin 0 -> 1233 bytes .../32x32/hi32-action-bt_cascade_auto.png | Bin 0 -> 1745 bytes .../pics/32x32/hi32-action-bt_commentary.png | Bin 0 -> 1915 bytes .../32x32/hi32-action-bt_commentary_add.png | Bin 0 -> 2226 bytes .../hi32-action-bt_commentary_locked.png | Bin 0 -> 2139 bytes .../32x32/hi32-action-bt_displayconfig.png | Bin 0 -> 2278 bytes .../32x32/hi32-action-bt_displaytranslit.png | Bin 0 -> 1731 bytes .../pics/32x32/hi32-action-bt_findstrongs.png | Bin 0 -> 1925 bytes .../pics/32x32/hi32-action-bt_lexicon.png | Bin 0 -> 1833 bytes .../pics/32x32/hi32-action-bt_lexicon_add.png | Bin 0 -> 2257 bytes .../32x32/hi32-action-bt_lexicon_locked.png | Bin 0 -> 2145 bytes .../pics/32x32/hi32-action-bt_startconfig.png | Bin 0 -> 2337 bytes .../pics/32x32/hi32-action-bt_swordconfig.png | Bin 0 -> 2067 bytes bibletime/pics/32x32/hi32-action-bt_sync.png | Bin 0 -> 2247 bytes bibletime/pics/32x32/hi32-action-bt_tile.png | Bin 0 -> 1108 bytes .../pics/32x32/hi32-action-bt_tile_auto.png | Bin 0 -> 1615 bytes bibletime/pics/32x32/hi32-app-bibletime.png | Bin 0 -> 2259 bytes bibletime/pics/48x48/Makefile.am | 7 + bibletime/pics/48x48/hi48-action-bt_bible.png | Bin 0 -> 3241 bytes .../pics/48x48/hi48-action-bt_bible_add.png | Bin 0 -> 3798 bytes .../48x48/hi48-action-bt_bible_locked.png | Bin 0 -> 3591 bytes bibletime/pics/48x48/hi48-action-bt_book.png | Bin 0 -> 2651 bytes .../pics/48x48/hi48-action-bt_book_add.png | Bin 0 -> 3420 bytes .../pics/48x48/hi48-action-bt_book_locked.png | Bin 0 -> 3275 bytes .../pics/48x48/hi48-action-bt_cascade.png | Bin 0 -> 1654 bytes .../48x48/hi48-action-bt_cascade_auto.png | Bin 0 -> 2628 bytes .../pics/48x48/hi48-action-bt_commentary.png | Bin 0 -> 3365 bytes .../48x48/hi48-action-bt_commentary_add.png | Bin 0 -> 3904 bytes .../hi48-action-bt_commentary_locked.png | Bin 0 -> 3775 bytes .../48x48/hi48-action-bt_displayconfig.png | Bin 0 -> 4063 bytes .../48x48/hi48-action-bt_displaytranslit.png | Bin 0 -> 2850 bytes .../pics/48x48/hi48-action-bt_lexicon.png | Bin 0 -> 3197 bytes .../pics/48x48/hi48-action-bt_lexicon_add.png | Bin 0 -> 3857 bytes .../48x48/hi48-action-bt_lexicon_locked.png | Bin 0 -> 3715 bytes .../pics/48x48/hi48-action-bt_startconfig.png | Bin 0 -> 4157 bytes .../pics/48x48/hi48-action-bt_swordconfig.png | Bin 0 -> 3623 bytes bibletime/pics/48x48/hi48-action-bt_sync.png | Bin 0 -> 3962 bytes bibletime/pics/48x48/hi48-action-bt_tile.png | Bin 0 -> 1603 bytes .../pics/48x48/hi48-action-bt_tile_auto.png | Bin 0 -> 2572 bytes bibletime/pics/48x48/hi48-app-bibletime.png | Bin 0 -> 3979 bytes bibletime/pics/64x64/Makefile.am | 7 + bibletime/pics/64x64/hi64-app-bibletime.png | Bin 0 -> 6060 bytes bibletime/pics/Makefile.am | 29 + bibletime/pics/startuplogo.png | Bin 0 -> 27328 bytes bibletime/util/Makefile.am | 16 + bibletime/util/autoptrvector.h | 176 + bibletime/util/cpointers.cpp | 58 + bibletime/util/cpointers.h | 120 + bibletime/util/cresmgr.cpp | 1198 ++ bibletime/util/cresmgr.h | 733 + bibletime/util/ctoolclass.cpp | 239 + bibletime/util/ctoolclass.h | 80 + bibletime/util/directoryutil.cpp | 111 + bibletime/util/directoryutil.h | 55 + bibletime/util/scoped_resource.h | 181 + bibletime/xml/Makefile.am | 3 + bibletime/xml/bibletimeui.rc | 70 + clucene.m4 | 153 + config.h.in | 243 + configure.in.in | 68 + docs/Makefile.am | 10 + docs/bibletime.1 | 109 + docs/bibletime.de.1 | 109 + docs/handbook/Makefile.am | 17 + docs/handbook/html/Makefile.am | 127 + docs/handbook/html/i_bible.png | Bin 0 -> 1875 bytes docs/handbook/html/i_bible_add.png | Bin 0 -> 2201 bytes docs/handbook/html/i_bibletime.png | Bin 0 -> 2259 bytes docs/handbook/html/i_book.png | Bin 0 -> 1586 bytes docs/handbook/html/i_book_add.png | Bin 0 -> 2044 bytes docs/handbook/html/i_cascade.png | Bin 0 -> 1233 bytes docs/handbook/html/i_cascade_auto.png | Bin 0 -> 1745 bytes docs/handbook/html/i_commentary.png | Bin 0 -> 1915 bytes docs/handbook/html/i_commentary_add.png | Bin 0 -> 2226 bytes docs/handbook/html/i_configure.png | Bin 0 -> 1839 bytes docs/handbook/html/i_configureaccels.png | Bin 0 -> 1605 bytes docs/handbook/html/i_configuredisplay.png | Bin 0 -> 2278 bytes docs/handbook/html/i_configurefonts.png | Bin 0 -> 2223 bytes docs/handbook/html/i_configurestart.png | Bin 0 -> 2337 bytes docs/handbook/html/i_configuresword.png | Bin 0 -> 2067 bytes docs/handbook/html/i_configuretoolbars.png | Bin 0 -> 1160 bytes docs/handbook/html/i_contents.png | Bin 0 -> 2467 bytes docs/handbook/html/i_delete.png | Bin 0 -> 1784 bytes docs/handbook/html/i_editdelete.png | Bin 0 -> 1368 bytes docs/handbook/html/i_exit.png | Bin 0 -> 1610 bytes docs/handbook/html/i_fileclose.png | Bin 0 -> 1594 bytes docs/handbook/html/i_fileprint.png | Bin 0 -> 1331 bytes docs/handbook/html/i_find.png | Bin 0 -> 2396 bytes docs/handbook/html/i_fullscreen.png | Bin 0 -> 1198 bytes docs/handbook/html/i_go.png | Bin 0 -> 3518 bytes docs/handbook/html/i_ktip.png | Bin 0 -> 1665 bytes docs/handbook/html/i_lexicon.png | Bin 0 -> 1833 bytes docs/handbook/html/i_lexicon_add.png | Bin 0 -> 2257 bytes docs/handbook/html/i_pencil.png | Bin 0 -> 361 bytes docs/handbook/html/i_sidetree.png | Bin 0 -> 930 bytes docs/handbook/html/i_sync.png | Bin 0 -> 2247 bytes docs/handbook/html/i_tile.png | Bin 0 -> 1108 bytes docs/handbook/html/i_tile_auto.png | Bin 0 -> 1615 bytes docs/handbook/html/ss_configfonts.png | Bin 0 -> 41575 bytes docs/handbook/html/ss_configtoolbar.png | Bin 0 -> 34080 bytes docs/handbook/html/ss_mainterms.png | Bin 0 -> 88580 bytes docs/handbook/html/ss_searchanal.png | Bin 0 -> 17886 bytes docs/handbook/html/ss_searchopts.png | Bin 0 -> 69926 bytes docs/handbook/unicode/Makefile.am | 31 + docs/handbook/unicode/hdbk-config.docbook | 182 + docs/handbook/unicode/hdbk-intro.docbook | 93 + docs/handbook/unicode/hdbk-operation.docbook | 260 + docs/handbook/unicode/hdbk-reference.docbook | 480 + docs/handbook/unicode/hdbk-start.docbook | 93 + docs/handbook/unicode/index.docbook | 89 + docs/howto/Makefile.am | 17 + docs/howto/html/Makefile.am | 13 + docs/howto/unicode/Makefile.am | 25 + docs/howto/unicode/how2-basics.docbook | 198 + docs/howto/unicode/how2-importance.docbook | 311 + .../howto/unicode/how2-interpretation.docbook | 212 + docs/howto/unicode/index.docbook | 86 + docs/ksgmltools-bug-read-me.txt | 36 + docs/tips | 165 + pot/Makefile.am | 30 + pot/extractrc | 74 + pot/handbook.pot | 2413 +++ pot/howto.pot | 1924 +++ pot/messages.pot | 2823 ++++ pot/preparetips | 45 + sword.m4 | 227 + 406 files changed, 70583 insertions(+) create mode 100644 BibleTime.kdevelop create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 INSTALL.in create mode 100644 LICENSE create mode 100644 Makefile.am create mode 100644 Makefile.cvs create mode 100644 README create mode 100644 README.in create mode 100644 acinclude.m4 create mode 100644 aclocal.m4 create mode 100755 autogen.sh create mode 100644 bibletime.desktop create mode 100644 bibletime.desktop.in create mode 100644 bibletime.lsm create mode 100644 bibletime.lsm.in create mode 100644 bibletime.m4 create mode 100644 bibletime.spec create mode 100644 bibletime.spec.in create mode 100644 bibletime/Makefile.am create mode 100644 bibletime/backend/Makefile.am create mode 100644 bibletime/backend/bt_gbfhtml.cpp create mode 100644 bibletime/backend/bt_gbfhtml.h create mode 100644 bibletime/backend/bt_osishtml.cpp create mode 100644 bibletime/backend/bt_osishtml.h create mode 100644 bibletime/backend/bt_plainhtml.cpp create mode 100644 bibletime/backend/bt_plainhtml.h create mode 100644 bibletime/backend/bt_thmlhtml.cpp create mode 100644 bibletime/backend/bt_thmlhtml.h create mode 100644 bibletime/backend/bt_thmlplain.cpp create mode 100644 bibletime/backend/bt_thmlplain.h create mode 100644 bibletime/backend/btstringmgr.cpp create mode 100644 bibletime/backend/btstringmgr.h create mode 100644 bibletime/backend/cbookdisplay.cpp create mode 100644 bibletime/backend/cbookdisplay.h create mode 100644 bibletime/backend/cchapterdisplay.cpp create mode 100644 bibletime/backend/cchapterdisplay.h create mode 100644 bibletime/backend/cdisplayrendering.cpp create mode 100644 bibletime/backend/cdisplayrendering.h create mode 100644 bibletime/backend/cdisplaytemplatemgr.cpp create mode 100644 bibletime/backend/cdisplaytemplatemgr.h create mode 100644 bibletime/backend/centrydisplay.cpp create mode 100644 bibletime/backend/centrydisplay.h create mode 100644 bibletime/backend/chtmlexportrendering.cpp create mode 100644 bibletime/backend/chtmlexportrendering.h create mode 100644 bibletime/backend/clanguagemgr.cpp create mode 100644 bibletime/backend/clanguagemgr.h create mode 100644 bibletime/backend/cplaintextexportrendering.cpp create mode 100644 bibletime/backend/cplaintextexportrendering.h create mode 100644 bibletime/backend/creferencemanager.cpp create mode 100644 bibletime/backend/creferencemanager.h create mode 100644 bibletime/backend/cswordbackend.cpp create mode 100644 bibletime/backend/cswordbackend.h create mode 100644 bibletime/backend/cswordbiblemoduleinfo.cpp create mode 100644 bibletime/backend/cswordbiblemoduleinfo.h create mode 100644 bibletime/backend/cswordbookmoduleinfo.cpp create mode 100644 bibletime/backend/cswordbookmoduleinfo.h create mode 100644 bibletime/backend/cswordcommentarymoduleinfo.cpp create mode 100644 bibletime/backend/cswordcommentarymoduleinfo.h create mode 100644 bibletime/backend/cswordkey.cpp create mode 100644 bibletime/backend/cswordkey.h create mode 100644 bibletime/backend/cswordldkey.cpp create mode 100644 bibletime/backend/cswordldkey.h create mode 100644 bibletime/backend/cswordlexiconmoduleinfo.cpp create mode 100644 bibletime/backend/cswordlexiconmoduleinfo.h create mode 100644 bibletime/backend/cswordmoduleinfo.cpp create mode 100644 bibletime/backend/cswordmoduleinfo.h create mode 100644 bibletime/backend/cswordmodulesearch.cpp create mode 100644 bibletime/backend/cswordmodulesearch.h create mode 100644 bibletime/backend/cswordtreekey.cpp create mode 100644 bibletime/backend/cswordtreekey.h create mode 100644 bibletime/backend/cswordversekey.cpp create mode 100644 bibletime/backend/cswordversekey.h create mode 100644 bibletime/backend/ctextrendering.cpp create mode 100644 bibletime/backend/ctextrendering.h create mode 100644 bibletime/backend/osismorphsegmentation.cpp create mode 100644 bibletime/backend/osismorphsegmentation.h create mode 100644 bibletime/bibletime.cpp create mode 100644 bibletime/bibletime.h create mode 100644 bibletime/bibletime_dcop.cpp create mode 100644 bibletime/bibletime_init.cpp create mode 100644 bibletime/bibletime_slots.cpp create mode 100644 bibletime/bibletimeapp.cpp create mode 100644 bibletime/bibletimeapp.h create mode 100644 bibletime/bibletimeinterface.h create mode 100644 bibletime/bibletimeinterface_skel.cpp create mode 100644 bibletime/display-templates/Blue.tmpl create mode 100644 bibletime/display-templates/Crazy.tmpl create mode 100644 bibletime/display-templates/Green.tmpl create mode 100644 bibletime/display-templates/HighContrast.tmpl create mode 100644 bibletime/display-templates/Makefile.am create mode 100644 bibletime/display-templates/Simple.tmpl create mode 100644 bibletime/display-templates/basic_template.txt create mode 100755 bibletime/display-templates/create_code.pl create mode 100644 bibletime/display-templates/names.conf create mode 100644 bibletime/display-templates/template-init.cpp create mode 100644 bibletime/frontend/Makefile.am create mode 100644 bibletime/frontend/btinstallmgr.cpp create mode 100644 bibletime/frontend/btinstallmgr.h create mode 100644 bibletime/frontend/cbtconfig.cpp create mode 100644 bibletime/frontend/cbtconfig.h create mode 100644 bibletime/frontend/cdragdropmgr.cpp create mode 100644 bibletime/frontend/cdragdropmgr.h create mode 100644 bibletime/frontend/cexportmanager.cpp create mode 100644 bibletime/frontend/cexportmanager.h create mode 100644 bibletime/frontend/cinfodisplay.cpp create mode 100644 bibletime/frontend/cinfodisplay.h create mode 100644 bibletime/frontend/cinputdialog.cpp create mode 100644 bibletime/frontend/cinputdialog.h create mode 100644 bibletime/frontend/cmanageindiceswidget.cpp create mode 100644 bibletime/frontend/cmanageindiceswidget.h create mode 100644 bibletime/frontend/cmdiarea.cpp create mode 100644 bibletime/frontend/cmdiarea.h create mode 100644 bibletime/frontend/cmoduleindexdialog.cpp create mode 100644 bibletime/frontend/cmoduleindexdialog.h create mode 100644 bibletime/frontend/coptionsdialog.cpp create mode 100644 bibletime/frontend/coptionsdialog.h create mode 100644 bibletime/frontend/cprinter.cpp create mode 100644 bibletime/frontend/cprinter.h create mode 100644 bibletime/frontend/cprofile.cpp create mode 100644 bibletime/frontend/cprofile.h create mode 100644 bibletime/frontend/cprofilemgr.cpp create mode 100644 bibletime/frontend/cprofilemgr.h create mode 100644 bibletime/frontend/cprofilewindow.cpp create mode 100644 bibletime/frontend/cprofilewindow.h create mode 100644 bibletime/frontend/crossrefrendering.cpp create mode 100644 bibletime/frontend/crossrefrendering.h create mode 100644 bibletime/frontend/cswordsetupdialog.cpp create mode 100644 bibletime/frontend/cswordsetupdialog.h create mode 100644 bibletime/frontend/cswordsetupinstallsourcesdialog.cpp create mode 100644 bibletime/frontend/cswordsetupinstallsourcesdialog.h create mode 100644 bibletime/frontend/cswordsetupmodulelistview.cpp create mode 100644 bibletime/frontend/cswordsetupmodulelistview.h create mode 100644 bibletime/frontend/display/Makefile.am create mode 100644 bibletime/frontend/display/cdisplay.cpp create mode 100644 bibletime/frontend/display/cdisplay.h create mode 100644 bibletime/frontend/display/chtmlreaddisplay.cpp create mode 100644 bibletime/frontend/display/chtmlreaddisplay.h create mode 100644 bibletime/frontend/display/chtmlwritedisplay.cpp create mode 100644 bibletime/frontend/display/chtmlwritedisplay.h create mode 100644 bibletime/frontend/display/cplainwritedisplay.cpp create mode 100644 bibletime/frontend/display/cplainwritedisplay.h create mode 100644 bibletime/frontend/display/creaddisplay.cpp create mode 100644 bibletime/frontend/display/creaddisplay.h create mode 100644 bibletime/frontend/display/cwritedisplay.cpp create mode 100644 bibletime/frontend/display/cwritedisplay.h create mode 100644 bibletime/frontend/displaywindow/Makefile.am create mode 100644 bibletime/frontend/displaywindow/cbiblereadwindow.cpp create mode 100644 bibletime/frontend/displaywindow/cbiblereadwindow.h create mode 100644 bibletime/frontend/displaywindow/cbookreadwindow.cpp create mode 100644 bibletime/frontend/displaywindow/cbookreadwindow.h create mode 100644 bibletime/frontend/displaywindow/cbuttons.cpp create mode 100644 bibletime/frontend/displaywindow/cbuttons.h create mode 100644 bibletime/frontend/displaywindow/ccommentaryreadwindow.cpp create mode 100644 bibletime/frontend/displaywindow/ccommentaryreadwindow.h create mode 100644 bibletime/frontend/displaywindow/cdisplaywindow.cpp create mode 100644 bibletime/frontend/displaywindow/cdisplaywindow.h create mode 100644 bibletime/frontend/displaywindow/chtmlwritewindow.cpp create mode 100644 bibletime/frontend/displaywindow/chtmlwritewindow.h create mode 100644 bibletime/frontend/displaywindow/clexiconreadwindow.cpp create mode 100644 bibletime/frontend/displaywindow/clexiconreadwindow.h create mode 100644 bibletime/frontend/displaywindow/cmodulechooserbar.cpp create mode 100644 bibletime/frontend/displaywindow/cmodulechooserbar.h create mode 100644 bibletime/frontend/displaywindow/cmodulechooserbutton.cpp create mode 100644 bibletime/frontend/displaywindow/cmodulechooserbutton.h create mode 100644 bibletime/frontend/displaywindow/cplainwritewindow.cpp create mode 100644 bibletime/frontend/displaywindow/cplainwritewindow.h create mode 100644 bibletime/frontend/displaywindow/creadwindow.cpp create mode 100644 bibletime/frontend/displaywindow/creadwindow.h create mode 100644 bibletime/frontend/displaywindow/cwritewindow.cpp create mode 100644 bibletime/frontend/displaywindow/cwritewindow.h create mode 100644 bibletime/frontend/keychooser/Makefile.am create mode 100644 bibletime/frontend/keychooser/cbiblekeychooser.cpp create mode 100644 bibletime/frontend/keychooser/cbiblekeychooser.h create mode 100644 bibletime/frontend/keychooser/cbookkeychooser.cpp create mode 100644 bibletime/frontend/keychooser/cbookkeychooser.h create mode 100644 bibletime/frontend/keychooser/cbooktreechooser.cpp create mode 100644 bibletime/frontend/keychooser/cbooktreechooser.h create mode 100644 bibletime/frontend/keychooser/ckeychooser.cpp create mode 100644 bibletime/frontend/keychooser/ckeychooser.h create mode 100644 bibletime/frontend/keychooser/ckeychooserwidget.cpp create mode 100644 bibletime/frontend/keychooser/ckeychooserwidget.h create mode 100644 bibletime/frontend/keychooser/ckeyreferencewidget.cpp create mode 100644 bibletime/frontend/keychooser/ckeyreferencewidget.h create mode 100644 bibletime/frontend/keychooser/clexiconkeychooser.cpp create mode 100644 bibletime/frontend/keychooser/clexiconkeychooser.h create mode 100644 bibletime/frontend/keychooser/crefselectdialog.cpp create mode 100644 bibletime/frontend/keychooser/crefselectdialog.h create mode 100644 bibletime/frontend/keychooser/cscrollbutton.cpp create mode 100644 bibletime/frontend/keychooser/cscrollbutton.h create mode 100644 bibletime/frontend/keychooser/cscrollerwidgetset.cpp create mode 100644 bibletime/frontend/keychooser/cscrollerwidgetset.h create mode 100644 bibletime/frontend/kstartuplogo.cpp create mode 100644 bibletime/frontend/kstartuplogo.h create mode 100644 bibletime/frontend/mainindex/Makefile.am create mode 100644 bibletime/frontend/mainindex/cindexitem.cpp create mode 100644 bibletime/frontend/mainindex/cindexitem.h create mode 100644 bibletime/frontend/mainindex/cmainindex.cpp create mode 100644 bibletime/frontend/mainindex/cmainindex.h create mode 100644 bibletime/frontend/manageindicesform.cpp create mode 100644 bibletime/frontend/manageindicesform.ui create mode 100644 bibletime/frontend/searchdialog/Makefile.am create mode 100644 bibletime/frontend/searchdialog/cmodulechooser.cpp create mode 100644 bibletime/frontend/searchdialog/cmodulechooser.h create mode 100644 bibletime/frontend/searchdialog/cmoduleresultview.cpp create mode 100644 bibletime/frontend/searchdialog/cmoduleresultview.h create mode 100644 bibletime/frontend/searchdialog/crangechooser.cpp create mode 100644 bibletime/frontend/searchdialog/crangechooser.h create mode 100644 bibletime/frontend/searchdialog/csearchanalysis.cpp create mode 100644 bibletime/frontend/searchdialog/csearchanalysis.h create mode 100644 bibletime/frontend/searchdialog/csearchdialog.cpp create mode 100644 bibletime/frontend/searchdialog/csearchdialog.h create mode 100644 bibletime/frontend/searchdialog/csearchdialogpages.cpp create mode 100644 bibletime/frontend/searchdialog/csearchdialogpages.h create mode 100644 bibletime/frontend/searchdialog/csearchresultview.cpp create mode 100644 bibletime/frontend/searchdialog/csearchresultview.h create mode 100644 bibletime/frontend/searchdialog/searchoptionsform.cpp create mode 100644 bibletime/frontend/searchdialog/searchoptionsform.ui create mode 100644 bibletime/frontend/searchdialog/searchresultsform.cpp create mode 100644 bibletime/frontend/searchdialog/searchresultsform.ui create mode 100644 bibletime/frontend/util/Makefile.am create mode 100644 bibletime/frontend/util/csortlistviewitem.cpp create mode 100644 bibletime/frontend/util/csortlistviewitem.h create mode 100644 bibletime/main.cpp create mode 100644 bibletime/pics/16x16/Makefile.am create mode 100644 bibletime/pics/16x16/hi16-action-bt_bible.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_bible_add.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_bible_locked.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_book.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_book_add.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_book_locked.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_cascade.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_cascade_auto.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_commentary.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_commentary_add.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_commentary_locked.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_displayconfig.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_displaytranslit.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_findstrongs.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_lexicon.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_lexicon_add.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_lexicon_locked.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_startconfig.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_swordconfig.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_sync.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_tile.png create mode 100644 bibletime/pics/16x16/hi16-action-bt_tile_auto.png create mode 100644 bibletime/pics/16x16/hi16-app-bibletime.png create mode 100644 bibletime/pics/22x22/Makefile.am create mode 100644 bibletime/pics/22x22/hi22-action-bt_bible.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_bible_add.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_bible_locked.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_book.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_book_add.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_book_locked.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_cascade.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_cascade_auto.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_commentary.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_commentary_add.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_commentary_locked.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_displayconfig.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_displaytranslit.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_findstrongs.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_lexicon.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_lexicon_add.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_lexicon_locked.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_parallel.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_startconfig.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_swordconfig.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_sync.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_tile.png create mode 100644 bibletime/pics/22x22/hi22-action-bt_tile_auto.png create mode 100644 bibletime/pics/22x22/hi22-app-bibletime.png create mode 100644 bibletime/pics/32x32/Makefile.am create mode 100644 bibletime/pics/32x32/hi32-action-bt_bible.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_bible_add.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_bible_locked.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_book.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_book_add.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_book_locked.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_cascade.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_cascade_auto.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_commentary.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_commentary_add.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_commentary_locked.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_displayconfig.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_displaytranslit.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_findstrongs.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_lexicon.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_lexicon_add.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_lexicon_locked.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_startconfig.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_swordconfig.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_sync.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_tile.png create mode 100644 bibletime/pics/32x32/hi32-action-bt_tile_auto.png create mode 100644 bibletime/pics/32x32/hi32-app-bibletime.png create mode 100644 bibletime/pics/48x48/Makefile.am create mode 100644 bibletime/pics/48x48/hi48-action-bt_bible.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_bible_add.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_bible_locked.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_book.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_book_add.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_book_locked.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_cascade.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_cascade_auto.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_commentary.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_commentary_add.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_commentary_locked.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_displayconfig.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_displaytranslit.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_lexicon.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_lexicon_add.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_lexicon_locked.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_startconfig.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_swordconfig.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_sync.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_tile.png create mode 100644 bibletime/pics/48x48/hi48-action-bt_tile_auto.png create mode 100644 bibletime/pics/48x48/hi48-app-bibletime.png create mode 100644 bibletime/pics/64x64/Makefile.am create mode 100644 bibletime/pics/64x64/hi64-app-bibletime.png create mode 100644 bibletime/pics/Makefile.am create mode 100644 bibletime/pics/startuplogo.png create mode 100644 bibletime/util/Makefile.am create mode 100644 bibletime/util/autoptrvector.h create mode 100644 bibletime/util/cpointers.cpp create mode 100644 bibletime/util/cpointers.h create mode 100644 bibletime/util/cresmgr.cpp create mode 100644 bibletime/util/cresmgr.h create mode 100644 bibletime/util/ctoolclass.cpp create mode 100644 bibletime/util/ctoolclass.h create mode 100644 bibletime/util/directoryutil.cpp create mode 100644 bibletime/util/directoryutil.h create mode 100644 bibletime/util/scoped_resource.h create mode 100644 bibletime/xml/Makefile.am create mode 100644 bibletime/xml/bibletimeui.rc create mode 100644 clucene.m4 create mode 100644 config.h.in create mode 100644 configure.in.in create mode 100644 docs/Makefile.am create mode 100644 docs/bibletime.1 create mode 100644 docs/bibletime.de.1 create mode 100644 docs/handbook/Makefile.am create mode 100644 docs/handbook/html/Makefile.am create mode 100644 docs/handbook/html/i_bible.png create mode 100644 docs/handbook/html/i_bible_add.png create mode 100644 docs/handbook/html/i_bibletime.png create mode 100644 docs/handbook/html/i_book.png create mode 100644 docs/handbook/html/i_book_add.png create mode 100644 docs/handbook/html/i_cascade.png create mode 100644 docs/handbook/html/i_cascade_auto.png create mode 100644 docs/handbook/html/i_commentary.png create mode 100644 docs/handbook/html/i_commentary_add.png create mode 100644 docs/handbook/html/i_configure.png create mode 100644 docs/handbook/html/i_configureaccels.png create mode 100644 docs/handbook/html/i_configuredisplay.png create mode 100644 docs/handbook/html/i_configurefonts.png create mode 100644 docs/handbook/html/i_configurestart.png create mode 100644 docs/handbook/html/i_configuresword.png create mode 100644 docs/handbook/html/i_configuretoolbars.png create mode 100644 docs/handbook/html/i_contents.png create mode 100644 docs/handbook/html/i_delete.png create mode 100644 docs/handbook/html/i_editdelete.png create mode 100644 docs/handbook/html/i_exit.png create mode 100644 docs/handbook/html/i_fileclose.png create mode 100644 docs/handbook/html/i_fileprint.png create mode 100644 docs/handbook/html/i_find.png create mode 100644 docs/handbook/html/i_fullscreen.png create mode 100644 docs/handbook/html/i_go.png create mode 100644 docs/handbook/html/i_ktip.png create mode 100644 docs/handbook/html/i_lexicon.png create mode 100644 docs/handbook/html/i_lexicon_add.png create mode 100644 docs/handbook/html/i_pencil.png create mode 100644 docs/handbook/html/i_sidetree.png create mode 100644 docs/handbook/html/i_sync.png create mode 100644 docs/handbook/html/i_tile.png create mode 100644 docs/handbook/html/i_tile_auto.png create mode 100644 docs/handbook/html/ss_configfonts.png create mode 100644 docs/handbook/html/ss_configtoolbar.png create mode 100644 docs/handbook/html/ss_mainterms.png create mode 100644 docs/handbook/html/ss_searchanal.png create mode 100644 docs/handbook/html/ss_searchopts.png create mode 100644 docs/handbook/unicode/Makefile.am create mode 100644 docs/handbook/unicode/hdbk-config.docbook create mode 100644 docs/handbook/unicode/hdbk-intro.docbook create mode 100644 docs/handbook/unicode/hdbk-operation.docbook create mode 100644 docs/handbook/unicode/hdbk-reference.docbook create mode 100644 docs/handbook/unicode/hdbk-start.docbook create mode 100644 docs/handbook/unicode/index.docbook create mode 100644 docs/howto/Makefile.am create mode 100644 docs/howto/html/Makefile.am create mode 100644 docs/howto/unicode/Makefile.am create mode 100644 docs/howto/unicode/how2-basics.docbook create mode 100644 docs/howto/unicode/how2-importance.docbook create mode 100644 docs/howto/unicode/how2-interpretation.docbook create mode 100644 docs/howto/unicode/index.docbook create mode 100644 docs/ksgmltools-bug-read-me.txt create mode 100644 docs/tips create mode 100644 pot/Makefile.am create mode 100644 pot/extractrc create mode 100644 pot/handbook.pot create mode 100644 pot/howto.pot create mode 100644 pot/messages.pot create mode 100755 pot/preparetips create mode 100644 sword.m4 diff --git a/BibleTime.kdevelop b/BibleTime.kdevelop new file mode 100644 index 0000000..f6d82ee --- /dev/null +++ b/BibleTime.kdevelop @@ -0,0 +1,247 @@ + + + + The BibleTime team + info@bibletime.info + KDevAutoProject + C++ + + kdevfilegroups + kdevfilelist + kdevdistpart + + 1.6cvs + + . + false + + Perl + + kdevcvsservice + BibleTime + + + + + bibletime/bibletime + default + + + /home/jansorg/Projekte/BibleTime/bibletime/bibletime/bibletime + + false + true + + executable + / + + /home/jansorg/Projekte/BibleTime/bibletime + false + false + false + + + + + true + 1 + false + + + + + + + + 0 + false + + + + + + + + + + kdevgccoptions + kdevgppoptions + kdevpgf77options + + + + + + + + + + + + libtool + --debug + + true + false + false + true + + + + + + false + true + 10 + + + + + + + + + + + + + + + + + + + false + false + + + + false + + + .h + .cpp + true + + + + true + 2 + + + + false + false + + + *.o,*.lo,CVS + false + false + + + + -z3 -f + + -dP + + -f + -u3 -p + + -C -d -P + + + + + false + true + false + true + true + true + 273 + 260 + true + 250 + false + 0 + true + true + false + std=_GLIBCXX_STD;__gnu_cxx=std + true + false + false + false + true + true + true + false + .; + false + false + + + + + set + m_,_ + theValue + true + true + + + true + 3 + /usr/share/qt3 + 3 + ExternalDesigner + /usr/bin/qmake-qt3 + /usr/bin/designer + + + + true + true + Vertical + + + + + + BibleTime C++ header template + + + BibleTime C++ source template + + + + + + + + + + + + + true + true + true + true + -C + + + + /home/jansorg/Projekte/BibleTime/bibletime/tags + + + + VisualBoyAdvance + + + false + false + -f0 + -1 + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..1875636 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,963 @@ +2007-05-07 Martin + * Released 1.6.5a, a maintenance version for packagers + * Only change is the new license for the bible study howto (cc-by-sa) + +2007-11-01 Martin, Eeli and Jeremy + * Several important bugfixes relating to crashes, session management, + display and bookshelf manager + * released 1.6.5 + +2007-04-18 Joachim Ansorg + * Released version 1.6.4 + +2007-04-02 Joachim Ansorg + * Updated list of contributors + +2007-03-23 Joachim Ansorg + * Printing now uses the windows's display settings (verse-numbers) + +2007-03-22 Joachim Ansorg + * Applied a patch by Eeli Kaikkonen to have a delay before the mag content appears + * Added Eeli Kaikkonen to the list of contributors + +2007-03-22 Joachim Ansorg + * Fixed the osis filter to work with the new NETfree module + +2007-03-14 Joachim Ansorg + * Added our own thmlplain filter to fix a CLucene indexing bug + +2007-02-25 David Blue + * Added CSS to templates to display Lord in small-caps when tagged that + way in the module. Fixes Bug #1660413. + +2007-02-19 Joachim Ansorg + * Added Chunshek Chan to the contributors + +2007-02-03 Martin Gruner + * more fixes to the make system + * released 1.6.3b + +2006-01-28 Joachim Ansorg + * fixes to the make system + * released 1.6.3a + +2007-01-27 Martin Gruner + * fixed searching in unicode texts which I broke on 2006-12-05; please accept my apologies. + * released 1.6.3 + +2007-01-27 Martin Gruner + * fixed session loading code to handle main window properties correctly + * fixed hotkey configuration for books + +2007-01-14 Martin Gruner + * another search fix, set max lucene field size to 1 MiB. BibleTime should not truncate long entries any more. + +2006-12-27 Joachim Ansorg + * Added Jeremy Erickson to the contributors + * Changed copyright to 1999-2007 + +2006-12-26 Joachim Ansorg + * Fixed some Makefile.am issues + * Added some contributors to the about dialog + +2006-12-14 Martin Gruner + * fixed handbook typo + * fixed required clucene version to 0.9.16 + +2006-12-07 Martin Gruner + * packaged BibleTime 1.6.2 + +2006-12-07 Daniel Glassey + * add --enable-howto to be able to disable building bible study howto + (required by Debian :/) + +2006-12-05 Martin Gruner + * BibleTime will now index, search and display pre-chapter and pre-book + headings; small cleanups + * searching should work as expected now with regard to headings + +2006-12-02 Martin Gruner + * allow automake 1.10 + +2006-11-30 Joachim Ansorg + * Fix for missing text if GBF red letter words were used + +2006-11-27 Joachim Ansorg + * The tree state is restored if a change in the Sword setup forces a reload at runtime. + +2006-11-25 Martin Gruner + * Fixed 2 tooltips which were swapped + * removed old leftover code that caused problems with --enable-final + +2006-11-24 Joachim Ansorg + * Updated contributors in the about dialog + +2006-11-01 Martin Gruner + * Reverted Analyzer Change of 1.6.1 to use StandardAnalyzer again, but + without stop words. Whitespace Analyzer did not correctly strip punctuation, + so that hits were missing. Sorry. Search should work as expected now. + * Added ability to display Book and Chapter headings + +2006-10-25 Martin Gruner + * Fixed crash on module uninstallation + * released BibleTime 1.6.1 + +2006-10-21 Martin Gruner + * Fixed KJV 2006 display, stripping NT transcription footnotes correctly + again + * Changed Search to use WhitespaceAnalyzer instead of StandardAnalyzer. Now + the default stop words of StandardAnalyzer are ignored. + * Fixed search result highlighting for queries with "*" - do not highlight + across word boundaries any more + * Fixed fullscreen toggeling + +2006-10-10 Martin Gruner + * small clucene.m4 bugfix for nonstandard sword installations + +2006-09-22 Joachim Ansorg + * Release of BibleTime 1.6 + +2006-09-12 Martin Gruner + * Fixed personal commentary display bug + +2006-08-25 Martin Gruner + * Changed location of bibletime.desktop to /usr/share/applications + +2006-08-23 Martin Gruner + * released BibleTime 1.6rc1 + +2006-08-21 Martin Gruner + * Fixed Keychooser Hotkeys to cross testament boundary + +2006-08-20 Joachim Ansorg + * Fixed the shrinking to zero of the left mainwindow's left part + * Fixed crossrefs in the clucene index + * Improved the layout of the searchdialog options + * Modules which require a more recent Sword are not loaded + +2006-08-20 Martin Gruner + * Added documentation for "Find text in read window" + +2006-08-07 Martin Gruner + * verse keychooser bugfix and cleanups + +2006-08-01 David Blue + * Matched the High Contrast Template to the High Contrast Black Text + colours in kde + +2006-07-25 David Blue + * Fixed display of crossrefs in all templates + +2006-06-20 Martin Gruner + * major patch to the printing system: printing works dynamically and + respects the display and filter settings, instead of loading the default + settings at program startup time + * Joachim, why does printing not work with headings and scriprefs and other + markup elements? Besides, it always shows verse numbers, even if they are + turned off + * Please test printing + +2006-06-17 Martin Gruner + * Released BibleTime 1.6beta3 + +2006-06-15 Martin Gruner + * BibleTime now unlocks immediately + * The module icon reflects this immediately + * unlock status reflects correct/incorrect key now, instead of empty/set + (possibly false) key + * Sword config setting and text retrieval prevention from locked modules are + not implemented yet, not as important (and I dunno how to do it right now) + * fixed display profile bug with maximized state; you may need to delete old + sessions + * removed workaround code for lucene 0.9.10 + +2006-06-09 Martin Gruner + * patched clucene.m4 to support and require clucene 0.9.12 + +2006-05-23 Martin Gruner + * Applied more patches by Mark Zealey + +2006-05-22 Martin Gruner + * Applied keychooser patch by Mark Zealey, BibleTime now uses an entirely + different and improved key chooser for Bibles and Commentaries. + +2006-05-18 Martin Gruner + * First patch after a month! + * Fixed UI issue in Bookshelf Manager which ended up in wrong place after + cancelling index download + +2006-04-26 Joachim Ansorg + * BibleTime 1.6beta2 + +2006-04-19 Martin Gruner + * Updated INSTALL.in + +2006-04-09 Joachim Ansorg + * Fixed popup menu in the commentary window + +2006-04-06 Martin Gruner + * Fixed all delayed popup menus to show up immediately + +2006-03-30 Martin Gruner + * Fixed "make messages" to include autogenerated .cpp and .h files (from .ui + files) by running "make" first before extracting the messages + * small enhancement to the crazy template + +2006-03-30 Joachim Ansorg + * Fix: Support robinson codes in the new KJV2006 module + +2006-03-25 Joachim Ansorg + * Support special x-p milestone in the new KJV2006 module. + * Support multiple lemmas and morphs per word in the KJV006 module + * Fix: OSIS filter fix for seg elements + * Fix: Display templates did not show headings in bold if a font was set for the module language + +2006-03-24 Gabriel Beddingfield + * Added isWritable() check (and error message) before saving in CPlainWriteWindow. + +2006-03-24 Martin Gruner + * Added DCOP call reloadModules() + +2006-03-21 Martin Gruner + * Fixed a ThML crossref parsing bug + +2006-03-18 Joachim Ansorg + * BibleTime 1.6beta1 + +2006-03-04 Martin Gruner + * added an CSwordModule::unlockKeyIsValid() function + +2006-02-25 Joachim and Martin: BibleTime Bug Squashing Party I + * Disabled sorting for the "manage indices" columns + * Added "automatically delete orphaned indices when BibleTime starts" option + * Fixed display window toolbar problems, now there are 2 toolbars + * Added support for "n" attribute in footnotes + * Fixes to the display templates + +2006-02-22 Martin Gruner + * Orphaned and defect indices are now automatically deleted + +2006-02-15 Joachim Ansorg + * Fix: Modules without indexes created an empty index directory. + * Fix: Module indexes are completely removed now + +2006-02-14 Martin Gruner + * Extended index logic to allow for additional indexes per module in future + +2006-02-14 Joachim Ansorg + * Search window: The result count in the module list are sortable now + * The "Strong's search" items in the context menus of display windows are disabled now if there's no number to search for + +2006-02-10 Joachim Ansorg + * Several smaller fixes to the searchdialog gui + * Moved searchdialog classes into several namespaces (Search::*) + * Added the icon for the "Search Strong's Number" option + * Bumped version number to 1.5.95, i.e. a 1.6pre version + * Sometime the wrong text was shows for notes + +2006-02-01 Lee Carpenter + * Applied Jim Campbell's updates to the Strong's search feature. + +2006-01-26 Lee Carpenter + * Added an index size field to the 'Manage search indices' page. + +2006-01-22 Lee Carpenter + * Added a page to the Bookshelf Manager to add/delete search indices. + +2006-01-19 Lee Carpenter + * Applied Jim Campbell's patches to add Strong's highlighting in search results. + +2006-01-18 Lee Carpenter + * Converted search dialog to use Designer .ui templates for layout. + +2006-01-02 Martin Gruner + * Search dialog UI cleanups + * Added index version tracking + +2005-12-30 Martin Gruner + * Simplified Search Dialog, code cleanups + * Added index creation progress dialog + +2005-11-13 Joachim Ansorg + * BibleTime 1.5.3 + * Patch: Applied patches by Jeremy Erickson to compile with KDE 3.0-3.3. + +2005-11-09 Martin Gruner + * Added support for OSIS tables + +2005-11-06 Joachim Ansorg + * Bugfix: Changed popup title in commentary windows to "Commentary window" instead of + "Lexicon window" + * Patch: Applied patch by Jeremy Erickson to CMDIArea to compile with Qt 3.2 + +2005-10-24 Joachim Ansorg + * Bugfix: Allow download of locked modules + +2005-10-16 Joachim Ansorg + * BibleTime 1.5.2 + +2005-10-15 Joachim Ansorg + * New feature: Remember open groups in the bookshelf on next startup + * New feature: Remember selected item of the bookshelf on next startup + +2005-10-11 Joachim Ansorg + * New feature: Added new method called getModulesOfType to our DCOP interface. + +2005-10-07 Joachim Ansorg + * New feature: The display windows now have a search dialog to search in the displayed text + (also activated by CTRL+F) + * Bugfix: Changed key accel of "Search open works" to CTRL + O, + because the standard action used CTRL + F, which we use in the new feature above. + Changed the settings in hdbk-reference as well. + * Bugfix: Hopefully the last fix for the parsing. We have to work around a Sword parsing problem. + +2005-10-05 Joachim Ansorg + * Bugfix: Enter in a keychooser did not change the display under special circuamstance + * Buffix: Newlines entered in the plain text editor were not displayed in the HTML editor or the read display window + * Bugfix: One more parsing fix + +2005-10-03 Joachim Ansorg + * Bugfix: Fix for bookshelf manager where the "Install works" button was always greyed out + * Bugfix: Another fix to reference parsing + * Feature: Refs in ThML modules (e.g. TSK) are now splitted if it doesn't alter content + +2005-10-01 Joachim Ansorg + * Bugfix: Fix for the key parsing where only a partial reference was given + +2005-09-25 Joachim Ansorg + * Bugfix: Crash on FedoraCore4 if the settings dialog has been closed + +2005-09-16 Joachim Ansorg + * Bugfix: ThML modules like the ISV crashed BibleTime if the default Bible couldn't be found + +2005-09-12 Joachim Ansorg + * BibleTime 1.5.1 + * BibleTime-i18n package 1.5.1 + +2005-09-10 Joachim Ansorg + * New feature: DCOP interface to control BibleTime. The available commands are avilable by calling "dcop bibletime BibleTimeInterface". To read the DCOP documentation please have a look at the file bibletime/bibletimeinterface.h + * Bugfix: The bookshelf manager didn't work with KDE systems which were configured to use a double click + * Bugfix: A trailing slash in the hostname prevented the bookshelf manager to connect to that remote host + +2005-08-24 Joachim Ansorg + * Bugfix: More Drag&Drop fixes + * Bugfix: Some compilers complained about a missing namespace declaration in the backend code + +2005-08-24 Joachim Ansorg + * Bugfix: Copyright infos for a module is now displayed as correctly enocoded text + * Bugfix: Larger fontsize for the display styles "Default" and "Green" + +2005-08-18 Joachim Ansorg + * Bugfix: Bookmark drag&drop should work now + +2005-08-01 Joachim Ansorg + * New feature: Display templates can now be stored in $KDEDIR/share/apps/bibletime/display-templates/ and + $HOME/.kde/share/apps/bibletime/display-templates/ + +2005-07-16 Joachim Ansorg + * BibleTime 1.5 + * Handbook update by Martin + * Hotkeys reviewed + +2005-06-17 Joachim Ansorg + * BibleTime 1.5rc2 + * Most of the bugs reported for rc1 are fixed + * Major handbook update + * Display windows scroll now to the right position after they opened and + after a resize + +2005-06-10 Joachim Ansorg + * API doc updates (BibleTime.DoxyFile) + * Fixed code to compile with GCC 3.3.6, 3.4.4 and 4.0 + +2005-06-06 Joachim Ansorg + * Added the missing "Delete session" menu item + * The sessions items are now disabled if no sub-menu items are present + +2005-05-29 Joachim Ansorg + * Releases BibleTime 1.5rc1 + -Tons of bugfixes, new features and improvements + +2004-07-17 Daniel Glassey + * Added English and German man files courtesy of Erik Schanze + +2004-07-16 Martin Gruner + * Added invocation of KDE's graphical regular expression editor. + -invoke simply by selecting "regular expression" as search type. + +2004-01-29 Joachim Ansorg + * BibleTime 1.4.1 release + -Bugfixes, especially in the Sword setup dialog part + -Changed default icons to crystalsvg + -Updated GUI translations + +2003-12-28 Joachim Ansorg + * BibleTime 1.4 release + -New SwordSetup Dialog to setup Sword's configuration, to install modules from remote or local sources and to uninstall modules. + -Bugfixes + +2003-08-28 Joachim Ansorg + * Released BibleTime 1.3. Major changes are: + -Redesign of the main index; bookmarks are seperated into an own folder, modules are sorted by type and language; + better menu structure + -Better bookmark file format, bookmarks are saved now in XML. Old bookmarks can still be imported. + -Improved Drag&Drop to work with multiple items, e.g. twenty search result items + -Redesign of the search dialog; it's easier to use now and better to navigate + -Better support for GenBooks (Generic Books) + -Improved support for writing commentaries. There's a plain text editor and a WYSIWYG editor now. + -BibleTime 1.3 requires Sword 1.5.6 now + -Many, many bugs and memory leaks fixed + -Updates to all translations, including new languages + We're sorry for the long time it took to prepare the 1.3 release! We hope to improve release cycles with the next + releases. + +2003-03-10 Joachim Ansorg + * Fixed BibleTime to work in all places with the new SWBuffer class. Should be now more bug free. + +2003-02-28 Joachim Ansorg + * Released 1.3rc1 which uses a Sword snapshot. We're in message freeze now - translators can finally start. + * Fixed BT to use Sword's new filter stuff + +2003-01-19 Joachim Ansorg + * Fixed BT_BASICFILTER::ProcessRWPRefs, made simpled and more bug free + +2003-01-18 Joachim Ansorg + * Removed install instructions from CResMgr and the actions XML file + * Fixed missing insertion of KAction objects into our KAccel object + +2003-01-17 Joachim Ansorg + * Removed installation instructions, the webpage and README/INSTALL files are good enough + +2003-01-16 Joachim Ansorg + * Bugfixes: + -Loading of profiles switched of auto-cascading and auto-tiling + -Debugged CMDIArea, was old, buggy code. Should work now more robust. + * Code cleanups for CDisplayWindow + +2003-01-14 Joachim Ansorg + * Last fixes for beta4: + -Changes everything to use CResMgr instead of ugly #defined + -Added support for new Red letter words strip filter + -Everything is now in CResMgr + -Many small bugfixes + +2003-01-11 Joachim Ansorg + * Searchdialog search result page highlights searched text + * Default color of strongs and morph codes changed to Qt::darkBlue + +2003-01-07 Joachim Ansorg + * Major speed improvements for displaying lexicons together + +2003-01-04 Martin Gruner + * Release 1.3beta3 release + * Changes in comparision with 1.2.x: + - New main index with better module grouping (using language and type), better bookmark format (XML), + import for old bookmarks from 1.2.2 + - Drag&Drop works now with multiple items (e.g. 200 search result items) + - Many more changes we don't remember + +2002-06-02 Martin Gruner + * Moved the english docs to bibletime/docs, and the pot file to bibletime/pot. + Created a new package bibletime-i18n-de for German docs, with the folders docs/ and po/. + Revised gen_am.sh file to suit the new arrangement, and it does at least run and create all the + necessary Makefile.am files for English and German. + +2002-05-03 Martin + + * Ported to KDE3: BibleTime 1.2. No new features. Text rendering works much better now + (right-to-left), as well as font / charset handling -- thanks to Trolltech. + +2002-10-04 Martin Gruner + * Differences between 1.0 and 1.1: + - Improved interface: + o Better optionsdialog: Better structure, more powerful settings + o Better menu structure: The documentation is now accessible from the Help menu, ... + o Keyaccelerators for each display window type + o much more + - General Book Support (GBS): Books like "Josephus" are supported now. + Operations like bookmarking, printing, copying or saving work just like with + Bibles, commentaries or lexicons. + - Crossreference support + Crossreferences work now. For example you can click now on a strong number to open the + module for it which displayes the chosen number. The same for Bibles, morph tags etc. + Tooltips work for the links, too. + - Improved Unicode support + Unicode encoded modules are now supported in a better way. Choosing the font and + the displaying of the text works better. RTL support and better rendering is still + missing. + - Profile management. Profiles capture the current state of the working area + (opened display windows, scrollbar positions, set keys ...). Profiles can be loaded to + restore the old state and can be saved to store the current state for later. Automatically + restoring the windows after startup is possible, too. + - Better crash management. BibleTime tries now to save settings if a crash occured. Although we + implemented this, we don't know how to make BibleTime crash ;) It's just for your safety. + - Speed improvements. Printing is almost two times faster now. Searching in modules is also faster, + but this was improved in the Sword library by the Sword developers. + - Improved display windows. Independent display settings for each window (footnotes, strongs ...) + - Fullscreen mode of the main application window + - Improved commentary editor: Ask if the text should be saved if the window or BibleTime should be closed + if the changed text was not saved before. + +2001-11-24 Fred Saalbach + * Moved documentation to bibletime-docs - includes .po files, handbook, etc. + * This will reduce the size of the main program and allow more flexibility + for the creation of RPM's. + * Compile time for the main program will also be reduced. + +2001-09-22 Fred Saalbach + * Fixed problem with sgml tag by replacing it with the in the english handbook. + * This only is a problem with systems running kde 2 and document + * text descripter "-//KDE//DTD DocBook V3.1-Based Variant V1.0//EN" + * kdb2html finishes without errors now. + +2001-08-30 Joachim Ansorg + * Added $(DESTDIR) to Makefile.am files + * Solved compilation errors + +2001-08-17 Joachim Ansorg + * Optimizations to CSwordBibleModuleInfo + * Fixed bug in CBibleKeyChooser + * New structure in the optionsdialog + * Key accelerators for each display window type + * Fullscreen button + +2001-07-28 Joachim Ansorg + * The new configure options are cached now (sword lib,includes, distribution name and version, RPM prefix and group) + +2001-07-27 Joachim Ansorg + * Added history box in the HTML dialog widget if history browsing is enabled + +2001-07-16 Joachim Ansorg + * Implemented better configure script. We have now options to link to a static Sword library! + * Added rudimentary support for version checking + +2001-06-20 Joachim Ansorg + * Release BibleTime 1.0! + We're really glad we got it out now! Enjoy! + Sorry for the large delay! + +2001-03-08 Joachim Ansorg + * Released BibleTime 1.0beta1. + +2001-02-17 Joachim Ansorg + * Added QTextEdit, QTextView, and QRichText classes from Qt3 (ported by David Faure) + * Removed the Qt2 classes QTextView, QTextBrowser and the class KTextEdit + +2001-02-13 Joachim Ansorg + * Changed the direction of the spin boxes + and of the scrollbutton in the presenters + * Updated QWorkspace to the one of Qt 2.2.4 + +2001-02-07 Joachim Ansorg + * Fixed bugs in the groupmanager, searchdialog and presenters + +2001-02-04 Joachim Ansorg + * Added new features: + RMB menus in the presenters and in the searchdialog + +2001-02-03 Joachim Ansorg + * Added Makefile system to create and install the handbook + * Fred added his really nice handbook in .docbook format + * Improved printing dialog: Now the styles are saved and restored correctly, needs some tweaking + * Fixed some bugs in the printing system, removed the range specifiers of the printing dialog + +2001-02-02 Joachim Ansorg + * Fixed some bug in CTipWindow + * Fixed some bugs in our copy of QTextView + * Fixed some bug in CStyleEditorDialog + * Fixed some bug in the printing system + * Improved CBiblePresenter and CPrinterDialog + +2001-01-30 Joachim Ansorg + * Updated ToDo + +2001-01-27 Joachim Ansorg + * Fixed the graphical search analysis, it should now work 99% + +2001-01-21 Joachim Ansorg + * Improved the style editor + +2001-01-19 Joachim Ansorg + * Improved the search anaylsis a little bit + +2001-01-18 Joachim Ansorg + * Fixed some bugs in the searchdialog + * The bug with indexed modules and first search is now fixed, + it was an error in Sword + * Fixed some nasty bugs in the Sword backend + * Marking searched words in the key text for multiple words works now 100% + * The last book is now shown in the graphical search analysis + +2001-01-18 Joachim Ansorg + * Changed icon names and updated icon directories + * Included all icons we need + * Improved the BibleTime icons + +2001-01-01 Joachim Ansorg + + A BLESSED NEW YEAR! + + -Added the command line option --debug to enable debug messages +2000-12-29 Joachim Ansorg + *Changed behaviour if a book, chapter or verse was changed in the Bible-keychooser + + +2000-12-29 Joachim Ansorg + * Changed iconname so it will be found + +2000-12-26 Joachim Ansorg + * Improved printing support (correct handling of singals ...) + +2000-12-22 Joachim Ansorg + * Fixed a bug in CGroupmanager: BibleTime does now start without installed modules! + +2000-12-19 Joachim Ansorg + * Some work on the oresenters and keychoosers + * Fixed a small bug in cprintitemlist.cpp + +2000-12-16 Joachim Ansorg + * Fixed the crash in ctipwindow.cpp + +2000-12-08 Joachim Ansorg + * Fixed some printing bugs + * Added QWorkspace of Qt 2.2.2 to our sources, so everybody has the fixed QWorkspace version + +2000-12-05 Jochim Ansorg ~ + * Drag& Drop on presenters works again + * Finished "context sensitive" presenter refreshing + +2000-12-04 Jochim Ansorg + * Fixed this nasty "Default verse color" bug (was a wrong placed readEntry instead of readColorEntry in bibletime.cpp) + * Fixed unifont support, it works no with non-ISO-8859-1 languages and fonts + +2000-12-03 Jochim Ansorg + * Changed the latin1() calls of QString to (const char*) ... local8Bit() + * Changed QTextView a little bit: Do not set contents pos to 0,0 in QTexView::setText(), the result is a fester displaying of the texts + * Changed the optionsdialog to display the language name and not the abbrevation + +2000-11-28 Joachim Ansorg + * You can now switch between different book translations on runtime! + * Improved "context sensitive" presenter refresh (e.g. if footnotes are enabled only presenters with modules having them will be refreshed) + * Fixed some memory leaks. + +2000-11-04 Joachim Ansorg + * Solved some bugs + * Updated ceditwidget.cpp so saving HTML is correct, loading is still incomplete + * Made te frontend a shared lib and moved sources which should be there into frontend + libfrontend is now called libbibletime_frontend.la. + * Made --enable-shared the default options (changed to configure.in.in) + +2000-10-30 Joachim Ansorg + * Added sources and headers of QTextView, QTextBrowser and QRichText + * Added signal wordHighlighted in QTextView + +2000-10-29 Joachim Ansorg + * Removed the toggle toolbar/footnotes/strongs bugs + * Removed the bug Troy found (deletion of the searchresult) + +2000-10-24 Joachim Ansorg + * Removed the old backend and introduced a new, better faster + backend with a new backend + * Fixed some GUI bugs (ported from 0.3) + * Fixed some backend bugs, removed CSwordVerseKey operators + * Added portuguese translation of 0.3's messages, but it's still + useable for 1.0CVS + +--Lots of time passed by + +2000-07-24 Joachim Ansorg + *Released 0.3! A really long time! We hope you like it! + +---Changelog will be continued after final 0.3 + +1999-12-30 Joachim Ansorg + *We should be now ready for 0.22 ;-) + +1999-12-26 Joachim Ansorg + *Removed the commented out #includes + *Updated AUTHORS file + +1999-12-25 Joachim Ansorg + *make now use of getFontList (in global.h) to get the fonts + *Added some ASSERT + *Check it objects are zero in fontmanagement dialog + +1999-12-24 Joachim Ansorg + *BibleTime 0.21 - I hope it's a nice Christmas present ;-) + +1999-12-23 Joachim Ansorg + *Changed some icons in CEditWidget to newer names + +1999-12-22 Birger Langkjer + *Updated danish translation + *Added bibletime/optionsdialog/Makefile.in because this prevented me from compiling the first time. + +1999-12-21 Joachim Ansorg + *The searchresult tab is now disabled if the list is empty + *The moduletree-tabs are disable if the correspondig trees are empty + +1999-12-20 Joachim Ansorg + *The fontmanagement dialog is now grayed out if there's no entry in the list + +1999-12-20 Birger Langkjer + *Updated danish translation + +1999-12-19 Joachim Ansorg + *Fontmanagementdialog uses now a XFonts list, not the list provided by KDE. This solves the problems on + systems without KFontManager + *Added files global.h and global.cpp which should contain global functions + *Fixed some typos in the german translation + +1999-12-18 Joachim Ansorg + *Added Apply-Button in the optionsdialog + +1999-12-17 Joachim Ansorg + *Tried to fix the charset problem in ktipoftheday.cpp + *Updated AUTHORS list + +1999-12-16 Joachim Ansorg + *Updated Michal's Czech translation + +1999-12-15 Joachim Ansorg + *Added Czech language file: Thanks to Michal Rovnan� + +1999-12-12 Joachim Ansorg + *Removed function CNotesEditor::isTextSelected() + *Added possibility to select type of highlighting of text for the notes editor + *Added load and save of current highlighting type + +1999-12-04 Joachim Ansorg + *Convrted the bmp images to jpg + *Bibletime uses now kimgio everywhere + *Added danish translation + +1999-11-27 Joachim Ansorg + *Removed unused images + *BibleTime 0.2 + +1999-11-26 Joachim Ansorg + *Finished the whole german handbook + *Removed the own filters (plainhtml, rwphtml and gbfhtml),use (newer) filters of SWORD version + *You can now select the entries in the bookmark-manager with the upper and lower keys and activate them with RETURN + +1999-11-25 Joachim Ansorg + *Updated ToDo and Readme + *Caption of mainwindow now contains the current chapter and verse + +1999-11-24 Joachim Ansorg + *Made some labels in the printer-optionsdialog bigger to fit french translation + *ResizeEvent in SearchScopeDialog + +1999-11-20 Joachim Ansorg + *Startuplogo is now a PNG, this makes the distribution smaller + *To make this work make use of kimgio + +1999-11-18 Joachim Ansorg + *Finished my part on german handbook + +1999-11-16 Joachim Ansorg + *Worked on translation of handbook to german + *Translated some tips in german tipdatabase + +1999-11-14 Joachim Ansorg + *The searchbuttons and the three radiobuttons are now resized + +1999-11-12 Joachim Ansorg + *Fixed Bug: Now you can paste into the loojupline + +1999-11-10 Joachim Ansorg + *Fixed bug in CDocBrowser on non KDE 1.1.2 systems + +1999-11-07 Joachim Ansorg + *Tidied up kwrite - removed lots of commented code + +1999-11-03 Joachim Ansorg + *Updated authors list + *Thorsten added the new printer dialog - it works now + +1999-11-03 Joachim Ansorg + *Added optimized paint function committed in the KDevelop mailing list by Vladimir Dvorak + Thanks Vladimir! + *Readded the nl.po file - it was lost by some reason + +1999-11-01 Joachim Ansorg + *Updated handbook - Jeff's work is really great! + *You can now use more than 31 tips in a tipdatabase + +1999-10-23 Joachim Ansorg + *Renamed members in BibleTimeView: tTabView to treeTabView and sTabView to browserTabView + We need this because sTabView and tTabView are confusing + *Changed CChartWidget to resize the different graphs to the height of the window + *Changed topPanner to leftPanner in BibleTimeView - this is a better name + *Updated API documentation + *Fixed BUG: Now the recentText part in BibleTimeView is saved correctly again + *Noticed that KDE 1.1.2 has the calcScrollBars bug solved, no we use only our own function in KDE version before 1.1.2 + +1999-10-21 Joachim Ansorg + *Bugfix: Key acelelerators are now saved after changing and restored on new startup + *Updated API documentation + *Updated ktipofday.cpp and ktipofday.h from KDevelop to compile with GCC 2.95 + +1999-10-19 Joachim Ansorg + *Fixed a bug in CDocBrowser: If you lookup some text, the module wasn't highlighted + *Added own submenu for the lookup part in CDocBrowser + +1999-10-18 Joachim Ansorg + *BibleTime needs now the upcoming SWORD 1.45 + +1999-10-17 Joachim Ansorg + *Fixed bug: standard accelerators are now really disabled + +1999-10-16 Joachim Ansorg + *Added Jeff to AUTHORS + *Updated german translation + +1999-10-15 Joachim Ansorg + *Solved a bug in the linkmanager: If you open the dialog and click OK the existing items were deleted + *Added a script to put all i18n() things into the translation template. It called make-messages.sh. It's on the topdir. + *Commented out the first lines of BibleTimeMgr to get BibleTime to compile without modifications of SWORD. + Please uncomment these lines to make use of the PLAINFootnotes option filter. Make the declarations in the header + file to protected on which the compiler complains about. + +1999-10-14 Joachim Ansorg + *Implemented context sensitive enabling and disabling of the edit menu entries + *Updated KWrite sourcen to the newest one shipped with KDevelop + *Added Class CKNewAccel - provides disabling and enabling of accels by reeourceentry like ID_FILE_PRINT + +1999-10-13 Joachim Ansorg + *Added refreshing of the list in CDocBrowser + *BibleTime does not load an empty HTML file + (e.g. when you load a file via a HREf module and the server is unknown -> KFM returns an empty file) + *Improved a little bit the internet support + +1999-10-12 Joachim Ansorg + *Implemented functions in linkmanager. Implemented the link management in CDocBrowser::showURL. + Needs some work: We have to decide if the file is local or remote and downloda it first + or we put a new option in the dialog. + +1999-10-10 Joachim Ansorg + *Added new german index.sgml + *Updated icons. You can now recpgnize what the icons mean + *Added BibleTimeDoc::slotMoveToPreviousVerse() and BibleTimeDoc::slotMoveToNextVerse() + Changed BibleTimeApp uses these functions to jump to the previous / next verse + Added needed pixmaps and keyaccels + +1999-10-09 Joachim Ansorg + *Worked on the handbook + *Added Quickhelp for the widgets in the link management dialog. + +1999-10-08 Joachim Ansorg + *Added some text to the handbook + *Removed the german index.sgml file, because it makes no senss. + We will add this if the english one is ready to translate it into german. + *Cleaned up KListView::addChildItem() + *Finished dialog of the link manager, needs implementation of functions to work + +1999-10-05 Joachim Ansorg + *Added -lz to bibletime/Makefile.am to avoid compilation problems on RedHat 5.2 systems + *Added some needed icons and changed iconnames in the sourcecode + *Solved some spelling errors in the CBugReportDlg and changed some kdevelop to bibletime in the class + *Now you can't print by pressing STRG+P if printing is disabled + +1999-10-03 Joachim Ansorg + *Changed CForeignFontOptions: The fonts are now saved in function saveSettings(), not after changing the font + *Changed OptionsDialog: The different options are displayed in a tree. + *Removed old OptionsDialog + *Created new subdirectory optionsdialog. We will need it for later development + +1999-10-01 Joachim Ansorg + *Changed some QColor (QRGB ...) to (QColor) (QRGB ...) to solve compilation problems on Debian. + +1999-09-29 Joachim Ansorg + *font auto-switching works now + *Changed the line to edit the fontname to a combobox + +1999-09-29 Joachim Ansorg + *Implemented more features of font-auto-switching, needs still work + +1999-09-28 Joachim Ansorg + *Implemented simple switching between fonts - will work on it + *Implemented signal BibleTimeDoc::sigSetBibleFont(const QString) + Implemented slot BibleTimeView::slotSetBibleFont(const QString) + These signal and the slot will be used in the near future for switching of fonts. + *Connected the signal and the slot in BibleTimeApp::initView + +1999-09-25 Joachim Ansorg + *On print the printerdialog is shown before the QT-dilaog. But printing + doesn't work at the moment. + We have to implement the slot slotPrint() of CPrinterDialog to make it work. + *Changes in cnoteseditor.cpp the #define BUTTON_BAR_HEIGHT to an abosolut value. + Solves a problem with the height of the editor. + *Updated the startuplogo. It's now much more nice as the previous version. + *Integrated the startuplogo in the aboutdialog. It's now displayed in the upper left corner of the box. + *The class KStartupLogo looks now for the size of the startuplogo and resize the widget in the right way if the size have changed. + *CDocBrowserColor: Made some hardcoded texts to i18n("") + +1999-09-19 Joachim Ansorg + *Reorganized the icons: + There are now two directories: pics and toolbar. pics contains the directory mini/ + which contains the mini icons. Mini icons are named with a trailing mini-. + The directory toolbar contains the icons which are only used in the toolbar. + This should be the new standard we use. + +1999-09-19 Joachim Ansorg + *Changed names and install paths of some icon + *Added some needed icons we forgot + *Added function BibleTimeApp::slotHelpContents(): calls the online help + *Solved: Changes of the key accelerators doesn't change the + accels in the menus + *rendered Footnotes are now displayed in dark red, too + *Cleaned up DCocBrowser + +1999-09-18 Joachim Ansorg + *Optimized a little bit the paintText function of CChartWidget + +1999-09-17 Joachim Ansorg + *Changed a little bit the GBFHTML filter: + Anotations are now displayed in dark red + *Decided to use use the PLAINHTML filter as standard + If no filter is specified in the .conf file of the module we use + now the PLAINHTML filter. Perhaps we need to change this + +1999-09-16 Joachim Ansorg + *Fixed this stupid bug related to the crash while searching the web bible + +1999-09-14 Joachim Ansorg + *Change the GBFHTML filter a little bit + It displays now the word explained in a footnote formatted as bold + +1999-09-14 Joachim Ansorg + *Updated program version to 0.2 + +1999-09-12 Joachim Ansorg + *Added some tips to the tipdatabase + *Added class KStartupLogo to display a picture on startup + +1999-09-10 Joachim Ansorg + *Rewrite of the Searchanalysis, it's now up to 63 times faster + *Text in the CChartWidget is now painted rotated (90) + +1999-09-05 Joachim Ansorg + *Added analysis of searchresults -> needs still some work + *updated de.po translation errors + *updated homepage + +1999-09-04 Joachim Ansorg + *created sub folders: gfx and printing + *Added CPrinterDialog of KHexedit 0.81 -> isn't used at the moment + +1999-09-02 Joachim Ansorg + *Added classes for searchanalysis and a ChartWidget + *Updated configure.in - it checks now for headers and the SWORD lib in two steps + +1999-08-30 Joachim Ansorg + *Changed and corrected some GUI errors + +1999-08-29 Joachim Ansorg + *Decided to update this Changelog frequently + *Changed the notesEditor to a non-tabbar look + *New class CNotesEditor + +1999-08-27 Joachim Ansorg + *First public release of BibleTime: Version 0.1 + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..18c8db7 --- /dev/null +++ b/INSTALL @@ -0,0 +1,244 @@ +Installation instructions for BibleTime 1.6.5.1: +--------------------------- + +Sometimes it is difficult to compile BibleTime from source code, but it's +possible. Don't hesitate to ask for support at info@bibletime.info. In that +case, please include your system's configuration details. + +BibleTime 1.6.5.1 requires: + + - KDE >= 3.0 (at least the libraries (kdelibs) and the base package (kdebase)) + Although BibleTime should compile and run with KDE 3.0-3.3, we strongly recommend + to use the latest version of KDE available for your Linux installation. + + - SWORD 1.5.9, available from http://www.crosswire.org/sword/; you should include + a stability patch to Sword 1.5.9 available from the BibleTime download pages + (fixes problems with compressed and locked modules). + + - CLucene >= 0.9.16, available from http://clucene.sf.net/. + + +If you don't have the sources already, please browse to www.bibletime.info to see +a list of required packages with their download URLs. + +To install texts (e.g. Bibles), just use the Bookshelf Manager in the Settings +menu of BibleTime. + + +Compile BibleTime 1.6.5.1: +--------------------------- + +cd ~ +tar -xjf bibletime-1.6.5.1.tar.bz2 +cd ~/bibletime-1.6.5.1 # Move to your source directory +kde-config --prefix # Displays your KDE directory (optional) +./configure --prefix= # create makefiles +make # compile BibleTime +su -c "make install" # change to "root user" and install BibleTime + +After this, if you want to use the translations of BibleTime's UI, you should +install the bibletime-i18n package. + + +Debian specifics +--------------------------- +Debian (and possibly derived distros as well) use a non-standard path to +store the documentation of KDE programs. Therefore the ./configure line above in +this case needs to be changed to: + +kde_htmldir=/usr/share/doc/kde/HTML ./configure --prefix=/usr + +If you forget this, you'll likely not be able to access the handbook and the +BibleStudy HowTo. + + +Other useful make options +--------------------------- +make clean # Removes binaries from the directory + # where BibleTime was compiled, but not the source + +make uninstall # Removes BibleTime from your system + + +If something is missing in this file please post to info@bibletime.info, the contact +adress for BibleTime. Please read README for a short description of BibleTime 1.6.5.1. + + + +The BibleTime team, + + + + +______________________________________________________________________________ +** The standard Installation instructions of auto-tool packages ** +------------------------------------------------------------------------------ + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/INSTALL.in b/INSTALL.in new file mode 100644 index 0000000..5704784 --- /dev/null +++ b/INSTALL.in @@ -0,0 +1,244 @@ +Installation instructions for BibleTime @VERSION@: +--------------------------- + +Sometimes it is difficult to compile BibleTime from source code, but it's +possible. Don't hesitate to ask for support at info@bibletime.info. In that +case, please include your system's configuration details. + +BibleTime @VERSION@ requires: + + - KDE >= 3.0 (at least the libraries (kdelibs) and the base package (kdebase)) + Although BibleTime should compile and run with KDE 3.0-3.3, we strongly recommend + to use the latest version of KDE available for your Linux installation. + + - SWORD 1.5.9, available from http://www.crosswire.org/sword/; you should include + a stability patch to Sword 1.5.9 available from the BibleTime download pages + (fixes problems with compressed and locked modules). + + - CLucene >= 0.9.16, available from http://clucene.sf.net/. + + +If you don't have the sources already, please browse to www.bibletime.info to see +a list of required packages with their download URLs. + +To install texts (e.g. Bibles), just use the Bookshelf Manager in the Settings +menu of BibleTime. + + +Compile BibleTime @VERSION@: +--------------------------- + +cd ~ +tar -xjf bibletime-@VERSION@.tar.bz2 +cd ~/bibletime-@VERSION@ # Move to your source directory +kde-config --prefix # Displays your KDE directory (optional) +./configure --prefix= # create makefiles +make # compile BibleTime +su -c "make install" # change to "root user" and install BibleTime + +After this, if you want to use the translations of BibleTime's UI, you should +install the bibletime-i18n package. + + +Debian specifics +--------------------------- +Debian (and possibly derived distros as well) use a non-standard path to +store the documentation of KDE programs. Therefore the ./configure line above in +this case needs to be changed to: + +kde_htmldir=/usr/share/doc/kde/HTML ./configure --prefix=/usr + +If you forget this, you'll likely not be able to access the handbook and the +BibleStudy HowTo. + + +Other useful make options +--------------------------- +make clean # Removes binaries from the directory + # where BibleTime was compiled, but not the source + +make uninstall # Removes BibleTime from your system + + +If something is missing in this file please post to info@bibletime.info, the contact +adress for BibleTime. Please read README for a short description of BibleTime @VERSION@. + + + +The BibleTime team, + + + + +______________________________________________________________________________ +** The standard Installation instructions of auto-tool packages ** +------------------------------------------------------------------------------ + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..21ccb13 --- /dev/null +++ b/LICENSE @@ -0,0 +1,291 @@ + The BibleTime Project + + - Free Bible study software for KDE - + +(C) 1998-2005 by the BibleTime Team (info@bibletime.info) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 as +published by the Free Software Foundation. + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..9f40e2f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,80 @@ +KDE_OPTIONS = noautodist +SUBDIRS = bibletime pot docs . + +EXTRA_DIST = \ +BibleTime.kdevelop \ +LICENSE \ +ChangeLog \ +bibletime.spec.in bibletime.spec \ +README.in README \ +INSTALL.in INSTALL\ +bibletime.lsm.in bibletime.lsm \ +configure.in.in configure.in \ +bibletime.desktop.in bibletime.desktop \ +Makefile.cvs autogen.sh \ +bibletime.m4 sword.m4 clucene.m4 + +btadmindir = $(top_srcdir)/admin + +# EXTRA_DIST += $(btadmindir)/ChangeLog +EXTRA_DIST += $(btadmindir)/compile +EXTRA_DIST += $(btadmindir)/config.guess +EXTRA_DIST += $(btadmindir)/config.pl +EXTRA_DIST += $(btadmindir)/config.sub +EXTRA_DIST += $(btadmindir)/configure.in.bot.end +EXTRA_DIST += $(btadmindir)/configure.in.min +EXTRA_DIST += $(btadmindir)/cvs-clean.pl +EXTRA_DIST += $(btadmindir)/install-sh +EXTRA_DIST += $(btadmindir)/ltmain.sh +EXTRA_DIST += $(btadmindir)/missing +EXTRA_DIST += $(btadmindir)/mkinstalldirs +EXTRA_DIST += $(btadmindir)/ylwrap +EXTRA_DIST += $(btadmindir)/Makefile.common +EXTRA_DIST += $(btadmindir)/acinclude.m4.in +EXTRA_DIST += $(btadmindir)/am_edit +EXTRA_DIST += $(btadmindir)/conf.change.pl +EXTRA_DIST += $(btadmindir)/debianrules +EXTRA_DIST += $(btadmindir)/depcomp +EXTRA_DIST += $(btadmindir)/detect-autoconf.sh +EXTRA_DIST += $(btadmindir)/libtool.m4.in +EXTRA_DIST += $(btadmindir)/nmcheck +EXTRA_DIST += $(btadmindir)/cvs.sh + + +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = 1.6 foreign dist-bzip2 + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in sword.m4 bibletime.m4 clucene.m4 + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in sword.m4 bibletime.m4 clucene.m4 > acinclude.m4 +$(top_srcdir)/configure.in: $(top_srcdir)/configure.files $(shell test -f $(top_srcdir)/configure.files && cat $(top_srcdir)/configure.files) + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs +$(top_srcdir)/configure.files: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.files + +install-data-local: + chmod 755 $(DESTDIR)$(kde_datadir)/bibletime -R + $(mkinstalldirs) $(datadir)/applications + $(INSTALL_DATA) $(top_builddir)/bibletime.desktop $(datadir)/applications/bibletime.desktop + +uninstall-local: + -rm -f $(datadir)/applications/bibletime.desktop + +MAINTAINERCLEANFILES = configure.files subdirs + +dist-hook: + rm -f $(distdir)/bibletime-*.tar.gz $(distdir)/bibletime-*.tar.bz2 + rm -rf $(find $(distdir) -name tags -o -name TAGS -o -name \*.xcf -o -name \*.xcf.bz2) +# rm -f $(distdir)/admin/Changelog $(distdir)/make-messages.sh \ +# $(distdir)/extractrc $(distdir)/preparetips \ +# $(distdir)/bibletime.doxygen $(distdir)/bibletime.kdevses \ +# $(distdir)/bibletime.start $(distdir)/configure.files \ +# $(distdir)/bibletime/pics/gen_am.sh + rm -rf $(distdir)/autom4te.cache + rm -rf $(distdir)/BibleTime.kdevelop.pcs + rm -rf $(distdir)/docs/handbook/html/*.html + rm -rf $(distdir)/docs/howto/html/*.html +# rm -rf $(distdir)/BibleTime.tag +# $(distdir)/BibleTime.kdevses diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..2444ea1 --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,14 @@ +# +# Makefile for the cvs repository of BibleTime +# Modified by Martin Gruner +# +# Copyright: (c) 2000 The BibleTime team. +# + +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + $(MAKE) -f admin/Makefile.common cvs + +.SILENT: diff --git a/README b/README new file mode 100644 index 0000000..c3eba83 --- /dev/null +++ b/README @@ -0,0 +1,36 @@ +In this file: +------------- + * General introduction + * Requirements + * Documentation + +General introduction: +-------------------- +This is BibleTime 1.6.6.0. BibleTime is a Bible study application based on KDE Trinity 3.5.12 or later. + +Please report any bugs your find to info@bibletime.info or use the links on our webpage at +http://www.bibletime.info. Please do not hesitate to send suggestions or criticism to info@bibletime.info. + +Read the file INSTALL how to install and compile this version of BibleTime. There's also a SPEC file +to create RPMs, it's called bibletime.spec. + +For a list of the contributors to BibleTime read the "About BibleTime" pages available in the +"Help" menu of BibleTime. + +This README file contains some useful instructions and tips how to use BibleTime. +Please read the handbook, too. It contains many instructions about the usage and +installation of BibleTime. + +Requirements: +------------- +See file INSTALL for detailed installation instructions. + +Documentation: +-------------- +You can find information about BibleTime, the installation and its usage in the following places: + o http://www.bibletime.info/ + o The BibleTime handbook available in the Help menu of the BibleTime application + o There's a Bible study tutorial in the help menu + +May God, our Lord use BibleTime for his glory, +The BibleTime developers, info@bibletime.info diff --git a/README.in b/README.in new file mode 100644 index 0000000..d53a104 --- /dev/null +++ b/README.in @@ -0,0 +1,36 @@ +In this file: +------------- + * General introduction + * Requirements + * Documentation + +General introduction: +-------------------- +This is BibleTime @VERSION@. BibleTime is a Bible study application based on KDE 3.3 or later. + +Please report any bugs your find to info@bibletime.info or use the links on our webpage at +http://www.bibletime.info. Please do not hesitate to send suggestions or criticism to info@bibletime.info. + +Read the file INSTALL how to install and compile this version of BibleTime. There's also a SPEC file +to create RPMs, it's called bibletime.spec. + +For a list of the contributors to BibleTime read the "About BibleTime" pages available in the +"Help" menu of BibleTime. + +This README file contains some useful instructions and tips how to use BibleTime. +Please read the handbook, too. It contains many instructions about the usage and +installation of BibleTime. + +Requirements: +------------- +See file INSTALL for detailed installation instructions. + +Documentation: +-------------- +You can find information about BibleTime, the installation and its usage in the following places: + o http://www.bibletime.info/ + o The BibleTime handbook available in the Help menu of the BibleTime application + o There's a Bible study tutorial in the help menu + +May God, our Lord use BibleTime for his glory, +The BibleTime developers, info@bibletime.info diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..bbd9be2 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,12174 @@ +## -*- autoconf -*- + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +# KDE_PATH_X_DIRECT +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN([KDE_PATH_X_DIRECT], +[ +AC_REQUIRE([KDE_CHECK_LIB64]) + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK([#include ], [${x_direct_test_function}(1)], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \ + /usr/X11/lib${kdelibsuff} \ + /usr/X11R6/lib${kdelibsuff} \ + /usr/X11R5/lib${kdelibsuff} \ + /usr/X11R4/lib${kdelibsuff} \ + \ + /usr/lib${kdelibsuff}/X11 \ + /usr/lib${kdelibsuff}/X11R6 \ + /usr/lib${kdelibsuff}/X11R5 \ + /usr/lib${kdelibsuff}/X11R4 \ + \ + /usr/local/X11/lib${kdelibsuff} \ + /usr/local/X11R6/lib${kdelibsuff} \ + /usr/local/X11R5/lib${kdelibsuff} \ + /usr/local/X11R4/lib${kdelibsuff} \ + \ + /usr/local/lib${kdelibsuff}/X11 \ + /usr/local/lib${kdelibsuff}/X11R6 \ + /usr/local/lib${kdelibsuff}/X11R5 \ + /usr/local/lib${kdelibsuff}/X11R4 \ + \ + /usr/X386/lib${kdelibsuff} \ + /usr/x386/lib${kdelibsuff} \ + /usr/XFree86/lib${kdelibsuff}/X11 \ + \ + /usr/lib${kdelibsuff} \ + /usr/local/lib${kdelibsuff} \ + /usr/unsupported/lib${kdelibsuff} \ + /usr/athena/lib${kdelibsuff} \ + /usr/local/x11r5/lib${kdelibsuff} \ + /usr/lpp/Xamples/lib${kdelibsuff} \ + /lib/usr/lib${kdelibsuff}/X11 \ + \ + /usr/openwin/lib${kdelibsuff} \ + /usr/openwin/share/lib${kdelibsuff} \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_FIND_FILE], +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs, +dnl if-not-found, test-parameter, prepend-path) +dnl +dnl Look for program-name in list-of-dirs+$PATH. +dnl If prepend-path is set, look in $PATH+list-of-dirs instead. +dnl If found, $variable-name is set. If not, if-not-found is evaluated. +dnl test-parameter: if set, the program is executed with this arg, +dnl and only a successful exit code is required. +AC_DEFUN([KDE_FIND_PATH], +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + dirs="" + for dir in $PATH; do + dirs="$dirs $dir" + done + if test -z "$6"; then dnl Append dirs in PATH (default) + dirs="$3 $dirs" + else dnl Prepend dirs in PATH (if 6th arg is set) + dirs="$dirs $3" + fi + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN([KDE_MOC_ERROR_MESSAGE], +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN([KDE_UIC_ERROR_MESSAGE], +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + + +AC_DEFUN([KDE_CHECK_UIC_FLAG], +[ + AC_MSG_CHECKING([whether uic supports -$1 ]) + kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'` + AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache, + [ + cat >conftest.ui < +EOT + ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null" + if AC_TRY_EVAL(ac_uic_testrun); then + eval "kde_cv_prog_uic_$kde_cache=yes" + else + eval "kde_cv_prog_uic_$kde_cache=no" + fi + rm -f conftest* + ]) + + if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then + AC_MSG_RESULT([yes]) + : + $3 + else + AC_MSG_RESULT([no]) + : + $4 + fi +]) + + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_MOC_UIC], +[ + AC_REQUIRE([KDE_CHECK_PERL]) + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""]) + if test -z "$UIC_PATH" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + else + UIC=$UIC_PATH + + if test $kde_qtver = 3; then + KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no) + KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no) + + if test x$ac_uic_supports_libpath = xyes; then + UIC="$UIC -L \$(kde_widgetdir)" + fi + if test x$ac_uic_supports_nounload = xyes; then + UIC="$UIC -nounload" + fi + fi + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) + + UIC_TR="i18n" + if test $kde_qtver = 3; then + UIC_TR="tr2i18n" + fi + + AC_SUBST(UIC_TR) +]) + +AC_DEFUN([KDE_1_CHECK_PATHS], +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN([KDE_SET_PATHS], +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_kcfgdir=\"$kde_kcfgdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_styledir=\"$kde_styledir\" \ + kde_widgetdir=\"$kde_widgetdir\" \ + xdg_appsdir=\"$xdg_appsdir\" \ + xdg_menudir=\"$xdg_menudir\" \ + xdg_directorydir=\"$xdg_directorydir\" \ + kde_result=$1" +]) + +AC_DEFUN([KDE_SET_DEFAULT_PATHS], +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${datadir}/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${datadir}/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${datadir}/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${datadir}/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${datadir}/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${datadir}/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${datadir}/config' + fi + if test -z "$kde_kcfgdir"; then + kde_kcfgdir='\${datadir}/config.kcfg' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${datadir}/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${datadir}/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${datadir}/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${datadir}/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${datadir}/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${datadir}/servicetypes' + fi + if test -z "$kde_moduledir"; then + if test "$kde_qtver" = "2"; then + kde_moduledir='\${libdir}/kde2' + else + kde_moduledir='\${libdir}/kde3' + fi + fi + if test -z "$kde_styledir"; then + kde_styledir='\${libdir}/kde3/plugins/styles' + fi + if test -z "$kde_widgetdir"; then + kde_widgetdir='\${libdir}/kde3/plugins/designer' + fi + if test -z "$xdg_appsdir"; then + xdg_appsdir='\${datadir}/applications/kde' + fi + if test -z "$xdg_menudir"; then + xdg_menudir='\${sysconfdir}/xdg/menus' + fi + if test -z "$xdg_directorydir"; then + xdg_directorydir='\${datadir}/desktop-directories' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS], +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_kcfgdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test -z "$kde_styledir" || test -z "kde_widgetdir" || + test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" || + test "x$kde_have_all_paths" != "xyes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN([KDE_MISSING_PROG_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN([KDE_MISSING_ARTS_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed aRts correctly or use +--without-arts to compile without aRts support (this will remove functionality). +]) +]) + +AC_DEFUN([KDE_SET_DEFAULT_BINDIRS], +[ + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin" + test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi +]) + +AC_DEFUN([KDE_SUBST_PROGRAMS], +[ + AC_ARG_WITH(arts, + AC_HELP_STRING([--without-arts],[build without aRts [default=no]]), + [build_arts=$withval], + [build_arts=yes] + ) + AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no") + if test "$build_arts" = "no"; then + AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts]) + fi + + KDE_SET_DEFAULT_BINDIRS + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + if test "$build_arts" '!=' "no"; then + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)]) + fi + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + kde32ornewer=1 + kde33ornewer=1 + if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then + kde32ornewer= + kde33ornewer= + else + if test "$kde_qtver" = "3"; then + if test "$kde_qtsubver" -le 1; then + kde32ornewer= + fi + if test "$kde_qtsubver" -le 2; then + kde33ornewer= + fi + fi + fi + + if test -n "$kde32ornewer"; then + KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)]) + KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)]) + fi + if test -n "$kde33ornewer"; then + KDE_FIND_PATH(makekdewidgets, MAKEKDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(makekdewidgets)]) + AC_SUBST(MAKEKDEWIDGETS) + fi + KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""]) + + if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + if test -n "$kde32ornewer"; then + KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)' + DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)' + AC_SUBST(KCONFIG_COMPILER) + AC_SUBST(KCFG_DEPENDENCIES) + AC_SUBST(DCOPIDLNG) + fi + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + AC_SUBST(XMLLINT) +])dnl + +AC_DEFUN([AC_CREATE_KFSSTND], +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + kde_styledir= + kde_widgetdir= + xdg_appsdir = xdg_menudir= xdg_directorydir= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN([AC_SUBST_KFSSTND], +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_kcfgdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl X Desktop Group standards +AC_SUBST(xdg_appsdir) +AC_SUBST(xdg_menudir) +AC_SUBST(xdg_directorydir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +AC_SUBST(kdeinitdir, '$(kde_moduledir)') +AC_SUBST(kde_styledir) +AC_SUBST(kde_widgetdir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN([KDE_MISC_TESTS], +[ + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # more headers that need to be explicitly included on darwin + AC_CHECK_HEADERS(sys/types.h stdint.h) + + # sys/bitypes.h is needed for uint32_t and friends on Tru64 + AC_CHECK_HEADERS(sys/bitypes.h) + + # darwin requires a poll emulation library + AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll") + + # for some image handling on Mac OS X + AC_CHECK_HEADERS(Carbon/Carbon.h) + + # CoreAudio framework + AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [ + AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API]) + FRAMEWORK_COREAUDIO="-Xlinker -framework -Xlinker CoreAudio" + ]) + + AC_CHECK_RES_INIT + AC_SUBST(LIB_POLL) + AC_SUBST(FRAMEWORK_COREAUDIO) + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL + KDE_CHECK_STRLCPY + +# darwin needs this to initialize the environment +AC_CHECK_HEADERS(crt_externs.h) +AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) + +AH_VERBATIM(_DARWIN_ENVIRON, +[ +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include +# include +# define environ (*_NSGetEnviron()) +#endif +]) + +AH_VERBATIM(_AIX_STRINGS_H_BZERO, +[ +/* + * AIX defines FD_SET in terms of bzero, but fails to include + * that defines bzero. + */ + +#if defined(_AIX) +#include +#endif +]) + +AC_CHECK_FUNCS([vsnprintf snprintf]) + +AH_VERBATIM(_TRU64,[ +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include +#include +#else +#include +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([K_PATH_X], +[ +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_ARG_ENABLE( + embedded, + AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]), + kde_use_qt_emb=$enableval, + kde_use_qt_emb=no +) + +AC_ARG_ENABLE( + qtopia, + AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]), + kde_use_qt_emb_palm=$enableval, + kde_use_qt_emb_palm=no +) + +AC_ARG_ENABLE( + mac, + AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]), + kde_use_qt_mac=$enableval, + kde_use_qt_mac=no +) + +# used to disable x11-specific stuff on special platforms +AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no") + +if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then + +AC_MSG_CHECKING(for X) + +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +KDE_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib${kdelibsuff}" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS" + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +LDFLAGS="$ac_save_LDFLAGS" + +LIB_X11='-lX11 $(LIBSOCKET)' + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include +#ifdef STDC_HEADERS +# include +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no +) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe +]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +LIB_XEXT="-lXext" +QTE_NORTTI="" + +elif test "$kde_use_qt_emb" = "yes"; then + dnl We're using QT Embedded + CPPFLAGS=-DQWS + CXXFLAGS="$CXXFLAGS -fno-rtti" + QTE_NORTTI="-fno-rtti -DQWS" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +elif test "$kde_use_qt_mac" = "yes"; then + dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to + dnl be included to get the information) --Sam + CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" + CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +fi +AC_SUBST(X_PRE_LIBS) +AC_SUBST(LIB_X11) +AC_SUBST(LIB_XRENDER) +AC_SUBST(LIBSM) +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_includes) +AC_SUBST(x_libraries) +AC_SUBST(QTE_NORTTI) +AC_SUBST(LIB_XEXT) + +]) + +AC_DEFUN([KDE_PRINT_QT_PROGRAM], +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext < +#include +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext < +#include +#include +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <> conftest.$ac_ext < +#include +#include +EOF +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_1_3], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]), + kde_use_qt_mt=$enableval, + [ + if test $kde_qtver = 3; then + kde_use_qt_mt=yes + else + kde_use_qt_mt=no + fi + ] +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +KDE_MT_LDFLAGS= +KDE_MT_LIBS= +if test "x$kde_use_qt_mt" = "xyes"; then + KDE_CHECK_THREADING + if test "x$kde_use_threading" = "xyes"; then + CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS" + KDE_MT_LDFLAGS="$USE_THREADS" + KDE_MT_LIBS="$LIBPTHREAD" + else + kde_use_qt_mt=no + fi +fi +AC_SUBST(KDE_MT_LDFLAGS) +AC_SUBST(KDE_MT_LIBS) + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ +if test -z "$LIBQT_GLOB"; then + if test "x$kde_use_qt_emb" = "xyes"; then + LIBQT_GLOB="libqte.*" + else + LIBQT_GLOB="libqt.*" + fi +fi + +if test -z "$LIBQT"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-embedded then adjust the Qt library name. +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + qtlib="qte" + else + qtlib="qt" + fi + + kde_int_qt="-l$qtlib" +else + kde_int_qt="$LIBQT" + kde_lib_qt_set=yes +fi + +if test -z "$LIBQPE"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-palmtop then add -lqpe to the link line +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + if test "x$kde_use_qt_emb_palm" = "xyes"; then + LIB_QPE="-lqpe" + else + LIB_QPE="" + fi + else + LIB_QPE="" + fi +fi + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + if test -z "$LIBQT"; then + LIBQT="-l$qtlib-mt" + kde_int_qt="-l$qtlib-mt" + else + LIBQT="$qtlib-mt" + kde_int_qt="$qtlib-mt" + fi + LIBQT_GLOB="lib$qtlib-mt.*" + USING_QT_MT="using -mt" +else + LIBQT="-l$qtlib" +fi + +if test $kde_qtver != 1; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +if test $kde_qtver = 3; then + AC_REQUIRE([KDE_CHECK_LIBDL]) + LIBQT="$LIBQT $LIBDL" +fi + +AC_MSG_CHECKING([for Qt]) + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +fi +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]), + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib${kdelibsuff} + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]), + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]), + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" != "1"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIBQT="$LIBQT ${kde_int_qt}_incremental" + break + fi +done + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" +LIBS="$LIBS $LIBQT $KDE_MT_LIBS" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + missing_qt_mt="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + if test "x$kde_use_qt_mt" = "xyes"; then + missing_qt_mt=" +Make sure that you have compiled Qt with thread support!" + ac_qt_notfound="(library $qtlib-mt)"; + else + ac_qt_notfound="(library $qtlib)"; + fi + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.$missing_qt_mt]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then + KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES="" +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$QT_LDFLAGS $all_libraries" +fi +test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS" + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +KDE_CHECK_QT_JPEG + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)' +else +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)' +fi +test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS" +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIB_QT="$LIB_QT ${kde_int_qt}_incremental" + break + fi +done + +AC_SUBST(LIB_QT) +AC_SUBST(LIB_QPE) + +AC_SUBST(kde_qtver) +]) + +AC_DEFUN([AC_PATH_QT], +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN([KDE_CHECK_UIC_PLUGINS], +[ +AC_REQUIRE([AC_PATH_QT_MOC_UIC]) + +if test x$ac_uic_supports_libpath = xyes; then + +AC_MSG_CHECKING([if UIC has KDE plugins available]) +AC_CACHE_VAL(kde_cv_uic_plugins, +[ +cat > actest.ui << EOF + +NewConnectionDialog + + + + testInput + + + + +EOF + + + +kde_cv_uic_plugins=no +kde_line="$UIC_PATH -L $kde_widgetdir" +if test x$ac_uic_supports_nounload = xyes; then + kde_line="$kde_line -nounload" +fi +kde_line="$kde_line -impl actest.h actest.ui > actest.cpp" +if AC_TRY_EVAL(kde_line); then + # if you're trying to debug this check and think it's incorrect, + # better check your installation. The check _is_ correct - your + # installation is not. + if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then + kde_cv_uic_plugins=yes + fi +fi +rm -f actest.ui actest.cpp +]) + +AC_MSG_RESULT([$kde_cv_uic_plugins]) +if test "$kde_cv_uic_plugins" != yes; then + AC_MSG_ERROR([ +you need to install kdelibs first. + +If you did install kdelibs, then the Qt version that is picked up by +this configure is not the same version you used to compile kdelibs. +The Qt Plugin installed by kdelibs is *ONLY* loadable if its the +same Qt version, compiled with the same compiler and the same Qt +configuration settings. +]) +fi +fi +]) + +AC_DEFUN([KDE_CHECK_FINAL], +[ + AC_ARG_ENABLE(final, + AC_HELP_STRING([--enable-final], + [build size optimized apps (experimental - needs lots of memory)]), + kde_use_final=$enableval, kde_use_final=no) + + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) +]) + +AC_DEFUN([KDE_CHECK_CLOSURE], +[ + AC_ARG_ENABLE(closure, + AC_HELP_STRING([--enable-closure],[delay template instantiation]), + kde_use_closure=$enableval, kde_use_closure=no) + + KDE_NO_UNDEFINED="" + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + KDE_NO_UNDEFINED="" + case $host in + *-*-linux-gnu) + KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined], + [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined], + [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"], + [KDE_NO_UNDEFINED=""])], + [KDE_NO_UNDEFINED=""]) + ;; + esac + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) + AC_SUBST(KDE_NO_UNDEFINED) +]) + +dnl Check if the linker supports --enable-new-dtags and --as-needed +AC_DEFUN([KDE_CHECK_NEW_LDFLAGS], +[ + AC_ARG_ENABLE(new_ldflags, + AC_HELP_STRING([--enable-new-ldflags], + [enable the new linker flags]), + kde_use_new_ldflags=$enableval, + kde_use_new_ldflags=no) + + LDFLAGS_AS_NEEDED="" + LDFLAGS_NEW_DTAGS="" + if test "x$kde_use_new_ldflags" = "xyes"; then + LDFLAGS_NEW_DTAGS="" + KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags], + [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],) + + KDE_CHECK_COMPILER_FLAG([Wl,--as-needed], + [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],) + fi + AC_SUBST(LDFLAGS_AS_NEEDED) + AC_SUBST(LDFLAGS_NEW_DTAGS) +]) + +AC_DEFUN([KDE_CHECK_NMCHECK], +[ + AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]), + kde_use_nmcheck=$enableval, kde_use_nmcheck=no) + + if test "$kde_use_nmcheck" = "yes"; then + KDE_USE_NMCHECK_TRUE="" + KDE_USE_NMCHECK_FALSE="#" + else + KDE_USE_NMCHECK_TRUE="#" + KDE_USE_NMCHECK_FALSE="" + fi + AC_SUBST(KDE_USE_NMCHECK_TRUE) + AC_SUBST(KDE_USE_NMCHECK_FALSE) +]) + +AC_DEFUN([KDE_EXPAND_MAKEVAR], [ +savex=$exec_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +tmp=$$2 +while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done +exec_prefix=$savex +]) + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_BASE_PATH_KDE], +[ +AC_REQUIRE([KDE_CHECK_STL]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${includedir} + KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir) + + kde_libraries=${libdir} + KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir) + +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="$kde_libs_prefix/lib${kdelibsuff} /usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi + +if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +AC_MSG_ERROR([ +I can't find the designer plugins. These are required and should have been installed +by kdelibs]) +fi + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1, e.g. from kdelibs + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${libdir}" + kde_includes="${includedir}" + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION" + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$KDE_LDFLAGS $all_libraries" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +if test -z "$1"; then +KDE_CHECK_UIC_PLUGINS +fi + +ac_kde_libraries="$kde_libdir" + +AC_SUBST(AUTODIRS) + + +]) + +AC_DEFUN([KDE_CHECK_EXTRA_LIBS], +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]), + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]), + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN([KDE_1_CHECK_PATH_HEADERS], +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext < +#endif +#include +#include "confdefs.h" +#include + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + printf("kde_styledir=\\"/tmp/dummy\\"\n"); + printf("kde_widgetdir=\\"/tmp/dummy\\"\n"); + printf("xdg_appsdir=\\"/tmp/dummy\\"\n"); + printf("xdg_menudir=\\"/tmp/dummy\\"\n"); + printf("xdg_directorydir=\\"/tmp/dummy\\"\n"); + printf("kde_kcfgdir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$all_includes $CPPFLAGS" + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_CHECK_KDEQTADDON], +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN([KDE_CREATE_LIBS_ALIASES], +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 3; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KJS, "-lkjs") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KABC, "-lkabc") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") + AC_SUBST(LIB_KUTILS, "-lkutils") + AC_SUBST(LIB_KDEPIM, "-lkdepim") + AC_SUBST(LIB_KIMPROXY, "-lkimproxy") + AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff") + AC_SUBST(LIB_KDNSSD, "-lkdnssd") +# these are for backward compatibility + AC_SUBST(LIB_KSYCOCA, "-lkio") + AC_SUBST(LIB_KFILE, "-lkio") +elif test $kde_qtver = 2; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KSYCOCA, "-lksycoca") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KFILE, "-lkfile") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +else + AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") + AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") + AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") + AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") + AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)") +fi +]) + +AC_DEFUN([AC_PATH_KDE], +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]), + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl KDE_CHECK_FUNC_EXT(, [headers], [sample-use], [C prototype], [autoheader define], [call if found]) +AC_DEFUN([KDE_CHECK_FUNC_EXT], +[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(kde_cv_func_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GXX" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +$2 +], +[ +$3 +], +kde_cv_func_$1=yes, +kde_cv_func_$1=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS="$kde_safe_LIBS" +AC_LANG_RESTORE +]) + +AC_MSG_RESULT($kde_cv_func_$1) + +AC_MSG_CHECKING([if $1 needs custom prototype]) +AC_CACHE_VAL(kde_cv_proto_$1, +[ +if test "x$kde_cv_func_$1" = xyes; then + kde_cv_proto_$1=no +else + case "$1" in + setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) + kde_cv_proto_$1="yes - in libkdefakes" + ;; + *) + kde_cv_proto_$1=unknown + ;; + esac +fi + +if test "x$kde_cv_proto_$1" = xunknown; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +$2 + +extern "C" $4; +], +[ +$3 +], +[ kde_cv_func_$1=yes + kde_cv_proto_$1=yes ], + [kde_cv_proto_$1="$1 unavailable"] +) +LIBS=$kde_safe_libs +AC_LANG_RESTORE +fi +]) +AC_MSG_RESULT($kde_cv_proto_$1) + +if test "x$kde_cv_func_$1" = xyes; then + AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) + $6 +fi +if test "x$kde_cv_proto_$1" = xno; then + AC_DEFINE(HAVE_$5_PROTO, 1, + [Define if you have the $1 prototype]) +fi + +AH_VERBATIM([_HAVE_$5_PROTO], +[ +#if !defined(HAVE_$5_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +$4; +#ifdef __cplusplus +} +#endif +#endif +]) +]) + +AC_DEFUN([AC_CHECK_SETENV], +[ + KDE_CHECK_FUNC_EXT(setenv, [ +#include +], + [setenv("VAR", "VALUE", 1);], + [int setenv (const char *, const char *, int)], + [SETENV]) +]) + +AC_DEFUN([AC_CHECK_UNSETENV], +[ + KDE_CHECK_FUNC_EXT(unsetenv, [ +#include +], + [unsetenv("VAR");], + [void unsetenv (const char *)], + [UNSETENV]) +]) + +AC_DEFUN([AC_CHECK_GETDOMAINNAME], +[ + KDE_CHECK_FUNC_EXT(getdomainname, [ +#include +#include +#include +], + [ +char buffer[200]; +getdomainname(buffer, 200); +], + [#include + int getdomainname (char *, size_t)], + [GETDOMAINNAME]) +]) + +AC_DEFUN([AC_CHECK_GETHOSTNAME], +[ + KDE_CHECK_FUNC_EXT(gethostname, [ +#include +#include +], + [ +char buffer[200]; +gethostname(buffer, 200); +], + [int gethostname (char *, unsigned int)], + [GETHOSTNAME]) +]) + +AC_DEFUN([AC_CHECK_USLEEP], +[ + KDE_CHECK_FUNC_EXT(usleep, [ +#include +], + [ +usleep(200); +], + [int usleep (unsigned int)], + [USLEEP]) +]) + + +AC_DEFUN([AC_CHECK_RANDOM], +[ + KDE_CHECK_FUNC_EXT(random, [ +#include +], + [ +random(); +], + [long int random(void)], + [RANDOM]) + + KDE_CHECK_FUNC_EXT(srandom, [ +#include +], + [ +srandom(27); +], + [void srandom(unsigned int)], + [SRANDOM]) + +]) + +AC_DEFUN([AC_CHECK_INITGROUPS], +[ + KDE_CHECK_FUNC_EXT(initgroups, [ +#include +#include +#include +], + [ +char buffer[200]; +initgroups(buffer, 27); +], + [int initgroups(const char *, gid_t)], + [INITGROUPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMPS], +[ + KDE_CHECK_FUNC_EXT(mkstemps, [ +#include +#include +], + [ +mkstemps("/tmp/aaaXXXXXX", 6); +], + [int mkstemps(char *, int)], + [MKSTEMPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMP], +[ + KDE_CHECK_FUNC_EXT(mkstemp, [ +#include +#include +], + [ +mkstemp("/tmp/aaaXXXXXX"); +], + [int mkstemp(char *)], + [MKSTEMP]) +]) + +AC_DEFUN([AC_CHECK_MKDTEMP], +[ + KDE_CHECK_FUNC_EXT(mkdtemp, [ +#include +#include +], + [ +mkdtemp("/tmp/aaaXXXXXX"); +], + [char *mkdtemp(char *)], + [MKDTEMP]) +]) + + +AC_DEFUN([AC_CHECK_RES_INIT], +[ + AC_MSG_CHECKING([if res_init needs -lresolv]) + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( + [ +#include +#include +#include +#include + ], + [ + res_init(); + ], + [ + LIBRESOLV="-lresolv" + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) + LIBS=$kde_libs_safe + AC_SUBST(LIBRESOLV) + + KDE_CHECK_FUNC_EXT(res_init, + [ +#include +#include +#include +#include + ], + [res_init()], + [int res_init(void)], + [RES_INIT]) +]) + +AC_DEFUN([AC_CHECK_STRLCPY], +[ + KDE_CHECK_FUNC_EXT(strlcpy, [ +#include +], +[ char buf[20]; + strlcpy(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcpy(char*, const char*, unsigned long)], + [STRLCPY]) +]) + +AC_DEFUN([AC_CHECK_STRLCAT], +[ + KDE_CHECK_FUNC_EXT(strlcat, [ +#include +], +[ char buf[20]; + buf[0]='\0'; + strlcat(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcat(char*, const char*, unsigned long)], + [STRLCAT]) +]) + +AC_DEFUN([AC_CHECK_RES_QUERY], +[ + KDE_CHECK_FUNC_EXT(res_query, [ +#include +#include +#include +#include +#include +], +[ +res_query(NULL, 0, 0, NULL, 0); +], + [int res_query(const char *, int, int, unsigned char *, int)], + [RES_QUERY]) +]) + +AC_DEFUN([AC_CHECK_DN_SKIPNAME], +[ + KDE_CHECK_FUNC_EXT(dn_skipname, [ +#include +#include +#include +#include +], +[ +dn_skipname (NULL, NULL); +], + [int dn_skipname (unsigned char *, unsigned char *)], + [DN_SKIPNAME]) +]) + + +AC_DEFUN([AC_FIND_GIF], + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +else +LIBS="$all_libraries -lgif" +fi +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN([KDE_FIND_JPEG_HELPER], +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[/* Override any gcc2 internal prototype to avoid an error. */ +struct jpeg_decompress_struct; +typedef struct jpeg_decompress_struct * j_decompress_ptr; +typedef int size_t; +#ifdef __cplusplus +extern "C" { +#endif + void jpeg_CreateDecompress(j_decompress_ptr cinfo, + int version, size_t structsize); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [jpeg_CreateDecompress(0L, 0, 0);], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN([AC_FIND_JPEG], +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +AH_VERBATIM(_AC_CHECK_JPEG, +[/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif +]) +]) + +AC_DEFUN([KDE_CHECK_QT_JPEG], +[ +if test -n "$LIBJPEG"; then +AC_MSG_CHECKING([if Qt needs $LIBJPEG]) +AC_CACHE_VAL(kde_cv_qt_jpeg, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS $LIBQT" +LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[#include ], + [ + int argc; + char** argv; + QApplication app(argc, argv);], + eval "kde_cv_qt_jpeg=no", + eval "kde_cv_qt_jpeg=yes") +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +fi +]) + +if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then + AC_MSG_RESULT(yes) + LIBJPEG_QT='$(LIBJPEG)' +else + AC_MSG_RESULT(no) + LIBJPEG_QT= +fi + +]) + +AC_DEFUN([AC_FIND_ZLIB], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include +], +[ + char buf[42]; + gzFile f = (gzFile) 0; + /* this would segfault.. but we only link, don't run */ + (void) gzgets(f, buf, sizeof(buf)); + + return (zlibVersion() == ZLIB_VERSION); +], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. + Possibly configure picks up an outdated version + installed by XFree86. Remove it from your system. + + Check your installation and look into config.log) + LIBZ="" +fi +AC_SUBST(LIBZ) +]) + +AC_DEFUN([KDE_TRY_TIFFLIB], +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +else +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm" +fi +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN([AC_FIND_TIFF], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + + +AC_DEFUN([AC_FIND_PNG], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +else +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm" +fi +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + + +AC_DEFUN([AC_FIND_JASPER], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_MSG_CHECKING([for jasper]) +AC_CACHE_VAL(ac_cv_jasper, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include + ], + [ + return( jas_init() ); + ], + eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'", + eval "ac_cv_jasper=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper]) + LIB_JASPER="$ac_cv_jasper" + AC_MSG_RESULT($ac_cv_jasper) +else + AC_MSG_RESULT(no) + LIB_JASPER="" +fi +AC_SUBST(LIB_JASPER) +]) + +AC_DEFUN([AC_CHECK_BOOL], +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN([AC_CHECK_GNU_EXTENSIONS], +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN([KDE_CHECK_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CXX supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], []) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CC supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_C + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], []) + CFLAGS="$save_CFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN([AC_REMOVE_FORBIDDEN], +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN([AC_VALIDIFY_CXXFLAGS], +[dnl +if test "x$kde_use_qt_emb" != "xyes"; then + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +else + AC_REMOVE_FORBIDDEN(CXX, [-rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath]) +fi +]) + +AC_DEFUN([AC_CHECK_COMPILERS], +[ + AC_ARG_ENABLE(debug, + AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]), + [ + case $enableval in + yes) + kde_use_debug_code="yes" + kde_use_debug_define=no + ;; + full) + kde_use_debug_code="full" + kde_use_debug_define=no + ;; + *) + kde_use_debug_code="no" + kde_use_debug_define=yes + ;; + esac + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption, + AC_HELP_STRING([--disable-debug], + [disables debug output and debug symbols [default=no]]), + [],[]) + + AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], + [compiles with strict compiler options (may not work!)]), + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]), + [ + if test $enableval = "no"; then + kde_use_warnings="no" + else + kde_use_warnings="yes" + fi + ], [kde_use_warnings="yes"]) + + dnl enable warnings for debug build + if test "$kde_use_debug_code" != "no"; then + kde_use_warnings=yes + fi + + AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]), + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + AC_PROG_CPP + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" != "no"; then + if test $kde_use_debug_code = "full"; then + CFLAGS="-g3 -fno-inline $CFLAGS" + else + CFLAGS="-g -O2 $CFLAGS" + fi + else + CFLAGS="-O2 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + if test "$GXX" = "yes" || test "$CXX" = "KCC"; then + if test "$kde_use_debug_code" != "no"; then + if test "$CXX" = "KCC"; then + CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS" + else + if test "$kde_use_debug_code" = "full"; then + CXXFLAGS="-g3 -fno-inline $CXXFLAGS" + else + CXXFLAGS="-g -O2 $CXXFLAGS" + fi + fi + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + dnl convenience compiler flags + KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""]) + AC_SUBST(WOVERLOADED_VIRTUAL) + else + if test "$CXX" = "KCC"; then + CXXFLAGS="+K3 $CXXFLAGS" + else + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + if test "$kde_use_warnings" = "yes"; then + if test "$GCC" = "yes"; then + CXXFLAGS="-Wall -W -Wpointer-arith -Wwrite-strings $CXXFLAGS" + case $host in + *-*-linux-gnu) + CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"]) + KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"]) + ;; + esac + KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) + fi + fi + + if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS" + fi + + AC_ARG_ENABLE(pch, + AC_HELP_STRING([--enable-pch], + [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]), + [ kde_use_pch=$enableval ],[ kde_use_pch=no ]) + + HAVE_GCC_VISIBILITY=0 + AC_SUBST([HAVE_GCC_VISIBILITY]) + + if test "$GXX" = "yes"; then + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + ENABLE_PERMISSIVE_FLAG="-fpermissive" + + if test "$kde_use_pch" = "yes"; then + AC_MSG_CHECKING(whether gcc supports precompiling c header files) + echo >conftest.h + if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then + kde_gcc_supports_pch=yes + AC_MSG_RESULT(yes) + else + kde_gcc_supports_pch=no + AC_MSG_RESULT(no) + fi + if test "$kde_gcc_supports_pch" = "yes"; then + AC_MSG_CHECKING(whether gcc supports precompiling c++ header files) + if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then + kde_gcc_supports_pch=yes + AC_MSG_RESULT(yes) + else + kde_gcc_supports_pch=no + AC_MSG_RESULT(no) + fi + fi + rm -f conftest.h conftest.h.gch + fi + fi + AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes") + if test "$CXX" = "KCC"; then + dnl unfortunately we currently cannot disable exception support in KCC + dnl because doing so is binary incompatible and Qt by default links with exceptions :-( + dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"]) + dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= ) + + if test "$kde_use_pch" = "yes"; then + dnl TODO: support --pch-dir! + KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"]) + dnl the below works (but the dir must exist), but it's + dnl useless for a whole package. + dnl The are precompiled headers for each source file, so when compiling + dnl from scratch, it doesn't make a difference, and they take up + dnl around ~5Mb _per_ sourcefile. + dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp, + dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"]) + fi + dnl this flag controls inlining. by default KCC inlines in optimisation mode + dnl all implementations that are defined inside the class {} declaration. + dnl because of templates-compatibility with broken gcc compilers, this + dnl can cause excessive inlining. This flag limits it to a sane level + KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"]) + KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"]) + KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"]) + KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"]) + dnl Some source files are shared between multiple executables + dnl (or libraries) and some of those need template instantiations. + dnl In that case KCC needs to compile those sources with + dnl --one_instantiation_per_object. To make it easy for us we compile + dnl _all_ objects with that flag (--one_per is a shorthand). + KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"]) + fi + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + if test "$GCC" = yes; then + NOOPT_CFLAGS=-O0 + fi + KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0]) + + AC_ARG_ENABLE(coverage, + AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [ + if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then + ac_coverage_compiler="-fprofile-arcs -ftest-coverage" + ac_coverage_linker="-lgcc" + elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then + ac_coverage_compiler="-fprofile-arcs -ftest-coverage" + ac_coverage_linker="" + else + AC_MSG_ERROR([coverage with your compiler is not supported]) + fi + CFLAGS="$CFLAGS $ac_coverage_compiler" + CXXFLAGS="$CXXFLAGS $ac_coverage_compiler" + LDFLAGS="$LDFLAGS $ac_coverage_linker" + ]) + + AC_SUBST(NOOPT_CXXFLAGS) + AC_SUBST(NOOPT_CFLAGS) + AC_SUBST(ENABLE_PERMISSIVE_FLAG) + + KDE_CHECK_NEW_LDFLAGS + KDE_CHECK_FINAL + KDE_CHECK_CLOSURE + KDE_CHECK_NMCHECK + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) +]) + +AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG], + [ + AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + safe_CXXFLAGS=$CXXFLAGS + safe_LDFLAGS=$LDFLAGS + CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0" + LDFLAGS="$LDFLAGS -shared -fPIC" + + AC_TRY_LINK( + [ + /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */ + #include + int some_function( void ) __attribute__ ((visibility("default"))); + int some_function( void ) + { + std::string s("blafasel"); + return 0; + } + ], [/* elvis is alive */], + kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes) + + CXXFLAGS=$safe_CXXFLAGS + LDFLAGS=$safe_LDFLAGS + AC_LANG_RESTORE + ] + ) + + if test x$kde_cv_val_gcc_visibility_bug = xno; then + CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" + fi + ] +) + +AC_DEFUN([KDE_CHECK_AND_ADD_HIDDEN_VISIBILITY], +[ + if test "$GXX" = "yes"; then + KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, + [ + CXXFLAGS="$CXXFLAGS -fvisibility=hidden" + KDE_CHECK_VISIBILITY_GCC_BUG + + HAVE_GCC_VISIBILITY=1 + AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported]) + ]) + fi +]) + +AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY], +[ + AC_REQUIRE([KDE_CHECK_AND_ADD_HIDDEN_VISIBILITY]) +]) + +AC_DEFUN([KDE_ADD_DEPENDENCIES], +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN([KDE_PROG_LIBTOOL], +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_OBJEXT +AC_EXEEXT + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)" +AC_SUBST(KDE_PLUGIN) + +# we patch configure quite some so we better keep that consistent for incremental runs +AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure') +]) + +AC_DEFUN([KDE_CHECK_LIB64], +[ + kdelibsuff="$kde_libs_suffix" + if test -z "$kdelibsuff"; then + kdelibsuff=no + fi + AC_ARG_ENABLE(libsuffix, + AC_HELP_STRING([--enable-libsuffix], + [/lib directory suffix (64,32,none[=default])]), + kdelibsuff=$enableval) + # TODO: add an auto case that compiles a little C app to check + # where the glibc is + if test "$kdelibsuff" = "no"; then + kdelibsuff= + fi + if test -z "$kdelibsuff"; then + AC_MSG_RESULT([not using lib directory suffix]) + AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories) + else + if test "$libdir" = '${exec_prefix}/lib'; then + libdir="$libdir${kdelibsuff}" + AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms + fi + AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories) + AC_MSG_RESULT([using lib directory suffix $kdelibsuff]) + fi +]) + +AC_DEFUN([KDE_CHECK_TYPES], +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(short)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl +])dnl + +dnl Not used - kept for compat only? +AC_DEFUN([KDE_DO_IT_ALL], +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN([AC_CHECK_RPATH], +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]), + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(libdir)" + + if test "$kde_libraries" != "$libdir"; then + KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)" + fi + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + X_RPATH="-R \$(x_libraries)" + KDE_RPATH="$KDE_RPATH $X_RPATH" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_SUBST(X_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN([AC_CHECK_SOCKLEN_T], +[ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(kde_cv_socklen_t, + [ + AC_LANG_PUSH(C++) + kde_cv_socklen_t=no + AC_TRY_COMPILE([ + #include + #include + ], + [ + socklen_t len; + getpeername(0,0,&len); + ], + [ + kde_cv_socklen_t=yes + kde_cv_socklen_t_equiv=socklen_t + ]) + AC_LANG_POP(C++) + ]) + AC_MSG_RESULT($kde_cv_socklen_t) + if test $kde_cv_socklen_t = no; then + AC_MSG_CHECKING([for socklen_t equivalent for socket functions]) + AC_CACHE_VAL(kde_cv_socklen_t_equiv, + [ + kde_cv_socklen_t_equiv=int + AC_LANG_PUSH(C++) + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #include + #include + ], + [ + $t len; + getpeername(0,0,&len); + ], + [ + kde_cv_socklen_t_equiv="$t" + break + ]) + done + AC_LANG_POP(C++) + ]) + AC_MSG_RESULT($kde_cv_socklen_t_equiv) + fi + AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined]) + AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)]) +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN([AM_KDE_WITH_NLS], + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. + +# serial 1 + +AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN([AM_FUNC_OBSTACK], +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN([AM_KDE_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN([AC_HAVE_XPM], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]), + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + else + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET" + fi + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include ],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN([AC_HAVE_DPMS], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]), + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then + AC_MSG_RESULT(no) + ac_cv_have_dpms="no" + else + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + LIBS="$LIBS -lXdpms" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + fi + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + ac_save_cflags="$CFLAGS" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO, + [Define if you have the DPMSCapable prototype in ]) + AC_CHECK_DECL(DPMSCapable, + AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),, + [#include ]) + AH_TEMPLATE(HAVE_DPMSINFO_PROTO, + [Define if you have the DPMSInfo prototype in ]) + AC_CHECK_DECL(DPMSInfo, + AC_DEFINE(HAVE_DPMSINFO_PROTO),, + [#include ]) + CFLAGS="$ac_save_cflags" + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN([AC_HAVE_GL], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]), + gl_test=$withval, gl_test="yes") + if test "x$kde_use_qt_emb" = "xyes"; then + # GL and Qt Embedded is a no-go for now. + ac_cv_have_gl=no + elif test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_ldflags=$LDFLAGS + ac_save_cxxflags=$CXXFLAGS + ac_save_libs=$LIBS + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries" + LIBS="$LIBS -lGL -lGLU" + test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11" + LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + AC_LANG_RESTORE + LDFLAGS=$ac_save_ldflags + CXXFLAGS=$ac_save_cxxflags + LIBS=$ac_save_libs + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + GLLIB='-lGLU -lGL $(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)' + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN([KDE_PAM], [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + want_pam= + AC_ARG_WITH(pam, + AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]), + [ if test "x$withval" = "xyes"; then + want_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + want_pam=no + else + want_pam=yes + pam_service=$withval + fi + ], [ pam_service=kde ]) + + use_pam= + PAMLIBS= + if test "x$want_pam" != xno; then + AC_CHECK_LIB(pam, pam_start, [ + AC_CHECK_HEADER(security/pam_appl.h, + [ pam_header=security/pam_appl.h ], + [ AC_CHECK_HEADER(pam/pam_appl.h, + [ pam_header=pam/pam_appl.h ], + [ + AC_MSG_WARN([PAM detected, but no headers found! +Make sure you have the necessary development packages installed.]) + ] + ) + ] + ) + ], , $LIBDL) + if test -z "$pam_header"; then + if test "x$want_pam" = xyes; then + AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!]) + fi + else + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + use_pam=yes + + dnl darwin claims to be something special + if test "$pam_header" = "pam/pam_appl.h"; then + AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/]) + fi + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], $pam_header, + [ AC_EGREP_HEADER([const struct pam_message], $pam_header, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN([DEF_PAM_SERVICE], [ + AC_ARG_WITH($1-pam, + AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]), + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE=$withval + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN([KDE_SHADOWPASSWD], [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + AC_HELP_STRING([--with-shadow],[If you want shadow password support]), + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN([KDE_PASSWDLIBS], [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but + dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires + dnl root to read, so kcheckpass needs to be root (even when using pam, since pam + dnl may need to read /etc/master.passwd). + case $host in + *-*-freebsd*) + SETUIDFLAGS="-m 4755 -o root" + ;; + *) + ;; + esac + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN([KDE_CHECK_LIBDL], +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN([KDE_CHECK_DLOPEN], +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]), +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING], +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN([KDE_ADD_INCLUDES], +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + +AC_DEFUN([KDE_CHECK_LIBPTHREAD], +[ + dnl This code is here specifically to handle the + dnl various flavors of threading library on FreeBSD + dnl 4-, 5-, and 6-, and the (weird) rules around it. + dnl There may be an environment PTHREAD_LIBS that + dnl specifies what to use; otherwise, search for it. + dnl -pthread is special cased and unsets LIBPTHREAD + dnl below if found. + LIBPTHREAD="" + + if test -n "$PTHREAD_LIBS"; then + if test "x$PTHREAD_LIBS" = "x-pthread" ; then + LIBPTHREAD="PTHREAD" + else + PTHREAD_LIBS_save="$PTHREAD_LIBS" + PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'` + AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS]) + KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [ + LIBPTHREAD="$PTHREAD_LIBS_save"]) + PTHREAD_LIBS="$PTHREAD_LIBS_save" + fi + fi + + dnl Is this test really needed, in the face of the Tru64 test below? + if test -z "$LIBPTHREAD"; then + AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"]) + fi + + dnl This is a special Tru64 check, see BR 76171 issue #18. + if test -z "$LIBPTHREAD" ; then + AC_MSG_CHECKING([for pthread_create in -lpthread]) + kde_safe_libs=$LIBS + LIBS="$LIBS -lpthread" + AC_TRY_LINK([#include ],[(void)pthread_create(0,0,0,0);],[ + AC_MSG_RESULT(yes) + LIBPTHREAD="-lpthread"],[ + AC_MSG_RESULT(no)]) + LIBS=$kde_safe_libs + fi + + dnl Un-special-case for FreeBSD. + if test "x$LIBPTHREAD" = "xPTHREAD" ; then + LIBPTHREAD="" + fi + + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_PTHREAD_OPTION], +[ + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"]) + fi + + AH_VERBATIM(__svr_define, [ +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif +]) + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + if test "$CXX" = "KCC"; then + CXXFLAGS="$CXXFLAGS --thread_safe" + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe" + fi + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_THREADING], +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + if test -z "$USE_THREADS"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]), + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN([KDE_TRY_LINK_PYTHON], +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi + +fi + +]) + +AC_DEFUN([KDE_CHECK_PYTHON_DIR], +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]), +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN([KDE_CHECK_PYTHON_INTERN], +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs" +AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.so; then + AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) + if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(db2, -ldb2) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm]) + KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this + and contact the authors to let them know about this problem]) + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN([KDE_CHECK_PYTHON], +[ + KDE_CHECK_PYTHON_INTERN("2.4", + [KDE_CHECK_PYTHON_INTERN("2.3", + [KDE_CHECK_PYTHON_INTERN("2.2", + [KDE_CHECK_PYTHON_INTERN("2.1", + [KDE_CHECK_PYTHON_INTERN("2.0", + [KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ]) + ]) + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_STL], +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + + AC_MSG_CHECKING([if C++ programs can be compiled]) + AC_CACHE_VAL(kde_cv_stl_works, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_works=yes, + kde_cv_stl_works=no) +]) + + AC_MSG_RESULT($kde_cv_stl_works) + + if test "$kde_cv_stl_works" = "yes"; then + # back compatible + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + else + AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs. +Check config.log for details - if you're using a Linux distribution you might miss +a package named similar to libstdc++-dev.]) + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN([AC_FIND_QIMGIO], + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include +#include +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN([AM_DISABLE_LIBRARIES], +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN([AC_CHECK_UTMP_FILE], +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN([KDE_CREATE_SUBDIRSLIST], +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" +TOPSUBDIRS="" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +ac_topsubdirs= +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +elif test -s $srcdir/subdirs; then + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + vari=`echo $i | sed -e 's,[[-+.@]],_,g'` + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + eval "$vari""_SUBDIR_included=yes" + else + eval "$vari""_SUBDIR_included=no" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN([KDE_CHECK_NAMESPACES], +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_S_ISSOCK], +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_TRY_LINK( +[ +#include +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi + +AH_VERBATIM(_ISSOCK, +[ +#ifndef HAVE_S_ISSOCK +#define HAVE_S_ISSOCK +#define S_ISSOCK(mode) (1==0) +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_KDEMAXPATHLEN], +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +cat > conftest.$ac_ext < +#endif +#include +#include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +AC_DEFUN([KDE_CHECK_HEADER], +[ + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER([$1], [$2], [$3], [$4]) + AC_LANG_RESTORE + CPPFLAGS=$kde_safe_cppflags +]) + +AC_DEFUN([KDE_CHECK_HEADERS], +[ + AH_CHECK_HEADERS([$1]) + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_FAST_CONFIGURE], +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]), + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN([KDE_CONF_FILES], +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +dnl This sets the prefix, for arts and kdelibs +dnl Do NOT use in any other module. +dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde +AC_DEFUN([KDE_SET_PREFIX_CORE], +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$prefix" + fi + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + + +AC_DEFUN([KDE_SET_PREFIX], +[ + unset CDPATH + dnl We can't give real code to that macro, only a value. + dnl It only matters for --help, since we set the prefix in this function anyway. + AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix}) + + KDE_SET_DEFAULT_BINDIRS + if test "x$prefix" = "xNONE"; then + dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend) + else + dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH + kde_save_PATH="$PATH" + PATH="$exec_prefix/bin:$prefix/bin:$PATH" + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend) + PATH="$kde_save_PATH" + fi + + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + kde_libs_suffix=`$KDECONFIG --libsuffix` + + AC_MSG_CHECKING([where to install]) + if test "x$prefix" = "xNONE"; then + prefix=$kde_libs_prefix + AC_MSG_RESULT([$prefix (as returned by kde-config)]) + else + dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different + given_prefix=$prefix + AC_MSG_RESULT([$prefix (as requested)]) + fi + + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + + AC_SUBST(KDECONFIG) + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) + + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN([KDE_LANG_CPLUSPLUS], +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN([KDE_CHECK_LONG_LONG], +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) + AC_LANG_RESTORE +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN([KDE_CHECK_LIB], +[ + kde_save_LDFLAGS="$LDFLAGS" + dnl AC_CHECK_LIB modifies LIBS, so save it here + kde_save_LIBS="$LIBS" + LDFLAGS="$LDFLAGS $all_libraries" + case $host_os in + aix*) LDFLAGS="-brtl $LDFLAGS" + test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LDFLAGS="$kde_save_LDFLAGS" + LIBS="$kde_save_LIBS" +]) + +AC_DEFUN([KDE_JAVA_PREFIX], +[ + dir=`dirname "$1"` + base=`basename "$1"` + list=`ls -1 $dir 2> /dev/null` + for entry in $list; do + if test -d $dir/$entry/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/bin" + ;; + esac + elif test -d $dir/$entry/jre/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/jre/bin" + ;; + esac + fi + done +]) + +dnl KDE_CHEC_JAVA_DIR(onlyjre) +AC_DEFUN([KDE_CHECK_JAVA_DIR], +[ + +AC_ARG_WITH(java, +AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]), +[ ac_java_dir=$withval +], ac_java_dir="" +) + +AC_MSG_CHECKING([for Java]) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = "xno"; then + kde_java_bindir=no + kde_java_includedir=no + kde_java_libjvmdir=no + kde_java_libgcjdir=no + kde_java_libhpidir=no +else + if test "x$ac_java_dir" = "x"; then + + + dnl No option set -> collect list of candidate paths + if test -n "$JAVA_HOME"; then + KDE_JAVA_PREFIX($JAVA_HOME) + fi + KDE_JAVA_PREFIX(/usr/j2se) + KDE_JAVA_PREFIX(/usr/lib/j2se) + KDE_JAVA_PREFIX(/usr/j*dk*) + KDE_JAVA_PREFIX(/usr/lib/j*dk*) + KDE_JAVA_PREFIX(/opt/j*sdk*) + KDE_JAVA_PREFIX(/usr/lib/java*) + KDE_JAVA_PREFIX(/usr/java*) + KDE_JAVA_PREFIX(/usr/java/j*dk*) + KDE_JAVA_PREFIX(/usr/java/j*re*) + KDE_JAVA_PREFIX(/usr/lib/SunJava2*) + KDE_JAVA_PREFIX(/usr/lib/SunJava*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava2*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava*) + KDE_JAVA_PREFIX(/opt/java*) + + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + if test -d "$dir"; then + javadirs="$javadirs $dir" + fi + done + IFS=$kde_save_IFS + jredirs= + + dnl Now javadirs contains a list of paths that exist, all ending with bin/ + for dir in $javadirs; do + dnl Check for the java executable + if test -x "$dir/java"; then + dnl And also check for a libjvm.so somewhere under there + dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big. + if test "$dir" != "/usr/bin"; then + libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + if test ! -f $libjvmdir/libjvm.so; then continue; fi + jredirs="$jredirs $dir" + fi + fi + done + + dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found + JAVAC= + JAVA= + kde_java_bindir=no + for dir in $jredirs; do + JAVA="$dir/java" + kde_java_bindir=$dir + if test -x "$dir/javac"; then + JAVAC="$dir/javac" + break + fi + done + + if test -n "$JAVAC"; then + dnl this substitution might not work - well, we test for jni.h below + kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'` + else + kde_java_includedir=no + fi + else + dnl config option set + kde_java_bindir=$ac_java_dir/bin + if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then + kde_java_includedir=no + else + kde_java_includedir=$ac_java_dir/include + fi + fi +fi + +dnl At this point kde_java_bindir and kde_java_includedir are either set or "no" +if test "x$kde_java_bindir" != "xno"; then + + dnl Look for libjvm.so + kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + dnl Look for libgcj.so + kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1` + dnl Look for libhpi.so and avoid green threads + kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1` + + dnl Now check everything's fine under there + dnl the include dir is our flag for having the JDK + if test -d "$kde_java_includedir"; then + if test ! -x "$kde_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.]) + fi + + jni_includes="-I$kde_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + + dnl not needed for gcj + + if test "x$kde_java_libgcjdir" = "x"; then + test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux" + test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris" + test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix" + fi + + else + JAVAC= + jni_includes= + fi + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) + fi + else + if test ! -r "$kde_java_libgcjdir/libgcj.so"; then + AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.]) + fi + fi + + if test ! -x "$kde_java_bindir/java"; then + AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + + dnl not needed for gcj compile + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) + fi + fi + + if test -n "$jni_includes"; then + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ + #include + ], + [ + #ifndef JNI_VERSION_1_2 + Syntax Error + #endif + ],[ kde_jni_works=yes ], + [ kde_jni_works=no ]) + + if test $kde_jni_works = no; then + AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + if test "x$kde_java_libgcjdir" = "x"; then + JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi" + else + JVMLIBS="-L$kde_java_libgcjdir -lgcj" + fi + AC_MSG_RESULT([java JDK in $kde_java_bindir]) + + else + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([java JRE in $kde_java_bindir]) + fi +elif test -d "/Library/Java/Home"; then + kde_java_bindir="/Library/Java/Home/bin" + jni_includes="-I/Library/Java/Home/include" + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + JVMLIBS="-Xlinker -framework -Xlinker JavaVM" + + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([Apple Java Framework]) +else + AC_MSG_RESULT([none found]) +fi + +AC_SUBST(JAVAC) +AC_SUBST(JAVAH) +AC_SUBST(JAR) +AC_SUBST(JVMLIBS) +AC_SUBST(jni_includes) + +# for backward compat +kde_cv_java_includedir=$kde_java_includedir +kde_cv_java_bindir=$kde_java_bindir +]) + +dnl this is a redefinition of autoconf 2.5x's AC_FOREACH. +dnl When the argument list becomes big, as in KDE for AC_OUTPUT in +dnl big packages, m4_foreach is dog-slow. So use our own version of +dnl it. (matz@kde.org) +m4_define([mm_foreach], +[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])]) +m4_define([mm_car], [[$1]]) +m4_define([mm_car2], [[$@]]) +m4_define([_mm_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1], + mm_car2(m4_shift($2)), + [$3])])]) +m4_define([AC_FOREACH], +[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + +AC_DEFUN([KDE_NEED_FLEX], +[ +kde_libs_safe=$LIBS +LIBS="$LIBS $USER_LDFLAGS" +AM_PROG_LEX +LIBS=$kde_libs_safe +if test -z "$LEXLIB"; then + AC_MSG_ERROR([You need to have flex installed.]) +fi +AC_SUBST(LEXLIB) +]) + +AC_DEFUN([AC_PATH_QTOPIA], +[ + dnl TODO: use AC_CACHE_VAL + + if test -z "$1"; then + qtopia_minver_maj=1 + qtopia_minver_min=5 + qtopia_minver_pat=0 + else + qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"` + qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"` + qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"` + fi + + qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat" + qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat" + + AC_REQUIRE([AC_PATH_QT]) + + AC_MSG_CHECKING([for Qtopia]) + + LIB_QTOPIA="-lqpe" + AC_SUBST(LIB_QTOPIA) + + kde_qtopia_dirs="$QPEDIR /opt/Qtopia" + + ac_qtopia_incdir=NO + + AC_ARG_WITH(qtopia-dir, + AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]), + [ ac_qtopia_incdir="$withval"/include] ) + + qtopia_incdirs="" + for dir in $kde_qtopia_dirs; do + qtopia_incdirs="$qtopia_incdirs $dir/include" + done + + if test ! "$ac_qtopia_incdir" = "NO"; then + qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs" + fi + + qtopia_incdir="" + AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir) + ac_qtopia_incdir="$qtopia_incdir" + + if test -z "$qtopia_incdir"; then + AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.]) + fi + + qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`; + qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`; + qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`; + + qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat" + qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat" + if test "$qtopia_ver" -lt "$qtopia_minver"; then + AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr +is required.]) + fi + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_cxxflags_safe="$CXXFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes" + LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" + LIBS="$LIBS $LIB_QTOPIA $LIBQT" + + cat > conftest.$ac_ext < +#include + +int main( int argc, char **argv ) +{ + QPEApplication app( argc, argv ); + return 0; +} +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* + else + rm -f conftest* + AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at +the end of config.log]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + QTOPIA_INCLUDES="-I$qtopia_incdir" + AC_SUBST(QTOPIA_INCLUDES) + + AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir]) +]) + + +AC_DEFUN([KDE_INIT_DOXYGEN], +[ +AC_MSG_CHECKING([for Qt docs]) +kde_qtdir= +if test "${with_qt_dir+set}" = set; then + kde_qtdir="$with_qt_dir" +fi + +AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) +AC_MSG_RESULT($QTDOCDIR) + +AC_SUBST(QTDOCDIR) + +KDE_FIND_PATH(dot, DOT, [], []) +if test -n "$DOT"; then + KDE_HAVE_DOT="YES" +else + KDE_HAVE_DOT="NO" +fi +AC_SUBST(KDE_HAVE_DOT) +KDE_FIND_PATH(doxygen, DOXYGEN, [], []) +AC_SUBST(DOXYGEN) + +DOXYGEN_PROJECT_NAME="$1" +DOXYGEN_PROJECT_NUMBER="$2" +AC_SUBST(DOXYGEN_PROJECT_NAME) +AC_SUBST(DOXYGEN_PROJECT_NUMBER) + +KDE_HAS_DOXYGEN=no +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then + KDE_HAS_DOXYGEN=yes +fi +AC_SUBST(KDE_HAS_DOXYGEN) + +]) + + +AC_DEFUN([AC_FIND_BZIP2], +[ +AC_MSG_CHECKING([for bzDecompress in libbz2]) +AC_CACHE_VAL(ac_cv_lib_bzip2, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET" +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#define BZ_NO_STDIO +#include +], + [ bz_stream s; (void) bzDecompress(&s); ], + eval "ac_cv_lib_bzip2='-lbz2'", + eval "ac_cv_lib_bzip2=no") +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +AC_MSG_RESULT($ac_cv_lib_bzip2) + +if test ! "$ac_cv_lib_bzip2" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2" + AC_SUBST(LIBBZ2) + +else + + cxx_shared_flag= + ld_shared_flag= + KDE_CHECK_COMPILER_FLAG(shared, [ + ld_shared_flag="-shared" + ]) + KDE_CHECK_COMPILER_FLAG(fPIC, [ + cxx_shared_flag="-fPIC" + ]) + + AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2]) + AC_CACHE_VAL(ac_cv_lib_bzip2_prefix, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET" + kde_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES" + + AC_TRY_LINK(dnl + [ + #define BZ_NO_STDIO + #include + ], + [ bz_stream s; (void) BZ2_bzDecompress(&s); ], + eval "ac_cv_lib_bzip2_prefix='-lbz2'", + eval "ac_cv_lib_bzip2_prefix=no") + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + AC_LANG_RESTORE + ])dnl + + AC_MSG_RESULT($ac_cv_lib_bzip2_prefix) + + if test ! "$ac_cv_lib_bzip2_prefix" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2_prefix" + AC_SUBST(LIBBZ2) + + AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix]) + dnl else, we just ignore this + fi + +fi +AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR") +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the SSL headers and libraries. +dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed) +dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([KDE_CHECK_SSL], +[ +LIBSSL="-lssl -lcrypto" +AC_REQUIRE([KDE_CHECK_LIB64]) + +ac_ssl_includes=NO ac_ssl_libraries=NO +ssl_libraries="" +ssl_includes="" +AC_ARG_WITH(ssl-dir, + AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]), + [ ac_ssl_includes="$withval"/include + ac_ssl_libraries="$withval"/lib$kdelibsuff + ]) + +want_ssl=yes +AC_ARG_WITH(ssl, + AC_HELP_STRING([--without-ssl],[disable SSL checks]), + [want_ssl=$withval]) + +if test $want_ssl = yes; then + +AC_MSG_CHECKING(for OpenSSL) + +AC_CACHE_VAL(ac_cv_have_ssl, +[#try to guess OpenSSL locations + + ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes" + ssl_incdirs="$ac_ssl_includes $ssl_incdirs" + AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir) + ac_ssl_includes="$ssl_incdir" + + ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs" + if test ! "$ac_ssl_libraries" = "NO"; then + ssl_libdirs="$ac_ssl_libraries $ssl_libdirs" + fi + + test=NONE + ssl_libdir=NONE + for dir in $ssl_libdirs; do + try="ls -1 $dir/libssl*" + if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done + + ac_ssl_libraries="$ssl_libdir" + + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries" + LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref" + + AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();, + ac_ssl_rsaref="yes" + , + ac_ssl_rsaref="no" + ) + + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then + have_ssl=no + else + have_ssl=yes; + fi + + ]) + + eval "$ac_cv_have_ssl" + + AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes]) + + AC_MSG_CHECKING([whether OpenSSL uses rsaref]) + AC_MSG_RESULT($ac_ssl_rsaref) + + AC_MSG_CHECKING([for easter eggs]) + AC_MSG_RESULT([none found]) + +else + have_ssl=no +fi + +if test "$have_ssl" = yes; then + AC_MSG_CHECKING(for OpenSSL version) + dnl Check for SSL version + AC_CACHE_VAL(ac_cv_ssl_version, + [ + + cat >conftest.$ac_ext < +#include + int main() { + +#ifndef OPENSSL_VERSION_NUMBER + printf("ssl_version=\\"error\\"\n"); +#else + if (OPENSSL_VERSION_NUMBER < 0x00906000) + printf("ssl_version=\\"old\\"\n"); + else + printf("ssl_version=\\"ok\\"\n"); +#endif + return (0); + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + if test "$ac_ssl_includes" != "/usr/include"; then + CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes" + fi + + if AC_TRY_EVAL(ac_link); then + + if eval `./conftest 2>&5`; then + if test $ssl_version = error; then + AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !]) + else + if test $ssl_version = old; then + AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.]) + have_ssl=no + fi + fi + ac_cv_ssl_version="ssl_version=$ssl_version" + else + AC_MSG_ERROR([Your system couldn't run a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure , attaching your config.log]) + fi + + else + AC_MSG_ERROR([Your system couldn't link a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure , attaching your config.log]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + ]) + + eval "$ac_cv_ssl_version" + AC_MSG_RESULT($ssl_version) +fi + +if test "$have_ssl" != yes; then + LIBSSL=""; +else + AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL]) + ac_cv_have_ssl="have_ssl=yes \ + ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref" + + + ssl_libraries="$ac_ssl_libraries" + ssl_includes="$ac_ssl_includes" + + if test "$ac_ssl_rsaref" = yes; then + LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" + fi + + if test $ssl_version = "old"; then + AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6]) + fi +fi + +SSL_INCLUDES= + +if test "$ssl_includes" = "/usr/include"; then + if test -f /usr/kerberos/include/krb5.h; then + SSL_INCLUDES="-I/usr/kerberos/include" + fi +elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then + SSL_INCLUDES="-I$ssl_includes" +fi + +if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then + SSL_LDFLAGS="" +else + SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries" +fi + +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_LDFLAGS) +AC_SUBST(LIBSSL) +]) + +AC_DEFUN([KDE_CHECK_STRLCPY], +[ + AC_REQUIRE([AC_CHECK_STRLCAT]) + AC_REQUIRE([AC_CHECK_STRLCPY]) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(unsigned long) + + AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long]) + AC_TRY_COMPILE(,[ + #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG + choke me + #endif + ],AC_MSG_RESULT([yes]),[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + Apparently on your system our assumption sizeof size_t == sizeof unsigned long + does not apply. Please mail kde-devel@kde.org with a description of your system! + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_BINUTILS], +[ + AC_MSG_CHECKING([if ld supports unversioned version maps]) + + kde_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo "{ local: extern \"C++\" { foo }; };" > conftest.map + AC_TRY_LINK([int foo;], +[ +#ifdef __INTEL_COMPILER +icc apparently does not support libtools version-info and version-script +at the same time. Dunno where the bug is, but until somebody figured out, +better disable the optional version scripts. +#endif + + foo = 42; +], kde_supports_versionmaps=yes, kde_supports_versionmaps=no) + LDFLAGS="$kde_save_LDFLAGS" + rm -f conftest.map + AM_CONDITIONAL(include_VERSION_SCRIPT, + [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"]) + + AC_MSG_RESULT($kde_supports_versionmaps) +]) + +AC_DEFUN([AM_PROG_OBJC],[ +AC_CHECK_PROGS(OBJC, gcc, gcc) +test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH]) +if test "x${OBJCFLAGS-unset}" = xunset; then + OBJCFLAGS="-g -O2" +fi +AC_SUBST(OBJCFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)]) +]) + +AC_DEFUN([KDE_CHECK_PERL], +[ + KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [ + AC_MSG_ERROR([No Perl found in your $PATH. +We need perl to generate some code.]) + ]) + AC_SUBST(PERL) +]) + +AC_DEFUN([KDE_CHECK_LARGEFILE], +[ +AC_SYS_LARGEFILE +if test "$ac_cv_sys_file_offset_bits" != no; then + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" +fi + +if test "x$ac_cv_sys_large_files" != "xno"; then + CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1" +fi + +]) + +dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in) +dnl which allows to search for libs that get installed into the KDE prefix. +dnl +dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not) +dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page +dnl also defines KSTUFF_PKG_ERRORS on error +AC_DEFUN([KDE_PKG_CHECK_MODULES], [ + + PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + if test "$prefix" != "$kde_libs_prefix"; then + PKG_CONFIG_PATH="$kde_libs_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + fi + export PKG_CONFIG_PATH + PKG_CHECK_MODULES($1,$2,$3,$4) +]) + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LINUX_64_MODE="32" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + LINUX_64_MODE="64" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + libsuff= + if test "x$LINUX_64_MODE" = x64; then + # Some platforms are per default 64-bit, so there's no /lib64 + if test -d /lib64; then + libsuff=64 + fi + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips* | powerpc* | sparc* | s390* | sh* | x86_64* ) + lt_cv_deplibs_check_method=pass_all ;; + # the debian people say, arm and glibc 2.3.1 works for them with pass_all + arm* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $compiler_flags $libobjs `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $libobjs $deplibs~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $libobjs $deplibs' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $compiler_flags $libobjs $deplibs$output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $compiler_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) +## -*- autoconf -*- +dnl This file was created by Joachim Ansorg +dnl It provides macord for the autoconf package to find the Sword library on your system. + +dnl ---------------------------------------------------------------------- +dnl Check wheter to use static linking +dnl first parameter is the required version +dnl second is whether to use static sword library +dnl ---------------------------------------------------------------------- +AC_DEFUN(AC_CHECK_SWORD, +[ +dnl AC_MSG_CHECKING([for a Sword installation]) + +dnl The option for the configure script +AC_ARG_WITH(sword-dir, +[ --with-sword-dir=DIR Path where Sword is being installed (default=/usr) ], +[ + ac_sword_dir=$withval +],ac_sword_dir=/usr +) + +AC_ARG_ENABLE(static-sword, +[ --enable-static-sword Link to the static Sword library], + ac_static_sword="YES", + [ ac_static_sword="$2" ] +) + +dnl try to find Sword library files +AC_MSG_CHECKING([for Sword library files]) +AC_REQUIRE([AC_FIND_ZLIB]) +ac_sword_library_dirs="$ac_sword_dir/lib $exec_prefix/lib $prefix/lib /usr/lib /usr/lib64 /usr/lib/sword /usr/local/lib /usr/local/lib/sword /usr/local/sword/lib" + +if test "x$ac_static_sword" = "xYES"; then + SEARCH_LIBS="libsword.a"; +else + SEARCH_LIBS="libsword.so libsword.so.3 libsword.so.4 libsword.a"; +fi + + +AC_CACHE_VAL(ac_cv_sword_libdir, AC_FIND_FILE($SEARCH_LIBS, $ac_sword_library_dirs, ac_cv_sword_libdir)) + +if test "x$ac_cv_sword_libdir" = "xNO"; then + AC_MSG_ERROR(SWORD library not found. Try to use configure with --with-sword-dir=/your/SWORD/path!); +fi + +if test "x$ac_static_sword" = "xYES"; then + LIB_SWORD="$ac_cv_sword_libdir/libsword.a"; +else + LIB_SWORD="-lsword"; +fi + +AC_SUBST(SWORD_LIBRARY_PATH) +AC_SUBST(LIB_SWORD) +all_libraries="$all_libraries -L$ac_cv_sword_libdir" + +if test "x$ac_static_sword" = "xYES"; then + MESSAGE="static library $ac_cv_sword_libdir/libsword.a"; +else + MESSAGE="$ac_cv_sword_libdir"; +fi +AC_MSG_RESULT([$MESSAGE]) + +dnl -- try to find Swords include files -- +AC_MSG_CHECKING([for Sword include files]) +ac_sword_include_dirs="$ac_sword_dir/include/sword $ac_sword_dir/include $exec_prefix/include $prefix/include /usr/include/sword /usr/include /usr/local/include/sword /usr/local/include /usr/local/sword/include /usr/local/sword/include/sword" + +AC_CACHE_VAL(ac_cv_sword_incdir, AC_FIND_FILE(swmgr.h, $ac_sword_include_dirs, ac_cv_sword_incdir)) + +if test "x$ac_cv_sword_incdir" = "xNO"; then + AC_MSG_ERROR([The Sword include file files were not found. +Please try to use configure with --with-sword-dir=/your/SWORD/path ! +]) +fi + +SWORD_INCLUDES="-I$ac_cv_sword_incdir" +AC_SUBST(SWORD_INCLUDES) +all_includes="$all_includes -I$ac_cv_sword_incdir" + +AC_MSG_RESULT([$ac_cv_sword_incdir]) + + + +dnl -- Sword version tests -- +dnl First test for installed Sword version +dnl Then check if it's recent enough + +AC_MSG_CHECKING([for installed Sword version]) + +AC_CACHE_VAL(ac_cv_installed_sword_version, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$" +LDFLAGS="$LDFLAGS -L$ac_cv_sword_libdir" +LIBS="$LIB_SWORD -lz" +LD_LIBRARY_PATH="$ac_cv_sword_libdir" +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +cat > conftest.$ac_ext < +#include + +#ifdef SWORD_NAMESPACE_START +using namespace sword; +#endif + +int main(int argc, char** argv) { + std::cout << SWVersion::currentVersion << std::endl; + return 0; +} +EOF + + +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +if AC_TRY_EVAL(ac_link) && test -s conftest; then + if test -x conftest; then + eval ac_cv_installed_sword_version=`./conftest 2>&5` + fi +else + echo "configure: failed program was:" >&AC_FD_CC + AC_MSG_ERROR([Failed to compile the test program to check the Sword version! Please have a look at config.log! Report this to the BibleTime developers!]); + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) +AC_MSG_RESULT([$ac_cv_installed_sword_version]) + + + + +dnl *** Now check if the installed version is recent enough +AC_MSG_CHECKING([whether your Sword installation is recent enough]) + +AC_CACHE_VAL(ac_cv_sword_recent_version, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$" +LDFLAGS="$LDFLAGS -L$ac_cv_sword_libdir" +LIBS="$LIB_SWORD -lz" +LD_LIBRARY_PATH="$ac_cv_sword_libdir" +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +cat > conftest.$ac_ext < +#include + +#ifdef SWORD_NAMESPACE_START +using namespace sword; +#endif + + +int main(int argc, char** argv) { + if (argc == 2) { //compare required with installed Sword version + const char* requiredVersion( argv[[1]] ); + if ( (SWVersion( requiredVersion ) < SWVersion::currentVersion) || (SWVersion( requiredVersion ) == SWVersion::currentVersion) ) { + std::cout << "ok"; + return -1; + } + else { + std::cout << "not-ok"; + return -2; //version not recent enough + } + } + return 0; +} +EOF + +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +if AC_TRY_EVAL(ac_link) && test -s conftest; then + if test -x conftest; then + eval ac_cv_sword_recent_version=`./conftest $1 2>&5` + fi +else + echo "configure: failed program was:" >&AC_FD_CC + AC_MSG_ERROR([Failed to compile the test program to check the Sword version! Please have a look at config.log! Report this to the BibleTime developers!]); + cat conftest.$ac_ext >&AC_FD_CC +fi; + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "x$ac_cv_sword_recent_version" = "xok"; then + AC_MSG_RESULT([yes]); +elif test "x$ac_cv_sword_recent_version" = "xnot-ok"; then + AC_MSG_RESULT([no]); + AC_MSG_ERROR([Your Sword installation is not recent enought! Please upgrade to version $1! Get the Sword library at www.crosswire.org.]); +else + AC_MSG_ERROR([Invalid return code of the internal Sword version test program. Please submit a bugreport!]); +fi; + +]) +## -*- autoconf -*- + +dnl ------------------------------------------------------------------------------- +dnl Check wheter to use static linking, first parameter is the result (YES/NO) +dnl ------------------------------------------------------------------------------- +AC_DEFUN(AC_CHECK_STATIC_LINKING, +[ +$1="NO" + +AC_MSG_CHECKING(whether to use static linking) +AC_ARG_ENABLE(static-linking, + [ --enable-static-linking use static linking], + USE_STATIC_LINKING=$enableval, USE_STATIC_LINKING="no") + +if test "$USE_STATIC_LINKING" = "yes"; then + BT_LDFLAGS="-all-static -Wl,-Bstatic"; + AC_SUBST(BT_LDFLAGS) + CPPFLAGS="-DSTATIC_BUILD $CPPFLAGS"; + $1="YES"; +else + $1="NO"; +fi + +AC_MSG_RESULT($USE_STATIC_LINKING) +]) + +dnl ------------------------------------------------------------------------------- +dnl Checks the type of the distribution +dnl Possible names for the distributions are SuSE, RedHat, Mandrake +dnl ------------------------------------------------------------------------------- +AC_DEFUN(AC_CHECK_DISTRIBUTION, +[ +AC_MSG_CHECKING([for the used Linux distribution]) + +AC_ARG_WITH(distribution, +[ --with-distribution=TYPE The name of your *NIX distribution, e.g. SuSE [auto] ], +[ + ac_distribution=$withval +],ac_distribution=auto +) + +AC_ARG_WITH(distribution-version, +[ --with-distribution-version=VERSION Version of your *NIX distribution, e.g. 7.2 [auto] ], +[ + ac_distribution_version=$withval +],ac_distribution_version=auto +) + +AC_ARG_WITH(rpm-prefix, +[ --with-rpm-prefix=DIR The directory which should be used as PREFIX + in the RPM spec file [auto] ], +[ + ac_rpm_prefix=$withval +],ac_rpm_prefix=auto +) + +AC_ARG_WITH(rpm-group, +[ --with-rpm-group=DIR The group which will be used for the RPM system [auto] ], +[ + ac_rpm_group=$withval +],ac_rpm_group=auto +) + +if test "$ac_distribution" != "auto"; then + DISTRIBUTION=[$ac_distribution] +fi + +if test "$ac_distribution" = "auto"; then +AC_CACHE_VAL(DISTRIBUTION, [ +if test -f "/etc/SuSE-release"; then + DISTRIBUTION="SuSE" +elif test -f "/etc/mandrake-release"; then + DISTRIBUTION="Mandrake" +elif test -f "/etc/redhat-release"; then + DISTRIBUTION="Red Hat" +elif test -f "/etc/debian_version"; then + DISTRIBUTION="Debian" +fi +]) +fi + +if test "$ac_distribution_version" != "auto"; then + DISTRIBUTION_VERSION=[$ac_distribution_version] +fi +if test "$ac_distribution_version" = "auto"; then +AC_CACHE_VAL(DISTRIBUTION_VERSION, [ +if test -f "/etc/SuSE-release" && test "$DISTRIBUTION" = "SuSE"; then + DISTRIBUTION_VERSION=[`grep "VERSION =" /etc/SuSE-release | sed 's/VERSION = //'`]; +elif test -f "/etc/mandrake-release" && test "$DISTRIBUTION" = "Mandrake"; then + DISTRIBUTION_VERSION=[`grep "Mandrake" /etc/mandrake-release | sed 's/[a-zA-Z()]*//g' | awk '{print $1}'`] +elif test -f "/etc/redhat-release" && test "$DISTRIBUTION" = "Red Hat"; then + DISTRIBUTION_VERSION=[`grep "Red Hat" /etc/redhat-release | sed 's/[a-zA-Z()]*//g' | awk '{print $1}'`] +elif test -f "/etc/debian_version" && test "$DISTRIBUTION" = "Debian"; then + DISTRIBUTION_VERSION=[`cat /etc/debian_version`] +fi +]) +fi + + +if test "$ac_rpm_prefix" != "auto"; then + RPM_PREFIX=[$ac_rpm_prefix] +fi +if test "$ac_rpm_prefix" = "auto"; then +AC_CACHE_VAL(RPM_PREFIX, [ +if test "$DISTRIBUTION" = "SuSE"; then + RPM_PREFIX="/opt/kde3" +elif test "$DISTRIBUTION" = "Mandrake"; then + RPM_PREFIX="/usr" +elif test "$DISTRIBUTION" = "Red Hat"; then + RPM_PREFIX="/usr" +elif test "$DISTRIBUTION" = "Debian"; then + RPM_PREFIX="/usr" +fi +]) +fi + +if test "$ac_rpm_group" != "auto"; then + RPM_GROUP=[$ac_rpm_group] +fi +if test "$ac_rpm_prefix" = "auto"; then +AC_CACHE_VAL(RPM_GROUP, +[ +if test "$DISTRIBUTION" = "SuSE"; then + RPM_GROUP="X11/KDE/Applications" +elif test "$DISTRIBUTION" = "Mandrake"; then + RPM_GROUP="Graphical desktop/KDE" +elif test "$DISTRIBUTION" = "Red Hat"; then + RPM_GROUP="Graphical desktop/KDE" +elif test "$DISTRIBUTION" = "Debian"; then + RPM_GROUP="Graphical desktop/KDE" +fi +]) +fi + +if test -n "$DISTRIBUTION" && test "$DISTRIBUTION" != "unknown"; then + AC_DEFINE_UNQUOTED(DISTRIBUTION, ${DISTRIBUTION}, [The type of your distribution]) +fi + +if test -n "$DISTRIBUTION_VERSION" && test "$DISTRIBUTION_VERSION" != "unknown"; then + AC_DEFINE_UNQUOTED(DISTRIBUTION_VERSION, ${DISTRIBUTION_VERSION}, [The version of your distribution]) +fi + +AC_SUBST(DISTRIBUTION) +AC_SUBST(DISTRIBUTION_VERSION) +AC_SUBST(RPM_PREFIX) +AC_SUBST(RPM_GROUP) + +AC_MSG_RESULT([$DISTRIBUTION $DISTRIBUTION_VERSION]) + +AC_MSG_CHECKING([for RPM installation prefix]) +AC_MSG_RESULT([$RPM_PREFIX]) + +AC_MSG_CHECKING([for the correct RPM group]) +AC_MSG_RESULT([$RPM_GROUP]) +]) + + + + +dnl MY_CURL +dnl ------- +dnl set my_cv_curl_vers to the version of libcurl or NONE +dnl if libcurl is not found or is too old +dnl This function comes from cURL's webpage + +AC_DEFUN(AC_CHECK_CURL,[ + AC_CACHE_VAL(my_cv_curl_vers,[ + my_cv_curl_vers=NONE + dnl check is the plain-text version of the required version + check="7.9" + dnl check_hex must be UPPERCASE if any hex letters are present + check_hex="070900" + + AC_MSG_CHECKING([for curl >= $check]) + + if eval curl-config --version 2>/dev/null >/dev/null; then + ver=`curl-config --version | sed -e "s/libcurl //g"` + hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'` + ok=`echo "ibase=16; if($hex_ver>=$check_hex) $hex_ver else 0" | bc` + + if test x$ok != x0; then + my_cv_curl_vers="$ver" + AC_MSG_RESULT([$my_cv_curl_vers]) + else + AC_MSG_RESULT(FAILED) + AC_MSG_ERROR([$ver is too old. Please install libcurl version $check or higher.]); + fi + else + AC_MSG_RESULT(FAILED) + AC_MSG_ERROR([curl-config was not found. Please install libcurl version $check or higher.]) + fi + ]) +]) +## -*- autoconf -*- +dnl This file was created by Lee Carpenter +dnl Later modified by Martin Gruner +dnl It provides macros for the autoconf package to find the CLucene library on your system. + +dnl ---------------------------------------------------------------------- +dnl Check for clucene installation +dnl First argument specifies whether or not to link +dnl CLucene statically +dnl ---------------------------------------------------------------------- +AC_DEFUN(AC_CHECK_CLUCENE, +[ +dnl AC_MSG_CHECKING([for a clucene installation]) + +dnl The option for the configure script +AC_ARG_WITH(clucene-dir, +[ --with-clucene-dir=DIR Path where CLucene is installed (default=/usr) ], +[ + ac_clucene_dir=$withval +],ac_clucene_dir=/usr +) + +AC_ARG_ENABLE(static-clucene, +[ --enable-static-clucene Link to the static CLucene library], + ac_static_clucene="YES", + [ ac_static_clucene="$1" ] +) + +dnl try to find CLucene library files +AC_MSG_CHECKING([for CLucene library files]) +ac_clucene_library_dirs="$ac_clucene_dir/lib $exec_prefix/lib $prefix/lib /usr/lib /usr/lib64 /usr/local/lib" + +if test "x$ac_static_clucene" = "xYES"; then + SEARCH_LIBS="libclucene.a"; +else + SEARCH_LIBS="libclucene.so libclucene.so.0 libclucene.so.0.0.0 libcluene.a"; +fi + + +AC_CACHE_VAL(ac_cv_clucene_libdir, AC_FIND_FILE($SEARCH_LIBS, $ac_clucene_library_dirs, ac_cv_clucene_libdir)) + +if test "x$ac_cv_clucene_libdir" = "xNO"; then + AC_MSG_ERROR(CLucene library not found. Try to use configure with --with-clucene-dir=/path/to/clucene); +fi + +if test "x$ac_static_clucene" = "xYES"; then + LIB_CLUCENE="$ac_cv_clucene_libdir/libclucene.a"; +else + LIB_CLUCENE="-lclucene"; +fi + +AC_SUBST(CLUCENE_LIBRARY_PATH) +AC_SUBST(LIB_CLUCENE) +all_libraries="$all_libraries -L$ac_cv_clucene_libdir" + +if test "x$ac_static_clucene" = "xYES"; then + MESSAGE="static library $ac_cv_clucene_libdir/libclucene.a"; +else + MESSAGE="$ac_cv_clucene_libdir"; +fi +AC_MSG_RESULT([$MESSAGE]) + +dnl -- try to find CLucene include files -- +AC_MSG_CHECKING([for Clucene include files]) +ac_clucene_include_dirs="$ac_clucene_dir/include $exec_prefix/include $prefix/include /usr/include /usr/local/include" + +AC_CACHE_VAL(ac_cv_clucene_incdir, AC_FIND_FILE(CLucene.h, $ac_clucene_include_dirs, ac_cv_clucene_incdir)) + +if test "x$ac_cv_clucene_incdir" = "xNO"; then + AC_MSG_ERROR([The CLucene include file files were not found. +Please try to use configure with --with-clucene-dir=/path/to/clucene +]) +fi + +CLUCENE_INCLUDES="-I$ac_cv_clucene_incdir" +AC_SUBST(CLUCENE_INCLUDES) +all_includes="$all_includes -I$ac_cv_clucene_incdir -I$ac_cv_clucene_libdir -I$ac_cv_sword_incdir" #$ac_cv_clucene_libdir needed for Clucene/clucene-config.h + +AC_MSG_RESULT([$ac_cv_clucene_incdir]) + + + +dnl -- CLucene installed test -- + +AC_MSG_CHECKING([for CLucene version]) + +AC_CACHE_VAL(ac_cv_installed_clucene_version, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$" +LDFLAGS="$LDFLAGS -L$ac_cv_clucene_libdir -L$ac_cv_sword_libdir" +LIBS="$LIB_CLUCENE -lz -lsword" +LD_LIBRARY_PATH="$ac_cv_clucene_libdir" +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +cat > conftest.$ac_ext < +#include +#include + +int main(int argc, char* argv[[]]) { + if ( sword::SWVersion( _CL_VERSION ) >= sword::SWVersion( "0.9.16" ) ){ + std::cout << "ok"; + } + else{ + std::cout << "not-ok"; + } + return 0; +} +EOF + + +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +if AC_TRY_EVAL(ac_link) && test -s conftest; then + if test -x conftest; then + eval ac_cv_installed_clucene_version=`./conftest 2>&5` + fi +else + echo "configure: failed program was:" >&AC_FD_CC + AC_MSG_ERROR([Failed to compile the test program to check the CLucene version! Please have a look at config.log! Report this to the BibleTime developers!]); + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "x$ac_cv_installed_clucene_version" = "xok"; then + AC_MSG_RESULT([ok, version is recent enough]); +elif test "x$ac_cv_installed_clucene_version" = "xnot-ok"; then + AC_MSG_RESULT([installed]); + AC_MSG_ERROR([Your CLucene version is not recent enough! Please upgrade to version >= 0.9.16!]); +fi; + +]) + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..2f1ca33 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,910 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..61b1206 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,2 @@ +#!/bin/sh +UNSERMAKE="no" make -f Makefile.cvs diff --git a/bibletime.desktop b/bibletime.desktop new file mode 100644 index 0000000..8ba325a --- /dev/null +++ b/bibletime.desktop @@ -0,0 +1,26 @@ +[Desktop Entry] +Comment=An easy to use bible study tool +Comment[C]=An easy to use bible study tool +Comment[cs]=Snadno pouiteln n�troj pro studium Bible +Comment[da]=Et letanvendeligt bibelstudieprogram +Comment[de]=Ein einfach zu benutzendes Bibelprogramm +Comment[fr]=Un outil d'�ude biblique facile �utiliser +Exec=bibletime +Icon=bibletime +MimeType= +Name=BibleTime 1.6.6.0 +Name[C]=BibleTime 1.6.6.0 +Name[cs]=BibleTime 1.6.6.0 +Name[da]=Bibeltime 1.6.6.0 +Name[de]=BibleTime 1.6.6.0 +Name[fr]=BibleTime 1.6.6.0 +GenericName=Bible Study Tool +SwallowExec= +SwallowTitle= +Terminal=false +TerminalOptions= +Type=Application +X-KDE-SubstituteUID=false +X-KDE-Username= +Categories=X-Bible;X-Religion;Literature;Art;Education;Utility;KDE;QT +DocPath=bibletime/handbook/index.html diff --git a/bibletime.desktop.in b/bibletime.desktop.in new file mode 100644 index 0000000..ab6b200 --- /dev/null +++ b/bibletime.desktop.in @@ -0,0 +1,26 @@ +[Desktop Entry] +Comment=An easy to use bible study tool +Comment[C]=An easy to use bible study tool +Comment[cs]=Snadno pouiteln n�troj pro studium Bible +Comment[da]=Et letanvendeligt bibelstudieprogram +Comment[de]=Ein einfach zu benutzendes Bibelprogramm +Comment[fr]=Un outil d'�ude biblique facile �utiliser +Exec=bibletime +Icon=bibletime +MimeType= +Name=BibleTime @VERSION@ +Name[C]=BibleTime @VERSION@ +Name[cs]=BibleTime @VERSION@ +Name[da]=Bibeltime @VERSION@ +Name[de]=BibleTime @VERSION@ +Name[fr]=BibleTime @VERSION@ +GenericName=Bible Study Tool +SwallowExec= +SwallowTitle= +Terminal=false +TerminalOptions= +Type=Application +X-KDE-SubstituteUID=false +X-KDE-Username= +Categories=X-Bible;X-Religion;Literature;Art;Education;Utility;KDE;QT +DocPath=bibletime/handbook/index.html diff --git a/bibletime.lsm b/bibletime.lsm new file mode 100644 index 0000000..ad91db9 --- /dev/null +++ b/bibletime.lsm @@ -0,0 +1,14 @@ +Begin3 +Title: BibleTime +Version: 1.6.5.1 +Entered-date: 31DEC2003 +Description: An easy to use but powerful Bible study tool for KDE 3. BibleTime is based on SWORD 1.5.8. +Keywords: bible,study,KDE3,KDE,QT,sword,bibletime,bibletime2,crosswire,www.bibletime.info,crosswire.org +Author: The BibleTime Team +Maintained-by: The BibleTime Team +Primary-site: http://www.bibletime.info/ +Home-page: http://www.bibletime.info/ +Original-site: http://www.bibletime.info/ +Platforms: Linux and other Unices +Copying-policy: GNU Public License +End diff --git a/bibletime.lsm.in b/bibletime.lsm.in new file mode 100644 index 0000000..38114bd --- /dev/null +++ b/bibletime.lsm.in @@ -0,0 +1,14 @@ +Begin3 +Title: BibleTime +Version: @VERSION@ +Entered-date: 31DEC2003 +Description: An easy to use but powerful Bible study tool for KDE 3. BibleTime is based on SWORD 1.5.8. +Keywords: bible,study,KDE3,KDE,QT,sword,bibletime,bibletime2,crosswire,www.bibletime.info,crosswire.org +Author: The BibleTime Team +Maintained-by: The BibleTime Team +Primary-site: http://www.bibletime.info/ +Home-page: http://www.bibletime.info/ +Original-site: http://www.bibletime.info/ +Platforms: Linux and other Unices +Copying-policy: GNU Public License +End diff --git a/bibletime.m4 b/bibletime.m4 new file mode 100644 index 0000000..3f42937 --- /dev/null +++ b/bibletime.m4 @@ -0,0 +1,193 @@ +## -*- autoconf -*- + +dnl ------------------------------------------------------------------------------- +dnl Check wheter to use static linking, first parameter is the result (YES/NO) +dnl ------------------------------------------------------------------------------- +AC_DEFUN(AC_CHECK_STATIC_LINKING, +[ +$1="NO" + +AC_MSG_CHECKING(whether to use static linking) +AC_ARG_ENABLE(static-linking, + [ --enable-static-linking use static linking], + USE_STATIC_LINKING=$enableval, USE_STATIC_LINKING="no") + +if test "$USE_STATIC_LINKING" = "yes"; then + BT_LDFLAGS="-all-static -Wl,-Bstatic"; + AC_SUBST(BT_LDFLAGS) + CPPFLAGS="-DSTATIC_BUILD $CPPFLAGS"; + $1="YES"; +else + $1="NO"; +fi + +AC_MSG_RESULT($USE_STATIC_LINKING) +]) + +dnl ------------------------------------------------------------------------------- +dnl Checks the type of the distribution +dnl Possible names for the distributions are SuSE, RedHat, Mandrake +dnl ------------------------------------------------------------------------------- +AC_DEFUN(AC_CHECK_DISTRIBUTION, +[ +AC_MSG_CHECKING([for the used Linux distribution]) + +AC_ARG_WITH(distribution, +[ --with-distribution=TYPE The name of your *NIX distribution, e.g. SuSE [auto] ], +[ + ac_distribution=$withval +],ac_distribution=auto +) + +AC_ARG_WITH(distribution-version, +[ --with-distribution-version=VERSION Version of your *NIX distribution, e.g. 7.2 [auto] ], +[ + ac_distribution_version=$withval +],ac_distribution_version=auto +) + +AC_ARG_WITH(rpm-prefix, +[ --with-rpm-prefix=DIR The directory which should be used as PREFIX + in the RPM spec file [auto] ], +[ + ac_rpm_prefix=$withval +],ac_rpm_prefix=auto +) + +AC_ARG_WITH(rpm-group, +[ --with-rpm-group=DIR The group which will be used for the RPM system [auto] ], +[ + ac_rpm_group=$withval +],ac_rpm_group=auto +) + +if test "$ac_distribution" != "auto"; then + DISTRIBUTION=[$ac_distribution] +fi + +if test "$ac_distribution" = "auto"; then +AC_CACHE_VAL(DISTRIBUTION, [ +if test -f "/etc/SuSE-release"; then + DISTRIBUTION="SuSE" +elif test -f "/etc/mandrake-release"; then + DISTRIBUTION="Mandrake" +elif test -f "/etc/redhat-release"; then + DISTRIBUTION="Red Hat" +elif test -f "/etc/debian_version"; then + DISTRIBUTION="Debian" +fi +]) +fi + +if test "$ac_distribution_version" != "auto"; then + DISTRIBUTION_VERSION=[$ac_distribution_version] +fi +if test "$ac_distribution_version" = "auto"; then +AC_CACHE_VAL(DISTRIBUTION_VERSION, [ +if test -f "/etc/SuSE-release" && test "$DISTRIBUTION" = "SuSE"; then + DISTRIBUTION_VERSION=[`grep "VERSION =" /etc/SuSE-release | sed 's/VERSION = //'`]; +elif test -f "/etc/mandrake-release" && test "$DISTRIBUTION" = "Mandrake"; then + DISTRIBUTION_VERSION=[`grep "Mandrake" /etc/mandrake-release | sed 's/[a-zA-Z()]*//g' | awk '{print $1}'`] +elif test -f "/etc/redhat-release" && test "$DISTRIBUTION" = "Red Hat"; then + DISTRIBUTION_VERSION=[`grep "Red Hat" /etc/redhat-release | sed 's/[a-zA-Z()]*//g' | awk '{print $1}'`] +elif test -f "/etc/debian_version" && test "$DISTRIBUTION" = "Debian"; then + DISTRIBUTION_VERSION=[`cat /etc/debian_version`] +fi +]) +fi + + +if test "$ac_rpm_prefix" != "auto"; then + RPM_PREFIX=[$ac_rpm_prefix] +fi +if test "$ac_rpm_prefix" = "auto"; then +AC_CACHE_VAL(RPM_PREFIX, [ +if test "$DISTRIBUTION" = "SuSE"; then + RPM_PREFIX="/opt/kde3" +elif test "$DISTRIBUTION" = "Mandrake"; then + RPM_PREFIX="/usr" +elif test "$DISTRIBUTION" = "Red Hat"; then + RPM_PREFIX="/usr" +elif test "$DISTRIBUTION" = "Debian"; then + RPM_PREFIX="/usr" +fi +]) +fi + +if test "$ac_rpm_group" != "auto"; then + RPM_GROUP=[$ac_rpm_group] +fi +if test "$ac_rpm_prefix" = "auto"; then +AC_CACHE_VAL(RPM_GROUP, +[ +if test "$DISTRIBUTION" = "SuSE"; then + RPM_GROUP="X11/KDE/Applications" +elif test "$DISTRIBUTION" = "Mandrake"; then + RPM_GROUP="Graphical desktop/KDE" +elif test "$DISTRIBUTION" = "Red Hat"; then + RPM_GROUP="Graphical desktop/KDE" +elif test "$DISTRIBUTION" = "Debian"; then + RPM_GROUP="Graphical desktop/KDE" +fi +]) +fi + +if test -n "$DISTRIBUTION" && test "$DISTRIBUTION" != "unknown"; then + AC_DEFINE_UNQUOTED(DISTRIBUTION, ${DISTRIBUTION}, [The type of your distribution]) +fi + +if test -n "$DISTRIBUTION_VERSION" && test "$DISTRIBUTION_VERSION" != "unknown"; then + AC_DEFINE_UNQUOTED(DISTRIBUTION_VERSION, ${DISTRIBUTION_VERSION}, [The version of your distribution]) +fi + +AC_SUBST(DISTRIBUTION) +AC_SUBST(DISTRIBUTION_VERSION) +AC_SUBST(RPM_PREFIX) +AC_SUBST(RPM_GROUP) + +AC_MSG_RESULT([$DISTRIBUTION $DISTRIBUTION_VERSION]) + +AC_MSG_CHECKING([for RPM installation prefix]) +AC_MSG_RESULT([$RPM_PREFIX]) + +AC_MSG_CHECKING([for the correct RPM group]) +AC_MSG_RESULT([$RPM_GROUP]) +]) + + + + +dnl MY_CURL +dnl ------- +dnl set my_cv_curl_vers to the version of libcurl or NONE +dnl if libcurl is not found or is too old +dnl This function comes from cURL's webpage + +AC_DEFUN(AC_CHECK_CURL,[ + AC_CACHE_VAL(my_cv_curl_vers,[ + my_cv_curl_vers=NONE + dnl check is the plain-text version of the required version + check="7.9" + dnl check_hex must be UPPERCASE if any hex letters are present + check_hex="070900" + + AC_MSG_CHECKING([for curl >= $check]) + + if eval curl-config --version 2>/dev/null >/dev/null; then + ver=`curl-config --version | sed -e "s/libcurl //g"` + hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'` + ok=`echo "ibase=16; if($hex_ver>=$check_hex) $hex_ver else 0" | bc` + + if test x$ok != x0; then + my_cv_curl_vers="$ver" + AC_MSG_RESULT([$my_cv_curl_vers]) + else + AC_MSG_RESULT(FAILED) + AC_MSG_ERROR([$ver is too old. Please install libcurl version $check or higher.]); + fi + else + AC_MSG_RESULT(FAILED) + AC_MSG_ERROR([curl-config was not found. Please install libcurl version $check or higher.]) + fi + ]) +]) diff --git a/bibletime.spec b/bibletime.spec new file mode 100644 index 0000000..e5bb4c7 --- /dev/null +++ b/bibletime.spec @@ -0,0 +1,234 @@ +%define name bibletime +%define version 1.6.5.1 + +# this needs to be changed depending on build number +%define release 1 + +# This should be set to your os. +# Possible values are Mandrake, Red Hat, Turbolinux, Caldera, SuSE, Debian, etc. +# In bibletime.spec.in this is automatically filled in by configure +%define ostype Debian + +# This should be set to the version of your OS (6.0, 6.1, 6.2, 7.0, 7.1, 7.2, 8.0, etc.) +# Done by configure in bibletime.spec.in +%define osversion lenny/sid + +# This is your cpu i486, i586, i686, ppc, sparc, alpha, etc. +%define buildarch i586 + +# This the RPM group on your system that this will installed into. +# Graphical desktop/KDE, X11/apps, etc. +%define rpmgroup Graphical desktop/KDE + +Summary: BibleTime %{version} is an easy to use Bible study tool for KDE. +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: GPL +Vendor: BibleTime's developer (info@bibletime.info) +Url: http://www.bibletime.info/ +Packager: Brook Humphrey , Joachim Ansorg +Group: %{rpmgroup} +BuildArch: %{buildarch} +Source0: %{name}-%{version}.tar.bz2 +BuildRoot: %{_tmppath}/%{name}-%{version}--rootbibletime +Prefix: /usr +Requires: sword >= 1.5.8 +Distribution: %{ostype} %{osversion} +BuildRequires: kdelibs-devel +BuildRequires: sword-devel >= 1.5.8 + +%description +BibleTime %{version}-%{release} is a free and easy to use bible study tool for UNIX systems. + +BibleTime provides easy handling of digitalized texts (Bibles, commentaries and lexicons) and powerful features to work with these texts (search in texts, write own notes, save, print etc.). BibleTime is a frontend for the SWORD Bible Framework. + +This is a relocatable package, you can install it on different target with +rpm -Uvh bibletime-%{version}-%{release}.rpm --prefix /usr/local/opt/apps/noncommercial +default is %{_prefix} + +The SWORD Project is an effort to create an ever expanding software package for research and study of God and His Word. The SWORD Bible Framework allows easy manipulation of Bible texts, commentaries, lexicons, dictionaries, etc. Many frontends are build using this framework. An installed module set may be shared between any frontend using the framework. + +This rpm was compiled on a %{ostype} %{osversion} system for %{buildarch} class cpu's. + + +%prep +rm -rf $RPM_BUILD_ROOT +rm -rf $RPM_BUILD_DIR/%{name}-%{version} + +%setup -q +make -f Makefile.cvs + +# Look for common rpm-options: +if [ -f /etc/opt/kde3/common_options ]; then + . /etc/opt/kde3/common_options + ./configure $configkde +else + ./configure --prefix=${_prefix} +fi + +# Setup for parallel builds +numprocs=`egrep -c ^cpu[0-9]+ /proc/stat || :` +if [ "$numprocs" = "0" ]; then + numprocs=1 +fi + +make -j$numprocs + +%install +make DESTDIR=$RPM_BUILD_ROOT install-strip + +#cd $RPM_BUILD_ROOT +#find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > $RPM_BUILD_DIR/bt-files.list +#find . -type f | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/bt-files.list +#find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/bt-files.list + + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%clean +#rm -f $RPM_BUILD_DIR/master.list +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%{prefix}/bin/* +%{prefix}/share/applnk/Applications/bibletime.desktop +%{prefix}/share/apps/bibletime/ +%{prefix}/share/doc/HTML/en/bibletime/ +%{prefix}/share/icons/* + +%changelog +* Sat Dec 27 2003 Joachim Ansorg + +-We require curl 7.10 or later now + +-Update to BibleTime 1.4 and Sword 1.5.7 + +* Sun Jun 22 2003 Joachim Ansorg + +-Cleanup. We require no an Sword RPM file to be installed. + +-Removed Mandrake menu stuff because there's an own SPEC file for this. + + +* Fri Feb 14 2003 Joachim Ansorg + +-Removed locales.d source and management of Sword files because we require a Sword RPM now. + + +* Mon Apr 8 2002 Brook Humphrey bibletime-1.1 + +- Added to the spec to better handle mandrake menus during compile. Now should be compatable with all os's. + +- added locals.d source to build. This removes dependecy on sword being installed. Will make seperate package for this later. + + +* Fri Mar 31 2002 Joachim Ansorg + +- Made including the book translations working finally. + +- Fixed SPEC files to work with SuSE + + +* Thu Feb 7 2002 Brook Humphrey bibletime-1.0.2 + +- changed compile time options to mach bibletime spec included with source files + +- compiled on mandrake 8.2 + + +* Fri Sep 7 2001 Joachim Ansorg + +- Added the bookname files in the file list + +* Tue Jul 10 2001 Brook Humphrey bibletime-1.0.1-Mandrake8.0.4mdk + +- Recompile because of dependecy problems. + +* Tue Jul 10 2001 Brook Humphrey bibletime-1.0.1-Mandrake8.0.1mdk + +- bug fix release bibletime-1.0.1 + +- adda extra compile options to spec file. + +- Merged in suse changes for compileing on SuSE + +* Sun May 27 2001 Brook Humphrey + +- Trying different variations of static compiles again. + +- Still using cvs sources while waiting for 1.0 release. + +* Thu May 24 2001 Brook Humphrey + +- Trying for x static and whatever else we can get into it. + +- No X for today Got libz to compile in but it causes segfault. + +* Wed May 23 2001 Brook Humphrey + +- Yet another try at static qt. + +- Qt static works now. + +* Mon May 21 2001 Brook Humphrey + +- Static is working for kde and a few other libs but not qt yet. + +- Testing another patch today to try to get qt compiled static. + +* Sun May 20 2001 Brook Humphrey + +- Cleaned up spec some more(stupid spelling error's) + +- static compile not working today so added option to compile kde and sword as static seperately + +* Sat May 19 2001 Brook Humphrey + +- Cleaned up spec some more and added a few more comments + +- Changed spec to automaticly do parts concerning static and Mandrake menus + +- All info can be set in defines at top of spec file no other changes should need to be made + +- Fixed patch to compile static should now compile static with kde libs + +- Test to compile with qt as static also + +* Sun May 13 2001 Brook Humphrey + +- cleaned up spec file and added more comments for easier reading. + +- changed sword.conf instelation to check for previous versions of sword.conf + +- If found a new sword.conf is not created + +- Made a patch to hopefully compile kde and other libs as atatic + +- static compile didn't work for today. + +* Tue May 8 2001 Brook Humphrey + +- Updated package to be relocatable + +- added sword directories and sword.conf to install + +* Mon Apr 30 2001 Brook Humphrey + +- Changed to build staticly + +- added more mandrake macros to spec file + +* Mon Apr 23 2001 Brook Humphrey + +- made changes to enable compile of cvs tree + +* Wed Mar 14 2001 Brook Humphrey + +- updated to use mandrake menu sysem + diff --git a/bibletime.spec.in b/bibletime.spec.in new file mode 100644 index 0000000..509f444 --- /dev/null +++ b/bibletime.spec.in @@ -0,0 +1,234 @@ +%define name @PACKAGE@ +%define version @VERSION@ + +# this needs to be changed depending on build number +%define release 1 + +# This should be set to your os. +# Possible values are Mandrake, Red Hat, Turbolinux, Caldera, SuSE, Debian, etc. +# In bibletime.spec.in this is automatically filled in by configure +%define ostype @DISTRIBUTION@ + +# This should be set to the version of your OS (6.0, 6.1, 6.2, 7.0, 7.1, 7.2, 8.0, etc.) +# Done by configure in bibletime.spec.in +%define osversion @DISTRIBUTION_VERSION@ + +# This is your cpu i486, i586, i686, ppc, sparc, alpha, etc. +%define buildarch i586 + +# This the RPM group on your system that this will installed into. +# Graphical desktop/KDE, X11/apps, etc. +%define rpmgroup @RPM_GROUP@ + +Summary: BibleTime %{version} is an easy to use Bible study tool for KDE. +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: GPL +Vendor: BibleTime's developer (info@bibletime.info) +Url: http://www.bibletime.info/ +Packager: Brook Humphrey , Joachim Ansorg +Group: %{rpmgroup} +BuildArch: %{buildarch} +Source0: %{name}-%{version}.tar.bz2 +BuildRoot: %{_tmppath}/%{name}-%{version}--rootbibletime +Prefix: @RPM_PREFIX@ +Requires: sword >= 1.5.8 +Distribution: %{ostype} %{osversion} +BuildRequires: kdelibs-devel +BuildRequires: sword-devel >= 1.5.8 + +%description +BibleTime %{version}-%{release} is a free and easy to use bible study tool for UNIX systems. + +BibleTime provides easy handling of digitalized texts (Bibles, commentaries and lexicons) and powerful features to work with these texts (search in texts, write own notes, save, print etc.). BibleTime is a frontend for the SWORD Bible Framework. + +This is a relocatable package, you can install it on different target with +rpm -Uvh bibletime-%{version}-%{release}.rpm --prefix /usr/local/opt/apps/noncommercial +default is %{_prefix} + +The SWORD Project is an effort to create an ever expanding software package for research and study of God and His Word. The SWORD Bible Framework allows easy manipulation of Bible texts, commentaries, lexicons, dictionaries, etc. Many frontends are build using this framework. An installed module set may be shared between any frontend using the framework. + +This rpm was compiled on a %{ostype} %{osversion} system for %{buildarch} class cpu's. + + +%prep +rm -rf $RPM_BUILD_ROOT +rm -rf $RPM_BUILD_DIR/%{name}-%{version} + +%setup -q +make -f Makefile.cvs + +# Look for common rpm-options: +if [ -f /etc/opt/kde3/common_options ]; then + . /etc/opt/kde3/common_options + ./configure $configkde +else + ./configure --prefix=${_prefix} +fi + +# Setup for parallel builds +numprocs=`egrep -c ^cpu[0-9]+ /proc/stat || :` +if [ "$numprocs" = "0" ]; then + numprocs=1 +fi + +make -j$numprocs + +%install +make DESTDIR=$RPM_BUILD_ROOT install-strip + +#cd $RPM_BUILD_ROOT +#find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > $RPM_BUILD_DIR/bt-files.list +#find . -type f | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/bt-files.list +#find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/bt-files.list + + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%clean +#rm -f $RPM_BUILD_DIR/master.list +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%{prefix}/bin/* +%{prefix}/share/applnk/Applications/bibletime.desktop +%{prefix}/share/apps/bibletime/ +%{prefix}/share/doc/HTML/en/bibletime/ +%{prefix}/share/icons/* + +%changelog +* Sat Dec 27 2003 Joachim Ansorg + +-We require curl 7.10 or later now + +-Update to BibleTime 1.4 and Sword 1.5.7 + +* Sun Jun 22 2003 Joachim Ansorg + +-Cleanup. We require no an Sword RPM file to be installed. + +-Removed Mandrake menu stuff because there's an own SPEC file for this. + + +* Fri Feb 14 2003 Joachim Ansorg + +-Removed locales.d source and management of Sword files because we require a Sword RPM now. + + +* Mon Apr 8 2002 Brook Humphrey bibletime-1.1 + +- Added to the spec to better handle mandrake menus during compile. Now should be compatable with all os's. + +- added locals.d source to build. This removes dependecy on sword being installed. Will make seperate package for this later. + + +* Fri Mar 31 2002 Joachim Ansorg + +- Made including the book translations working finally. + +- Fixed SPEC files to work with SuSE + + +* Thu Feb 7 2002 Brook Humphrey bibletime-1.0.2 + +- changed compile time options to mach bibletime spec included with source files + +- compiled on mandrake 8.2 + + +* Fri Sep 7 2001 Joachim Ansorg + +- Added the bookname files in the file list + +* Tue Jul 10 2001 Brook Humphrey bibletime-1.0.1-Mandrake8.0.4mdk + +- Recompile because of dependecy problems. + +* Tue Jul 10 2001 Brook Humphrey bibletime-1.0.1-Mandrake8.0.1mdk + +- bug fix release bibletime-1.0.1 + +- adda extra compile options to spec file. + +- Merged in suse changes for compileing on SuSE + +* Sun May 27 2001 Brook Humphrey + +- Trying different variations of static compiles again. + +- Still using cvs sources while waiting for 1.0 release. + +* Thu May 24 2001 Brook Humphrey + +- Trying for x static and whatever else we can get into it. + +- No X for today Got libz to compile in but it causes segfault. + +* Wed May 23 2001 Brook Humphrey + +- Yet another try at static qt. + +- Qt static works now. + +* Mon May 21 2001 Brook Humphrey + +- Static is working for kde and a few other libs but not qt yet. + +- Testing another patch today to try to get qt compiled static. + +* Sun May 20 2001 Brook Humphrey + +- Cleaned up spec some more(stupid spelling error's) + +- static compile not working today so added option to compile kde and sword as static seperately + +* Sat May 19 2001 Brook Humphrey + +- Cleaned up spec some more and added a few more comments + +- Changed spec to automaticly do parts concerning static and Mandrake menus + +- All info can be set in defines at top of spec file no other changes should need to be made + +- Fixed patch to compile static should now compile static with kde libs + +- Test to compile with qt as static also + +* Sun May 13 2001 Brook Humphrey + +- cleaned up spec file and added more comments for easier reading. + +- changed sword.conf instelation to check for previous versions of sword.conf + +- If found a new sword.conf is not created + +- Made a patch to hopefully compile kde and other libs as atatic + +- static compile didn't work for today. + +* Tue May 8 2001 Brook Humphrey + +- Updated package to be relocatable + +- added sword directories and sword.conf to install + +* Mon Apr 30 2001 Brook Humphrey + +- Changed to build staticly + +- added more mandrake macros to spec file + +* Mon Apr 23 2001 Brook Humphrey + +- made changes to enable compile of cvs tree + +* Wed Mar 14 2001 Brook Humphrey + +- updated to use mandrake menu sysem + diff --git a/bibletime/Makefile.am b/bibletime/Makefile.am new file mode 100644 index 0000000..4cd9bd9 --- /dev/null +++ b/bibletime/Makefile.am @@ -0,0 +1,70 @@ +bibletime_SOURCES = bibletime_init.cpp bibletime_slots.cpp bibletime.cpp \ + bibletimeapp.cpp main.cpp bibletime_dcop.cpp bibletimeinterface.skel + +bibletime_LDADD = \ +./frontend/displaywindow/libdisplaywindow.a \ +./frontend/display/libdisplay.a \ +./frontend/keychooser/libkeychooser.a \ +./frontend/mainindex/libmainindex.a \ +./frontend/searchdialog/libsearchdialog.a \ +./frontend/libfrontend.a \ +./frontend/util/libfrontendutil.a \ +./backend/libbackend.a \ +./util/libutil.a \ +-lXext \ +$(LIB_QT) \ +$(LIB_KDECORE) \ +$(LIB_KDEUI) \ +-lkdeprint \ +$(LIB_KFILE) \ +$(LIB_KHTML) \ +$(LIB_X11) \ +$(LIB_SWORD) \ +$(LIB_CLUCENE) \ +$(LIBSOCKET) + +SUBDIRS = display-templates backend frontend xml pics util + +all_headers = bibletime.h bibletimeapp.h +include_HEADERS = bibletimeinterface.h + +EXTRA_DIST = $(bibletime_SOURCES) $(all_headers) + +# this 10 paths are KDE specific. Use them: +# kde_htmldir Where your docs should go to. (contains lang subdirs) +# kde_appsdir Where your application file (.kdelnk) should go to. +# kde_icondir Where your icon should go to. +# kde_minidir Where your mini icon should go to. +# kde_datadir Where you install application data. (Use a subdir) +# kde_locale Where translation files should go to.(contains lang subdirs) +# kde_cgidir Where cgi-bin executables should go to. +# kde_confdir Where config files should go to. +# kde_mimedir Where mimetypes should go to. +# kde_toolbardir Where general toolbar icons should go to. +# kde_wallpaperdir Where general wallpapers should go to. + +# set the include path for X, qt, KDE and Sword +INCLUDES = $(all_includes) + +# claim, which subdirectories you want to install +# you can add here more. This one gets installed +bin_PROGRAMS = bibletime + +bibletime_METASOURCES = AUTO + +# the library search path. +bibletime_LDFLAGS = $(BT_LDFLAGS) $(all_libraries) $(KDE_RPATH) + +# them while "make clean", use CLEANFILES +DISTCLEANFILES = $(bibletime_METASOURCES) + +# make messages.po. Move this one to ../po/ and "make merge" in po +# the -x is for skipping messages already translated in kdelibs +#messages: +# $(XGETTEXT) -C -ki18n -x $(KDEDIR)/include/kde.pot `find . -name \*.h -o -name \*.cpp -o -name \*.cc` -o ../po/bibletime.pot + +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(kde_confdir) + +rpm: dist +noinst_HEADERS = bibletimeinterface.h diff --git a/bibletime/backend/Makefile.am b/bibletime/backend/Makefile.am new file mode 100644 index 0000000..85624f7 --- /dev/null +++ b/bibletime/backend/Makefile.am @@ -0,0 +1,44 @@ +libbackend_a_METASOURCES = AUTO +noinst_LIBRARIES = libbackend.a + +INCLUDES = $(all_includes) + +libbackend_a_SOURCES = bt_gbfhtml.cpp bt_osishtml.cpp bt_plainhtml.cpp \ + bt_thmlhtml.cpp bt_thmlplain.cpp btstringmgr.cpp cbookdisplay.cpp \ + cchapterdisplay.cpp cdisplayrendering.cpp cdisplaytemplatemgr.cpp centrydisplay.cpp \ + chtmlexportrendering.cpp clanguagemgr.cpp cplaintextexportrendering.cpp \ + creferencemanager.cpp cswordbackend.cpp cswordbiblemoduleinfo.cpp cswordbookmoduleinfo.cpp \ + cswordcommentarymoduleinfo.cpp cswordkey.cpp cswordldkey.cpp cswordlexiconmoduleinfo.cpp \ + cswordmoduleinfo.cpp cswordmodulesearch.cpp cswordtreekey.cpp cswordversekey.cpp \ + ctextrendering.cpp osismorphsegmentation.cpp + +all_headers = cswordbiblemoduleinfo.h \ +cswordcommentarymoduleinfo.h \ +cswordlexiconmoduleinfo.h \ +cswordkey.h \ +cswordversekey.h \ +cswordldkey.h \ +cswordbackend.h \ +cswordmoduleinfo.h \ +cswordmodulesearch.h \ +creferencemanager.h \ +cswordbookmoduleinfo.h \ +cswordtreekey.h \ +bt_thmlhtml.h \ +bt_osishtml.h \ +bt_gbfhtml.h \ +bt_plainhtml.h \ +bt_thmlplain.h \ +centrydisplay.h \ +clanguagemgr.h \ +cdisplaytemplatemgr.h \ +ctextrendering.h \ +btstringmgr.h \ +cbookdisplay.h \ +cchapterdisplay.h \ +chtmlexportrendering.h \ +cplaintextexportrendering.h \ +cdisplayrendering.h \ +osismorphsegmentation.h + +EXTRA_DIST = $(libbackend_a_SOURCES) $(all_headers) diff --git a/bibletime/backend/bt_gbfhtml.cpp b/bibletime/backend/bt_gbfhtml.cpp new file mode 100644 index 0000000..33d31a9 --- /dev/null +++ b/bibletime/backend/bt_gbfhtml.cpp @@ -0,0 +1,303 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordmoduleinfo.h" +#include "cswordbackend.h" +#include "util/cpointers.h" + +#include "bt_gbfhtml.h" + +//sytsme includes +#include +#include + +//Sword includes +#include + +//Qt includes +#include +#include + +using namespace Filters; + +BT_GBFHTML::BT_GBFHTML() : sword::GBFHTML() { + + setEscapeStringCaseSensitive(true); + setPassThruUnknownEscapeString(true); //the HTML widget will render the HTML escape codes + + removeTokenSubstitute("Rf"); + // addTokenSubstitute("RB", ""); //start of a footnote with embedded text + + addTokenSubstitute("FI", ""); // italics begin + addTokenSubstitute("Fi", ""); + + addTokenSubstitute("FB", ""); // bold begin + addTokenSubstitute("Fb", ""); + + addTokenSubstitute("FR", ""); + addTokenSubstitute("Fr", ""); + + addTokenSubstitute("FU", ""); // underline begin + addTokenSubstitute("Fu", ""); + + addTokenSubstitute("FO", ""); // Old Testament quote begin + addTokenSubstitute("Fo", ""); + + + addTokenSubstitute("FS", ""); // Superscript begin// Subscript begin + addTokenSubstitute("Fs", ""); + + addTokenSubstitute("FV", ""); // Subscript begin + addTokenSubstitute("Fv", ""); + + addTokenSubstitute("TT", "
"); + addTokenSubstitute("Tt", "
"); + + addTokenSubstitute("TS", "
"); + addTokenSubstitute("Ts", "
"); + + //addTokenSubstitute("PP", ""); // poetry begin + //addTokenSubstitute("Pp", ""); + + + addTokenSubstitute("Fn", ""); // font end + addTokenSubstitute("CL", "
"); // new line + addTokenSubstitute("CM", "
"); // paragraph is a non showing comment that can be changed in the front end to

if desired + + addTokenSubstitute("CG", ">"); // literal greater-than sign + addTokenSubstitute("CT", "<"); // literal less-than sign + + addTokenSubstitute("JR", ""); // right align begin + addTokenSubstitute("JC", ""); // center align begin + addTokenSubstitute("JL", ""); // align end +} + +/** No descriptions */ +char BT_GBFHTML::processText(sword::SWBuf& buf, const sword::SWKey * key, const sword::SWModule * module) { + GBFHTML::processText(buf, key, module); + + if (!module->isProcessEntryAttributes()) { + return 1; //no processing should be done, may happen in a search + } + + CSwordModuleInfo* m = CPointers::backend()->findModuleByName( module->Name() ); + + if (m && !(m->has(CSwordModuleInfo::lemmas) || m->has(CSwordModuleInfo::morphTags) || m->has(CSwordModuleInfo::strongNumbers))) { //only parse if the module has strongs or lemmas + return 1; //WARNING: Return alread here + } + + //Am Anfang schuf Gott Himmel und Erde. + //A simple word means: No entry for this word "word" + QString result; + + QString t = QString::fromUtf8(buf.c_str()); + + QRegExp tag("([.,;:]?]*>\\s*)+"); + + QStringList list; + + int lastMatchEnd = 0; + + int pos = tag.search(t,0); + + if (pos == -1) { //no strong or morph code found in this text + return 1; //WARNING: Return already here + } + + //split the text into parts which end with the GBF tag marker for strongs/lemmas + while (pos != -1) { + list.append(t.mid(lastMatchEnd, pos+tag.matchedLength()-lastMatchEnd)); + + lastMatchEnd = pos + tag.matchedLength(); + pos = tag.search(t, pos + tag.matchedLength()); + } + + //append the trailing text to the list. + if (!t.right(t.length() - lastMatchEnd).isEmpty()) { + list.append(t.right(t.length() - lastMatchEnd)); + } + + //list is now a list of words with 1-n Strongs at the end, which belong to this word. + + //now create the necessary HTML in list entries and concat them to the result + tag = QRegExp("]*)>"); + tag.setMinimal(true); + + for (QStringList::iterator it = list.begin(); it != list.end(); ++it) { + QString e = (*it); //current entry to process + //qWarning(e.latin1()); + + //check if there is a word to which the strongs info belongs to. + //If yes, wrap that word with the strongs info + //If not, leave out the strongs info, because it can't be tight to a text + //Comparing the first char with < is not enough, because the tokenReplace is done already + //so there might be html tags already. + const bool textPresent = (e.stripWhiteSpace().remove(QRegExp("[.,;:]")).left(2) != ""); + pos += 7; + + //skip blanks, commas, dots and stuff at the beginning, it doesn't belong to the morph code + QString rep(""); + + hasMorphAttr = isMorph; + hasLemmaAttr = !isMorph; + + int startPos = 0; + QChar c = e[startPos]; + + while ((startPos < pos) && (c.isSpace() || c.isPunct())) { + ++startPos; + + c = e[startPos]; + } + + e.insert( startPos, rep ); + tagAttributeStart = startPos + 6; //to point to the start of the attributes + pos += rep.length(); + } + else { //add the attribute to the existing tag + e.remove(pos, tag.matchedLength()); + + if (tagAttributeStart == -1) { + continue; //nothing valid found + } + + if ((!isMorph && hasLemmaAttr) || (isMorph && hasMorphAttr)) { //we append another attribute value, e.g. 3000 gets 3000|5000 + //search the existing attribute start + QRegExp attrRegExp( isMorph ? "morph=\".+(?=\")" : "lemma=\".+(?=\")" ); + attrRegExp.setMinimal(true); + const int foundPos = e.find(attrRegExp, tagAttributeStart); + + if (foundPos != -1) { + e.insert(foundPos + attrRegExp.matchedLength(), QString("|").append(value)); + pos += value.length() + 1; + + hasLemmaAttr = !isMorph; + hasMorphAttr = isMorph; + } + } + else { //attribute was not yet inserted + QString attr; + attr.setLatin1(isMorph ? "morph" : "lemma").append("=\"").append(value).append("\" "); + + e.insert(tagAttributeStart, attr); + pos += attr.length(); + + hasMorphAttr = isMorph; + hasLemmaAttr = !isMorph; + } + + //tagAttributeStart remains the same + } + + insertedTag = true; + pos = tag.search(e, pos); + } + + result += e; + } + + if (list.count()) { + buf = (const char*)result.utf8(); + } + + return 1; +} + +bool BT_GBFHTML::handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData) { + if (!substituteToken(buf, token)) { //more than a simple replace + const unsigned int tokenLength = strlen(token); + unsigned long i; + sword::SWBuf value; + + BT_UserData* myUserData = dynamic_cast(userData); + sword::SWModule* myModule = const_cast(myUserData->module); //hack to be able to call stuff like Lang() + + if ( !strncmp(token, "WG", 2) + || !strncmp(token, "WH", 2) + || !strncmp(token, "WT", 2) ) { + buf.append('<'); + buf.append(token); + buf.append('>'); + } + else if (!strncmp(token, "RB", 2)) { + myUserData->hasFootnotePreTag = true; + buf.append(""); + } + else if (!strncmp(token, "RF", 2)) { + //we use several append calls because appendFormatted slows down filtering, which should be fast + + if (myUserData->hasFootnotePreTag) { + // qWarning("inserted footnotepre end"); + buf.append(""); + myUserData->hasFootnotePreTag = false; + } + + buf.append(" Name()); + buf.append('/'); + buf.append(myUserData->key->getShortText()); + buf.append('/'); + buf.append( QString::number(myUserData->swordFootnote++).latin1() ); + buf.append("\">* "); + + userData->suspendTextPassThru = true; + } + else if (!strncmp(token, "Rf", 2)) { //end of footnote + userData->suspendTextPassThru = false; + } + else if (!strncmp(token, "FN", 2)) { //the end tag is inserted in addTokenSubsitute + buf.append(""); + } + else if (!strncmp(token, "CA", 2)) { // ASCII value + buf.append( (char)atoi(&token[2]) ); + } + else { + return GBFHTML::handleToken(buf, token, userData); + } + } + + return true; +} diff --git a/bibletime/backend/bt_gbfhtml.h b/bibletime/backend/bt_gbfhtml.h new file mode 100644 index 0000000..4132047 --- /dev/null +++ b/bibletime/backend/bt_gbfhtml.h @@ -0,0 +1,60 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +/* $Header: /cvsroot/bibletime/bibletime/bibletime/backend/bt_gbfhtml.h,v 1.25 2007/06/29 22:47:14 joachim Exp $ */ +/* $Revision: 1.25 $ */ + +#ifndef BT_GBFHTML_H +#define BT_GBFHTML_H + +//Backend + +//Sword includes +#include +#include +#include +#include + +namespace Filters { + + /** GBF to HTML filter, + * This filter converts GBF Text into HTML + */ + +class BT_GBFHTML : public sword::GBFHTML/*, protected CFilterTool */ + { + +protected: + +class BT_UserData : public sword::GBFHTML::MyUserData { + +public: +BT_UserData(const sword::SWModule *module, const sword::SWKey *key) : sword::GBFHTML::MyUserData(module, key) { + swordFootnote = 1; + hasFootnotePreTag = false; + } + + short unsigned int swordFootnote; + }; + + virtual sword::BasicFilterUserData *createUserData(const sword::SWModule* module, const sword::SWKey* key) { + return new BT_UserData(module, key); + } + +public: + BT_GBFHTML(); + virtual bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData); + virtual char processText(sword::SWBuf& buf, const sword::SWKey*, const sword::SWModule * = 0); + }; + +} + +#endif diff --git a/bibletime/backend/bt_osishtml.cpp b/bibletime/backend/bt_osishtml.cpp new file mode 100644 index 0000000..efe8f3f --- /dev/null +++ b/bibletime/backend/bt_osishtml.cpp @@ -0,0 +1,621 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include +#include "bt_osishtml.h" +#include "versekey.h" + +#include "clanguagemgr.h" +#include "creferencemanager.h" +#include "cswordmoduleinfo.h" +#include "frontend/cbtconfig.h" +#include "util/cpointers.h" + +#include + +//Sword includes +#include +#include +#include + +//KDE includes +#include + +//Qt includes +#include + +using sword::SWBuf; +using sword::XMLTag; + +using namespace Filters; + +BT_OSISHTML::BT_OSISHTML() : sword::OSISHTMLHREF() { + setPassThruUnknownEscapeString(true); //the HTML widget will render the HTML escape codes + + addTokenSubstitute("inscription", ""); + addTokenSubstitute("/inscription",""); + + addTokenSubstitute("mentioned", ""); + addTokenSubstitute("/mentioned", ""); + +// addTokenSubstitute("divineName", ""); +// addTokenSubstitute("/divineName", ""); + + //TODO Move that down to the real tag handling, segs without the type morph would generate incorrect markup, as the end span is always inserted +// addTokenSubstitute("seg type=\"morph\"", ""); +// addTokenSubstitute("/seg", ""); + + // OSIS tables + addTokenSubstitute("table", ""); + addTokenSubstitute("/table", "
"); + addTokenSubstitute("row", ""); + addTokenSubstitute("/row", ""); + addTokenSubstitute("cell", ""); + addTokenSubstitute("/cell", ""); + +} + +bool BT_OSISHTML::handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData) { + // manually process if it wasn't a simple substitution + + if (!substituteToken(buf, token)) { + BT_UserData* myUserData = dynamic_cast(userData); + sword::SWModule* myModule = const_cast(myUserData->module); //hack + + XMLTag tag(token); + // qWarning("found %s", token); + const bool osisQToTick = ((!userData->module->getConfigEntry("OSISqToTick")) || (strcmp(userData->module->getConfigEntry("OSISqToTick"), "false"))); + + if (!tag.getName()) { + return false; + } + + //

tag + if (!strcmp(tag.getName(), "div")) { + //handle intro + + if ((!tag.isEmpty()) && (!tag.isEndTag())) { //start tag + SWBuf type( tag.getAttribute("type") ); + + if (type == "introduction") { + buf.append("
"); + } + else if (type == "chapter") { + buf.append("
"); //don't open a div here, that would lead to a broken XML structure + } + else { + buf.append("
"); + } + } + else if (tag.isEndTag()) { //end tag + buf.append("
"); + } + } + else if (!strcmp(tag.getName(), "w")) { + if ((!tag.isEmpty()) && (!tag.isEndTag())) { //start tag + const char *attrib; + const char *val; + + XMLTag outTag("span"); + SWBuf attrValue; + + if ((attrib = tag.getAttribute("xlit"))) { + val = strchr(attrib, ':'); + val = (val) ? (val + 1) : attrib; + outTag.setAttribute("xlit", val); + } + + if ((attrib = tag.getAttribute("gloss"))) { + val = strchr(attrib, ':'); + val = (val) ? (val + 1) : attrib; + outTag.setAttribute("gloss", val); + } + + if ((attrib = tag.getAttribute("lemma"))) { + char splitChar = '|'; + const int countSplit1 = tag.getAttributePartCount("lemma", '|'); + const int countSplit2 = tag.getAttributePartCount("lemma", ' '); //TODO: not allowed, remove soon + int count = 0; + + if (countSplit1 > countSplit2) { //| split char + splitChar = '|'; //TODO: not allowed, remove soon + count = countSplit1; + } + else { + splitChar = ' '; + count = countSplit2; + } + + int i = (count > 1) ? 0 : -1; // -1 for whole value cuz it's faster, but does the same thing as 0 + attrValue = ""; + + do { + if (attrValue.length()) { + attrValue.append( '|' ); + } + + attrib = tag.getAttribute("lemma", i, splitChar); + + if (i < 0) { // to handle our -1 condition + i = 0; + } + + val = strchr(attrib, ':'); + val = (val) ? (val + 1) : attrib; + + attrValue.append(val); + } + while (++i < count); + + if (attrValue.length()) { + outTag.setAttribute("lemma", attrValue.c_str()); + } + } + + if ((attrib = tag.getAttribute("morph"))) { + char splitChar = '|'; + const int countSplit1 = tag.getAttributePartCount("morph", '|'); + const int countSplit2 = tag.getAttributePartCount("morph", ' '); //TODO: not allowed, remove soon + int count = 0; + + if (countSplit1 > countSplit2) { //| split char + splitChar = '|'; + count = countSplit1; + } + else { + splitChar = ' '; + count = countSplit2; + } + + int i = (count > 1) ? 0 : -1; // -1 for whole value cuz it's faster, but does the same thing as 0 + + attrValue = ""; + + do { + if (attrValue.length()) { + attrValue.append('|'); + } + + attrib = tag.getAttribute("morph", i, splitChar); + + if (i < 0) { + i = 0; // to handle our -1 condition + } + + val = strchr(attrib, ':'); + + if (val) { //the prefix gives the modulename + //check the prefix + if (!strncmp("robinson:", attrib, 9)) { //robinson + attrValue.append( "Robinson:" ); //work is not the same as Sword's module name + attrValue.append( val+1 ); + } + //strongs is handled by BibleTime + /*else if (!strncmp("strongs", attrib, val-atrrib)) { + attrValue.append( !strncmp(attrib, "x-", 2) ? attrib+2 : attrib ); + }*/ + else { + attrValue.append( !strncmp(attrib, "x-", 2) ? attrib+2 : attrib ); + } + } + else { //no prefix given + const bool skipFirst = ((val[0] == 'T') && ((val[1] == 'H') || (val[1] == 'H'))); + attrValue.append( skipFirst ? val+1 : val ); + } + } + while (++i < count); + + if (attrValue.length()) { + outTag.setAttribute("morph", attrValue.c_str()); + } + } + + if ((attrib = tag.getAttribute("POS"))) { + val = strchr(attrib, ':'); + val = (val) ? (val + 1) : attrib; + outTag.setAttribute("pos", val); + } + + buf.append( outTag.toString() ); + } + else if (tag.isEndTag()) { // end or empty tag + buf.append(""); + } + } + + // tag + else if (!strcmp(tag.getName(), "note")) { + if (!tag.isEndTag()) { //start tag + const SWBuf type( tag.getAttribute("type") ); + + if (type == "crossReference") { //note containing cross references + myUserData->inCrossrefNote = true; + myUserData->noteType = BT_UserData::CrossReference; + myUserData->swordFootnote++; // cross refs count as notes, too + + /* //get the refList value of the right entry attribute + AttributeList notes = myModule->getEntryAttributes()["Footnote"]; + bool foundNote = false; + + SWBuf id( tag.getAttribute("osisID") ); + SWBuf refList; + + for (AttributeList::iterator list_it = notes.begin(); (list_it != notes.end()) && !foundNote; ++list_it ) { + for (AttributeValue::iterator val_it = list_it->second.begin(); (val_it != list_it->second.end()) && !foundNote; ++val_it ) { + if ((val_it->first == "osisID") && (val_it->second == id)) { + foundNote = true; //this break the loop + refList = list_it->second["refList"]; + } + } + } + + if (refList.length()) { + buf.append(" "); + + myUserData->noteType = BT_UserData::CrossReference; + } + else { + myUserData->noteType = BT_UserData::Unknown; + }*/ + + buf.append(""); + } + + /* else if (type == "explanation") { + } + */ + else if ((type == "strongsMarkup") || (type == "x-strongsMarkup")) { + /** + * leave strong's markup notes out, in the future we'll probably have + * different option filters to turn different note types on or off + */ + + myUserData->suspendTextPassThru = true; + myUserData->noteType = BT_UserData::StrongsMarkup; + } + else if (type == "alternative") { + // qWarning("found alternative"); + // buf.append(" "); + myUserData->noteType = BT_UserData::Alternative; + myUserData->suspendTextPassThru = true; + myUserData->swordFootnote++; // count as notes, too + } + else { + // qWarning("found note in %s", myUserData->key->getShortText()); + buf.append(" Name()); + buf.append('/'); + buf.append(myUserData->key->getShortText()); + buf.append('/'); + buf.append( QString::number(myUserData->swordFootnote++).latin1() ); //inefficient + + const SWBuf n = tag.getAttribute("n"); + + buf.append("\">"); + buf.append( (n.length() > 0) ? n.c_str() : "*" ); + buf.append(" "); + + myUserData->noteType = BT_UserData::Footnote; + myUserData->suspendTextPassThru = true; + } + } + else { //if (tag.isEndTag()) { + Q_ASSERT(myUserData->noteType != BT_UserData::Unknown); + + if (myUserData->noteType == BT_UserData::CrossReference) { + buf.append(" "); +// myUserData->suspendTextPassThru = false; + myUserData->inCrossrefNote = false; + } + else if (myUserData->noteType == BT_UserData::Alternative) { + buf.append(" lastTextNode); + buf.append("\" title=\""); + buf.append((const char*)i18n("Alternative text").utf8()); + buf.append("\" />"); + } + + myUserData->noteType = BT_UserData::Unknown; + myUserData->suspendTextPassThru = false; + } + } + // The

paragraph tag is handled by OSISHTMLHref + else if (!strcmp(tag.getName(), "reference")) { // tag + + if (!tag.isEndTag() && !tag.isEmpty()) { + QString ref( tag.getAttribute("osisRef") ); + QString hrefRef( ref ); + Q_ASSERT(!ref.isEmpty()); + + if (!ref.isEmpty()) { + //find out the mod, using the current module makes sense if it's a bible or commentary because the refs link into a bible by default. + //If the osisRef is something like "ModuleID:key comes here" then the + // modulename is given, so we'll use that one + + CSwordModuleInfo* mod = CPointers::backend()->findSwordModuleByPointer(myModule); + Q_ASSERT(mod); + if (!mod || (mod->type() != CSwordModuleInfo::Bible + && mod->type() != CSwordModuleInfo::Commentary)) { + + mod = CBTConfig::get( CBTConfig::standardBible ); + } + + Q_ASSERT(mod); + + //if the osisRef like "GerLut:key" contains a module, use that + int pos = ref.find(":"); + + if ((pos >= 0) && ref.at(pos-1).isLetter() && ref.at(pos+1).isLetter()) { + QString newModuleName = ref.left(pos); + hrefRef = ref.mid(pos+1); + + if (CPointers::backend()->findModuleByName(newModuleName)) { + mod = CPointers::backend()->findModuleByName(newModuleName); + } + } + + CReferenceManager::ParseOptions options; + options.refBase = QString::fromUtf8(myUserData->key->getText()); + options.refDestinationModule = QString(mod->name()); + options.sourceLanguage = QString(myModule->Lang()); + options.destinationLanguage = QString("en"); + + buf.append("name(), + CReferenceManager::parseVerseReference(hrefRef, options), + CReferenceManager::typeFromModule(mod->type()) + ).utf8() + ); + buf.append("\" crossrefs=\""); + buf.append((const char*)CReferenceManager::parseVerseReference(ref, options).utf8()); //ref must contain the osisRef module marker if there was any + buf.append("\">"); + } + } + else if (tag.isEndTag()) { + buf.append(""); + } + else { // empty reference marker + // -- what should we do? nothing for now. + } + } + + // is handled by OSISHTMLHref + // + else if (!strcmp(tag.getName(), "title")) { + if (!tag.isEndTag() && !tag.isEmpty()) { + buf.append("<div class=\"sectiontitle\">"); + } + else if (tag.isEndTag()) { + buf.append("</div>"); + } + else { // empty title marker + // what to do? is this even valid? + buf.append("<br/>"); + } + } + + // <hi> highlighted text + else if (!strcmp(tag.getName(), "hi")) { + const SWBuf type = tag.getAttribute("type"); + + if ((!tag.isEndTag()) && (!tag.isEmpty())) { + if (type == "bold") { + buf.append("<span class=\"bold\">"); + } + else if (type == "illuminated") { + buf.append("<span class=\"illuminated\">"); + } + else if (type == "italic") { + buf.append("<span class=\"italic\">"); + } + else if (type == "line-through") { + buf.append("<span class=\"line-through\">"); + } + else if (type == "normal") { + buf.append("<span class=\"normal\">"); + } + else if (type == "small-caps") { + buf.append("<span class=\"small-caps\">"); + } + else if (type == "underline") { + buf.append("<span class=\"underline\">"); + } + else { + buf.append("<span>"); //don't break markup, </span> is inserted later + } + } + else if (tag.isEndTag()) { //all hi replacements are html spans + buf.append("</span>"); + } + } + + //name + else if (!strcmp(tag.getName(), "name")) { + const SWBuf type = tag.getAttribute("type"); + + if ((!tag.isEndTag()) && (!tag.isEmpty())) { + if (type == "geographic") { + buf.append("<span class=\"name\"><span class=\"geographic\">"); + } + else if (type == "holiday") { + buf.append("<span class=\"name\"><span class=\"holiday\">"); + } + else if (type == "nonhuman") { + buf.append("<span class=\"name\"><span class=\"nonhuman\">"); + } + else if (type == "person") { + buf.append("<span class=\"name\"><span class=\"person\">"); + } + else if (type == "ritual") { + buf.append("<span class=\"name\"><span class=\"ritual\">"); + } + else { + buf.append("<span class=\"name\"><span>"); + } + } + else if (tag.isEndTag()) { //all hi replacements are html spans + buf.append("</span></span> "); + } + } + else if (!strcmp(tag.getName(), "transChange")) { + SWBuf type( tag.getAttribute("type") ); + + if ( !type.length() ) { + type = tag.getAttribute("changeType"); + } + + if ((!tag.isEndTag()) && (!tag.isEmpty())) { + if (type == "added") { + buf.append("<span class=\"transchange\" title=\""); + buf.append((const char*)i18n("Added text").utf8()); + buf.append("\"><span class=\"added\">"); + } + else if (type == "amplified") { + buf.append("<span class=\"transchange\"><span class=\"amplified\">"); + } + else if (type == "changed") { + buf.append("<span class=\"transchange\"><span class=\"changed\">"); + } + else if (type == "deleted") { + buf.append("<span class=\"transchange\"><span class=\"deleted\">"); + } + else if (type == "moved") { + buf.append("<span class=\"transchange\"><span class=\"moved\">"); + } + else if (type == "tenseChange") { + buf.append("<span class=\"transchange\"><span class=\"tenseChange\">"); + } + else { + buf.append("<span class=\"transchange\"><span>"); + } + } + else if (tag.isEndTag()) { //all hi replacements are html spans + buf.append("</span></span>"); + } + } + else if (!strcmp(tag.getName(), "p")) { + if (tag.isEmpty()) { + buf.append("<p/>"); + } + } + + // <q> quote + else if (!strcmp(tag.getName(), "q")) { + SWBuf type = tag.getAttribute("type"); + SWBuf who = tag.getAttribute("who"); + const char *lev = tag.getAttribute("level"); + int level = (lev) ? atoi(lev) : 1; + + if ((!tag.isEndTag()) && (!tag.isEmpty())) { + myUserData->quote.who = who; + + if(osisQToTick) //alternate " and ' + buf.append((level % 2) ? '\"' : '\''); + + if (who == "Jesus") { + buf.append("<span class=\"jesuswords\">"); + } + } + else if (tag.isEndTag()) { + if (myUserData->quote.who == "Jesus") { + buf.append("</span>"); + } + + if (osisQToTick) { //alternate " and ' + buf.append((level % 2) ? '\"' : '\''); + } + + myUserData->quote.who = ""; + } + } + + // abbr tag + else if (!strcmp(tag.getName(), "abbr")) { + if (!tag.isEndTag() && !tag.isEmpty()) { + const SWBuf expansion = tag.getAttribute("expansion"); + + buf.append("<span class=\"abbreviation\" expansion=\""); + buf.append(expansion); + buf.append("\">"); + } + else if (tag.isEndTag()) { + buf.append("</span>"); + } + } + + // <milestone> tag + else if (!strcmp(tag.getName(), "milestone")) { + const SWBuf type = tag.getAttribute("type"); + + if ((type == "screen") || (type == "line")) {//line break + buf.append("<br/>"); + userData->supressAdjacentWhitespace = true; + } + else if (type == "x-p") { //e.g. occurs in the KJV2006 module + //buf.append("<br/>"); + const SWBuf marker = tag.getAttribute("marker"); + if (marker.length() > 0) { + buf.append(marker); + } + } + } + //seg tag + else if (!strcmp(tag.getName(), "seg")) { + if (!tag.isEndTag() && !tag.isEmpty()) { + + const SWBuf type = tag.getAttribute("type"); + + if (type == "morph") {//line break + //This code is for WLC and MORPH (WHI) + XMLTag outTag("span"); + outTag.setAttribute("class", "morphSegmentation"); + const char* attrValue; + //Transfer the values to the span + //Problem: the data is in hebrew/aramaic, how to encode in HTML/BibleTime? + if ((attrValue = tag.getAttribute("lemma"))) outTag.setAttribute("lemma", attrValue); + if ((attrValue = tag.getAttribute("morph"))) outTag.setAttribute("morph", attrValue); + if ((attrValue = tag.getAttribute("homonym"))) outTag.setAttribute("homonym", attrValue); + + buf.append(outTag.toString()); + //buf.append("<span class=\"morphSegmentation\">"); + } + else{ + buf.append("<span>"); + } + } + else { // seg end tag + buf.append("</span>"); + } + //qWarning(QString("handled <seg> token. result: %1").arg(buf.c_str()).latin1()); + } + + //divine name, don't use simple tag replacing because it may have attributes + else if (!strcmp(tag.getName(), "divineName")) { + if (!tag.isEndTag()) { + buf.append("<span class=\"name\"><span class=\"divine\">"); + } + else { //all hi replacements are html spans + buf.append("</span></span>"); + } + } + + else { //all tokens handled by OSISHTMLHref will run through the filter now + return sword::OSISHTMLHREF::handleToken(buf, token, userData); + } + } + + return false; +} diff --git a/bibletime/backend/bt_osishtml.h b/bibletime/backend/bt_osishtml.h new file mode 100644 index 0000000..22e5b81 --- /dev/null +++ b/bibletime/backend/bt_osishtml.h @@ -0,0 +1,66 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef BT_OSISHTML_H +#define BT_OSISHTML_H + +//Sword includes +#include <osishtmlhref.h> + +namespace Filters { + + /** BibleTime's OSIS to HTMl filter. + * This filter works on OSIS tags and outputs HTML in the structure supported by BibleTime. + */ + +class BT_OSISHTML : public sword::OSISHTMLHREF { + +protected: + +class BT_UserData : public sword::OSISHTMLHREF::MyUserData { + +public: +BT_UserData(const sword::SWModule *module, const sword::SWKey *key) : sword::OSISHTMLHREF::MyUserData(module, key) { + noteType = Unknown; + swordFootnote = 1; + inCrossrefNote = false; + } + + unsigned short int swordFootnote; + bool inCrossrefNote; + + enum NoteType { + Unknown, + Alternative, + CrossReference, + Footnote, + StrongsMarkup + } noteType; + + struct { + sword::SWBuf who; + } + + quote; + }; + + virtual sword::BasicFilterUserData *createUserData(const sword::SWModule* module, const sword::SWKey* key) { + return new BT_UserData(module, key); + } + +public: + BT_OSISHTML(); + virtual bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData); + }; + +} //end of Filters namespace + +#endif diff --git a/bibletime/backend/bt_plainhtml.cpp b/bibletime/backend/bt_plainhtml.cpp new file mode 100644 index 0000000..703362a --- /dev/null +++ b/bibletime/backend/bt_plainhtml.cpp @@ -0,0 +1,92 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordmoduleinfo.h" +#include "cswordbackend.h" +#include "util/cpointers.h" + +#include "bt_plainhtml.h" + +//system includes +#include <stdlib.h> +#include <stdio.h> + +//Sword includes +#include <utilxml.h> + +//Qt includes +#include <qregexp.h> +#include <qstring.h> + +using namespace Filters; + +BT_PLAINHTML::BT_PLAINHTML() : sword::SWFilter() { +} + +/** No descriptions */ +char BT_PLAINHTML::processText(sword::SWBuf& text, const sword::SWKey * key, const sword::SWModule * module) { + int count = 0; + + SWBuf orig = text; + const char *from = orig.c_str(); + for (text = ""; *from; from++) + { + if ((*from == '\n') && (from[1] == '\n')) // two newlinea are a paragraph + { + text += "<P>"; + from++; + continue; + } + //This is a special case: Newlines in the plaintext editor are stored as <br />, not as \n + //we need to let them through + else if ((*from == '<') && (from[1] == 'b') && (from[2] == 'r') && (from[3] == ' ') && (from[4] == '/') && (from[5] == '>')){ + text += "<br />"; + from += 5; + continue; + } + else if ((*from == '\n')){ // only one new line + text += "<BR>"; + continue; + } + else if (*from == '<') { + text += "<"; + continue; + } + else if (*from == '>') { + text += ">"; + continue; + } + else if (*from == '&'){ + text += "&"; + continue; + } + else if (*from == '{') { //footnote start + text += "<FONT COLOR=\"#80000\"><SMALL> ("; + continue; + } + else if (*from == '}') //footnote end + { + text += ") </SMALL></FONT>"; + continue; + } + else if ((*from == ' ') && (count > 5000)) + { + text += "<WBR>"; + count = 0; + continue; + } + + text += *from; + count++; + } + return 0; +} diff --git a/bibletime/backend/bt_plainhtml.h b/bibletime/backend/bt_plainhtml.h new file mode 100644 index 0000000..fec3a48 --- /dev/null +++ b/bibletime/backend/bt_plainhtml.h @@ -0,0 +1,41 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +/* $Header: /cvsroot/bibletime/bibletime/bibletime/backend/bt_plainhtml.h,v 1.3 2007/06/29 22:47:14 joachim Exp $ */ +/* $Revision: 1.3 $ */ + +#ifndef BT_PLAINHTML_H +#define BT_PLAINHTML_H + +//Sword includes +#include <swkey.h> +#include <swmodule.h> +#include <swfilter.h> +//#include <plainhtml.h> + +namespace Filters { + + /** Plain to HTML filter, + * This filter converts Plain Text into HTML + */ + +class BT_PLAINHTML : public sword::SWFilter{ + +protected: + +public: + BT_PLAINHTML(); + virtual char processText(sword::SWBuf& buf, const sword::SWKey*, const sword::SWModule * = 0); + }; + +} + +#endif diff --git a/bibletime/backend/bt_thmlhtml.cpp b/bibletime/backend/bt_thmlhtml.cpp new file mode 100644 index 0000000..7a00bd4 --- /dev/null +++ b/bibletime/backend/bt_thmlhtml.cpp @@ -0,0 +1,395 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + + +//BibleTime includes +#include "backend/bt_thmlhtml.h" +#include "backend/clanguagemgr.h" +#include "backend/cswordmoduleinfo.h" +#include "backend/creferencemanager.h" + +#include "frontend/cbtconfig.h" + +#include "util/cpointers.h" +#include "util/scoped_resource.h" + +#include <iostream> + +//Sword includes +#include <swmodule.h> +#include <utilxml.h> +#include "versekey.h" + +//Qt includes +#include <qstring.h> +#include <qregexp.h> + +//System includes +#include <stdlib.h> + +using namespace Filters; + +BT_ThMLHTML::BT_ThMLHTML() { + setEscapeStringCaseSensitive(true); + setPassThruUnknownEscapeString(true); //the HTML widget will render the HTML escape codes + + setTokenStart("<"); + setTokenEnd(">"); + setTokenCaseSensitive(true); + + addTokenSubstitute("/foreign", "</span>"); + + removeTokenSubstitute("note"); + removeTokenSubstitute("/note"); +} + +char BT_ThMLHTML::processText(sword::SWBuf& buf, const sword::SWKey* key, const sword::SWModule* module) { + ThMLHTML::processText(buf, key, module); + + CSwordModuleInfo* m = CPointers::backend()->findModuleByName( module->Name() ); + + if (m && !(m->has(CSwordModuleInfo::lemmas) || m->has(CSwordModuleInfo::strongNumbers))) { //only parse if the module has strongs or lemmas + return 1; + } + + QString result; + + QString t = QString::fromUtf8(buf.c_str()); + QRegExp tag("([.,;]?<sync[^>]+(type|value)=\"([^\"]+)\"[^>]+(type|value)=\"([^\"]+)\"([^<]*)>)+"); + + QStringList list; + int lastMatchEnd = 0; + int pos = tag.search(t,0); + + if (pos == -1) { //no strong or morph code found in this text + return 1; //WARNING: Return alread here + } + + while (pos != -1) { + list.append(t.mid(lastMatchEnd, pos+tag.matchedLength()-lastMatchEnd)); + + lastMatchEnd = pos+tag.matchedLength(); + pos = tag.search(t,pos+tag.matchedLength()); + } + + if (!t.right(t.length() - lastMatchEnd).isEmpty()) { + list.append(t.right(t.length() - lastMatchEnd)); + } + + tag = QRegExp("<sync[^>]+(type|value|class)=\"([^\"]+)\"[^>]+(type|value|class)=\"([^\"]+)\"[^>]+((type|value|class)=\"([^\"]+)\")*([^<]*)>"); + + for (QStringList::iterator it = list.begin(); it != list.end(); ++it) { + QString e( *it ); + + const bool textPresent = (e.stripWhiteSpace().remove(QRegExp("[.,;:]")).left(1) != "<"); + + if (!textPresent) { + continue; + } + + + bool hasLemmaAttr = false; + bool hasMorphAttr = false; + + int pos = tag.search(e, 0); + bool insertedTag = false; + QString value; + QString valueClass; + + while (pos != -1) { + bool isMorph = false; + bool isStrongs = false; + value = QString::null; + valueClass = QString::null; + + // check 3 attribute/value pairs + + for (int i = 1; i < 6; i += 2) { + if (i > 4) + i++; + + if (tag.cap(i) == "type") { + isMorph = (tag.cap(i+1) == "morph"); + isStrongs = (tag.cap(i+1) == "Strongs"); + } + else if (tag.cap(i) == "value") { + value = tag.cap(i+1); + } + else if (tag.cap(i) == "class") { + valueClass = tag.cap(i+1); + } + } + + // prepend the class qualifier to the value + if (!valueClass.isEmpty()) { + value = valueClass + ":" + value; + // value.append(":").append(value); + } + + if (value.isEmpty()) { + break; + } + + //insert the span + if (!insertedTag) { + e.replace(pos, tag.matchedLength(), "</span>"); + pos += 7; + + QString rep; + rep.setLatin1("<span lemma=\"").append(value).append("\">"); + int startPos = 0; + QChar c = e[startPos]; + + while ((startPos < pos) && (c.isSpace() || c.isPunct())) { + ++startPos; + c = e[startPos]; + } + + hasLemmaAttr = isStrongs; + hasMorphAttr = isMorph; + + e.insert( startPos, rep ); + pos += rep.length(); + } + else { //add the attribute to the existing tag + e.remove(pos, tag.matchedLength()); + + if ((!isMorph && hasLemmaAttr) || (isMorph && hasMorphAttr)) { //we append another attribute value, e.g. 3000 gets 3000|5000 + //search the existing attribute start + QRegExp attrRegExp( isMorph ? "morph=\".+(?=\")" : "lemma=\".+(?=\")" ); + attrRegExp.setMinimal(true); + const int foundAttrPos = e.find(attrRegExp, pos); + + if (foundAttrPos != -1) { + e.insert(foundAttrPos + attrRegExp.matchedLength(), QString("|").append(value)); + pos += value.length() + 1; + + hasLemmaAttr = !isMorph; + hasMorphAttr = isMorph; + } + } + else { //attribute was not yet inserted + const int attrPos = e.find(QRegExp("morph=|lemma="), 0); + + if (attrPos >= 0) { + QString attr; + attr.append(isMorph ? "morph" : "lemma").append("=\"").append(value).append("\" "); + e.insert(attrPos, attr); + + hasMorphAttr = isMorph; + hasLemmaAttr = !isMorph; + + pos += attr.length(); + } + } + } + + insertedTag = true; + pos = tag.search(e, pos); + } + + result.append( e ); + } + + if (list.count()) { + buf = (const char*)result.utf8(); + } + + return 1; +} + + +bool BT_ThMLHTML::handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData) { + if (!substituteToken(buf, token) && !substituteEscapeString(buf, token)) { + sword::XMLTag tag(token); + BT_UserData* myUserData = dynamic_cast<BT_UserData*>(userData); + sword::SWModule* myModule = const_cast<sword::SWModule*>(myUserData->module); //hack to be able to call stuff like Lang() + + if ( tag.getName() && !strcasecmp(tag.getName(), "foreign") ) { // a text part in another language, we have to set the right font + + if (tag.getAttribute("lang")) { + const char* abbrev = tag.getAttribute("lang"); + //const CLanguageMgr::Language* const language = CPointers::languageMgr()->languageForAbbrev( QString::fromLatin1(abbrev) ); + + buf.append("<span class=\"foreign\" lang=\""); + buf.append(abbrev); + buf.append("\">"); + } + } + else if (tag.getName() && !strcasecmp(tag.getName(), "sync")) { //lemmas, morph codes or strongs + + if (tag.getAttribute("type") && (!strcasecmp(tag.getAttribute("type"), "morph") || !strcasecmp(tag.getAttribute("type"), "Strongs") || !strcasecmp(tag.getAttribute("type"), "lemma"))) { // Morph or Strong + buf.append('<'); + buf.append(token); + buf.append('>'); + } + } + else if (tag.getName() && !strcasecmp(tag.getName(), "note")) { // <note> tag + + if (!tag.isEndTag() && !tag.isEmpty()) { + //appending is faster than appendFormatted + buf.append(" <span class=\"footnote\" note=\""); + buf.append(myModule->Name()); + buf.append('/'); + buf.append(myUserData->key->getShortText()); + buf.append('/'); + buf.append( QString::number(myUserData->swordFootnote++).latin1() ); + buf.append("\">*</span> "); + + myUserData->suspendTextPassThru = true; + myUserData->inFootnoteTag = true; + } + else if (tag.isEndTag() && !tag.isEmpty()) { //end tag + //buf += ")</span>"; + myUserData->suspendTextPassThru = false; + myUserData->inFootnoteTag = false; + } + } + else if (tag.getName() && !strcasecmp(tag.getName(), "scripRef")) { // a scripRef + //scrip refs which are embeded in footnotes may not be displayed! + + if (!myUserData->inFootnoteTag) { + if (tag.isEndTag()) { + if (myUserData->inscriptRef) { // like "<scripRef passage="John 3:16">See John 3:16</scripRef>" + buf.append("</a></span>"); + + myUserData->inscriptRef = false; + myUserData->suspendTextPassThru = false; + } + else { // like "<scripRef>John 3:16</scripRef>" + + CSwordModuleInfo* mod = CBTConfig::get(CBTConfig::standardBible); + Q_ASSERT(mod); + if (mod) { + CReferenceManager::ParseOptions options; + options.refBase = QString::fromUtf8(myUserData->key->getText()); //current module key + options.refDestinationModule = QString(mod->name()); + options.sourceLanguage = QString(myModule->Lang()); + options.destinationLanguage = QString("en"); + + //it's ok to split the reference, because to descriptive text is given + bool insertSemicolon = false; + buf.append("<span class=\"crossreference\">"); + QStringList refs = QStringList::split(";", QString::fromUtf8(myUserData->lastTextNode.c_str())); + QString oldRef; //the previous reference to use as a base for the next refs + for (QStringList::iterator it(refs.begin()); it != refs.end(); ++it) { + + if (! oldRef.isEmpty() ){ + options.refBase = oldRef; //use the last ref as a base, e.g. Rom 1,2-3, when the next ref is only 3:3-10 + } + const QString completeRef( CReferenceManager::parseVerseReference((*it), options) ); + + oldRef = completeRef; //use the parsed result as the base for the next ref. + + if (insertSemicolon) { //prepend a ref divider if we're after the first one + buf.append("; "); + } + + buf.append("<a href=\""); + buf.append( + CReferenceManager::encodeHyperlink( + mod->name(), + completeRef, + CReferenceManager::typeFromModule(mod->type()) + ).utf8() + ); + + buf.append("\" crossrefs=\""); + buf.append((const char*)completeRef.utf8()); + buf.append("\">"); + + buf.append((const char*)(*it).utf8()); + + buf.append("</a>"); + + insertSemicolon = true; + } + buf.append("</span>"); //crossref end + } + + myUserData->suspendTextPassThru = false; + } + } + else if (tag.getAttribute("passage") ) { //the passage was given as a parameter value + myUserData->inscriptRef = true; + myUserData->suspendTextPassThru = false; + + const char* ref = tag.getAttribute("passage"); + Q_ASSERT(ref); + + CSwordModuleInfo* mod = CBTConfig::get(CBTConfig::standardBible); + Q_ASSERT(mod); + + CReferenceManager::ParseOptions options; + options.refBase = QString::fromUtf8(myUserData->key->getText()); + options.refDestinationModule = QString(mod->name()); + options.sourceLanguage = myModule->Lang(); + options.destinationLanguage = QString("en"); + + const QString completeRef = CReferenceManager::parseVerseReference(QString::fromUtf8(ref), options); + + if (mod) { + buf.append("<span class=\"crossreference\">"); + buf.append("<a href=\""); + buf.append( + CReferenceManager::encodeHyperlink( + mod->name(), + completeRef, + CReferenceManager::typeFromModule(mod->type()) + ).utf8() + ); + buf.append("\" crossrefs=\""); + buf.append((const char*)completeRef.utf8()); + buf.append("\">"); + } + else { + buf.append("<span><a>"); + } + } + else if ( !tag.getAttribute("passage") ) { // we're starting a scripRef like "<scripRef>John 3:16</scripRef>" + myUserData->inscriptRef = false; + + // let's stop text from going to output, the text get's added in the -tag handler + myUserData->suspendTextPassThru = true; + } + } + } + else if (tag.getName() && !strcasecmp(tag.getName(), "div")) { + if (tag.isEndTag()) { + buf.append("</div>"); + } + else if ( tag.getAttribute("class") && !strcasecmp(tag.getAttribute("class"),"sechead") ) { + buf.append("<div class=\"sectiontitle\">"); + } + else if (tag.getAttribute("class") && !strcasecmp(tag.getAttribute("class"), "title")) { + buf.append("<div class=\"booktitle\">"); + } + } + else if (tag.getName() && !strcasecmp(tag.getName(), "img") && tag.getAttribute("src")) { + const char* value = tag.getAttribute("src"); + + if (value[0] == '/') { + value++; //strip the first / + } + + buf.append("<img src=\"file:"); + buf.append(myUserData->module->getConfigEntry("AbsoluteDataPath")); + buf.append('/'); + buf.append(value); + buf.append("\" />"); + } + else { // let unknown token pass thru + return sword::ThMLHTML::handleToken(buf, token, userData); + } + } + + return true; +} diff --git a/bibletime/backend/bt_thmlhtml.h b/bibletime/backend/bt_thmlhtml.h new file mode 100644 index 0000000..e5ac614 --- /dev/null +++ b/bibletime/backend/bt_thmlhtml.h @@ -0,0 +1,56 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef BT_THMLHTML_H +#define BT_THMLHTML_H + +#include <swbuf.h> +#include <thmlhtml.h> + +using sword::SWBuf; + +namespace Filters { + + /** ThML to HTML filter. + * This filter converts ThML text to HTML text + */ + +class BT_ThMLHTML : public sword::ThMLHTML { + +protected: + +class BT_UserData : public sword::ThMLHTML::MyUserData { + +public: +BT_UserData(const sword::SWModule *module, const sword::SWKey *key) : sword::ThMLHTML::MyUserData(module, key) { + inscriptRef = false; + swordFootnote = 1; + inFootnoteTag = false; + } + + bool inscriptRef; + bool inFootnoteTag; + unsigned short int swordFootnote; + }; + + virtual sword::BasicFilterUserData *createUserData(const sword::SWModule* module, const sword::SWKey* key) { + return new BT_UserData(module, key); + } + +public: + BT_ThMLHTML (); + virtual bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData); + virtual char processText(sword::SWBuf& buf, const sword::SWKey*, const sword::SWModule * = 0); + }; + +} + +#endif diff --git a/bibletime/backend/bt_thmlplain.cpp b/bibletime/backend/bt_thmlplain.cpp new file mode 100644 index 0000000..8c4d72d --- /dev/null +++ b/bibletime/backend/bt_thmlplain.cpp @@ -0,0 +1,221 @@ +/****************************************************************************** + * + * thmlplain - SWFilter descendant to strip out all ThML tags or convert to + * ASCII rendered symbols. + */ + +#include "bt_thmlplain.h" + +#include <stdlib.h> +#include <swbuf.h> + +using namespace sword; + +namespace Filters { + +BT_ThMLPlain::BT_ThMLPlain() { +} + +char BT_ThMLPlain::processText(SWBuf &text, const SWKey *key, const SWModule *module) +{ + char token[2048]; + int tokpos = 0; + bool intoken = false; + bool ampersand = false; + + const char *from; + SWBuf orig = text; + from = orig.c_str(); + for (text = ""; *from; from++) + { + if (*from == 10 || *from == 13) + from++; + if (*from == '<') { + intoken = true; + tokpos = 0; + token[0] = 0; + token[1] = 0; + token[2] = 0; + ampersand = false; + continue; + } + else if (*from == '&') { + intoken = true; + tokpos = 0; + token[0] = 0; + token[1] = 0; + token[2] = 0; + ampersand = true; + continue; + } + if (*from == ';' && ampersand) { + intoken = false; + ampersand = false; + + if (!strncmp("nbsp", token, 4)) text += " "; + else if (!strncmp("quot", token, 4)) text += "\""; + else if (!strncmp("amp", token, 3)) text += "&"; + else if (!strncmp("lt", token, 2)) text += "<"; + else if (!strncmp("gt", token, 2)) text += ">"; + else if (!strncmp("brvbar", token, 6)) text += "¦"; + else if (!strncmp("sect", token, 4)) text += "§"; + else if (!strncmp("copy", token, 4)) text += "©"; + else if (!strncmp("laquo", token, 5)) text += "«"; + else if (!strncmp("reg", token, 3)) text += "®"; + else if (!strncmp("acute", token, 5)) text += "´"; + else if (!strncmp("para", token, 4)) text += "¶"; + else if (!strncmp("raquo", token, 5)) text += "»"; + + else if (!strncmp("Aacute", token, 6)) text += "Á"; + else if (!strncmp("Agrave", token, 6)) text += "À"; + else if (!strncmp("Acirc", token, 5)) text += "Â"; + else if (!strncmp("Auml", token, 4)) text += "Ä"; + else if (!strncmp("Atilde", token, 6)) text += "Ã"; + else if (!strncmp("Aring", token, 5)) text += "Å"; + else if (!strncmp("aacute", token, 6)) text += "á"; + else if (!strncmp("agrave", token, 6)) text += "à"; + else if (!strncmp("acirc", token, 5)) text += "â"; + else if (!strncmp("auml", token, 4)) text += "ä"; + else if (!strncmp("atilde", token, 6)) text += "ã"; + else if (!strncmp("aring", token, 5)) text += "å"; + else if (!strncmp("Eacute", token, 6)) text += "É"; + else if (!strncmp("Egrave", token, 6)) text += "È"; + else if (!strncmp("Ecirc", token, 5)) text += "Ê"; + else if (!strncmp("Euml", token, 4)) text += "Ë"; + else if (!strncmp("eacute", token, 6)) text += "é"; + else if (!strncmp("egrave", token, 6)) text += "è"; + else if (!strncmp("ecirc", token, 5)) text += "ê"; + else if (!strncmp("euml", token, 4)) text += "ë"; + else if (!strncmp("Iacute", token, 6)) text += "Í"; + else if (!strncmp("Igrave", token, 6)) text += "Ì"; + else if (!strncmp("Icirc", token, 5)) text += "Î"; + else if (!strncmp("Iuml", token, 4)) text += "Ï"; + else if (!strncmp("iacute", token, 6)) text += "í"; + else if (!strncmp("igrave", token, 6)) text += "ì"; + else if (!strncmp("icirc", token, 5)) text += "î"; + else if (!strncmp("iuml", token, 4)) text += "ï"; + else if (!strncmp("Oacute", token, 6)) text += "Ó"; + else if (!strncmp("Ograve", token, 6)) text += "Ò"; + else if (!strncmp("Ocirc", token, 5)) text += "Ô"; + else if (!strncmp("Ouml", token, 4)) text += "Ö"; + else if (!strncmp("Otilde", token, 6)) text += "Õ"; + else if (!strncmp("oacute", token, 6)) text += "ó"; + else if (!strncmp("ograve", token, 6)) text += "ò"; + else if (!strncmp("ocirc", token, 5)) text += "ô"; + else if (!strncmp("ouml", token, 4)) text += "ö"; + else if (!strncmp("otilde", token, 6)) text += "õ"; + else if (!strncmp("Uacute", token, 6)) text += "Ú"; + else if (!strncmp("Ugrave", token, 6)) text += "Ù"; + else if (!strncmp("Ucirc", token, 5)) text += "Û"; + else if (!strncmp("Uuml", token, 4)) text += "Ü"; + else if (!strncmp("uacute", token, 6)) text += "ú"; + else if (!strncmp("ugrave", token, 6)) text += "ù"; + else if (!strncmp("ucirc", token, 5)) text += "û"; + else if (!strncmp("uuml", token, 4)) text += "ü"; + else if (!strncmp("Yacute", token, 6)) text += "Ý"; + else if (!strncmp("yacute", token, 6)) text += "ý"; + else if (!strncmp("yuml", token, 4)) text += "ÿ"; + + else if (!strncmp("deg", token, 3)) text += "°"; + else if (!strncmp("plusmn", token, 6)) text += "±"; + else if (!strncmp("sup2", token, 4)) text += "²"; + else if (!strncmp("sup3", token, 4)) text += "³"; + else if (!strncmp("sup1", token, 4)) text += "¹"; + else if (!strncmp("nbsp", token, 4)) text += "º"; + else if (!strncmp("pound", token, 5)) text += "£"; + else if (!strncmp("cent", token, 4)) text += "¢"; + else if (!strncmp("frac14", token, 6)) text += "¼"; + else if (!strncmp("frac12", token, 6)) text += "½"; + else if (!strncmp("frac34", token, 6)) text += "¾"; + else if (!strncmp("iquest", token, 6)) text += "¿"; + else if (!strncmp("iexcl", token, 5)) text += "¡"; + else if (!strncmp("ETH", token, 3)) text += "Ð"; + else if (!strncmp("eth", token, 3)) text += "ð"; + else if (!strncmp("THORN", token, 5)) text += "Þ"; + else if (!strncmp("thorn", token, 5)) text += "þ"; + else if (!strncmp("AElig", token, 5)) text += "Æ"; + else if (!strncmp("aelig", token, 5)) text += "æ"; + else if (!strncmp("Oslash", token, 6)) text += "Ø"; + else if (!strncmp("curren", token, 6)) text += "¤"; + else if (!strncmp("Ccedil", token, 6)) text += "Ç"; + else if (!strncmp("ccedil", token, 6)) text += "ç"; + else if (!strncmp("szlig", token, 5)) text += "ß"; + else if (!strncmp("Ntilde", token, 6)) text += "Ñ"; + else if (!strncmp("ntilde", token, 6)) text += "ñ"; + else if (!strncmp("yen", token, 3)) text += "¥"; + else if (!strncmp("not", token, 3)) text += "¬"; + else if (!strncmp("ordf", token, 4)) text += "ª"; + else if (!strncmp("uml", token, 3)) text += "¨"; + else if (!strncmp("shy", token, 3)) text += "­"; + else if (!strncmp("macr", token, 4)) text += "¯"; + else if (!strncmp("micro", token, 5)) text += "µ"; + else if (!strncmp("middot", token, 6)) text +="·"; + else if (!strncmp("cedil", token, 5)) text += "¸"; + else if (!strncmp("ordm", token, 4)) text += "º"; + else if (!strncmp("times", token, 5)) text += "×"; + else if (!strncmp("divide", token, 6)) text +="÷"; + else if (!strncmp("oslash", token, 6)) text +="ø"; + continue; + + } + else if (*from == '>' && !ampersand) { + intoken = false; + // process desired tokens + if (!strncmp(token, "sync type=\"Strongs\" value=\"", 27)) { + text += ' '; + text += '<'; + for (unsigned int i = 27; token[i] != '\"'; i++) + text += token[i]; + text += '>'; + continue; + } + if (!strncmp(token, "sync type=\"morph\" value=\"", 25)) { + text += ' '; + text += '('; + for (unsigned int i = 25; token[i] != '\"'; i++) + text += token[i]; + text += ')'; + continue; + } + if (!strncmp("note", token, 4)) { + text += ' '; + text += '('; + } + else if (!strncmp("br", token, 2)) + text += '\n'; + else if (!strncmp("/p", token, 2)) + text += '\n'; + else if (!strncmp("/note", token, 5)) { + text += ')'; + text += ' '; + } + continue; + } + if (intoken) { + if (tokpos < 2045) + token[tokpos++] = *from; + token[tokpos+2] = 0; + } + else text += *from; + } + + orig = text; + from = orig.c_str(); + for (text = ""; *from; from++) { //loop to remove extra spaces + if ((strchr(" \t\n\r", *from))) { + while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) { + from++; + } + text += " "; + } + else { + text += *from; + } + } + text += (char)0; + + return 0; +} + + +} diff --git a/bibletime/backend/bt_thmlplain.h b/bibletime/backend/bt_thmlplain.h new file mode 100644 index 0000000..b510d33 --- /dev/null +++ b/bibletime/backend/bt_thmlplain.h @@ -0,0 +1,40 @@ +/****************************************************************************** + * + * $Id: bt_thmlplain.h,v 1.1 2007/03/14 21:32:47 joachim Exp $ + * + * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) + * CrossWire Bible Society + * P. O. Box 2528 + * Tempe, AZ 85280-2528 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef BT_THMLPLAIN_H +#define BT_THMLPLAIN_H + +#include <swfilter.h> + +using namespace sword; + +namespace Filters { + +/** this filter converts ThML text to plain text + */ +class BT_ThMLPlain : public SWFilter { +protected: + virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0); +public: + BT_ThMLPlain(); +}; + +} +#endif diff --git a/bibletime/backend/btstringmgr.cpp b/bibletime/backend/btstringmgr.cpp new file mode 100644 index 0000000..83c29c8 --- /dev/null +++ b/bibletime/backend/btstringmgr.cpp @@ -0,0 +1,145 @@ +// +// C++ Implementation: btstringmgr +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include "btstringmgr.h" + +//System includes +#include <ctype.h> + +char* BTStringMgr::upperUTF8(char* text, unsigned int maxlen) const { + const int max = (maxlen>0) ? maxlen : strlen(text); + + if (isUtf8(text)) { + strncpy(text, (const char*)QString::fromUtf8(text).upper().utf8(), max); + + return text; + } + else { + char* ret = text; + + while (*text) { + *text = toupper(*text); + text++; + } + + return ret; + } + + return text; +} + +char* BTStringMgr::upperLatin1(char* text, unsigned int max) const { + char* ret = text; + + while (*text) { + *text = toupper(*text); + text++; + } + + return ret; +} + +bool BTStringMgr::supportsUnicode() const { + return true; +} + +const bool BTStringMgr::isUtf8(const char *buf) const { + int i, n; + register unsigned char c; + bool gotone = false; + + #define F 0 /* character never appears in text */ + #define T 1 /* character appears in plain ASCII text */ + #define I 2 /* character appears in ISO-8859 text */ + #define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ + + static const unsigned char text_chars[256] = { + /* BEL BS HT LF FF CR */ + F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */ + /* ESC */ + F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */ + /* NEL */ + X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ + X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ + }; + + /* *ulen = 0; */ + + for (i = 0; (c = buf[i]); i++) { + if ((c & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ + /* + * Even if the whole file is valid UTF-8 sequences, + * still reject it if it uses weird control characters. + */ + + if (text_chars[c] != T) + return false; + + } + else if ((c & 0x40) == 0) { /* 10xxxxxx never 1st byte */ + return false; + } + else { /* 11xxxxxx begins UTF-8 */ + int following; + + if ((c & 0x20) == 0) { /* 110xxxxx */ + following = 1; + } + else if ((c & 0x10) == 0) { /* 1110xxxx */ + following = 2; + } + else if ((c & 0x08) == 0) { /* 11110xxx */ + following = 3; + } + else if ((c & 0x04) == 0) { /* 111110xx */ + following = 4; + } + else if ((c & 0x02) == 0) { /* 1111110x */ + following = 5; + } + else + return false; + + for (n = 0; n < following; n++) { + i++; + + if (!(c = buf[i])) + goto done; + + if ((c & 0x80) == 0 || (c & 0x40)) + return false; + } + + gotone = true; + } + } + +done: + return gotone; /* don't claim it's UTF-8 if it's all 7-bit */ +} + +#undef F +#undef T +#undef I +#undef X diff --git a/bibletime/backend/btstringmgr.h b/bibletime/backend/btstringmgr.h new file mode 100644 index 0000000..de5349d --- /dev/null +++ b/bibletime/backend/btstringmgr.h @@ -0,0 +1,57 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef BTSTRINGMGR_H +#define BTSTRINGMGR_H + +//Sword includes +#include <stringmgr.h> + +//Qt includes +#include <qstring.h> + +using namespace sword; + +/** Unicode string manager implementation. + * This is the StringManager implementation which works with QString. + * @author The BibleTime developers + */ + +class BTStringMgr : public StringMgr { + +public: + /** Converts the param to an upper case Utf8 string + * @param The text encoded in utf8 which should be turned into an upper case string + */ + virtual char *upperUTF8(char *text, unsigned int max = 0) const; + + /** Converts the param to an uppercase latin1 string + * @param The text encoded in latin1 which should be turned into an upper case string + */ + virtual char *upperLatin1(char *text, unsigned int max = 0) const; + +protected: + /** Enable Unicode support. + * Reimplementation to show unicode support. + */ + virtual bool supportsUnicode() const; + + /** CODE TAKEN FROM KDELIBS 3.2, which is licensed under the LGPL 2. + * + * This code was taken from KStringHandler, which is part of the KDE libraries. + * + * This function checks whether a string is utf8 or not. + * It was taken from kdelibs so we do not depend on KDE 3.2. + */ + const bool isUtf8(const char *buf) const; +}; + +#endif diff --git a/bibletime/backend/cbookdisplay.cpp b/bibletime/backend/cbookdisplay.cpp new file mode 100644 index 0000000..276c604 --- /dev/null +++ b/bibletime/backend/cbookdisplay.cpp @@ -0,0 +1,144 @@ +// +// C++ Implementation: cbookdisplay +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004-2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +//Backend +#include "cbookdisplay.h" +#include "cdisplayrendering.h" +#include "cswordbookmoduleinfo.h" +#include "cswordtreekey.h" + +//Util +#include "util/scoped_resource.h" + +namespace Rendering { + + + /** Returns the rendered text using the modules in the list and using the key parameter. The displayoptions and filter options are used, too. */ + const QString CBookDisplay::text( const ListCSwordModuleInfo& modules, const QString& keyName, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions ) { + CSwordBookModuleInfo* book = dynamic_cast<CSwordBookModuleInfo*>(modules.first()); + Q_ASSERT(book); + + CSwordBackend::DisplayOptions dOpts = displayOptions; + dOpts.lineBreaks = true; //books should render with blocks, not with inlined sections + + CDisplayRendering render(dOpts, filterOptions); + CDisplayRendering::KeyTree tree; + CDisplayRendering::KeyTreeItem::Settings itemSettings; + + // the number of levels which should be display together, 1 means display no entries together + int displayLevel = book->config( CSwordModuleInfo::DisplayLevel ).toInt(); + + util::scoped_ptr<CSwordTreeKey> key ( + dynamic_cast<CSwordTreeKey*>( CSwordKey::createInstance(book) ) + ); + key->key(keyName); //set the key to position we'd like to get + + const unsigned long offset = key->getOffset(); + + // standard of DisplayLevel, display nothing together + // if the current key is the root entry don't display anything together! + + if ((displayLevel <= 1) || (key->key().isEmpty() || (key->key() == "/") )) { + tree.append( new CDisplayRendering::KeyTreeItem( key->key(), modules, itemSettings ) ); + + const QString renderedText = render.renderKeyTree(tree); + key->setOffset( offset ); + return renderedText; + }; + + /** + * Check whether displaying displayLevel levels together is possible. + * For this count the childs and parents + * of the required position + */ + + int possibleLevels = 1; //we start with the default value of displayLevel, which means no entries together + + while( key->parent() && (key->key() != "/") && !key->key().isEmpty() ) {//add parents + ++possibleLevels; + }; + + // key->key(keyName); //set the key to the start position + + key->setOffset( offset ); + + while( key->firstChild( )) { //add childs + ++possibleLevels; + }; + + if (possibleLevels < displayLevel) { //too few levels available! + //display current level, we could also decide to display the available levels together + tree.append( new CDisplayRendering::KeyTreeItem( key->key(), modules, itemSettings ) ); + + const QString renderedText = render.renderKeyTree(tree); + key->setOffset( offset ); + return renderedText; + }; + + if ((displayLevel > 2) && (displayLevel == possibleLevels)) { //fix not to diplay the whole module + --displayLevel; + } + + // at this point we're sure that we can display the required levels toogether + // at the moment we're at the lowest level, so we only have to go up! + for (int currentLevel = 1; currentLevel < displayLevel; ++currentLevel) { //we start again with 1 == standard of displayLevel + + if ( !key->parent() ) { //something went wrong although we checked before! Be safe and return entry's text + tree.append( new CDisplayRendering::KeyTreeItem( key->key(), modules, itemSettings ) ); + + const QString renderedText = render.renderKeyTree(tree); + key->setOffset( offset ); + return renderedText; + }; + }; + + // no we can display all sub levels together! We checked before that this is possible! + itemSettings.highlight = (key->key() == keyName); + + tree.append( new CDisplayRendering::KeyTreeItem( key->key(), modules, itemSettings ) ); + + //const bool hasToplevelText = !key->strippedText().isEmpty(); + key->firstChild(); //go to the first sibling on the same level + + setupRenderTree(key.get(), &tree, keyName); + + const QString renderedText = render.renderKeyTree(tree); + + key->setOffset( offset ); //restore key + + return renderedText; + } + + void CBookDisplay::setupRenderTree(CSwordTreeKey * swordTree, CTextRendering::KeyTree * renderTree, const QString& highlightKey) { +// const QString key = swordTree->getFullName(); + const QString key = swordTree->key(); + const unsigned long offset = swordTree->getOffset(); + + CTextRendering::KeyTreeItem::Settings settings; + settings.highlight = (key == highlightKey); + + CTextRendering::KeyTreeItem* item = new CTextRendering::KeyTreeItem(key, swordTree->module(0), settings ); + renderTree->append( item ); + + if (swordTree->hasChildren()) { //print tree for the child items + swordTree->firstChild(); + setupRenderTree(swordTree, item->childList(), highlightKey); + swordTree->setOffset( offset ); //go back where we came from + } + + if (swordTree->nextSibling()) { //print tree for next entry on the same depth + setupRenderTree(swordTree, renderTree, highlightKey); + swordTree->setOffset( offset ); //return to the value we had at the beginning of this block! + } + } + +}; diff --git a/bibletime/backend/cbookdisplay.h b/bibletime/backend/cbookdisplay.h new file mode 100644 index 0000000..56fc2f2 --- /dev/null +++ b/bibletime/backend/cbookdisplay.h @@ -0,0 +1,45 @@ +// +// C++ Interface: cbookdisplay +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef RENDERINGCBOOKDISPLAY_H +#define RENDERINGCBOOKDISPLAY_H + +#include "centrydisplay.h" + +class CSwordTreeKey; + +namespace Rendering { + + class CTextRendering::KeyTree; + + /** + * A CEntryDisplay implementation which works on tree-based GenBook modules + * of Sword. + * @short CEntryDisplay implementation for GenBook modules, + * @author The BibleTime team + */ + +class CBookDisplay : public CEntryDisplay { +public: // Public methods + virtual ~CBookDisplay() {} + + /** + * Returns the rendered text using the modules in the list and using the key parameter. + * The displayoptions and filter options are used, too. + */ + virtual const QString text( const ListCSwordModuleInfo& modules, const QString& key, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions); + +protected: + void setupRenderTree(CSwordTreeKey* swordTree, CTextRendering::KeyTree* renderTree, const QString& highlightKey); + }; +}; + +#endif diff --git a/bibletime/backend/cchapterdisplay.cpp b/bibletime/backend/cchapterdisplay.cpp new file mode 100644 index 0000000..02668e4 --- /dev/null +++ b/bibletime/backend/cchapterdisplay.cpp @@ -0,0 +1,67 @@ +// +// C++ Implementation: cchapterdisplay +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +//Backend +#include "cchapterdisplay.h" +#include "cdisplayrendering.h" +#include "cswordversekey.h" +#include "cswordbiblemoduleinfo.h" + + +namespace Rendering { + + const QString CChapterDisplay::text( const ListCSwordModuleInfo& modules, const QString& keyName, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions ) { + Q_ASSERT( modules.count() >= 1 ); + Q_ASSERT( !keyName.isEmpty() ); + + CSwordModuleInfo* module = modules.first(); + + if (modules.count() == 1) module->module()->setSkipConsecutiveLinks( true ); //skip empty, linked verses + + CTextRendering::KeyTreeItem::Settings settings; + settings.keyRenderingFace = + displayOptions.verseNumbers + ? CTextRendering::KeyTreeItem::Settings::SimpleKey + : CTextRendering::KeyTreeItem::Settings::NoKey; + + QString startKey = keyName; + QString endKey = startKey; + + //check whether there's an intro we have to include + Q_ASSERT((module->type() == CSwordModuleInfo::Bible)); + + if (module->type() == CSwordModuleInfo::Bible) { + ((VerseKey*)(module->module()->getKey()))->Headings(1); //HACK: enable headings for VerseKeys + + CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module); + Q_ASSERT(bible); + + CSwordVerseKey k1(module); + k1.Headings(1); + k1.key(keyName); + + if (k1.Chapter() == 1) k1.Chapter(0); //Chapter 1, start with 0:0, otherwise X:0 + + k1.Verse(0); + + startKey = k1.key(); + + if (k1.Chapter() == 0) k1.Chapter(1); + k1.Verse(bible->verseCount(k1.book(), k1.Chapter())); + endKey = k1.key(); + } + + CDisplayRendering render(displayOptions, filterOptions); + return render.renderKeyRange( startKey, endKey, modules, keyName, settings ); + } + +}; diff --git a/bibletime/backend/cchapterdisplay.h b/bibletime/backend/cchapterdisplay.h new file mode 100644 index 0000000..891b16b --- /dev/null +++ b/bibletime/backend/cchapterdisplay.h @@ -0,0 +1,39 @@ +// +// C++ Interface: cchapterdisplay +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef RENDERINGCCHAPTERDISPLAY_H +#define RENDERINGCCHAPTERDISPLAY_H + +#include "centrydisplay.h" + +namespace Rendering { + +/** Chapter rendering. +* A CEntryDisplay implementation mde for Bibles to display whole chapters +* at once. +* @author The BibleTime team +*/ + +class CChapterDisplay : public CEntryDisplay { + +public: // Public methods + virtual ~CChapterDisplay() {} + + /** + * Returns the rendered text using the modules in the list and using the key parameter. + * The displayoptions and filter options are used, too. + */ + virtual const QString text( const ListCSwordModuleInfo& modules, const QString& key, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions); +}; + +}; + +#endif diff --git a/bibletime/backend/cdisplayrendering.cpp b/bibletime/backend/cdisplayrendering.cpp new file mode 100644 index 0000000..6b13114 --- /dev/null +++ b/bibletime/backend/cdisplayrendering.cpp @@ -0,0 +1,163 @@ +// +// C++ Implementation: cdisplayrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +//Backend includes +#include "cdisplayrendering.h" + +#include "cdisplaytemplatemgr.h" +#include "creferencemanager.h" +#include "cswordkey.h" +#include "cswordversekey.h" + +//Qt includes +#include <qstring.h> +#include <qregexp.h> + +namespace Rendering { + + CDisplayRendering::CDisplayRendering(CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions) +: CHTMLExportRendering(CHTMLExportRendering::Settings(true), displayOptions, filterOptions) {} + + const QString CDisplayRendering::entryLink( const KeyTreeItem& item, CSwordModuleInfo* module ) { + QString linkText; + + const bool isBible = module && (module->type() == CSwordModuleInfo::Bible); + CSwordVerseKey vk(module); //only valid for bible modules, i.e. isBible == true + vk.Headings(true); + + if (isBible) { + vk = item.key(); + } + + if (isBible && (vk.Verse() == 0)) { + return QString::null; //Warning: return already here + } + + switch (item.settings().keyRenderingFace) { + + case KeyTreeItem::Settings::NoKey: { + linkText = QString::null; + break; //no key is valid for all modules + } + + case KeyTreeItem::Settings::CompleteShort: { + if (isBible) { + linkText = QString::fromUtf8(vk.getShortText()); + break; + } + + //fall through for non-Bible modules + } + + case KeyTreeItem::Settings::CompleteLong: { + if (isBible) { + linkText = vk.key(); + break; + } + + //fall through for non-Bible modules + } + + case KeyTreeItem::Settings::SimpleKey: { + if (isBible) { + linkText = QString::number(vk.Verse()); + break; + } + + //fall through for non-Bible modules + } + + default: { //default behaviour to return the passed key + linkText = item.key(); + break; + } + } + + if (linkText.isEmpty()) { + return QString("<a name=\"").append(keyToHTMLAnchor(item.key())).append("\" />"); + } + else { + return QString("<a name=\"").append(keyToHTMLAnchor(item.key())).append("\" ") + .append("href=\"") + .append(CReferenceManager::encodeHyperlink( + module->name(), item.key(), CReferenceManager::typeFromModule(module->type())) + ) + .append("\">").append(linkText).append("</a>\n"); + } + + return QString::null; + } + + const QString CDisplayRendering::keyToHTMLAnchor(const QString& key) { + QString ret = key; + ret = ret.stripWhiteSpace().remove(QRegExp("[^A-Za-z0-9]+")); + ret = ret.remove(QRegExp("^\\d+|")); + + return ret; + } + + const QString CDisplayRendering::finishText( const QString& oldText, KeyTree& tree ) { + ListCSwordModuleInfo modules = tree.collectModules(); + + + //marking words is very slow, we have to find a better solution + + /* + //mark all words by spans + + QString text = oldText; + + QRegExp re("(\\b)(?=\\w)"); //word begin marker + int pos = text.find(re, 0); + + while (pos != -1) { //word begin found + //qWarning("found word at %i in %i", pos, text.length()); + int endPos = pos + 1; + if (!CToolClass::inHTMLTag(pos+1, text)) { //the re has a positive look ahead which matches one char before the word start + //qWarning("matched %s", text.mid(pos+1, 4).latin1()); + + //find end of word and put a marker around it + endPos = text.find(QRegExp("\\b|[,.:]"), pos+1); + if ((endPos != -1) && !CToolClass::inHTMLTag(endPos, text) && (endPos - pos >= 3)) { //reuire wordslonger than 3 chars + text.insert(endPos, "</span>"); + text.insert(pos, "<span class=\"word\">"); + + endPos += 26; + } + } + pos = text.find(re, endPos); + } + */ + const CLanguageMgr::Language* const lang = + (modules.count() >= 1) + ? modules.first()->language() + : CPointers::languageMgr()->defaultLanguage(); + + CDisplayTemplateMgr* tMgr = CPointers::displayTemplateManager(); + + Q_ASSERT(modules.count() >= 1); + + CDisplayTemplateMgr::Settings settings; + settings.modules = modules; + settings.langAbbrev = ((modules.count() == 1) && lang->isValid()) + ? lang->abbrev() + : QString::null; + settings.pageDirection = (modules.count() == 1) + ? ((modules.first()->textDirection() == CSwordModuleInfo::LeftToRight) ? "ltr" : "rtl") + : QString::null; + + return tMgr->fillTemplate(CBTConfig::get + (CBTConfig::displayStyle), oldText, settings); + + + } +} diff --git a/bibletime/backend/cdisplayrendering.h b/bibletime/backend/cdisplayrendering.h new file mode 100644 index 0000000..b835ac6 --- /dev/null +++ b/bibletime/backend/cdisplayrendering.h @@ -0,0 +1,40 @@ +// +// C++ Interface: cdisplayrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef RENDERINGCDISPLAYRENDERING_H +#define RENDERINGCDISPLAYRENDERING_H + +#include "chtmlexportrendering.h" + +namespace Rendering { + +/** HTML rendering for the text display widgets. + * @short Rendering for the html display widget. + * @author The BibleTime team + */ + +class CDisplayRendering : public CHTMLExportRendering { +public: + static const QString keyToHTMLAnchor(const QString& key); + + CDisplayRendering( + CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults(), + CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults() + ); + +protected: + virtual const QString entryLink( const KeyTreeItem& item, CSwordModuleInfo* const module ); + virtual const QString finishText( const QString&, KeyTree& tree ); +}; + +} + +#endif diff --git a/bibletime/backend/cdisplaytemplatemgr.cpp b/bibletime/backend/cdisplaytemplatemgr.cpp new file mode 100644 index 0000000..a0f5222 --- /dev/null +++ b/bibletime/backend/cdisplaytemplatemgr.cpp @@ -0,0 +1,191 @@ +// +// C++ Implementation: cdisplaytemplatemgr +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +//BibleTime includes +#include "cdisplaytemplatemgr.h" +#include "cswordmoduleinfo.h" +#include "clanguagemgr.h" + +#include "frontend/cbtconfig.h" + +#include "util/cpointers.h" + +#include "config.h" + +//Qt includes +#include <qstringlist.h> +#include <qfile.h> +#include <qfileinfo.h> + +//KDE includes +#include <klocale.h> +#include <kstandarddirs.h> + +#include <iostream> + +CDisplayTemplateMgr::CDisplayTemplateMgr() { + init(); + loadUserTemplates(); +} + +CDisplayTemplateMgr::~CDisplayTemplateMgr() {} + + +/*! + \fn CDisplayTemplateMgr::fillTemplate( const QString& name, const QString& title, const QString& content ) + */ +const QString CDisplayTemplateMgr::fillTemplate( const QString& name, const QString& content, Settings& settings ) { + const QString templateName = m_templateMap.contains(name) ? name : defaultTemplate(); + + QString displayTypeString; + + if (!settings.pageCSS_ID.isEmpty()) { + displayTypeString = settings.pageCSS_ID; + } + else { + if (settings.modules.count()) { + switch (settings.modules.first()->type()) { + + case CSwordModuleInfo::Bible: + displayTypeString = "bible"; + break; + + case CSwordModuleInfo::GenericBook: + displayTypeString = "book"; + break; + + case CSwordModuleInfo::Commentary: + + case CSwordModuleInfo::Lexicon: + + default: + displayTypeString = "singleentry"; + break; + }; + } + else { //use bible as default type if no modules are set + displayTypeString = "bible"; + }; + } + + QString newContent = content; + const int moduleCount = settings.modules.count(); + + if (moduleCount >= 2) { + //create header for the modules + QString header; + + ListCSwordModuleInfo::iterator end_it = settings.modules.end(); + + for (ListCSwordModuleInfo::iterator it(settings.modules.begin()); it != end_it; ++it) { + header.append("<th style=\"width:") + .append(QString::number(int( 100.0 / (float)moduleCount ))) + .append("%;\">") + .append((*it)->name()) + .append("</th>"); + } + + newContent.setLatin1("<table><tr>") + .append(header) + .append("</tr>") + .append(content) + .append("</table>"); + } + + QString langCSS; + CLanguageMgr::LangMap langMap = CPointers::languageMgr()->availableLanguages(); + + for ( CLanguageMgr::LangMapIterator it( langMap ); it.current(); ++it ) { + const CLanguageMgr::Language* lang = it.current(); + + + //if (lang->isValid() && CBTConfig::get(lang).first) { + if (!lang->abbrev().isEmpty() && CBTConfig::get(lang).first) { + const QFont f = CBTConfig::get(lang).second; + + //don't use important, because it would reset the title formatting, etc. to the setup font + QString css("{ "); + css.append("font-family:").append(f.family())/*.append(" !important")*/; + css.append("; font-size:").append(QString::number(f.pointSize())).append("pt /*!important*/"); + css.append("; font-weight:").append(f.bold() ? "bold" : "normal /*!important*/"); + css.append("; font-style:").append(f.italic() ? "italic" : "normal /*!important*/"); + css.append("; }\n"); + + langCSS += + QString("\n*[lang=%1] %2") + .arg(lang->abbrev()) + .arg(css); + } + } + + //at first append the font standard settings for all languages without configured font + CLanguageMgr::LangMapIterator it( langMap ); + + const CLanguageMgr::Language* lang = it.current(); + + if (lang && !lang->abbrev().isEmpty()/*&& lang->isValid()*/) { + const QFont standardFont = CBTConfig::getDefault(lang); //we just need a dummy lang param + langCSS.prepend( + QString("\n#content {font-family:%1; font-size:%2pt; font-weight:%3; font-style: %4;}\n") + .arg(standardFont.family()) + .arg(standardFont.pointSize()) + .arg(standardFont.bold() ? "bold" : "normal") + .arg(standardFont.italic() ? "italic" : "normal") + ); + } + +// qWarning("Outputing unformated text"); + const QString t = QString(m_templateMap[ templateName ]) //don't change the map's content directly, use a copy + .replace("#TITLE#", settings.title) + .replace("#LANG_ABBREV#", settings.langAbbrev.isEmpty() ? QString("en") : settings.langAbbrev) + .replace("#DISPLAYTYPE#", displayTypeString) + .replace("#LANG_CSS#", langCSS) + .replace("#PAGE_DIRECTION#", settings.pageDirection) + .replace("#CONTENT#", newContent); + //printf("%s\n\n", t.latin1()); + + return t; +/* QString(m_templateMap[ templateName ]) //don't change the map's content directly, use a copy + .replace("#TITLE#", settings.title) + .replace("#LANG_ABBREV#", settings.langAbbrev.isEmpty() ? QString("en") : settings.langAbbrev) + .replace("#DISPLAYTYPE#", displayTypeString) + .replace("#LANG_CSS#", langCSS) + .replace("#PAGE_DIRECTION#", settings.pageDirection) + .replace("#CONTENT#", newContent);*/ +} + + +/*! + \fn CDisplayTemplateMgr::loadUserTemplates + */ +void CDisplayTemplateMgr::loadUserTemplates() { + qDebug("Loading user templates"); + QStringList files = KGlobal::dirs()->findAllResources("BT_DisplayTemplates"); + + for ( QStringList::iterator it( files.begin() ); it != files.end(); ++it) { + qDebug("Found user template %s", (*it).latin1()); + + QFile f( *it ); + Q_ASSERT( f.exists() ); + + if (f.open( IO_ReadOnly )) { + QString fileContent = QTextStream( &f ).read(); + + if (!fileContent.isEmpty()) { + m_templateMap[ QFileInfo(*it).fileName() + QString(" ") + i18n("(user template)")] = fileContent; + } + } + } +} + +//Include the HTML templates which were put into a cpp file by a Perl script +#include "../display-templates/template-init.cpp" diff --git a/bibletime/backend/cdisplaytemplatemgr.h b/bibletime/backend/cdisplaytemplatemgr.h new file mode 100644 index 0000000..764fb69 --- /dev/null +++ b/bibletime/backend/cdisplaytemplatemgr.h @@ -0,0 +1,100 @@ +// +// C++ Interface: cdisplaytemplatemgr +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef CDISPLAYTEMPLATEMGR_H +#define CDISPLAYTEMPLATEMGR_H + +//BibleTime include +#include "cswordmoduleinfo.h" + +//Qt includes +#include <qmap.h> +#include <qstring.h> +#include <qstringlist.h> + +//KDE includes +#include <klocale.h> + +/** + * Manages the display templates used in the filters and display classes. + * @author The BibleTime team +*/ + +class CDisplayTemplateMgr { + +public: + /** Settings which are used to fill the content into the template. + */ + + struct Settings { + /** Constructor. Constructs the new settings object. The default values are empty. + */ + Settings() { + title = QString::null; + langAbbrev = QString::null; + pageCSS_ID = QString::null; + pageDirection = QString("ltr"); + }; + + ListCSwordModuleInfo modules; /**< the list of modules */ + QString title; /**< the title which is used for the new processed HTML page */ + QString langAbbrev; /**< the language for the HTML page. */ + QString pageDirection; /**< the language for the HTML page. */ + QString pageCSS_ID; /**< the CSS ID which is used in the content part of the page */ + }; + + /** Available templates. + * @return The list of templates, which are available. + */ + inline const QStringList availableTemplates(); + /** Fill template. Fill rendered content into the template given by the name. + * @param name The name of the template + * @param content The content which should be filled into the template + * @param settings The settings which are used to process the templating process + * @return The full HTML template HTML code including the CSS data. + */ + const QString fillTemplate( const QString& name, const QString& content, Settings& settings); + /** Default template. + * @return The i18n'ed name of the default template + */ + inline static const QString defaultTemplate(); + +protected: + + friend class CPointers; + /** Display template manager constructor. Protected to just allow CPointers to create objects. + */ + CDisplayTemplateMgr(); + /** Destructor. + */ + ~CDisplayTemplateMgr(); + + void loadUserTemplates(); + +private: + void init(); + QMap<QString, QString> m_templateMap; +}; + +inline const QString CDisplayTemplateMgr::defaultTemplate() { + return i18n("Default"); +} + +/** + * CDisplayTemplateMgr::availableTemplates() + */ +inline const QStringList CDisplayTemplateMgr::availableTemplates() { + return m_templateMap.keys(); +} + + + +#endif diff --git a/bibletime/backend/centrydisplay.cpp b/bibletime/backend/centrydisplay.cpp new file mode 100644 index 0000000..8fdcace --- /dev/null +++ b/bibletime/backend/centrydisplay.cpp @@ -0,0 +1,66 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "centrydisplay.h" + +#include "cswordkey.h" +#include "cswordversekey.h" +#include "cswordbookmoduleinfo.h" +#include "creferencemanager.h" +#include "cdisplaytemplatemgr.h" +#include "cdisplayrendering.h" + +#include "frontend/cbtconfig.h" + +#include "util/scoped_resource.h" + +//Qt includes +#include <qapplication.h> +#include <qregexp.h> + +using namespace Rendering; + +/** Returns the rendered text using the modules in the list and using the key parameter. + * The displayoptions and filter options are used, too. + */ +const QString CEntryDisplay::text( const ListCSwordModuleInfo& modules, const QString& keyName, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions ) { + CDisplayRendering render(displayOptions, filterOptions); + + //no highlighted key and no extra key link in the text + CTextRendering::KeyTreeItem::Settings normal_settings(false, CTextRendering::KeyTreeItem::Settings::CompleteShort); + CSwordModuleInfo* module = modules.first(); + QString result; + + //in Bibles and Commentaries we need to check if 0:0 and X:0 contain something + if (module->type() == CSwordModuleInfo::Bible || module->type() == CSwordModuleInfo::Commentary) { + ((VerseKey*)(module->module()->getKey()))->Headings(1); //HACK: enable headings for VerseKeys + + CSwordVerseKey k1(module); + k1.Headings(1); + k1.key(keyName); + + // don't print the key + CTextRendering::KeyTreeItem::Settings preverse_settings(false, CTextRendering::KeyTreeItem::Settings::NoKey); + + if (k1.Verse() == 1){ //X:1, prepend X:0 + if (k1.Chapter() == 1){ //1:1, also prepend 0:0 before that + k1.Chapter(0); + k1.Verse(0); + if ( k1.rawText().length() > 0 ) result.append( render.renderSingleKey(k1.key(), modules, preverse_settings ) ); + k1.Chapter(1); + } + k1.Verse(0); + if ( k1.rawText().length() > 0 ) result.append( render.renderSingleKey(k1.key(), modules, preverse_settings ) ); + } + } + return result.append( render.renderSingleKey(keyName, modules, normal_settings) ); +} diff --git a/bibletime/backend/centrydisplay.h b/bibletime/backend/centrydisplay.h new file mode 100644 index 0000000..141ed1d --- /dev/null +++ b/bibletime/backend/centrydisplay.h @@ -0,0 +1,53 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CENTRYDISPLAY_H +#define CENTRYDISPLAY_H + +//BibleTime includes +#include "ctextrendering.h" +#include "cswordmoduleinfo.h" +#include "cswordbackend.h" + +#include "util/cpointers.h" + +//Sword includes +#include <swdisp.h> + +//Qt includes +#include <qstring.h> + +class CSwordModuleInfo; + +namespace Rendering { + +/** +* The reimplementation of SWDisplay to fit our needs. +* @short Display implementation +* @author The BibleTime team +*/ + +class CEntryDisplay : public sword::SWDisplay, public CPointers { + +public: + virtual ~CEntryDisplay() {} + + /** + * Returns the rendered text using the modules in the list and using the key parameter. + * The displayoptions and filter options are used, too. + */ + virtual const QString text( const ListCSwordModuleInfo& modules, const QString& key, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions); +}; + + +} + +#endif diff --git a/bibletime/backend/chtmlexportrendering.cpp b/bibletime/backend/chtmlexportrendering.cpp new file mode 100644 index 0000000..a32d57c --- /dev/null +++ b/bibletime/backend/chtmlexportrendering.cpp @@ -0,0 +1,236 @@ +// +// C++ Implementation: chtmlexportrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +//Backend +#include "chtmlexportrendering.h" + +#include "cdisplaytemplatemgr.h" +#include "clanguagemgr.h" +#include "cswordkey.h" +#include "cswordversekey.h" +#include "cswordmoduleinfo.h" + +//Util +#include "util/cpointers.h" +#include "util/scoped_resource.h" + +//KDE includes +#include <klocale.h> + +namespace Rendering { + + CHTMLExportRendering::CHTMLExportRendering(const CHTMLExportRendering::Settings& settings, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions) +: m_displayOptions(displayOptions), + m_filterOptions(filterOptions), + m_settings(settings) {} + + CHTMLExportRendering::~CHTMLExportRendering() {} + + const QString CHTMLExportRendering::renderEntry( const KeyTreeItem& i, CSwordKey* k) { + // qDebug("CHTMLExportRendering::renderEntry"); + + if (i.hasAlternativeContent()) { + QString ret; + ret.setLatin1(i.settings().highlight ? "<div class=\"currententry\">" : "<div class=\"entry\">"); + ret.append(i.getAlternativeContent()); + + // Q_ASSERT(i.hasChildItems()); + + if (i.hasChildItems()) { + KeyTree const * tree = i.childList(); + + const ListCSwordModuleInfo& modules( tree->collectModules() ); + + if (modules.count() == 1) { //insert the direction into the sorrounding div + ret.insert( 5, QString("dir=\"%1\" ").arg((modules.first()->textDirection() == CSwordModuleInfo::LeftToRight) ? "ltr" : "rtl" )); + } + + for ( KeyTreeItem* c = tree->first(); c; c = tree->next() ) { + ret.append( renderEntry( *c ) ); + } + } + + ret.append("</div>"); + return ret; //WARNING: Return already here! + } + + + const ListCSwordModuleInfo& modules( i.modules() ); + + Q_ASSERT(modules.count() >= 1); + + util::scoped_ptr<CSwordKey> scoped_key( !k ? CSwordKey::createInstance(modules.first()) : 0 ); + + CSwordKey* key = k ? k : scoped_key; + + Q_ASSERT(key); + + CSwordVerseKey* myVK = dynamic_cast<CSwordVerseKey*>(key); + + if ( myVK ) { + myVK->Headings(1); + } + + QString renderedText( (modules.count() > 1) ? "<tr>" : "" ); + + if (modules.count() == 0) { + return QString(""); //no module present for rendering + } + + // Only insert the table stuff if we are displaying parallel. + // Otherwise, strip out he table stuff -> the whole chapter will be rendered in one cell! + + //declarations out of the loop for optimization + QString entry; + + QString keyText; + + bool isRTL; + + //taken out of the loop for optimization + QString preverseHeading; + + QString langAttr; + + ListCSwordModuleInfo::const_iterator end_modItr = modules.end(); + + for (ListCSwordModuleInfo::const_iterator mod_Itr(modules.begin()); mod_Itr != end_modItr; ++mod_Itr) { + key->module(*mod_Itr); + key->key( i.key() ); + + keyText = key->key(); + isRTL = ((*mod_Itr)->textDirection() == CSwordModuleInfo::RightToLeft); + entry = QString::null; + + if ((*mod_Itr)->language()->isValid()) { + langAttr.setLatin1("xml:lang=\"") + .append((*mod_Itr)->language()->abbrev()) + .append("\" lang=\"") + .append((*mod_Itr)->language()->abbrev()) + .append("\""); + } + else { + langAttr.setLatin1("xml:lang=\"") + .append((*mod_Itr)->module()->Lang()) + .append("\" lang=\"") + .append((*mod_Itr)->module()->Lang()) + .append("\""); + } + + const QString key_renderedText = key->renderedText(); + + // qWarning(key_renderedText.latin1()); + + if (m_filterOptions.headings) { + AttributeValue::const_iterator it = + (*mod_Itr)->module()->getEntryAttributes()["Heading"]["Preverse"].begin(); + const AttributeValue::const_iterator end = + (*mod_Itr)->module()->getEntryAttributes()["Heading"]["Preverse"].end(); + + for (; it != end; ++it) { + preverseHeading = QString::fromUtf8(it->second.c_str()); + + //TODO: Take care of the heading type! + + if (!preverseHeading.isEmpty()) { + entry.append("<div ") + .append(langAttr) + .append(" class=\"sectiontitle\">") + .append(preverseHeading) + .append("</div>"); + } + } + } + + entry.append(m_displayOptions.lineBreaks ? "<div " : "<span "); + + if (modules.count() == 1) { //insert only the class if we're not in a td + entry.append( i.settings().highlight ? "class=\"currententry\" " : "class=\"entry\" " ); + } + + entry.append(langAttr).append(isRTL ? " dir=\"rtl\"" : " dir=\"ltr\"").append(">"); + + //keys should normally be left-to-right, but this doesn't apply in all cases + entry.append("<span class=\"entryname\" dir=\"ltr\">").append(entryLink(i, *mod_Itr)).append("</span>"); + + if (m_settings.addText) { + //entry.append( QString::fromLatin1("<span %1>%2</span>").arg(langAttr).arg(key_renderedText) ); + entry.append( key_renderedText ); + } + + if (i.hasChildItems()) { + KeyTree const * tree = i.childList(); + + for (KeyTreeItem* c = tree->first(); c; c = tree->next()) { + entry.append( renderEntry(*c) ); + } + } + + entry.append(m_displayOptions.lineBreaks ? "</div>\n" : "</span>\n"); + + if (modules.count() == 1) { + renderedText.append( entry ); + } + else { + renderedText.append("<td class=\"") + .append(i.settings().highlight ? "currententry" : "entry") + .append("\" ") + .append(langAttr) + .append(" dir=\"") + .append(isRTL ? "rtl" : "ltr") + .append("\">") + .append(entry) + .append("</td>\n"); + } + } + + if (modules.count() > 1) { + renderedText.append("</tr>\n"); + } + + // qDebug("CHTMLExportRendering: %s", renderedText.latin1()); + return renderedText; + } + + void CHTMLExportRendering::initRendering() { + CPointers::backend()->setDisplayOptions( m_displayOptions ); + CPointers::backend()->setFilterOptions( m_filterOptions ); + } + + const QString CHTMLExportRendering::finishText( const QString& text, KeyTree& tree ) { + ListCSwordModuleInfo modules = tree.collectModules(); + + const CLanguageMgr::Language* const lang = modules.first()->language(); + + CDisplayTemplateMgr* tMgr = CPointers::displayTemplateManager(); + CDisplayTemplateMgr::Settings settings; + settings.modules = modules; + settings.langAbbrev = ((modules.count() == 1) && lang->isValid()) + ? lang->abbrev() + : "unknown"; + settings.pageDirection = (modules.count() == 1) + ? ((modules.first()->textDirection() == CSwordModuleInfo::LeftToRight) ? "ltr" : "rtl") + : QString::null; + + return tMgr->fillTemplate(i18n("Export"), text, settings); + } + + /*! + \fn CHTMLExportRendering::entryLink( KeyTreeItem& item ) + */ + const QString CHTMLExportRendering::entryLink( const KeyTreeItem& item, CSwordModuleInfo* ) { + return item.key(); + } + +} + +; //end of namespace "Rendering" diff --git a/bibletime/backend/chtmlexportrendering.h b/bibletime/backend/chtmlexportrendering.h new file mode 100644 index 0000000..0526df9 --- /dev/null +++ b/bibletime/backend/chtmlexportrendering.h @@ -0,0 +1,60 @@ +// +// C++ Interface: chtmlexportrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef RENDERINGCHTMLEXPORTRENDERING_H +#define RENDERINGCHTMLEXPORTRENDERING_H + +#include "cswordbackend.h" +#include "ctextrendering.h" + +#include "frontend/cbtconfig.h" + +namespace Rendering { + + /** + * This CTextRenerding implementation + * creates HTML specially made for export as HTML files. + * @short HTML rendering for export. + * @author The BibleTime team + */ + +class CHTMLExportRendering : public CTextRendering { + +public: + struct Settings { + Settings(const bool text = true) { + addText = text; + }; + + bool addText; + }; + + CHTMLExportRendering( + const Settings& settings, + CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults(), + CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults() + ); + virtual ~CHTMLExportRendering(); + +protected: + virtual const QString renderEntry( const KeyTreeItem&, CSwordKey* = 0 ); + virtual const QString finishText( const QString&, KeyTree& tree ); + virtual const QString entryLink( const KeyTreeItem& item, CSwordModuleInfo* module ); + virtual void initRendering(); + + CSwordBackend::DisplayOptions m_displayOptions; + CSwordBackend::FilterOptions m_filterOptions; + Settings m_settings; +}; + +} + +#endif diff --git a/bibletime/backend/clanguagemgr.cpp b/bibletime/backend/clanguagemgr.cpp new file mode 100644 index 0000000..ef05b3e --- /dev/null +++ b/bibletime/backend/clanguagemgr.cpp @@ -0,0 +1,499 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#include "clanguagemgr.h" + +#include "cswordmoduleinfo.h" +#include "cswordbackend.h" + +#include "util/cpointers.h" + + +//Qt includes +#include <qptrlist.h> + +//KDE includes +#include <klocale.h> + +//initialize static language list +CLanguageMgr::LanguageList CLanguageMgr::m_langList; +CLanguageMgr::LanguageList CLanguageMgr::m_cleanupLangPtrs; + +CLanguageMgr::Language::Language() : m_altAbbrevs(0) { + m_abbrev = QString::null; + m_englishName = QString::null; + m_translatedName = QString::null; +}; + +CLanguageMgr::Language::Language(const Language& l) { + m_abbrev = l.m_abbrev; + m_englishName = l.m_englishName; + m_translatedName = l.m_translatedName; + + if (l.m_altAbbrevs) { //copy alternative abbrevs in a new list + m_altAbbrevs = new QStringList(*l.m_altAbbrevs); + //*m_altAbbrevs = *l.m_altAbbrevs; + } + else { + m_altAbbrevs = 0; + } +} + +CLanguageMgr::Language::Language( const QString& abbrev, const QString& name, const QString& translatedName, const QStringList& altAbbrevs ) : m_altAbbrevs(0) { + m_abbrev = abbrev; + m_englishName = name; + m_translatedName = translatedName; + + if (altAbbrevs.count() > 0) { + m_altAbbrevs = new QStringList(); + *m_altAbbrevs = altAbbrevs; + } +}; + +CLanguageMgr::Language::~Language() { + delete m_altAbbrevs; +}; + + +/****************************************************/ +/******************** CLanguageMgr ******************/ +/****************************************************/ +CLanguageMgr::CLanguageMgr() : m_langMap(0) { + m_availableModulesCache.moduleCount = 0; + + init(); +} + +CLanguageMgr::~CLanguageMgr() { + m_cleanupLangPtrs.setAutoDelete(true); + m_cleanupLangPtrs.clear(); + + m_langList.setAutoDelete(true); + m_langList.clear(); +} + +const CLanguageMgr::LangMap& CLanguageMgr::availableLanguages() { + ListCSwordModuleInfo mods = CPointers::backend()->moduleList(); + + if ( m_availableModulesCache.moduleCount != mods.count() ) { //we have to refill the cached map + m_availableModulesCache.availableLanguages.clear(); + m_availableModulesCache.moduleCount = mods.count(); + + //collect the languages abbrevs of all modules + QStrList abbrevs; + char *abbrev; + + ListCSwordModuleInfo::iterator end_it = mods.end(); + + for (ListCSwordModuleInfo::iterator it(mods.begin()); it != end_it; ++it) { + // for (CSwordModuleInfo* m = mods.first(); m; m = mods.next()) { + abbrev = (*it)->module()->Lang(); + + if (abbrev && !abbrevs.contains(abbrev)) { + abbrevs.append( abbrev ); + } + }; + + //now create a map of available langs + for ( abbrev = abbrevs.first(); abbrev; abbrev = abbrevs.next() ) { + const Language* const lang = languageForAbbrev(abbrev); + + if (lang->isValid()) { + m_availableModulesCache.availableLanguages.insert( abbrev, lang ); + } + else { //invalid lang used by a modules, create a new language using the abbrev + Language* newLang = new Language(abbrev, abbrev, abbrev); + m_cleanupLangPtrs.append(newLang); + + m_availableModulesCache.availableLanguages.insert( abbrev, newLang ); + } + }; + } + + return m_availableModulesCache.availableLanguages; +}; + +const CLanguageMgr::Language* const CLanguageMgr::languageForAbbrev( const QString& abbrev ) const { + Language* lang = m_langMap.find(abbrev); + + if (lang) { + return lang; + } + + //try to search in the alternative abbrevs + //const LangMapIterator end = m_langMap.constEnd(); + for ( LangMapIterator it( m_langMap ); it.current(); ++it ) { + if (it.current()->alternativeAbbrevs() && it.current()->alternativeAbbrevs()->contains(abbrev)) { + return it.current(); + } + } + + // Invalid lang used by a modules, create a new language using the abbrev + Language* newLang = new Language(abbrev, abbrev, abbrev); //return a language which holds the valid abbrev + m_cleanupLangPtrs.append(newLang); + + return newLang; +}; + +const CLanguageMgr::Language* const CLanguageMgr::languageForName( const QString& name ) const { + for ( LangMapIterator it( m_langMap ); it.current(); ++it ) { + if (it.current()->name() == name) { + return it.current(); + } + } + + return &m_defaultLanguage;//invalid language +}; + +const CLanguageMgr::Language* const CLanguageMgr::languageForTranslatedName( const QString& name ) const { + for ( LangMapIterator it( m_langMap ); it.current(); ++it ) { + if (it.current()->translatedName() == name) { + return it.current(); + } + } + + return &m_defaultLanguage; //invalid language +}; + +void CLanguageMgr::init() { + //if we've already inserted all items we do not proceed + + if (m_langMap.count() > 0) { + return; + } + + /* + * Chris explained in an eMail how language codes are build: + + Preference order for locale codes are: + + ISO 639-1 + ISO 639-2 + Ethnologue (http://www.ethnologue.org/) + + We intend to always follow OSIS locale conventions, which state that + Ethnologue codes will be encoded in the format x-E-??? where ??? + represents the 3-letter Ethnologue code in capital letters (though + capitalization really doesn't matter here). + + Some older modules maintain a former format for Ethnolgoue codes of + xx-???, including the AleWiesler module. + + --Chris + + */ + + // m_langList.append( new Language("aa" , "Afar" , i18n("Afar")) ); + // m_langList.append( new Language("ab" , "Abkhazian" , i18n("Abkhazian")) ); + // m_langList.append( new Language("ae" , "Avestan" , i18n("Avestan")) ); + m_langList.append( new Language("af" , "Afrikaans" , i18n("Afrikaans")) ); + + // m_langList.append( new Language("am" , "Amharic" , i18n("Amharic")) ); + m_langList.append( new Language("ang", "English, Old (ca.450-1100)", i18n("English, Old (ca.450-1100)")) ); + + m_langList.append( new Language("ar" , "Arabic" , i18n("Arabic")) ); + + // m_langList.append( new Language("as" , "Assamese" , i18n("Assamese")) ); + m_langList.append( new Language("az" , "Azerbaijani" , i18n("Azerbaijani")) ); + + // m_langList.append( new Language("ba" , "Bashkir" , i18n("Bashkir")) ); + m_langList.append( new Language("be" , "Belarusian" , i18n("Belarusian")) ); + + m_langList.append( new Language("bg" , "Bulgarian" , i18n("Bulgarian")) ); + + // m_langList.append( new Language("bh" , "Bihari" , i18n("Bihari")) ); + // m_langList.append( new Language("bi" , "Bislama" , i18n("Bislama")) ); + // m_langList.append( new Language("bn" , "Bengali" , i18n("Bengali")) ); + // m_langList.append( new Language("bo" , "Tibetan" , i18n("Tibetan")) ); + m_langList.append( new Language("br" , "Breton" , i18n("Breton")) ); + + m_langList.append( new Language("bs" , "Bosnian" , i18n("Bosnian")) ); + + m_langList.append( new Language("ca" , "Catalan" , i18n("Catalan")) ); + + // m_langList.append( new Language("ce" , "Chechen" , i18n("Chechen")) ); + m_langList.append( new Language("ceb" , "Cebuano" , i18n("Cebuano")) ); + + m_langList.append( new Language("ch" , "Chamorro" , i18n("Chamorro")) ); + + // m_langList.append( new Language("co" , "Corsican" , i18n("Corsican")) ); + m_langList.append( new Language("cop" , "Coptic" , i18n("Coptic")) ); + + m_langList.append( new Language("cs" , "Czech" , i18n("Czech")) ); + + m_langList.append( new Language("cu" , "Church Slavic" , i18n("Church Slavic")) ); + + // m_langList.append( new Language("cv" , "Chuvash" , i18n("Chuvash")) ); + m_langList.append( new Language("cy" , "Welsh" , i18n("Welsh")) ); + + m_langList.append( new Language("da" , "Danish" , i18n("Danish")) ); + + m_langList.append( new Language("de" , "German" , i18n("German")) ); + + // m_langList.append( new Language("dz" , "Dzongkha" , i18n("Dzongkha")) ); + + m_langList.append( new Language("el" , "Greek, Modern (1453-)" , i18n("Greek, Modern (1453-)"), makeStringList("gre;ell")) ); + + m_langList.append( new Language("en" , "English" , i18n("English")) ); + + m_langList.append( new Language("en_US","American English" , i18n("American English")) ); + + m_langList.append( new Language("enm" , "English, Middle (1100-1500)", i18n("English, Middle (1100-1500)")) ); + + m_langList.append( new Language("eo" , "Esperanto" , i18n("Esperanto")) ); + + m_langList.append( new Language("es" , "Spanish" , i18n("Spanish")) ); + + m_langList.append( new Language("et" , "Estonian" , i18n("Estonian")) ); + + m_langList.append( new Language("eu" , "Basque" , i18n("Basque")) ); + + // m_langList.append( new Language("fa" , "Persian" , i18n("Persian")) ); + m_langList.append( new Language("fi" , "Finnish" , i18n("Finnish")) ); + + // m_langList.append( new Language("fj" , "Fijian" , i18n("Fijian")) ); + // m_langList.append( new Language("fo" , "Faroese" , i18n("Faroese")) ); + m_langList.append( new Language("fr" , "French" , i18n("French")) ); + + m_langList.append( new Language("fy" , "Frisian" , i18n("Frisian")) ); + + m_langList.append( new Language("ga" , "Irish" , i18n("Irish")) ); + + m_langList.append( new Language("gd" , "Gaelic (Scots)", i18n("Gaelic (Scots)")) ); + + // m_langList.append( new Language("gl" , "Gallegan" , i18n("Gallegan")) ); + // m_langList.append( new Language("gn" , "Guarani" , i18n("Guarani")) ); + // m_langList.append( new Language("gn" , "Gujarati" , i18n("Gujarati")) ); + m_langList.append( new Language("got" , "Gothic" , i18n("Gothic")) ); + + m_langList.append( new Language("gv" , "Manx" , i18n("Manx")) ); + + m_langList.append( new Language("grc" , "Greek, Ancient (to 1453)" , i18n("Greek, Ancient (to 1453)")) ); + + m_langList.append( new Language("he" , "Hebrew" , i18n("Hebrew")) ); + + m_langList.append( new Language("hau" , "Hausa" , i18n("Hausa")) ); + + m_langList.append( new Language("haw" , "Hawaiian" , i18n("Hawaiian")) ); + + // m_langList.append( new Language("hi" , "Hindi" , i18n("Hindi")) ); + // m_langList.append( new Language("ho" , "Hiri Motu" , i18n("Hiri Motu")) ); + m_langList.append( new Language("hr" , "Croatian" , i18n("Croatian")) ); + + m_langList.append( new Language("hu" , "Hungarian" , i18n("Hungarian")) ); + + m_langList.append( new Language("hy" , "Armenian" , i18n("Armenian")) ); + + // m_langList.append( new Language("hz" , "Herero" , i18n("Herero")) ); + + // m_langList.append( new Language("ia" , "Interlingua" , i18n("Interlingua")) ); + m_langList.append( new Language("id" , "Indonesian" , i18n("Indonesian")) ); + + // m_langList.append( new Language("ie" , "Interlingue" , i18n("Interlingue")) ); + // m_langList.append( new Language("ik" , "Inupiaq" , i18n("Inupiaq")) ); + m_langList.append( new Language("is" , "Icelandic" , i18n("Icelandic")) ); + + m_langList.append( new Language("it" , "Italian" , i18n("Italian")) ); + + // m_langList.append( new Language("iu" , "Inuktitut" , i18n("Inuktitut")) ); + + m_langList.append( new Language("ja" , "Japanese" , i18n("Japanese")) ); + + m_langList.append( new Language("ka" , "Georgian" , i18n("Georgian")) ); + + // m_langList.append( new Language("x-E-KAB" , "Kabyle" , i18n("Kabyle")) ); + // m_langList.append( new Language("ki" , "Kikuyu" , i18n("Kikuyu")) ); + // m_langList.append( new Language("kj" , "Kuanyama" , i18n("Kuanyama")) ); + // m_langList.append( new Language("kk" , "Kazakh" , i18n("Kazakh")) ); + // m_langList.append( new Language("kl" , "Kalaallisut" , i18n("Kalaallisut")) ); + // m_langList.append( new Language("km" , "Khmer" , i18n("Khmer")) ); + // m_langList.append( new Language("kn" , "Kannada" , i18n("Kannada")) ); + m_langList.append( new Language("ko" , "Korean" , i18n("Korean")) ); + + // m_langList.append( new Language("ks" , "Kashmiri" , i18n("Kashmiri")) ); + m_langList.append( new Language("ku" , "Kurdish" , i18n("Kurdish")) ); + + // m_langList.append( new Language("kv" , "Komi" , i18n("Komi")) ); + // m_langList.append( new Language("kw" , "Cornish" , i18n("Cornish")) ); + m_langList.append( new Language("ky" , "Kirghiz" , i18n("Kirghiz")) ); + + m_langList.append( new Language("la" , "Latin" , i18n("Latin")) ); + + // m_langList.append( new Language("lb" , "Letzeburgesch" , i18n("Letzeburgesch")) ); + // m_langList.append( new Language("ln" , "Lingala" , i18n("Lingala")) ); + // m_langList.append( new Language("lo" , "Lao" , i18n("Lao")) ); + m_langList.append( new Language("lt" , "Lithuanian" , i18n("Lithuanian")) ); + + m_langList.append( new Language("lv" , "Latvian" , i18n("Latvian")) ); + + // m_langList.append( new Language("mg" , "Malagasy" , i18n("Malagasy")) ); + // m_langList.append( new Language("mh" , "Marshall" , i18n("Marshall")) ); + m_langList.append( new Language("mi" , "Maori" , i18n("Maori")) ); + + m_langList.append( new Language("mk" , "Macedonian" , i18n("Macedonian")) ); + + // m_langList.append( new Language("ml" , "Malayalam" , i18n("Malayalam")) ); + // m_langList.append( new Language("mn" , "Mongolian" , i18n("Mongolian")) ); + // m_langList.append( new Language("mo" , "Moldavian" , i18n("Moldavian")) ); + m_langList.append( new Language("mos" , "More" , i18n("More")) ); + + // m_langList.append( new Language("mr" , "Marathi" , i18n("Marathi")) ); + m_langList.append( new Language("ms" , "Malay" , i18n("Malay")) ); + + m_langList.append( new Language("mt" , "Maltese" , i18n("Maltese")) ); + + // m_langList.append( new Language("my" , "Burmese" , i18n("Burmese")) ); + + // m_langList.append( new Language("na" , "Nauru" , i18n("Nauru")) ); + // m_langList.append( new Language("nb" , "Norwegian Bokmål" , i18n("Norwegian Bokmål")) ); + // m_langList.append( new Language("nd" , "Ndebele, North" , i18n("Ndebele, North")) ); + m_langList.append( new Language("nds" , "Low German; Low Saxon" , i18n("Low German; Low Saxon")) ); + + // m_langList.append( new Language("ne" , "Nepali" , i18n("Nepali")) ); + // m_langList.append( new Language("ng" , "Ndonga" , i18n("Ndonga")) ); + m_langList.append( new Language("nl" , "Dutch" , i18n("Dutch")) ); + + // m_langList.append( new Language("nn" , "Norwegian Nynorsk" , i18n("Norwegian Nynorsk")) ); + m_langList.append( new Language("no" , "Norwegian" , i18n("Norwegian")) ); + + // m_langList.append( new Language("nr" , "Ndebele, South" , i18n("Ndebele, South")) ); + // m_langList.append( new Language("nv" , "Navajo" , i18n("Navajo")) ); + // m_langList.append( new Language("ny" , "Chichewa; Nyanja" , i18n("Chichewa; Nyanja")) ); + + // m_langList.append( new Language("oc" , "Occitan (post 1500); Provençal" , i18n("Occitan (post 1500); Provençal")) ); + // m_langList.append( new Language("om" , "Oromo" , i18n("Oromo")) ); + // m_langList.append( new Language("or" , "Oriya" , i18n("Oriya")) ); + // m_langList.append( new Language("os" , "Ossetian; Ossetic" , i18n("Ossetian; Ossetic")) ); + + // m_langList.append( new Language("pa" , "Panjabi" , i18n("Panjabi")) ); + m_langList.append( new Language("pap" , "Papiamento" , i18n("Papiamento")) ); + + // m_langList.append( new Language("pi" , "Pali" , i18n("Pali")) ); + m_langList.append( new Language("pl" , "Polish" , i18n("Polish")) ); + + // m_langList.append( new Language("ps" , "Pushto" , i18n("Pushto")) ); + m_langList.append( new Language("pt" , "Portuguese" , i18n("Portuguese")) ); + + m_langList.append( new Language("pt_BR" , "Brasilian Portuguese" , i18n("Brasilian Portuguese")) );//added by ourself + + // m_langList.append( new Language("qu" , "Quechua" , i18n("Quechua")) ); + + // m_langList.append( new Language("rm" , "Raeto-Romance" , i18n("Raeto-Romance")) ); + // m_langList.append( new Language("rn" , "Rundi" , i18n("Rundi")) ); + + m_langList.append( new Language("ro" , "Romanian" , i18n("Romanian")) ); + + m_langList.append( new Language("ru" , "Russian" , i18n("Russian")) ); + + // m_langList.append( new Language("rw" , "Kinyarwanda" , i18n("Kinyarwanda")) ); + + // m_langList.append( new Language("sa" , "Sanskrit" , i18n("Sanskrit")) ); + // m_langList.append( new Language("sc" , "Sardinian" , i18n("Sardinian")) ); + m_langList.append( new Language("sco" , "Scots" , i18n("Scots")) ); + + // m_langList.append( new Language("sd" , "Sindhi" , i18n("Sindhi")) ); + // m_langList.append( new Language("se" , "Northern Sami" , i18n("Northern Sami")) ); + // m_langList.append( new Language("sg" , "Sango" , i18n("Sango")) ); + // m_langList.append( new Language("si" , "Sinhalese" , i18n("Sinhalese")) ); + m_langList.append( new Language("sk" , "Slovak" , i18n("Slovak")) ); + + m_langList.append( new Language("sl" , "Slovenian" , i18n("Slovenian")) ); + + // m_langList.append( new Language("sm" , "Samoan" , i18n("Samoan")) ); + // m_langList.append( new Language("sn" , "Shona" , i18n("Shona")) ); + m_langList.append( new Language("so" , "Somali" , i18n("Somali")) ); + + m_langList.append( new Language("sq" , "Albanian" , i18n("Albanian")) ); + + // m_langList.append( new Language("sr" , "Serbian" , i18n("Serbian")) ); + // m_langList.append( new Language("ss" , "Swati" , i18n("Swati")) ); + // m_langList.append( new Language("st" , "Sotho, Southern" , i18n("Sotho, Southern")) ); + // m_langList.append( new Language("su" , "Sundanese" , i18n("Sundanese")) ); + m_langList.append( new Language("sv" , "Swedish" , i18n("Swedish")) ); + + m_langList.append( new Language("sw" , "Swahili" , i18n("Swahili")) ); + + m_langList.append( new Language("syr" , "Syriac" , i18n("Syriac")) ); + + m_langList.append( new Language("ta" , "Tamil" , i18n("Tamil")) ); + + // m_langList.append( new Language("te" , "Telugu" , i18n("Telugu")) ); + // m_langList.append( new Language("tg" , "Tajik" , i18n("Tajik")) ); + m_langList.append( new Language("th" , "Thai" , i18n("Thai")) ); + + // m_langList.append( new Language("tk" , "Turkmen" , i18n("Turkmen")) ); + m_langList.append( new Language("tl" , "Tagalog" , i18n("Tagalog")) ); + + m_langList.append( new Language("tn" , "Tswana" , i18n("Tswana")) ); + + m_langList.append( new Language("tr" , "Turkish" , i18n("Turkish")) ); + + // m_langList.append( new Language("ts" , "Tsonga" , i18n("Tsonga")) ); + // m_langList.append( new Language("tt" , "Tatar" , i18n("Tatar")) ); + // m_langList.append( new Language("tw" , "Twi" , i18n("Twi")) ); + m_langList.append( new Language("ty" , "Tahitian" , i18n("Tahitian")) ); + + // + // m_langList.append( new Language("ug" , "Uighur" , i18n("Uighur")) ); + m_langList.append( new Language("uk" , "Ukrainian" , i18n("Ukrainian")) ); + + // m_langList.append( new Language("ur" , "Urdu" , i18n("Urdu")) ); + // m_langList.append( new Language("uz" , "Uzbek" , i18n("Uzbek")) ); + + m_langList.append( new Language("vi" , "Vietnamese" , i18n("Vietnamese")) ); + + // m_langList.append( new Language("vo" , "Volapük" , i18n("Volapük")) ); + // + // m_langList.append( new Language("wo" , "Wolof" , i18n("Wolof")) ); + + m_langList.append( new Language("xh" , "Xhosa" , i18n("Xhosa")) ); + + m_langList.append( new Language("x-E-BAR" , "Bavarian" , i18n("Bavarian")) ); + + m_langList.append( new Language("x-E-DJE" , "Zarma" , i18n("Zarma")) ); + + m_langList.append( new Language("x-E-GSW" , "Alemannisch" , i18n("Alemannisch")) ); + + m_langList.append( new Language("x-E-HAT" , "Haitian Creole French" , i18n("Haitian Creole French")) ); + + m_langList.append( new Language("x-E-ITZ" , QString::fromUtf8("Itzá") , i18n("Itzá")) ); + + m_langList.append( new Language("x-E-JIV" , "Shuar" , i18n("Shuar")) ); + + m_langList.append( new Language("x-E-KEK" , QString::fromUtf8("Kekchí") , i18n("Kekchí")) ); + + m_langList.append( new Language("x-E-KAB" , "Kabyle" , i18n("Kabyle")) ); + + m_langList.append( new Language("x-E-LMO" , "Lombard" , i18n("Lombard")) ); + + m_langList.append( new Language("x-E-MKJ" , "Macedonian" , i18n("Macedonian")) ); + + m_langList.append( new Language("x-E-PDG" , "Tok Pisin" , i18n("Tok Pisin")) ); + + m_langList.append( new Language("x-E-PPK" , "Uma" , i18n("Uma")) ); + + m_langList.append( new Language("x-E-RMY" , "Romani, Vlax" , i18n("Romani, Vlax")) ); + + m_langList.append( new Language("x-E-SAJ" , "Sango" , i18n("Sango")) ); + + m_langList.append( new Language("x-E-SRN" , "Sranan" , i18n("Sranan")) ); + + // m_langList.append( new Language("yi" , "Yiddish" , i18n("Yiddish")) ); + // + // m_langList.append( new Language("za" , "Zhuang" , i18n("Zhuang")) ); + m_langList.append( new Language("zh" , "Chinese" , i18n("Chinese")) ); + + m_langList.append( new Language("zu" , "Zulu" , i18n("Zulu")) ); + + for ( Language* lang = m_langList.first(); lang; lang = m_langList.next() ) { + m_langMap.insert( lang->abbrev(), lang); + }; +}; diff --git a/bibletime/backend/clanguagemgr.h b/bibletime/backend/clanguagemgr.h new file mode 100644 index 0000000..2acc4c7 --- /dev/null +++ b/bibletime/backend/clanguagemgr.h @@ -0,0 +1,172 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CLANGUAGEMGR_H +#define CLANGUAGEMGR_H + +//Qt includes +#include <qstring.h> +#include <qstringlist.h> +#include <qvaluelist.h> +#include <qmap.h> +#include <qdict.h> + +/** Manages the anguages of BibleTime and provides functions to work with them. + * @author The BibleTime team + */ + +class CLanguageMgr { + +public: + /** Language container. + * This class (Language) contains the information about the chosen language. + */ + class Language { + public: + /** Default constructor of a language object. + * Uses the abbreviation parameter to lookup the + * language name and to be able to return the name, flag etc. + * Possible values for abbrev are de, en, fr, it etc. + */ + Language(); + /** Copy constructor. + */ + Language(const Language&); + /** Constructor which takes all necessary data. + */ + Language(const QString& abbrev, const QString& englishName, const QString& translatedName, const QStringList& altAbbrevs = QStringList()); + /** Destructor. + */ + ~Language(); + /** Returns the abbreviation. + * @return The abbreviation of the chosen language. + */ + inline const QString& abbrev() const; + /** Returns the translated name. + * @return The translated name of the language. + */ + inline const QString& translatedName() const; + //always define inlines in the header file, or make them not inline. + /** The english name of the language. + * @return The english name of the chosen language. + */ + inline const QString& name() const { + return m_englishName; + } + + /** The alternative abbreviations which are avalable for this language. + * @return A pointer to the list of alternate abbreviations + */ + inline const QStringList* const alternativeAbbrevs() const { + return m_altAbbrevs; + }; + + /** + * Returns true if this language object is valid, i.e. has an abbrev and name. + * @return True if the data is valid for this language. + */ + inline const bool isValid() const; + + private: + QString m_abbrev; + QString m_englishName; + QString m_translatedName; + QStringList* m_altAbbrevs; + }; + + typedef QPtrList<CLanguageMgr::Language> LanguageList; + + typedef QDict<Language> LangMap; + typedef QDictIterator<Language> LangMapIterator; + + /** Constructor. + */ + CLanguageMgr(); + /** Destructor + */ + virtual ~CLanguageMgr(); + /** + * Returns the standard languages available as standard. Does nothing for Sword. + * @return A QDict<Language> map which contains all known languages + */ + inline const CLanguageMgr::LangMap* const languages() const; + /** + * Returns the languages which are available. The languages cover all available modules, but nothing more. + * @return A map of all languages with modules available for them + */ + const CLanguageMgr::LangMap& availableLanguages(); + /** Language for abbreviation. + * @param abbrev The language abbreviation + * @return Pointer to a language for the given string abbreviation. + */ + const CLanguageMgr::Language* const languageForAbbrev( const QString& abbrev ) const; + /** Language for english name. + * @param abbrev The english language name. + * @return Pointer to a language for the given name + */ + const CLanguageMgr::Language* const languageForName( const QString& language ) const; + /** Language for translated language name. + * @param abbrev The translated language name + * @return Pointer to a language for the given translated language name + */ + const CLanguageMgr::Language* const languageForTranslatedName( const QString& language ) const; + /** Default language so we don't return NULL pointers. + * @return Pointer to the default language + */ + inline const CLanguageMgr::Language* const defaultLanguage() const; + +private: + void init(); + inline const QStringList makeStringList(const QString& abbrevs) { + return QStringList::split( ";", abbrevs, false ); + } + + mutable LangMap m_langMap; + Language m_defaultLanguage; + + //typedef QPtrList<CLanguageMgr::Language> LanguageList; + static LanguageList m_langList; + static LanguageList m_cleanupLangPtrs; + + struct ModuleCache { + unsigned int moduleCount; + LangMap availableLanguages; + } + m_availableModulesCache; +}; + + +/** Returns true if this language object is valid, i.e. has an abbrev and name. */ +inline const bool CLanguageMgr::Language::isValid() const { + return (!abbrev().isEmpty() && !name().isEmpty()); +} + +inline const QString& CLanguageMgr::Language::abbrev() const { + if (m_altAbbrevs && m_abbrev.isEmpty() && m_altAbbrevs->count()) { //no standard abbrev but alternative ones + return m_altAbbrevs->first(); + } + + return m_abbrev; +} + +inline const QString& CLanguageMgr::Language::translatedName() const { + return m_translatedName; +} + +inline const CLanguageMgr::LangMap* const CLanguageMgr::languages() const { + return &m_langMap; +} + +inline const CLanguageMgr::Language* const CLanguageMgr::defaultLanguage() const { + return &m_defaultLanguage; +} + +#endif diff --git a/bibletime/backend/cplaintextexportrendering.cpp b/bibletime/backend/cplaintextexportrendering.cpp new file mode 100644 index 0000000..37d0fa0 --- /dev/null +++ b/bibletime/backend/cplaintextexportrendering.cpp @@ -0,0 +1,58 @@ +// +// C++ Implementation: cplaintextexportrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +//Backend includes +#include "cplaintextexportrendering.h" +#include "cswordkey.h" + +//Util +#include "util/scoped_resource.h" + + + +namespace Rendering { + + CPlainTextExportRendering::CPlainTextExportRendering(const CPlainTextExportRendering::Settings& settings, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions) +: CHTMLExportRendering(settings, displayOptions, filterOptions) {} + + CPlainTextExportRendering::~CPlainTextExportRendering() {} + + const QString CPlainTextExportRendering::renderEntry( const KeyTreeItem& i, CSwordKey* ) { + if (!m_settings.addText) { + return QString(i.key()).append("\n"); + } + + ListCSwordModuleInfo modules = i.modules(); + util::scoped_ptr<CSwordKey> key( CSwordKey::createInstance(modules.first()) ); + QString renderedText = QString(i.key()).append(":\n"); + + QString entry; + // for (CSwordModuleInfo* m = modules.first(); m; m = modules.next()) { + ListCSwordModuleInfo::iterator end_it = modules.end(); + + for (ListCSwordModuleInfo::iterator it(modules.begin()); it != end_it; ++it) { + key->module(*it); + key->key( i.key() ); + + //ToDo: Check this code + entry.append(key->strippedText()).append("\n"); + renderedText.append( entry ); + } + + return renderedText; + } + + const QString CPlainTextExportRendering::finishText( const QString& oldText, KeyTree& ) { + return oldText; + } + +}; diff --git a/bibletime/backend/cplaintextexportrendering.h b/bibletime/backend/cplaintextexportrendering.h new file mode 100644 index 0000000..95a1cae --- /dev/null +++ b/bibletime/backend/cplaintextexportrendering.h @@ -0,0 +1,42 @@ +// +// C++ Interface: cplaintextexportrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef RENDERINGCPLAINTEXTEXPORTRENDERING_H +#define RENDERINGCPLAINTEXTEXPORTRENDERING_H + +#include "chtmlexportrendering.h" + +namespace Rendering { + + /** + * This implementation can be used to export content as plain text. + * @short Text rendering as plain text. + * @author The BibleTime team + */ + +class CPlainTextExportRendering : public CHTMLExportRendering { + +public: + CPlainTextExportRendering( + const Settings& settings, + CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults(), + CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults() + ); + virtual ~CPlainTextExportRendering(); + +protected: + virtual const QString renderEntry( const KeyTreeItem&, CSwordKey* = 0 ); + virtual const QString finishText( const QString&, KeyTree& tree ); + }; + +}; + +#endif diff --git a/bibletime/backend/creferencemanager.cpp b/bibletime/backend/creferencemanager.cpp new file mode 100644 index 0000000..7b41e7f --- /dev/null +++ b/bibletime/backend/creferencemanager.cpp @@ -0,0 +1,434 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#include "creferencemanager.h" +#include "cswordversekey.h" + +#include "../frontend/cbtconfig.h" + +//QT includes +#include <qregexp.h> + +//stl includes +#include <algorithm> // STL algorithms class library + +/** Returns a hyperlink used to be imbedded in the display windows. At the moment the format is sword://module/key */ +const QString CReferenceManager::encodeHyperlink( const QString moduleName, const QString key, const CReferenceManager::Type type) { + QString ret = QString::null; + + switch (type) { + + case Bible: + ret.setLatin1("sword://Bible/"); + break; + + case Commentary: + ret.setLatin1("sword://Commentary/"); + break; + + case Lexicon: + ret.setLatin1("sword://Lexicon/"); + break; + + case GenericBook: + ret.setLatin1("sword://Book/"); + break; + + case MorphHebrew: + ret.setLatin1("morph://Hebrew/"); + break; + + case MorphGreek: + ret.setLatin1("morph://Greek/"); + break; + + case StrongsHebrew: + ret.setLatin1("strongs://Hebrew/"); + break; + + case StrongsGreek: + ret.setLatin1("strongs://Greek/"); + break; + + default: + break; + } + + if (!moduleName.isEmpty()) { + ret.append( moduleName ).append('/'); + } + else { //if module is empty use fallback module + ret.append( preferredModule(type) ).append('/'); + } + + if (type == GenericBook) { + const QString s = (!key.isEmpty() ? key : QString::null); + QString newKey = QString::null; + //replace all / of the key (e.g. of a CSwordTreeKey) with + // the escape sequence \/ so we know it's a link internal divider (e.g. of CSwordTreeKey)! + + QChar c; + + for(unsigned int i = 0; i < s.length(); ++i) { + c = s.at(i); + + if (c == '/') { + newKey.append("\\/"); + } + else { + newKey.append(c); + } + } + + ret.append( newKey ); + } + else { //slashes do not appear in verses and dictionary entries + + switch (type) { + + case Bible: //bibles or commentary keys need parsing + + case Commentary: { +/* CSwordModuleInfo* mod = CPointers::backend()->findModuleByName(moduleName); + + ParseOptions options; + options.refDestinationModule = mod->name(); + options.refBase = + options.sourceLanguage = mod->module()->Lang(); + options.destinationLanguage = "en"; + + ret.append( parseVerseReference(key, options) ); //we add the english key, so drag and drop will work in all cases*/ + ret.append(key); + break; + } + + default: + ret.append( key ); //use the standard key, no parsing required + break; + } + } + + return ret; +} + +/** Decodes the given hyperlink to module and key. */ +const bool CReferenceManager::decodeHyperlink( const QString& hyperlink, QString& module, QString& key, CReferenceManager::Type& type ) { + /** + * We have to decide between three types of URLS: sword://Type/Module/Key, morph://Testament/key and strongs://Testament/Key + */ + module = QString::null; + key = QString::null; + + type = Unknown; //not yet known + QString ref = hyperlink; + //remove the trailing slash + + if (ref.right(1)=="/" && ref.right(2) != "\\/") //trailing slash, but not escaped + ref = ref.left(ref.length()-1); + + //find out which type we have by looking at the beginning (protocoll section of URL) + if (ref.left(8).lower() == "sword://") { //Bible, Commentary or Lexicon + ref = ref.mid(8); + + if (ref.left(5).lower() == "bible") { //a bible hyperlink + type = CReferenceManager::Bible; + ref = ref.mid(6); //inclusive trailing slash + } + else if (ref.left(10).lower() == "commentary") { // a Commentary hyperlink + type = CReferenceManager::Commentary; + ref = ref.mid(11); //inclusive trailing slash + } + else if (ref.left(7).lower() == "lexicon") { // a Lexicon hyperlink + type = CReferenceManager::Lexicon; + ref = ref.mid(8); //inclusive trailing slash + } + else if (ref.left(4).lower() == "book") { // a Book hyperlink + type = CReferenceManager::GenericBook; + ref = ref.mid(5); //inclusive trailing slash + } + + // string up to next slash is the modulename + if (ref.at(0) != '/' ) { //we have a module given + + while (true) { + const int pos = ref.find("/"); + + if ((pos>0) && ref.at(pos-1) != '\\') { //found a slash which is not escaped + module = ref.mid(0,pos); + ref = ref.mid(pos+1); + break; + } + else if (pos == -1) { + break; + } + } + + // the rest is the key + key = ref; + } + else { + key = ref.mid(1); + } + + //the key may be an osis key like "NASBLex:Moses", which sets the module, too + // const int modPos = key.find(":"); + // if (modPos != -1 && key.at(modPos-1).isLetter() && key.at(modPos+1).isLetter()) { + // module = key.left(modPos); + // key = key.mid(modPos+1); + // + // qWarning("found the module name %s with key %s", module.latin1(), key.latin1()); + // } + + //replace \/ escapes with / + key.replace(QRegExp("\\\\/"), "/"); + } + else if (ref.left(8).lower() == "morph://" || ref.left(10).lower() == "strongs://") { //strongs or morph URL have the same format + enum PreType {IsMorph, IsStrongs}; + PreType preType = IsMorph; + + if (ref.left(8).lower() == "morph://") { //morph code hyperlink + ref = ref.mid(8); + preType = IsMorph; + } + else if (ref.left(10).lower() == "strongs://") { + ref = ref.mid(10); + preType = IsStrongs; + } + + //part up to next slash is the language + const int pos = ref.find("/"); + + if (pos>0) { //found + const QString language = ref.mid(0,pos); + + if (language.lower() == "hebrew") { + switch (preType) { + + case IsMorph: + type = CReferenceManager::MorphHebrew; + break; + + case IsStrongs: + type = CReferenceManager::StrongsHebrew; + break; + } + } + else if (language.lower() == "greek") { + switch (preType) { + + case IsMorph: + type = CReferenceManager::MorphGreek; + break; + + case IsStrongs: + type = CReferenceManager::StrongsGreek; + break; + } + } + + ref = ref.mid(pos+1); + key = ref; //the remaining part is the key + + module = preferredModule(type); + } + } + + if (key.isEmpty() && module.isEmpty()) + return false; + + return true; +} + +const QString CReferenceManager::encodeReference(const QString &module, const QString &reference) { + //return QString("(%1)%2").arg(module).arg(reference); + return QString("(").append(module).append(")").append(reference); +} + +void CReferenceManager::decodeReference(QString &dragreference, QString &module, QString &reference) { + const int pos = dragreference.find(")"); + const QString fallbackModule = dragreference.mid( 1, pos - 1); + dragreference = dragreference.mid(pos+1); + + module = fallbackModule; + reference = dragreference; +} + +/** Returns true if the parameter is a hyperlink. */ +const bool CReferenceManager::isHyperlink( const QString& hyperlink ) { + return ( hyperlink.left(8) == "sword://") + || (hyperlink.left(10) == "strongs://") + || (hyperlink.left(8) == "morph://"); +} + +/** Returns the preferred module name for the given type. */ +const QString CReferenceManager::preferredModule( const CReferenceManager::Type type ) { + QString moduleName = QString::null; + CSwordModuleInfo* module = 0; + + switch (type) { + + case CReferenceManager::Bible: + + module = CBTConfig::get + ( CBTConfig::standardBible ); + + break; + + case CReferenceManager::Commentary: + module = CBTConfig::get + ( CBTConfig::standardCommentary ); + + break; + + case CReferenceManager::Lexicon: + module = CBTConfig::get + ( CBTConfig::standardLexicon ); + + break; + + case CReferenceManager::StrongsHebrew: + module = CBTConfig::get + ( CBTConfig::standardHebrewStrongsLexicon ); + + break; + + case CReferenceManager::StrongsGreek: + module = CBTConfig::get + ( CBTConfig::standardGreekStrongsLexicon ); + + break; + + case CReferenceManager::MorphHebrew: + module = CBTConfig::get + ( CBTConfig::standardHebrewMorphLexicon ); + + break; + + case CReferenceManager::MorphGreek: + module = CBTConfig::get + ( CBTConfig::standardGreekMorphLexicon ); + + break; + + default: + module = 0; + + break; + } + + return module ? module->name() : QString::null; +} + +/** No descriptions */ +CReferenceManager::Type CReferenceManager::typeFromModule( const CSwordModuleInfo::ModuleType type) { + switch (type) { + + case CSwordModuleInfo::Bible: + return CReferenceManager::Bible; + + case CSwordModuleInfo::Commentary: + return CReferenceManager::Commentary; + + case CSwordModuleInfo::Lexicon: + return CReferenceManager::Lexicon; + + case CSwordModuleInfo::GenericBook: + return CReferenceManager::GenericBook; + + default: + return CReferenceManager::Unknown; + } +} + +/** Parses the given verse references using the given language and the module.*/ +const QString CReferenceManager::parseVerseReference( const QString& ref, const CReferenceManager::ParseOptions& options) { + + CSwordModuleInfo* const mod = CPointers::backend()->findModuleByName(options.refDestinationModule); + Q_ASSERT(mod); + + if (!mod) { + //parsing of non-verse based references is not supported + return ref; + } + + if ((mod->type() != CSwordModuleInfo::Bible) && (mod->type() != CSwordModuleInfo::Commentary)) { + qDebug("CReferenceManager: Only verse based modules are supported as ref destination module"); + return QString::null; + } + + QString sourceLanguage = options.sourceLanguage; + QString destinationLanguage = options.destinationLanguage; + + StringList locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales(); + if (/*options.sourceLanguage == "en" ||*/ std::find(locales.begin(), locales.end(), sourceLanguage) == locales.end()) { //sourceLanguage not available + sourceLanguage = "en_US"; + } + + if (/*options.destinationLanguage == "en" ||*/ std::find(locales.begin(), locales.end(), sourceLanguage) == locales.end()) { //destination not available + destinationLanguage = "en_US"; + } + + + QString ret; + QStringList refList = QStringList::split(";", ref); + + CSwordVerseKey baseKey(0); + baseKey.setLocale( sourceLanguage.latin1() ); + baseKey.key( options.refBase ); //probably in the sourceLanguage + baseKey.setLocale( "en_US" ); //english works in all environments as base + +// CSwordVerseKey dummy(0); + //HACK: We have to workaround a Sword bug, we have to set the default locale to the same as the sourceLanguage ! + const QString oldLocaleName = CPointers::backend()->booknameLanguage(); + CPointers::backend()->booknameLanguage(sourceLanguage); + + VerseKey dummy; + dummy.setLocale( sourceLanguage.latin1() ); + Q_ASSERT( !strcmp(dummy.getLocale(), sourceLanguage.latin1()) ); + +// qDebug("Parsing '%s' in '%s' using '%s' as base, source lang '%s', dest lang '%s'", ref.latin1(), options.refDestinationModule.latin1(), baseKey.key().latin1(), sourceLanguage.latin1(), destinationLanguage.latin1()); + + for (QStringList::iterator it = refList.begin(); it != refList.end(); it++) { + //The listkey may contain more than one item, because a ref lik "Gen 1:3,5" is parsed into two single refs + ListKey lk = dummy.ParseVerseList((const char*)(*it).utf8(), (const char*)baseKey.key().utf8(), true); + Q_ASSERT(!dummy.Error()); + + Q_ASSERT(lk.Count()); + if (!lk.Count()) { + ret.append( *it ); //don't change the original + continue; + } + + for (int i = 0; i < lk.Count(); ++i) { + if (dynamic_cast<VerseKey*>(lk.getElement(i))) { // a range + VerseKey* k = dynamic_cast<VerseKey*>(lk.getElement(i)); + Q_ASSERT(k); + k->setLocale( destinationLanguage.latin1() ); + + ret.append( QString::fromUtf8(k->getRangeText()) ).append("; "); + } + else { // a single ref + VerseKey vk; + vk.setLocale( sourceLanguage.latin1() ); + vk = lk.getElement(i)->getText(); + vk.setLocale( destinationLanguage.latin1() ); + + ret.append( QString::fromUtf8(vk.getText()) ).append("; "); + } + } + + } + + CPointers::backend()->booknameLanguage(oldLocaleName); +// qDebug(" %s", ret.latin1()); + + return ret; +} diff --git a/bibletime/backend/creferencemanager.h b/bibletime/backend/creferencemanager.h new file mode 100644 index 0000000..343e3ef --- /dev/null +++ b/bibletime/backend/creferencemanager.h @@ -0,0 +1,112 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CREFERENCEMANAGER_H +#define CREFERENCEMANAGER_H + +//Qt includes +#include <qstring.h> + +#include "cswordmoduleinfo.h" + +/** Contains static functions to work with referneces used for Drag & Drop and for hyperlinks used in our + * rendered HTML code. + * @author The BibleTime team + */ + +class CReferenceManager { + +public: + enum Type { + Bible, /**< Bibles */ + Commentary, /**< Commentary */ + Lexicon, /**< Lexicon */ + GenericBook, /**< Generic Book */ + MorphHebrew, /**< Module for hebrew morphology*/ + MorphGreek, /**< Module for greek morphology */ + StrongsHebrew, /**< Module for hebrew strongs */ + StrongsGreek, /**< Module for greek strongs */ + Unknown /**< Unknown */ + }; + + /** Turn a hyperlink into module, key and type. + * Decodes the given hyperlink into module, key and type. + * @param hyperlink The hyperlink to decode + * @param module The string which will contain the module name after decoding + * @param key The string which will contain the key after decoding + * @param type The type param will contain the reference type after decoding + */ + static const bool decodeHyperlink( const QString& hyperlink, QString& module, QString& key, Type& type); + /** + * Returns a hyperlink used to be imbedded in the display windows. + * At the moment the format is sword://module/key + * @param module The module which is used to encode the hyperlink + * @param key The key which is used to encode the hyperlink + * @param type The type which is used to encode the hyperlink + * @return The encoded hyperlink + */ + static const QString encodeHyperlink( const QString module, const QString key, const Type type); + /** + * Puts a module Name and a Reference together in the 'draggable' form + * (module)reference + * @param module The name of the module + * @param reference The key reference as text + * @return The encoded reference using module and reference + * @author Martin Gruner + */ + static const QString encodeReference(const QString &module, const QString &reference); + /** + * decodes a 'draggable' reference into a modulename and a reference + * @author Martin Gruner + */ + static void decodeReference(QString &dragreference, QString &module, QString &reference); + /** + * Returns true if the parameter is a hyperlink. + * @param hyperlink The string which is tested + * @return True if the passed string is a hyperlink + */ + static const bool isHyperlink( const QString& hyperlink ); + /** + * Returns the preferred module name for the given type. + * @param type The type which is used to find the module + * @return The default module name for the passed type + */ + static const QString preferredModule( const Type type ); + /** + * Returns the type of the passed module type + * @param type The CSwordModuleInfo module typpe + * @return The ReferenceManager type + */ + static CReferenceManager::Type typeFromModule( const CSwordModuleInfo::ModuleType type ); + + + struct ParseOptions { + QString refDestinationModule; + QString refBase; /* only valid for verse based destination modules*/ + QString sourceLanguage; /* only valid for verse based destination modules*/ + QString destinationLanguage; /* only valid for verse based destination modules*/ + + ParseOptions() { + destinationLanguage = "en"; + }; + }; + + /** Parses the given verse references using the given language and the module. + * @param moduleName The name of the module to use. Required for the language checking before parsing the key. + * @param ref The verse reference. + * @param lang The language of the verse reference + * @param newLang The language of the reference, which will be returned. For example: If BibleTime using an english environment parses a spanish ref (lang=es) the returned ref should be in english (newLang=en), because his english standard module only understands en. + */ + static const QString parseVerseReference( const QString& ref, const ParseOptions& options); +}; + +#endif + diff --git a/bibletime/backend/cswordbackend.cpp b/bibletime/backend/cswordbackend.cpp new file mode 100644 index 0000000..f46b444 --- /dev/null +++ b/bibletime/backend/cswordbackend.cpp @@ -0,0 +1,692 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordbackend.h" +#include "centrydisplay.h" +#include "cbookdisplay.h" +#include "cchapterdisplay.h" +#include "cswordbiblemoduleinfo.h" +#include "cswordcommentarymoduleinfo.h" +#include "cswordlexiconmoduleinfo.h" +#include "cswordbookmoduleinfo.h" + +#include "bt_thmlhtml.h" +#include "bt_thmlplain.h" +#include "bt_osishtml.h" +#include "bt_gbfhtml.h" +#include "bt_plainhtml.h" +#include "osismorphsegmentation.h" + +#include "frontend/cbtconfig.h" + +#include <dirent.h> +#include <unistd.h> +#include <ctype.h> + +//Qt includes +#include <qdir.h> +#include <qfileinfo.h> + +//KDE includes +#include <klocale.h> +#include <kstringhandler.h> + +//Sword includes +#include <swdisp.h> +#include <swfiltermgr.h> +#include <encfiltmgr.h> +#include <rtfhtml.h> +#include <filemgr.h> +#include <utilstr.h> +#include <swfilter.h> + +using std::string; + +using namespace Filters; + +using namespace Rendering; + +CSwordBackend::CSwordBackend() +: sword::SWMgr(0, 0, false, new sword::EncodingFilterMgr( sword::ENC_UTF8 ), true) { + m_displays.entry = 0; + m_displays.chapter = 0; + m_displays.book = 0; + + m_filters.gbf = 0; + m_filters.thml = 0; + m_filters.osis = 0; + m_filters.plain = 0; + + filterInit(); +} + +CSwordBackend::CSwordBackend(const QString& path, const bool augmentHome) +: sword::SWMgr(!path.isEmpty() ? (const char*)path.local8Bit() : 0, false, new sword::EncodingFilterMgr( sword::ENC_UTF8 ), false, augmentHome) // don't allow module renaming, because we load from a path +{ + qDebug("CSwordBackend::CSwordBackend for %s, using %s", path.latin1(), configPath); + m_displays.entry = 0; + m_displays.chapter = 0; + m_displays.book = 0; + + m_filters.gbf = 0; + m_filters.thml = 0; + m_filters.osis = 0; + m_filters.plain = 0; + + filterInit(); +} + +CSwordBackend::~CSwordBackend() { + shutdownModules(); + + delete m_filters.gbf; + delete m_filters.plain; + delete m_filters.thml; + delete m_filters.osis; + + delete m_displays.book; + delete m_displays.chapter; + delete m_displays.entry; +} + +/** Initializes the Sword modules. */ +const CSwordBackend::LoadError CSwordBackend::initModules() { + // qWarning("globalSwordConfigPath is %s", globalConfPath); + LoadError ret = NoError; + + shutdownModules(); //remove previous modules + m_moduleList.clear(); + + sword::ModMap::iterator end = Modules.end(); + ret = LoadError( Load() ); + + for (sword::ModMap::iterator it = Modules.begin(); it != end; it++) { + sword::SWModule* const curMod = (*it).second; + CSwordModuleInfo* newModule = 0; + + if (!strcmp(curMod->Type(), "Biblical Texts")) { + newModule = new CSwordBibleModuleInfo(curMod, this); + newModule->module()->Disp( + m_displays.chapter + ? m_displays.chapter + : (m_displays.chapter = new CChapterDisplay) + ); + } + else if (!strcmp(curMod->Type(), "Commentaries")) { + newModule = new CSwordCommentaryModuleInfo(curMod, this); + newModule->module()->Disp( + m_displays.entry + ? m_displays.entry + : (m_displays.entry = new CEntryDisplay) + ); + } + else if (!strcmp(curMod->Type(), "Lexicons / Dictionaries")) { + newModule = new CSwordLexiconModuleInfo(curMod, this); + newModule->module()->Disp( + m_displays.entry + ? m_displays.entry + : (m_displays.entry = new CEntryDisplay) + ); + } + else if (!strcmp(curMod->Type(), "Generic Books")) { + newModule = new CSwordBookModuleInfo(curMod, this); + newModule->module()->Disp( + m_displays.book + ? m_displays.book + : (m_displays.book = new CBookDisplay) + ); + } + + if (newModule) { + //append the new modules to our list, but only if it's supported + //the constructor of CSwordModuleInfo prints a waring on stdout + if (!newModule->hasVersion() || (newModule->minimumSwordVersion() <= sword::SWVersion::currentVersion)) { + m_moduleList.append( newModule ); + } + } + } + + ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin() ; it != end_it; ++it) { + // for (m_moduleList.first(); m_moduleList.current(); m_moduleList.next()) { + m_moduleDescriptionMap.insert( (*it)->config(CSwordModuleInfo::Description), (*it)->name() ); + } + + //unlock modules if keys are present + // ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin() ; it != end_it; ++it) { + // for (m_moduleList.first(); m_moduleList.current(); m_moduleList.next()) { + + if ( (*it)->isEncrypted() ) { + const QString unlockKey = CBTConfig::getModuleEncryptionKey( (*it)->name() ).latin1(); + + if (!unlockKey.isNull()) { + setCipherKey( (*it)->name().latin1(), unlockKey.latin1() ); + } + } + } + + return ret; +} + +void CSwordBackend::AddRenderFilters(sword::SWModule *module, sword::ConfigEntMap §ion) { + sword::SWBuf moduleDriver; + sword::SWBuf sourceformat; + sword::ConfigEntMap::iterator entry; + bool noDriver = true; + + sourceformat = ((entry = section.find("SourceType")) != section.end()) ? (*entry).second : (sword::SWBuf) ""; + moduleDriver = ((entry = section.find("ModDrv")) != section.end()) ? (*entry).second : (sword::SWBuf) ""; + + if (sourceformat == "GBF") { + if (!m_filters.gbf) { + m_filters.gbf = new BT_GBFHTML(); + } + module->AddRenderFilter(m_filters.gbf); + noDriver = false; + } + else if (sourceformat == "PLAIN") { + if (!m_filters.plain) { + m_filters.plain = new BT_PLAINHTML(); + } + module->AddRenderFilter(m_filters.plain); + noDriver = false; + } + else if (sourceformat == "ThML") { + if (!m_filters.thml) { + m_filters.thml = new BT_ThMLHTML(); + } + module->AddRenderFilter(m_filters.thml); + noDriver = false; + } + else if (sourceformat == "OSIS") { + if (!m_filters.osis) { + m_filters.osis = new BT_OSISHTML(); + } + + module->AddRenderFilter(m_filters.osis); + noDriver = false; + } + + if (noDriver) { //no driver found + if ( (moduleDriver == "RawCom") || (moduleDriver == "RawLD") ) { + if (!m_filters.plain) { + m_filters.plain = new BT_PLAINHTML(); + } + module->AddRenderFilter(m_filters.plain); + noDriver = false; + } + } +} + +/** This function deinitializes the modules and deletes them. */ +const bool CSwordBackend::shutdownModules() { + ListCSwordModuleInfo::iterator it = m_moduleList.begin(); + ListCSwordModuleInfo::iterator end = m_moduleList.end(); + + while (it != end) { + CSwordModuleInfo* current = (*it); + it = m_moduleList.remove(it); + + delete current; + } + + Q_ASSERT(m_moduleList.count() == 0); + + //BT mods are deleted now, delete Sword mods, too. + DeleteMods(); + + return true; +} + +/** Returns true if the given option is enabled. */ +const bool CSwordBackend::isOptionEnabled( const CSwordModuleInfo::FilterTypes type) { + return (getGlobalOption( optionName(type).latin1() ) == "On"); +} + +/** Sets the given options enabled or disabled depending on the second parameter. */ +void CSwordBackend::setOption( const CSwordModuleInfo::FilterTypes type, const int state ) { + sword::SWBuf value; + + switch (type) { + + case CSwordModuleInfo::textualVariants: + + if (state == 0) { + value = "Primary Reading"; + } + else if (state == 1) { + value = "Secondary Reading"; + } + else { + value = "All Readings"; + } + + break; + + default: + value = state ? "On": "Off"; + break; + }; + + if (value.length()) + setGlobalOption(optionName(type).latin1(), value.c_str()); +} + +void CSwordBackend::setFilterOptions( const CSwordBackend::FilterOptions options) { + setOption( CSwordModuleInfo::footnotes, options.footnotes ); + setOption( CSwordModuleInfo::strongNumbers, options.strongNumbers ); + setOption( CSwordModuleInfo::headings, options.headings ); + setOption( CSwordModuleInfo::morphTags, options.morphTags ); + setOption( CSwordModuleInfo::lemmas, options.lemmas ); + setOption( CSwordModuleInfo::hebrewPoints, options.hebrewPoints ); + setOption( CSwordModuleInfo::hebrewCantillation, options.hebrewCantillation ); + setOption( CSwordModuleInfo::greekAccents, options.greekAccents ); + setOption( CSwordModuleInfo::redLetterWords, options.redLetterWords ); + setOption( CSwordModuleInfo::textualVariants, options.textualVariants ); + setOption( CSwordModuleInfo::morphSegmentation, options.morphSegmentation ); + // setOption( CSwordModuleInfo::transliteration, options.transliteration ); + setOption( CSwordModuleInfo::scriptureReferences, options.scriptureReferences); +} + +void CSwordBackend::setDisplayOptions( const CSwordBackend::DisplayOptions ) { + /* if (m_displays.entry) { + m_displays.entry->setDisplayOptions(options); + } + if (m_displays.chapter) { + m_displays.chapter->setDisplayOptions(options); + } + if (m_displays.book) { + m_displays.book->setDisplayOptions(options); + } + */ +} + +/** This function searches for a module with the specified description */ +CSwordModuleInfo* const CSwordBackend::findModuleByDescription(const QString& description) { + CSwordModuleInfo* ret = 0; + ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin() ; it != end_it; ++it) { + if ( (*it)->config(CSwordModuleInfo::Description) == description ) { + ret = *it; + break; + } + } + + return ret; +} + +/** This function searches for a module with the specified description */ +const QString CSwordBackend::findModuleNameByDescription(const QString& description) { + if (m_moduleDescriptionMap.contains(description)) { + return m_moduleDescriptionMap[description]; + } + + return QString::null; +} + +/** This function searches for a module with the specified name */ +CSwordModuleInfo* const CSwordBackend::findModuleByName(const QString& name) { + CSwordModuleInfo* ret = 0; + + ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin() ; it != end_it; ++it) { + if ( (*it)->name() == name ) { + ret = *it; + break; + } + } + + return ret; +} + +CSwordModuleInfo* const CSwordBackend::findSwordModuleByPointer(const sword::SWModule* const swmodule) { + CSwordModuleInfo* ret = 0; + ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin() ; it != end_it; ++it) { + if ( (*it)->module() == swmodule ) { + ret = *it; + break; + } + } + + return ret; +} + +CSwordModuleInfo* const CSwordBackend::findModuleByPointer(const CSwordModuleInfo* const module) { + CSwordModuleInfo* ret = 0; + + ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin() ; it != end_it; ++it) { + if ( (*it) == module ) { + ret = *it; + break; + } + } + + return ret; +} + +/** Returns our local config object to store the cipher keys etc. locally for each user. The values of the config are merged with the global config. */ +const bool CSwordBackend::moduleConfig(const QString& module, sword::SWConfig& moduleConfig) { + sword::SectionMap::iterator section; + DIR *dir = opendir(configPath); + + struct dirent *ent; + + bool foundConfig = false; + QString modFile; + + if (dir) { // find and update .conf file + rewinddir(dir); + + while ((ent = readdir(dir)) && !foundConfig) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile.setLatin1(configPath); + modFile.append("/"); + modFile.append( QString::fromLocal8Bit(ent->d_name) ); + + moduleConfig = sword::SWConfig( (const char*)modFile.local8Bit() ); + section = moduleConfig.Sections.find( (const char*)module.local8Bit() ); + foundConfig = ( section != moduleConfig.Sections.end() ); + } + } + + closedir(dir); + } + else { //try to read mods.conf + moduleConfig = sword::SWConfig("");//global config + section = config->Sections.find( (const char*)module.local8Bit() ); + foundConfig = ( section != config->Sections.end() ); + + sword::ConfigEntMap::iterator entry; + + if (foundConfig) { //copy module section + + for (entry = (*section).second.begin(); entry != (*section).second.end(); entry++) { + moduleConfig.Sections[(*section).first].insert(sword::ConfigEntMap::value_type((*entry).first, (*entry).second)); + } + } + } + + if (!foundConfig && configType != 2) { //search in $HOME/.sword/ + QString myPath(getenv("HOME")); + myPath.append("/.sword/mods.d"); + dir = opendir(myPath.latin1()); + + if (dir) { + rewinddir(dir); + + while ((ent = readdir(dir)) && !foundConfig) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = myPath; + modFile.append('/'); + modFile.append(ent->d_name); + moduleConfig = sword::SWConfig( (const char*)modFile.local8Bit() ); + section = moduleConfig.Sections.find( (const char*)module.local8Bit() ); + foundConfig = ( section != moduleConfig.Sections.end() ); + } + } + + closedir(dir); + } + } + + return foundConfig; +} + +/** Returns the text used for the option given as parameter. */ +const QString CSwordBackend::optionName( const CSwordModuleInfo::FilterTypes option ) { + switch (option) { + + case CSwordModuleInfo::footnotes: + return QString("Footnotes"); + + case CSwordModuleInfo::strongNumbers: + return QString("Strong's Numbers"); + + case CSwordModuleInfo::headings: + return QString("Headings"); + + case CSwordModuleInfo::morphTags: + return QString("Morphological Tags"); + + case CSwordModuleInfo::lemmas: + return QString("Lemmas"); + + case CSwordModuleInfo::hebrewPoints: + return QString("Hebrew Vowel Points"); + + case CSwordModuleInfo::hebrewCantillation: + return QString("Hebrew Cantillation"); + + case CSwordModuleInfo::greekAccents: + return QString("Greek Accents"); + + case CSwordModuleInfo::redLetterWords: + return QString("Words of Christ in Red"); + + case CSwordModuleInfo::textualVariants: + return QString("Textual Variants"); + + case CSwordModuleInfo::scriptureReferences: + return QString("Cross-references"); + + case CSwordModuleInfo::morphSegmentation: + return QString("Morph Segmentation"); + // case CSwordModuleInfo::transliteration: + // return QString("Transliteration"); + } + + return QString::null; +} + +/** Returns the translated name of the option given as parameter. */ +const QString CSwordBackend::translatedOptionName(const CSwordModuleInfo::FilterTypes option) { + switch (option) { + + case CSwordModuleInfo::footnotes: + return i18n("Footnotes"); + + case CSwordModuleInfo::strongNumbers: + return i18n("Strong's numbers"); + + case CSwordModuleInfo::headings: + return i18n("Headings"); + + case CSwordModuleInfo::morphTags: + return i18n("Morphological tags"); + + case CSwordModuleInfo::lemmas: + return i18n("Lemmas"); + + case CSwordModuleInfo::hebrewPoints: + return i18n("Hebrew vowel points"); + + case CSwordModuleInfo::hebrewCantillation: + return i18n("Hebrew cantillation marks"); + + case CSwordModuleInfo::greekAccents: + return i18n("Greek accents"); + + case CSwordModuleInfo::redLetterWords: + return i18n("Red letter words"); + + case CSwordModuleInfo::textualVariants: + return i18n("Textual variants"); + + case CSwordModuleInfo::scriptureReferences: + return i18n("Scripture cross-references"); + + case CSwordModuleInfo::morphSegmentation: + return i18n("Morph segmentation"); + // case CSwordModuleInfo::transliteration: + // return i18n("Transliteration between scripts"); + } + + return QString::null; +} + + +const QString CSwordBackend::configOptionName( const CSwordModuleInfo::FilterTypes option ) { + switch (option) { + + case CSwordModuleInfo::footnotes: + return QString("Footnotes"); + + case CSwordModuleInfo::strongNumbers: + return QString("Strongs"); + + case CSwordModuleInfo::headings: + return QString("Headings"); + + case CSwordModuleInfo::morphTags: + return QString("Morph"); + + case CSwordModuleInfo::lemmas: + return QString("Lemma"); + + case CSwordModuleInfo::hebrewPoints: + return QString("HebrewPoints"); + + case CSwordModuleInfo::hebrewCantillation: + return QString("Cantillation"); + + case CSwordModuleInfo::greekAccents: + return QString("GreekAccents"); + + case CSwordModuleInfo::redLetterWords: + return QString("RedLetterWords"); + + case CSwordModuleInfo::textualVariants: + return QString("Variants"); + + case CSwordModuleInfo::scriptureReferences: + return QString("Scripref"); + + case CSwordModuleInfo::morphSegmentation: + return QString("MorphSegmentation"); + + default: + return QString::null; + } + + return QString::null; +} + +const QString CSwordBackend::booknameLanguage( const QString& language ) { + if (!language.isEmpty()) { + sword::LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName( language.latin1() ); + + //refresh the locale of all Bible and commentary modules! + const ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + //use what sword returns, language may be different + QString newLocaleName( sword::LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName() ); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin(); it != end_it; ++it) { + if ( ((*it)->type() == CSwordModuleInfo::Bible) || ((*it)->type() == CSwordModuleInfo::Commentary) ) { + //Create a new key, it will get the default bookname language + ((sword::VerseKey*)((*it)->module()->getKey()))->setLocale( newLocaleName.latin1() ); + } + } + + } + + return QString( sword::LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName() ); +} + + +/** Reload all Sword modules. */ +void CSwordBackend::reloadModules() { + shutdownModules(); + + //delete Sword's config to make Sword reload it! + + if (myconfig) { // force reload on config object because we may have changed the paths + delete myconfig; + config = myconfig = 0; + loadConfigDir(configPath); + } + else if (config) { + config->Load(); + } + + initModules(); +} + +const QStringList CSwordBackend::swordDirList() { + QStringList ret; + const QString home = QString(getenv("HOME")); + + //return a list of used Sword dirs. Useful for the installer + QString configPath = QString("%1/.sword/sword.conf").arg(home); + + if (!QFile(configPath).exists()) { + configPath = globalConfPath; //e.g. /etc/sword.conf, /usr/local/etc/sword.conf + + + } + + + QStringList configs = QStringList::split(":", configPath); + + /*ToDo: Use the const iterator as soon as we switch to Qt > 3.1 + for (QStringList::const_iterator it = configs.constBegin(); it != configs.constEnd(); ++it) {*/ + + for (QStringList::const_iterator it = configs.begin(); it != configs.end(); ++it) { + if (!QFileInfo(*it).exists()) { + continue; + } + + //get all DataPath and AugmentPath entries from the config file and add them to the list + sword::SWConfig conf( (*it).latin1() ); + + ret << conf["Install"]["DataPath"].c_str(); + + sword::ConfigEntMap group = conf["Install"]; + + sword::ConfigEntMap::iterator start = group.equal_range("AugmentPath").first; + + sword::ConfigEntMap::iterator end = group.equal_range("AugmentPath").second; + + for (sword::ConfigEntMap::const_iterator it = start; it != end; ++it) { + ret << it->second.c_str(); //added augment path + } + } + + if (!home.isEmpty()) { + ret << home + "/.sword/"; + } + + return ret; +} + +void CSwordBackend::filterInit() { + // qWarning("## INIT"); + + SWOptionFilter* tmpFilter = new OSISMorphSegmentation(); + optionFilters.insert(OptionFilterMap::value_type("OSISMorphSegmentation", tmpFilter)); + cleanupFilters.push_back(tmpFilter); + + //HACK: replace Sword's ThML strip filter with our own version + //remove this hack as soon as Sword is fixed + cleanupFilters.remove(thmlplain); + delete thmlplain; + thmlplain = new BT_ThMLPlain(); + cleanupFilters.push_back(thmlplain); +} diff --git a/bibletime/backend/cswordbackend.h b/bibletime/backend/cswordbackend.h new file mode 100644 index 0000000..90d7031 --- /dev/null +++ b/bibletime/backend/cswordbackend.h @@ -0,0 +1,266 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDBACKEND_H +#define CSWORDBACKEND_H + +//BibleTime includes +#include "cswordmoduleinfo.h" +//#include "centrydisplay.h" + +//Qt includes +#include <qptrlist.h> +#include <qmap.h> +#include <qstring.h> +#include <qstringlist.h> + +//Sword includes +#include <swmgr.h> +#include <swbuf.h> +#include <swmodule.h> +#include <swversion.h> +#include <localemgr.h> +#include <utilstr.h> + +using namespace sword; + +namespace Rendering { + + class CEntryDisplay; + + class CChapterDisplay; + + class CBookDisplay; +} + +/** The backend layer main class. + * This is the implementation of CBackend for Sword. It's additionally derived from SWMgr + * to provide functions of Sword. + * + * @short The backend implementation of Sword + * @author The BibleTime team + * @version $Id: cswordbackend.h,v 1.58 2007/03/14 21:32:47 joachim Exp $ + */ + +class CSwordBackend : public sword::SWMgr { + +public: + /** Filter options. Filter options to + * control the text display of modules. Uses int and not bool because not all + * options have just two toggle values. + */ + + struct FilterOptions { + int footnotes; /**< 0 for disabled, 1 for enabled */ + int strongNumbers; /**< 0 for disabled, 1 for enabled */ + int headings; /**< 0 for disabled, 1 for enabled */ + int morphTags; /**< 0 for disabled, 1 for enabled */ + int lemmas; /**< 0 for disabled, 1 for enabled */ + int hebrewPoints; /**< 0 for disabled, 1 for enabled */ + int hebrewCantillation; /**< 0 for disabled, 1 for enabled */ + int greekAccents; /**< 0 for disabled, 1 for enabled */ + int textualVariants; /**< Number n to enabled the n-th variant */ + int redLetterWords; /**< 0 for disabled, 1 for enabled */ + int scriptureReferences; /**< 0 for disabled, 1 for enabled */ + int morphSegmentation; /**< 0 for disabled, 1 for enabled */ + }; + + /** Control the display of a text. + */ + + struct DisplayOptions { + int lineBreaks; + int verseNumbers; + }; + + /** The error codes which may be returned by the @ref Load() call. + */ + enum LoadError { // the values exist to cast from the char return of SWMgr::Load + NoSwordConfig = -1, + NoError = 0, + NoModules = 1 + }; + /** + * The constructor of the Sword backend. + * It creates the SWModule objects using SWMgr's methods, it adds the necessary + * filters for the module format. + */ + CSwordBackend(); + /** + * The constructor of the Sword backend. + * @param path The path which is used to load modules + * @param augmentHome True if the $HOME/.sword/ modules should be augmented with the other modules + */ + CSwordBackend( const QString& path, const bool augmentHome = true ); + + /** + * The destrctor of this backend. This function shuts the modules down using @ref shutdownModules. + */ + virtual ~CSwordBackend(); + + /** + * This function returns the list of available modules managed by this backend. + * You have to call initModules() first; + * + * @return The list of modules managed by this backend + */ + inline virtual ListCSwordModuleInfo& moduleList(); + /** + * Initializes the Sword modules. + * + * @return True if the initializiation was succesful, otherwise return false. + */ + virtual const CSwordBackend::LoadError initModules(); + /** + * This function deinitializes the modules and deletes them. + * + * @return True if it was succesful, otherwise return false + */ + virtual const bool shutdownModules(); + /** + * Sets the given options enabled or disabled depending on the second parameter. + * + * @param type This is the type this function should set enabled or disabled + * @param enable If this is true the option will be enabled, otherwise it will be disabled. + */ + void setOption( const CSwordModuleInfo::FilterTypes type, const int state ); + void setFilterOptions( const CSwordBackend::FilterOptions options ); + void setDisplayOptions( const CSwordBackend::DisplayOptions options ); + /** + * Returns true if the given option is enabled. + * + * @return Returns true if the options given as aparameter is switched on at this time, otherwise return false. + */ + virtual const bool isOptionEnabled( const CSwordModuleInfo::FilterTypes type); + /** + * Sets the language for the international booknames of Sword. + * @param langName The abbreviation string which should be used for the Sword backend + */ + const QString booknameLanguage( const QString& langName = QString::null ); + /** + * This function searches for a module with the specified description + * @param description The description of the desired module + * @return pointer to the desired module; null if no module has the specified description + */ + virtual CSwordModuleInfo* const findModuleByDescription(const QString& description); + /** + * This function searches for a module with the specified description + * @param description The description of the desired module + * @return pointer to the desired module; null if no module has the specified description + */ + const QString findModuleNameByDescription(const QString& description); + /** + * This function searches for a module with the specified name + * @param name The name of the desired module + * @return Pointer to the desired module; null if no module has the specified name + */ + CSwordModuleInfo* const findModuleByName(const QString& name); + /** + * This function searches for a module with the specified sword module as module() object! + * @param swmodule to a Sword module + * @return pointer to the desired module; null if no module has the specified name + */ + CSwordModuleInfo* const findSwordModuleByPointer(const sword::SWModule* const swmodule); + /** + * This function searches for a module which is the same as the passed module. + * @param module The module which should be used for searching the new one. May be child of a different backend. + * @return Pointer to the desired module; null if no module has the specified name + */ + CSwordModuleInfo* const findModuleByPointer(const CSwordModuleInfo* const module); + /** + * @return Our global config object which contains the configs of all modules merged together. + */ + inline sword::SWConfig* const getConfig() const; + /** + * Tries to find the config object for the module. The second paramter will be the found config. + * @return True if the config was found, false if not. If false is returned the moduleConfig object is in undefined/unknwon state. + */ + const bool moduleConfig(const QString& module, sword::SWConfig& moduleConfig ); + /** + * Returns the text used for the option given as parameter. + * @param The paramter enum + * @return The name of the option given by the parameter + */ + static const QString optionName( const CSwordModuleInfo::FilterTypes option ); + /** + * Returns the text used for the option given as parameter. + */ + static const QString configOptionName( const CSwordModuleInfo::FilterTypes option ); + /** + * Returns the translated name of the option given as parameter. + * @param The translated option name + */ + static const QString translatedOptionName(const CSwordModuleInfo::FilterTypes option ); + /** + * Returns the version of the Sword library. + * @return The version used by this backend + */ + inline virtual const sword::SWVersion Version(); + /** + * Reload all Sword modules. + */ + void reloadModules(); + /** Sword prefix list. + * @return A list of all known Sword prefix dirs + */ + const QStringList swordDirList(); + +protected: + /** + * Adds a render filter to the module. + * @param module Add a render filter to this module! + */ + virtual void AddRenderFilters(sword::SWModule *module, sword::ConfigEntMap §ion); + /** + * Initializes the filters provided by BibleTime. + */ + virtual void filterInit(); + +private: + // Filters + + struct Filters { + sword::SWFilter *gbf; + sword::SWFilter *plain; + sword::SWFilter *thml; + sword::SWFilter *osis; + } + + m_filters; + + struct Displays { + Rendering::CChapterDisplay* chapter; + Rendering::CEntryDisplay* entry; + Rendering::CBookDisplay* book; + } + + m_displays; + + ListCSwordModuleInfo m_moduleList; + QMap<QString, QString> m_moduleDescriptionMap; +}; + +/**Returns The list of modules managed by this backend*/ +inline ListCSwordModuleInfo& CSwordBackend::moduleList() { + return m_moduleList; +} + +/** Returns our local config object to store the cipher keys etc. locally for each user. The values of the config are merged with the global config. */ +inline sword::SWConfig* const CSwordBackend::getConfig() const { + return config; +} + +/** Returns the version of the Sword library. */ +inline const sword::SWVersion CSwordBackend::Version() { + return sword::SWVersion::currentVersion; +} + +#endif diff --git a/bibletime/backend/cswordbiblemoduleinfo.cpp b/bibletime/backend/cswordbiblemoduleinfo.cpp new file mode 100644 index 0000000..f05cf20 --- /dev/null +++ b/bibletime/backend/cswordbiblemoduleinfo.cpp @@ -0,0 +1,272 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordbiblemoduleinfo.h" +#include "cswordbackend.h" +#include "cswordversekey.h" + +// #include "util/cpointers.h" + +//Qt includes +#include <qfile.h> + +//Sword includes +#include <versekey.h> + +// Boost includes +// TODO: Detect Boost in autoconf +#include <boost/scoped_ptr.hpp> + +// Needed for new Sword libraries +// TODO: Move this into autoconf +#define SWORD_MULTIVERSE + +static sword::VerseKey staticKey; + +CSwordBibleModuleInfo::CSwordBibleModuleInfo( sword::SWModule* module, CSwordBackend* const usedBackend ) +: CSwordModuleInfo(module, usedBackend), +m_lowerBound(0), +m_upperBound(0), +m_bookList(0), +m_cachedLocale("unknown"), +m_hasOT(-1), +m_hasNT(-1) {} + +CSwordBibleModuleInfo::CSwordBibleModuleInfo( const CSwordBibleModuleInfo& m ) : +CSwordModuleInfo(m), +m_lowerBound(0), +m_upperBound(0), +m_bookList(0) { + if (m.m_bookList) { + m_bookList = new QStringList(); + *m_bookList = *m.m_bookList; + } + + m_hasOT = m.m_hasOT; + m_hasNT = m.m_hasNT; + m_cachedLocale = m.m_cachedLocale; +} + +CSwordModuleInfo* CSwordBibleModuleInfo::clone() { + return new CSwordBibleModuleInfo(*this); +} + +CSwordBibleModuleInfo::~CSwordBibleModuleInfo() { + delete m_bookList; +} + +void CSwordBibleModuleInfo::initBounds() { + if (m_hasOT == -1) { + m_hasOT = hasTestament(OldTestament); + } + + if (m_hasNT == -1) { + m_hasNT = hasTestament(NewTestament); + } + + if (m_hasOT) { + m_lowerBound.key("Genesis 1:1"); + } + else { + m_lowerBound.key("Matthew 1:1"); + } + + if (!m_hasNT) { + m_upperBound.key("Malachi 4:6"); + } + else { + m_upperBound.key("Revelation of John 22:21"); + } +} + + +/** Returns the books available in this module */ +QStringList* const CSwordBibleModuleInfo::books() { + if (m_cachedLocale != backend()->booknameLanguage()) { //if the locale has changed + delete m_bookList; + m_bookList = 0; + } + + if (!m_bookList) { + m_bookList = new QStringList(); + + initBounds(); + int min = 0; + int max = 1; + + //find out if we have ot and nt, only ot or only nt + + if (m_hasOT>0 && m_hasNT>0) { //both + min = 0; + max = 1; + } + else if (m_hasOT>0 && !m_hasNT) { //only OT + min = 0; + max = 0; + } + else if (!m_hasOT && m_hasNT>0) { //only NT + min = 1; + max = 1; + } + else if (!m_hasOT && !m_hasNT) { //somethings wrong here! - no OT and no NT + qWarning("CSwordBibleModuleInfo (%s) no OT and not NT! Check your config!", module()->Name()); + min = 0; + max = -1; + } + + boost::scoped_ptr<sword::VerseKey> key((sword::VerseKey *)module()->CreateKey()); + (*key) = sword::TOP; + + for (key->Testament(min+1); !key->Error() && (key->Testament()-1) <= max; key->Book(key->Book()+1)) { + m_bookList->append( QString::fromUtf8(key->getBookName()) ); + } + + m_cachedLocale = backend()->booknameLanguage(); + } + + return m_bookList; +} + +/** Returns the number of chapters for the given book. */ +const unsigned int CSwordBibleModuleInfo::chapterCount(const unsigned int book) { + int result = 0; + + boost::scoped_ptr<sword::VerseKey> key((sword::VerseKey *)module()->CreateKey()); + (*key) = sword::TOP; + + // works for old and new versions + key->Book(book); + (*key) = sword::MAXCHAPTER; + result = key->Chapter(); + + return result; +} + +const unsigned int CSwordBibleModuleInfo::chapterCount(const QString& book) { + return chapterCount( bookNumber(book) ); +} + +/** Returns the number of verses for the given chapter. */ + +const unsigned int CSwordBibleModuleInfo::verseCount( const unsigned int book, const unsigned int chapter ) { + unsigned int result = 0; + + boost::scoped_ptr<sword::VerseKey> key((sword::VerseKey *)module()->CreateKey()); + (*key) = sword::TOP; + + // works for old and new versions + key->Book(book); + key->Chapter(chapter); + (*key) = sword::MAXVERSE; + result = key->Verse(); + + return result; +} + +const unsigned int CSwordBibleModuleInfo::verseCount( const QString& book, const unsigned int chapter ) { + return verseCount( bookNumber(book), chapter ); +} + +const unsigned int CSwordBibleModuleInfo::bookNumber(const QString &book) { + unsigned int bookNumber = 0; + + //find out if we have ot and nt, only ot or only nt + initBounds(); + + boost::scoped_ptr<sword::VerseKey> key((sword::VerseKey *)module()->CreateKey()); + (*key) = sword::TOP; + +#ifdef SWORD_MULTIVERSE + key->setBookName(book.utf8().data()); + + bookNumber = ((key->Testament() > 1) ? key->BMAX[0] : 0) + key->Book(); +#else + bool found = false; + int min = 0; + int max = 1; + + if ((m_hasOT>0 && m_hasNT>0) || (m_hasOT == -1 && m_hasNT == -1)) { + min = 0; + max = 1; + bookNumber = 0; + } + else if (m_hasOT>0 && !m_hasNT) { + min = 0; + max = 0; + bookNumber = 0; + } + else if (!m_hasOT && m_hasNT>0) { + min = 1; + max = 1; + bookNumber = key->BMAX[0]; + } + else if (!m_hasOT && !m_hasNT) { + min = 0; + max = -1; //no loop + bookNumber = 0; + } + + for (int i = min; i <= max && !found; ++i) { + for ( int j = 0; j < key->BMAX[i] && !found; ++j) { + ++bookNumber; + + if (book == QString::fromUtf8( key->books[i][j].name) ) + found = true; + } + } +#endif + + return bookNumber; +} + +/** Returns true if his module has the text of desired type of testament */ +const bool CSwordBibleModuleInfo::hasTestament( CSwordBibleModuleInfo::Testament type ) { + if (m_hasOT == -1 || m_hasNT == -1) { + const bool oldStatus = module()->getSkipConsecutiveLinks(); + module()->setSkipConsecutiveLinks(true); + + *module() = sword::TOP; //position to first entry + sword::VerseKey key( module()->KeyText() ); + + if (key.Testament() == 1) { // OT && NT + m_hasOT = 1; + } + else if (key.Testament() == 2) { //no OT + m_hasOT = 0; + } + + *module() = sword::BOTTOM; + key = module()->KeyText(); + + if (key.Testament() == 1) { // only OT, no NT + m_hasNT = 0; + } + else if (key.Testament() == 2) { //has NT + m_hasNT = 1; + } + + module()->setSkipConsecutiveLinks(oldStatus); + } + + switch (type) { + + case OldTestament: + return m_hasOT>0; + + case NewTestament: + return m_hasNT>0; + + default: + return false; + } +} + diff --git a/bibletime/backend/cswordbiblemoduleinfo.h b/bibletime/backend/cswordbiblemoduleinfo.h new file mode 100644 index 0000000..1cd3784 --- /dev/null +++ b/bibletime/backend/cswordbiblemoduleinfo.h @@ -0,0 +1,132 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDBIBLEMODULEINFO_H +#define CSWORDBIBLEMODULEINFO_H + +//own includes +#include "cswordmoduleinfo.h" +#include "cswordversekey.h" + +//Qt includes +#include <qstringlist.h> + +//Sword includes + + +/** + * This is the CModuleInfo imlementation for Bible modules managed by Sword. + * + * @short Implementation for Sword Bibles + * @author The BibleTime team + * @version $Id: cswordbiblemoduleinfo.h,v 1.18 2006/02/25 11:38:15 joachim Exp $ + */ + +class CSwordBibleModuleInfo : public CSwordModuleInfo { + +public: + enum Testament { + OldTestament = 1, + NewTestament = 2 + }; + + /** + * The constructor of this class + */ + CSwordBibleModuleInfo( sword::SWModule* module, CSwordBackend* const = CPointers::backend() ); + /** The copy constructor for this Bible module. + */ + CSwordBibleModuleInfo( const CSwordBibleModuleInfo& m ); + /** + * The destructor of this class + */ + ~CSwordBibleModuleInfo(); + /** + * Returns the number of avalable verses for the given chapter and book. + * + * @param book The number book we should use + * @param chapter The chapter we should use + * @return The number of verses for the given book and chapter + */ + virtual const unsigned int verseCount( const unsigned int book, const unsigned int chapter ); + /** + * Returns the number of avalable verses for the given chapter and book. + * + * @param book The name of the book we use + * @param chapter The number of the chapter we use + * @return The number of verses for the given book and chapter + */ + virtual const unsigned int verseCount( const QString& book, const unsigned int chapter ); + /** Information about the chapters in a book. + * @return The number of available chapters of the given book. + * @return The number of chapters for the given book + */ + virtual const unsigned int chapterCount( const unsigned int book ); + /** Information about the chapters in a book. + * @return The number of available chapters of the given book. + */ + virtual const unsigned int chapterCount( const QString& book ); + /** Return all book of this module. + * @return A QStringList containing the books which are available in this module. + */ + virtual QStringList* const books(); + /** + * Reimplementation, Returns the type + */ + virtual const CSwordModuleInfo::ModuleType type() const; + /** + * @return the book number, values starting with 1; 0 if not found + */ + const unsigned int bookNumber(const QString &book); + /** + * Returns true if his module has the text of desired type of testament + */ + const bool hasTestament( CSwordBibleModuleInfo::Testament ); + /** Reimplementation to clone this object. */ + virtual CSwordModuleInfo* clone(); + /** + * Returns the key which represents the lower bound of this module. + */ + inline const CSwordVerseKey& lowerBound(); + /** + * Returns the key which represents the upper bound of this module. + */ + inline const CSwordVerseKey& upperBound(); + +private: + void initBounds(); + + CSwordVerseKey m_lowerBound; + CSwordVerseKey m_upperBound; + + QStringList* m_bookList; //This booklist is cached + QString m_cachedLocale; + short int m_hasOT; + short int m_hasNT; +}; + +inline const CSwordModuleInfo::ModuleType CSwordBibleModuleInfo::type() const { + return CSwordModuleInfo::Bible; +} + +/** Returns the key which represents the lower bound of this module. */ +inline const CSwordVerseKey& CSwordBibleModuleInfo::lowerBound() { + initBounds(); + return m_lowerBound; +} + +/** Returns the key which represents the lower bound of this module. */ +inline const CSwordVerseKey& CSwordBibleModuleInfo::upperBound() { + initBounds(); + return m_upperBound; +} + +#endif diff --git a/bibletime/backend/cswordbookmoduleinfo.cpp b/bibletime/backend/cswordbookmoduleinfo.cpp new file mode 100644 index 0000000..17cfb28 --- /dev/null +++ b/bibletime/backend/cswordbookmoduleinfo.cpp @@ -0,0 +1,75 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordbookmoduleinfo.h" +#include "cswordtreekey.h" + +//Sword includes +#include <treekeyidx.h> +#include <treekey.h> + +#include <iostream> +#include <string> +using std::cout; +using std::endl; + +CSwordBookModuleInfo::CSwordBookModuleInfo( sword::SWModule* module, CSwordBackend* const usedBackend ) +: CSwordModuleInfo(module, usedBackend), +m_depth(-1) {} + +CSwordBookModuleInfo::CSwordBookModuleInfo( const CSwordBookModuleInfo& module ) +: CSwordModuleInfo(module) { + m_depth = module.m_depth; +} + +CSwordBookModuleInfo::~CSwordBookModuleInfo() {} + +const int CSwordBookModuleInfo::depth() { + if (m_depth == -1) { + sword::TreeKeyIdx* key = tree(); + + if (key) { + key->root(); + computeDepth(key, 0); + } + } + + return m_depth; +} + +void CSwordBookModuleInfo::computeDepth(sword::TreeKeyIdx* key, int level ) { + std::string savedKey; + // savedKey = key->getFullName(); //sword 1.5.8 + savedKey = key->getText(); + + if (level > m_depth) { + m_depth = level; + } + + if (key->hasChildren()) { + key->firstChild(); + computeDepth(key, level+1); + + key->setText( savedKey.c_str() );//return to the initial value + } + + if (key->nextSibling()) { + computeDepth(key, level); + } +} + +/** Returns a treekey filled with the structure of this module */ +sword::TreeKeyIdx* const CSwordBookModuleInfo::tree() const { + sword::TreeKeyIdx* treeKey = dynamic_cast<sword::TreeKeyIdx*>((sword::SWKey*)*(module())); + Q_ASSERT(treeKey); + return treeKey; +} diff --git a/bibletime/backend/cswordbookmoduleinfo.h b/bibletime/backend/cswordbookmoduleinfo.h new file mode 100644 index 0000000..28e9d75 --- /dev/null +++ b/bibletime/backend/cswordbookmoduleinfo.h @@ -0,0 +1,67 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDGENBOOKMODULEINFO_H +#define CSWORDGENBOOKMODULEINFO_H + +//BibleTime includes +#include "cswordmoduleinfo.h" + +//Sword includes +#include <treekeyidx.h> + +/** Class for generic book support + * @author The BibleTime team + */ + +class CSwordBookModuleInfo : public CSwordModuleInfo { + +public: + /** Constructor. + * @param module The module which belongs to this object + * @param backend The parent backend for this book module. + */ + CSwordBookModuleInfo( sword::SWModule* module, CSwordBackend* const backend = CPointers::backend() ); + /** Copy constructor. + * Copy constructor to copy the passed parameter. + * @param module The module which should be copied. + */ + CSwordBookModuleInfo( const CSwordBookModuleInfo& module ); + /** Destructor. + */ + ~CSwordBookModuleInfo(); + /** + * Returns the type of the module. + */ + virtual const CSwordModuleInfo::ModuleType type() const; + /** + * Returns the maximal depth of sections and subsections. + */ + const int depth(); + /** + * @return A treekey filled with the structure of this module. Don't delete the returned key because it's casted from the module object. + */ + sword::TreeKeyIdx* const tree() const; + +private: + /** + * A recursive helper function to help computng the module depth! + */ + void computeDepth(sword::TreeKeyIdx* key, int level = 0 ); + int m_depth; +}; + +inline const CSwordBookModuleInfo::ModuleType CSwordBookModuleInfo::type() const { + return CSwordModuleInfo::GenericBook; +} + + +#endif diff --git a/bibletime/backend/cswordcommentarymoduleinfo.cpp b/bibletime/backend/cswordcommentarymoduleinfo.cpp new file mode 100644 index 0000000..187ac65 --- /dev/null +++ b/bibletime/backend/cswordcommentarymoduleinfo.cpp @@ -0,0 +1,36 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#include "cswordcommentarymoduleinfo.h" + +#include <string> + +CSwordCommentaryModuleInfo::CSwordCommentaryModuleInfo( sword::SWModule* module, CSwordBackend* const usedBackend) +: CSwordBibleModuleInfo(module, usedBackend) {} + +CSwordCommentaryModuleInfo::~CSwordCommentaryModuleInfo() {} + +/** No descriptions */ +CSwordModuleInfo* CSwordCommentaryModuleInfo::clone() { + return new CSwordCommentaryModuleInfo(*this); +} + +/** Returns true if this module may be written by the write display windows. */ +const bool CSwordCommentaryModuleInfo::isWritable() const { + // qWarning(module()->getConfigEntry("ModDrv")); + //a module is only writable if it's a RawFiles module with writable returning true + + if ( (std::string(module()->getConfigEntry("ModDrv")) == std::string("RawFiles")) && module()->isWritable()) { + return true; + }; + + return false; +} diff --git a/bibletime/backend/cswordcommentarymoduleinfo.h b/bibletime/backend/cswordcommentarymoduleinfo.h new file mode 100644 index 0000000..c387ede --- /dev/null +++ b/bibletime/backend/cswordcommentarymoduleinfo.h @@ -0,0 +1,45 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDCOMMENTARYMODULEINFO_H +#define CSWORDCOMMENTARYMODULEINFO_H + +//own includes +#include "cswordbiblemoduleinfo.h" + +/** Commentary module implementation. + * This CSwordModule implementation provides access to Sword's commentary modules. + * @author The BibleTime team + * @version $Id: cswordcommentarymoduleinfo.h,v 1.13 2006/02/25 11:38:15 joachim Exp $ + */ + +class CSwordCommentaryModuleInfo : public CSwordBibleModuleInfo { + +public: + CSwordCommentaryModuleInfo( sword::SWModule* module, CSwordBackend* const = CPointers::backend() ); + ~CSwordCommentaryModuleInfo(); + /** Reimplementation to return the commentary type. + */ + virtual const CSwordModuleInfo::ModuleType type() const; + /** Reimplementation to clone the current object. + */ + virtual CSwordModuleInfo* clone(); + /** + * Returns true if this module may be written by the write display windows. + */ + virtual const bool isWritable() const; +}; + +inline const CSwordModuleInfo::ModuleType CSwordCommentaryModuleInfo::type() const { + return CSwordModuleInfo::Commentary; +} + +#endif diff --git a/bibletime/backend/cswordkey.cpp b/bibletime/backend/cswordkey.cpp new file mode 100644 index 0000000..a939162 --- /dev/null +++ b/bibletime/backend/cswordkey.cpp @@ -0,0 +1,193 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + + +//own includes +#include "cswordkey.h" +#include "cswordmoduleinfo.h" + +#include "cswordversekey.h" +#include "cswordldkey.h" +#include "cswordtreekey.h" + +#include "util/ctoolclass.h" + +//Sword includes +#include <swmodule.h> +#include <swkey.h> +#include <versekey.h> +#include <treekey.h> +#include <treekeyidx.h> + +//Qt includes +#include <qregexp.h> +#include <qstring.h> +#include <qtextcodec.h> + +CSwordKey::CSwordKey(CSwordModuleInfo* const module) : m_module(module) {} + +CSwordKey::CSwordKey(const CSwordKey& k) { + m_module = k.m_module; +} + +const QString CSwordKey::rawText() { + if (!m_module) { + return QString::null; + } + + if (dynamic_cast<sword::SWKey*>(this)) { + char * buffer = new char[strlen(rawKey()) + 1]; + strcpy(buffer, rawKey()); + m_module->module()->getKey()->setText( buffer ); + delete buffer; + } + + if (key().isNull()) { + return QString::null; + } + +// qWarning("rawText: %s", m_module->module()->getRawEntry()); + return QString::fromUtf8( m_module->module()->getRawEntry() ); +} + +const QString CSwordKey::renderedText( const CSwordKey::TextRenderType mode ) { + Q_ASSERT(m_module); + if (!m_module) { + return QString::null; + } + + using namespace sword; + SWKey* const k = dynamic_cast<SWKey*>(this); + + if (k) { + char * buffer = new char[strlen(rawKey()) + 1]; + strcpy(buffer, rawKey()); + VerseKey* vk_mod = dynamic_cast<VerseKey*>(m_module->module()->getKey()); + + if (vk_mod) { + vk_mod->Headings(1); + } + + m_module->module()->getKey()->setText( buffer ); + + if (m_module->type() == CSwordModuleInfo::Lexicon) { + m_module->snap(); + /* In lexicons make sure that our key (e.g. 123) was successfully set to the module, + i.e. the module key contains this key (e.g. 0123 contains 123) */ + + if ( strcasecmp(m_module->module()->getKey()->getText(), buffer) + && !strstr(m_module->module()->getKey()->getText(), buffer) + ) { + qDebug("return an empty key for %s", m_module->module()->getKey()->getText()); + return QString::null; + } + } + delete buffer; + } + + Q_ASSERT(!key().isNull()); + if (!key().isNull()) { //we have valid text + QString text = QString::fromUtf8( m_module->module()->RenderText() ); + + // This is yucky, but if we want strong lexicon refs we have to do it here. + if (m_module->type() == CSwordModuleInfo::Lexicon) { + QString t(text); + QRegExp rx("(GREEK|HEBREW) for 0*([1-9]\\d*)"); // ignore 0's before number + int pos = 0; + while( (pos = rx.search(t, pos)) != -1 ) { + QString language = rx.cap(1); + QString langcode = QString(language.at(0)); // "G" or "H" + QString number = rx.cap(2); + QString paddednumber = number.rightJustify(5, '0'); // Form 00123 + + text.replace( + QRegExp( QString( + "(>[^<>]+)" // Avoid replacing inside tags + "\\b(0*%1)\\b").arg(number) ), // And span around 0's + QString("\\1<span lemma=\"%1%2\"><a href=\"strongs://%3/%4\">\\2</a></span>") + .arg(langcode, paddednumber, language, paddednumber) + ); + pos += rx.matchedLength(); + } + } + + if (mode == HTMLEscaped) { + //we have to encode all UTF-8 in HTML escapes + // go though every character and write down the escaped HTML unicode entity + // form is &#<decimal unicode value here>; + QString ret; + QChar c; + const unsigned int length = text.length(); + + for (unsigned int i = 0; i < length; ++i) { + c = text.at(i); + + if (c.latin1()) { //normal latin1 character + ret.append(c); + } + else {//unicode character, needs to be escaped + ret.append("&#") + .append(c.unicode()) + .append(";"); + } + } + + return ret; + } + else { + return text; + } + } + + return QString::null; +} + +const QString CSwordKey::strippedText() { + if (!m_module) { + return QString::null; + } + + if (/*sword::SWKey* k =*/ dynamic_cast<sword::SWKey*>(this)) { + // m_module->module()->SetKey(k); + //m_module->module()->getKey()->setText( (const char*)key().utf8() ); + char * buffer = new char[strlen(rawKey()) + 1]; + strcpy(buffer, rawKey()); + m_module->module()->getKey()->setText(buffer); + delete buffer; + } + + return QString::fromUtf8( m_module->module()->StripText() ); +} + + +/** This will create a proper key object from a given module */ +CSwordKey* CSwordKey::createInstance( CSwordModuleInfo* const module ) { + if (!module) { + return 0; + } + + switch( module->type() ) { + + case CSwordModuleInfo::Bible://fall through + + case CSwordModuleInfo::Commentary: + return new CSwordVerseKey( (sword::VerseKey *) ( (sword::SWKey *)(*module->module()) ), module ); + + case CSwordModuleInfo::Lexicon: + return new CSwordLDKey( (sword::SWKey *)(*module->module()), module); + + case CSwordModuleInfo::GenericBook: + return new CSwordTreeKey( (sword::TreeKeyIdx*)((sword::SWKey *)(*module->module())), module ); + + default: + return 0; + } +} diff --git a/bibletime/backend/cswordkey.h b/bibletime/backend/cswordkey.h new file mode 100644 index 0000000..2b549f8 --- /dev/null +++ b/bibletime/backend/cswordkey.h @@ -0,0 +1,121 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDKEY_H +#define CSWORDKEY_H + +//Own includes + + +//Qt includes +#include <qstring.h> +//forward declarations + +class CSwordModuleInfo; + +/** Base class for all keys. + * The base class for all Sword based keys. + * @author The BibleTime team + * @version $Id: cswordkey.h,v 1.28 2007/10/26 18:26:23 jerickson314 Exp $ + */ + +class CSwordKey { + +protected: + /** Constructor. May not be called because this class contains pure virtual methods. + * @param module The module which belongs to this key, may be NULL + */ + CSwordKey(CSwordModuleInfo* const module = 0); //protected constructor, because CSwordKey shouldn't be used (it's an abstract base class). + /** Copy constructor. + */ + CSwordKey(const CSwordKey&); //copy constructor + +public: + enum TextRenderType { + Normal = 0, + HTMLEscaped + }; + /** Destructor. + * Public, not protected like the constructor, because CSwordKey pointers may be deleted by all others. + */ + virtual ~CSwordKey() {} + + ; + + //pure virtual functions + /** Returns the current key. + * @return The current key which belongs to the current object. + */ + virtual const QString key() const = 0; + /** Sets the current key. Sets the key using a utf8 enabled QString. + * @param key The key which should be used to set the current one + */ + virtual const bool key(const QString& key) = 0; + /** Set the key using a utf8-decoded c-string + * @param key The key which should be used to set the current one + */ + virtual const bool key(const char* key) = 0; + /** Clone this object. Clone this current object and return it. + * @return A clone of the current object. + */ + virtual CSwordKey* copy() const = 0; + + //implemented functions + /** Set/get the module. Set and get the module which belongs to this key. + * @return The module which belongs to this key. + */ + inline virtual CSwordModuleInfo* const module(CSwordModuleInfo* const newModule = 0); + /** Returns the raw, unchanged text. Returns the text without any filter modifications, + * just in the way it comes out of the module. + */ + virtual const QString rawText(); + /** Returns the rendered text. Returns the text of the current key after passign it through the + * modules filters. + */ + virtual const QString renderedText( const CSwordKey::TextRenderType mode = CSwordKey::Normal ); + /** Stripped down text. Returns the text after removing all markup tags from it. + */ + virtual const QString strippedText(); + /** + * This returns a new object of the right CSwordKey* implementation + * (e.g. CSwordVerseKey or CSwordLDKey) + * The type is determined by the type of the module. + * @see CSwordModuleInfo, CSwordBibleModuleInfo, CSwordCommentaryModuleInfo, CSwordLexiconModukleInfo + */ + static CSwordKey* createInstance(CSwordModuleInfo * const module); + /** + * The assignment operator for more easy use of the key classes. + */ + inline virtual CSwordKey& operator = ( const QString& ); + +protected: + /** Returns the current key in raw format, for Sword. + * @return The current key which belongs to the current object. + */ + virtual const char* rawKey() const = 0; + CSwordModuleInfo* m_module; //module pointer used by all keys +}; + + +/** The assignment operator for more easy use of the key classes. */ +inline CSwordKey& CSwordKey::operator = ( const QString& newKey ) { + key(newKey); + return *this; +} + +inline CSwordModuleInfo* const CSwordKey::module(CSwordModuleInfo* const newModule) { + if (newModule) { + m_module = newModule; + } + return m_module; +} + +#endif diff --git a/bibletime/backend/cswordldkey.cpp b/bibletime/backend/cswordldkey.cpp new file mode 100644 index 0000000..0f189e9 --- /dev/null +++ b/bibletime/backend/cswordldkey.cpp @@ -0,0 +1,130 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2007 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordldkey.h" +#include "cswordlexiconmoduleinfo.h" + +//Qt includes +#include <qtextcodec.h> + +//Sword includes +#include <swmodule.h> +#include <swld.h> +#include <utilstr.h> + + +CSwordLDKey::CSwordLDKey( CSwordModuleInfo* module ) { + if ((m_module = dynamic_cast<CSwordLexiconModuleInfo*>(module))) { + // *(m_module->module()) = TOP; + } + + SWKey::operator = (" "); +} + +/** No descriptions */ +CSwordLDKey::CSwordLDKey( const CSwordLDKey &k ) : CSwordKey(k), SWKey((const char*)k) {} + +/** No descriptions */ +CSwordLDKey::CSwordLDKey( const SWKey *k, CSwordModuleInfo* module) : CSwordKey(module), SWKey(*k) {} + +/** Clones this object by copying the members. */ +CSwordLDKey* CSwordLDKey::copy() const { + return new CSwordLDKey(*this); +} + +/** Sets the module of this key. */ +CSwordModuleInfo* const CSwordLDKey::module(CSwordModuleInfo* const newModule) { + if (newModule && newModule->type() == CSwordModuleInfo::Lexicon) { + const QString oldKey = key(); + m_module = newModule; + key(oldKey); + } + + return m_module; +} + +/** Sets the key of this instance */ +const QString CSwordLDKey::key() const { + + if (!m_module || m_module->isUnicode()) { + return QString::fromUtf8((const char*)*this); + } else { + QTextCodec *codec = QTextCodec::codecForName("CP1252"); + return codec->toUnicode((const char*)*this); + } +} + +const char * CSwordLDKey::rawKey() const { + return (const char*)*this; +} + +const bool CSwordLDKey::key( const QString& newKey ) { + + Q_ASSERT(m_module); + + if (!m_module || m_module->isUnicode()) { + return key((const char*)newKey.utf8()); + } else { + QTextCodec *codec = QTextCodec::codecForName("CP1252"); + return key((const char*)codec->fromUnicode(newKey)); + } +} + + +/** Sets the key of this instance */ +const bool CSwordLDKey::key( const char* newKey ) { + Q_ASSERT(newKey); + + if (newKey) { + SWKey::operator = (newKey); //set the key + + m_module->module()->SetKey(this); + // m_module->module()->getKey()->setText( (const char*)key().utf8() ); + m_module->snap(); + // SWKey::operator = (m_module->module()->KeyText()); + } + + return !Error(); +} + +/** Uses the parameter to returns the next entry afer this key. */ +CSwordLDKey* CSwordLDKey::NextEntry() { + m_module->module()->SetKey(this); //use this key as base for the next one! + + m_module->module()->setSkipConsecutiveLinks(true); + ( *( m_module->module() ) )++; + m_module->module()->setSkipConsecutiveLinks(false); + + key(m_module->module()->KeyText()); + SWKey::operator = (m_module->module()->KeyText()); + + return this; +} + +/** Uses the parameter to returns the next entry afer this key. */ +CSwordLDKey* CSwordLDKey::PreviousEntry() { + m_module->module()->SetKey(this); //use this key as base for the next one! + + m_module->module()->setSkipConsecutiveLinks(true); + ( *( m_module->module() ) )--; + m_module->module()->setSkipConsecutiveLinks(false); + + SWKey::operator = (m_module->module()->KeyText()); + + return this; +} + +/** Assignment operator for more ease of use of this class. */ +CSwordLDKey& CSwordLDKey::operator = (const QString& keyname ) { + key(keyname); + return *this; +} diff --git a/bibletime/backend/cswordldkey.h b/bibletime/backend/cswordldkey.h new file mode 100644 index 0000000..bd6b6ce --- /dev/null +++ b/bibletime/backend/cswordldkey.h @@ -0,0 +1,110 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDLDKEY_H +#define CSWORDLDKEY_H + + +//own includes +#include "cswordkey.h" +#include "cswordmoduleinfo.h" + +//Qt includes +#include <qstring.h> + +//Sword includes +#include <swkey.h> + +/** + * This class is the implementation of CSwordKey used for dictionaries and lexicons. + * + * CSwordLDKey is the implementation of CKey for Lexicons and dictionaries. + * It provides a simple interface to set the current key, + * to get the text for the key and functions to get the next and previous items + * of the used module in comparision to the current key.<BR> + * Here's an example how to use this class:<BR> + * @code + * CSwordLexiconModuleInfo* m_module = backend()->findModuleByName("ISBE"); + * CSwordLDKey ldKey(m_module); + * ldKey.key("Adam"); + * ldKey.nextEntry(); + * qDebug( QString("The current key is: %1").arg(ldKey.key())); + * @endcode + * + * Please not, that the result will be invalid if use the operator const char* + * on the adress of the object, use something like this + * + * @code + * CSwordLDKey* key = new CSwordLDKey( lexicon_module ); + * const QString keyname = key->getKey(); + * @endcode + * + * @author The BibleTime team + * @version $Id: cswordldkey.h,v 1.25 2007/10/26 18:26:23 jerickson314 Exp $ + */ + +class CSwordLDKey : public CSwordKey, public sword::SWKey { + +public: + /** + * Constructor of CSwordLDKey + */ + CSwordLDKey( CSwordModuleInfo* module ); + /** + * Copy constructor for this key class. + */ + CSwordLDKey( const CSwordLDKey &k ); + /** + * Copy constructor for this key class. + */ + CSwordLDKey( const sword::SWKey *k, CSwordModuleInfo* module); + /** + * Clones this object by copying the members. + */ + virtual CSwordLDKey* copy() const; + /** + * Uses the parameter to returns the next entry afer this key. + */ + CSwordLDKey* NextEntry( void ); + /** + * Uses the parameter to returns the previous entry afer this key. + */ + CSwordLDKey* PreviousEntry( void ); + /** + * Sets the module of this key. + */ + virtual CSwordModuleInfo* const module( CSwordModuleInfo* const module = 0 ); + /** + * Returns the current key as a QString + */ + virtual const QString key() const; + /** + * Set the current key + */ + virtual const bool key( const QString& newKey ); + /** + * Returns the current key as a QString + */ + virtual const bool key( const char* ); + /** + * Assignment operator for more ease of use of this class. + */ + virtual CSwordLDKey& operator = (const QString& keyname ); +protected: + /** + * The raw key for direct use with Sword. + */ + virtual const char * rawKey() const; +}; + + +#endif + diff --git a/bibletime/backend/cswordlexiconmoduleinfo.cpp b/bibletime/backend/cswordlexiconmoduleinfo.cpp new file mode 100644 index 0000000..26da0e7 --- /dev/null +++ b/bibletime/backend/cswordlexiconmoduleinfo.cpp @@ -0,0 +1,183 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordlexiconmoduleinfo.h" +//#include "frontend/cbtconfig.h" + +//Qt includes +#include <qfile.h> +#include <qdatastream.h> +#include <qtextcodec.h> + +//Sword includes +#include <swmodule.h> + +#include <kglobal.h> +#include <kstandarddirs.h> + +//STL includes +#include <algorithm> + +//Change it once the format changed to make all +//systems rebuild their caches +#define CACHE_FORMAT "2" + +CSwordLexiconModuleInfo::CSwordLexiconModuleInfo( sword::SWModule* module, CSwordBackend* const backend ) : CSwordModuleInfo(module, backend) { + m_entryList = 0; +} + +CSwordLexiconModuleInfo::CSwordLexiconModuleInfo( const CSwordLexiconModuleInfo& m ) : CSwordModuleInfo(m) { + delete m_entryList; + m_entryList = 0; + + if (m.m_entryList) { + m_entryList = new QStringList(); + *m_entryList = *m.m_entryList;//copy list items + } +} + +CSwordLexiconModuleInfo::~CSwordLexiconModuleInfo() { + delete m_entryList; + m_entryList = 0; +} + +/** Returns the entries of the module. */ +QStringList* const CSwordLexiconModuleInfo::entries() { + if (!module()) { + return 0; + } + + sword::SWModule* my_module = module(); + bool is_unicode = isUnicode(); + + if (!m_entryList) { + m_entryList = new QStringList(); + bool read = false; + + //Check for buggy modules! They will not be loaded any more. + + if ( name() == QString("ZhEnglish")) { + qWarning("Module ZhEnglish is buggy and will not be loaded."); + return m_entryList; + } + + QString dir( KGlobal::dirs()->saveLocation("data", "bibletime/cache/") ); + QFile f1( + QString(dir) + .append("/") + .append(name()) + ); + + if ( f1.open( IO_ReadOnly ) ) { + QDataStream s( &f1 ); + QString mod_ver, prog_ver; + s >> mod_ver; + s >> prog_ver; + + if ((mod_ver == config(ModuleVersion)) && (prog_ver == CACHE_FORMAT)) { + s >> *m_entryList; + read = true; + } + + f1.close(); + // qWarning("read entries %d",m_entryList->count()); + } + + // Q_ASSERT(read); + // Q_ASSERT(m_entryList->count()); + if (!read || !m_entryList->count()) { + my_module->setSkipConsecutiveLinks(true); + (*my_module) = sword::TOP; + snap(); //snap to top entry + + // qWarning("Reading in module" ); + int i = 0; + + do { + if ( is_unicode ) { + m_entryList->append(QString::fromUtf8(my_module->KeyText())); + // qWarning("Entry: %s", my_module->KeyText() ); + } + else { //for latin1 modules use fromLatin1 because of speed + // m_entryList->append(QString::fromLatin1(my_module->KeyText())); + + QTextCodec *codec = QTextCodec::codecForName("CP1252"); + m_entryList->append(codec->toUnicode(my_module->KeyText())); + } + + (*my_module)++; + i++; + } + while ( !my_module->Error() ); + + // qWarning("Reading finished. Module has %d entries.", i ); + + (*my_module) = sword::TOP; //back to the first entry + + my_module->setSkipConsecutiveLinks(false); + + if (m_entryList->count()) { + m_entryList->first().simplifyWhiteSpace(); + + if (m_entryList->first().stripWhiteSpace().isEmpty()) { + + m_entryList->remove + ( m_entryList->begin() ); + } + + //now sort the list, this is necesssary because Sword doesn't do Unicode ordering + + // qWarning("sorting"); + // QStringList::iterator start(m_entryList->begin()); + // QStringList::iterator end(m_entryList->end()); + // std::sort( start, end, myLocaleAwareCompare() ); //stl sort + // m_entryList->sort(); //make sure the module is sorted by utf-8 + } + + qWarning("Writing cache file."); + + if (m_entryList->count()) { + //create cache + QString dir = KGlobal::dirs()->saveLocation("data", "bibletime/cache/"); + //QFile f2( QString::fromLatin1("%1/%2").arg(dir).arg( name() ) ); + QFile f2( QString(dir).append("/").append(name()) ); + + + if (f2.open( IO_WriteOnly )) { + QDataStream s( &f2 ); + s << config(CSwordModuleInfo::ModuleVersion); //store module version + s << QString(CACHE_FORMAT); //store BT version -- format may change + s << *m_entryList; + f2.close(); + } + } + + // // qWarning("Writing finished." ); + } + } + + return m_entryList; +} + +/** Jumps to the closest entry in the module. */ +const bool CSwordLexiconModuleInfo::snap() { + if(module()->getRawEntry()) { // Snap to the current entry + return true; + } + + return false; +} + +/** No descriptions */ +CSwordModuleInfo* CSwordLexiconModuleInfo::clone() { + return new CSwordLexiconModuleInfo(*this); +} diff --git a/bibletime/backend/cswordlexiconmoduleinfo.h b/bibletime/backend/cswordlexiconmoduleinfo.h new file mode 100644 index 0000000..8b8e8fe --- /dev/null +++ b/bibletime/backend/cswordlexiconmoduleinfo.h @@ -0,0 +1,73 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDLEXICONMODULEINFO_H +#define CSWORDLEXICONMODULEINFO_H + +//own includes +#include "cswordmoduleinfo.h" + +//Qt includes +#include <qstringlist.h> + +/** + * The implementation of CModuleInfo for the Sword lexiccons and citionaries. + * @author The BibleTime team + * @version $Id: cswordlexiconmoduleinfo.h,v 1.12 2006/02/25 11:38:15 joachim Exp $ + */ + +class CSwordLexiconModuleInfo : public CSwordModuleInfo { + +public: + /** + * The standard constructor fot this object. + * A default constructor doesn't exist. Use this one. + */ + CSwordLexiconModuleInfo( sword::SWModule* module, CSwordBackend* const = CPointers::backend() ); + /** + * The copy constructor + */ + CSwordLexiconModuleInfo( const CSwordLexiconModuleInfo& m ); + /** Reimplementation to return a valid clone. + */ + virtual CSwordModuleInfo* clone(); + /** Destructor. + */ + virtual ~CSwordLexiconModuleInfo(); + /** + * Returns the entries of the module. + * This function returns the entries of the modules represented by this object. + * If this function is called for the first time the list is load from disk and stored in a list which cahes it. + * If the function is called again, the cached list is returned so we have a major speed improvement. + * @return The list of lexicon entries + */ + QStringList* const entries(); + /** + * Reimplementation, to return the right type for this lexicon. + */ + virtual const CSwordModuleInfo::ModuleType type() const; + /** + * Jumps to the closest entry in the module. + */ + const bool snap(); + +private: + /** + * This is the list which caches the entres of the module. + */ + QStringList* m_entryList; +}; + +inline const CSwordModuleInfo::ModuleType CSwordLexiconModuleInfo::type() const { + return CSwordModuleInfo::Lexicon; +} + +#endif diff --git a/bibletime/backend/cswordmoduleinfo.cpp b/bibletime/backend/cswordmoduleinfo.cpp new file mode 100644 index 0000000..cb37426 --- /dev/null +++ b/bibletime/backend/cswordmoduleinfo.cpp @@ -0,0 +1,888 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + +//BibleTime includes +#include "cswordmoduleinfo.h" +#include "cswordbackend.h" +#include "cswordmodulesearch.h" +#include "cswordkey.h" +#include "centrydisplay.h" +#include "clanguagemgr.h" + +#include "util/scoped_resource.h" +#include "util/directoryutil.h" +#include "util/cpointers.h" +#include "frontend/cbtconfig.h" + +#include <sys/types.h> +#include <unistd.h> +#include <stddef.h> +#include <dirent.h> +#include <regex.h> + +//Qt includes +#include <qregexp.h> +#include <qdir.h> +#include <qvariant.h> +#include <qfileinfo.h> + +//KDE includes +#include <klocale.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <kconfig.h> + +//Sword includes +#include <swbuf.h> +#include <swkey.h> +#include <listkey.h> +#include <versekey.h> +#include <swconfig.h> +#include <rtfhtml.h> + +//Lucence includes +#include <CLucene.h> +#include <CLucene/util/Reader.h> +#include <CLucene/util/Misc.h> +#include <CLucene/util/dirent.h> + +//Increment this, if the index format changes +//Then indices on the user's systems will be rebuilt +const unsigned int INDEX_VERSION = 6; + +//Maximum index entry size, 1MiB for now +//Lucene default is too small +const unsigned long BT_MAX_LUCENE_FIELD_LENGTH = 1024*1024; + +CSwordModuleInfo::CSwordModuleInfo(sword::SWModule * module, CSwordBackend * const usedBackend) { + m_module = module; + Q_ASSERT(module); + + m_searchResult.ClearList(); + m_backend = usedBackend ? usedBackend : CPointers::backend(); + m_dataCache.name = module ? QString(module->Name()) : QString::null; + m_dataCache.isUnicode = module ? module->isUnicode() : false; + m_dataCache.category = UnknownCategory; + m_dataCache.language = 0; + m_dataCache.hasVersion = !QString((*m_backend->getConfig())[module->Name()]["Version"]).isEmpty(); + + if (backend()) { + if (hasVersion() && (minimumSwordVersion() > sword::SWVersion::currentVersion)) { + qWarning("The module \"%s\" requires a newer Sword library. Please update to \"Sword %s\".", + name().latin1(), (const char *)minimumSwordVersion()); + } + } +} + +CSwordModuleInfo::CSwordModuleInfo(const CSwordModuleInfo & m) { + m_module = m.m_module; + m_backend = m.m_backend; + m_dataCache = m.m_dataCache; + m_searchResult = m.m_searchResult; +} + +/** No descriptions */ +CSwordModuleInfo *CSwordModuleInfo::clone() { + return new CSwordModuleInfo(*this); +} + +CSwordModuleInfo::~CSwordModuleInfo() { + m_searchResult.ClearList(); + m_module = 0; //the Sword module object is deleted by the backend +} + +/** Sets the unlock key of the modules and writes the key into the cofig file.*/ +const bool CSwordModuleInfo::unlock(const QString & unlockKey) { + if (!isEncrypted()) { + return false; + } + + CBTConfig::setModuleEncryptionKey(name(), unlockKey); + backend()->setCipherKey(m_module->Name(), unlockKey.latin1()); + //TODO: write to Sword config as well + + return true; +} + +/** This function returns true if this module is locked, otherwise return false. */ +const bool CSwordModuleInfo::isLocked() { + //still works, but the cipherkey is stored in CBTConfig. + //Works because it is set in sword on program startup. + + if (isEncrypted()) { + if (unlockKeyIsValid()) { + return false; + } + return true; + } + return false; +} + +/** This functions returns true if this module is encrypted (locked or unlocked). */ +const bool CSwordModuleInfo::isEncrypted() const { + /** + * If we have the CipherKey entry the module + * is encrypted but not necessarily locked + */ + + //This code is still right, though we do no longer write to the module config files any more + sword::ConfigEntMap config = backend()->getConfig()->Sections.find(name().latin1())->second; + sword::ConfigEntMap::iterator it = config.find("CipherKey"); + + if (it != config.end()) { + return true; + } + + return false; +} + +/** This function makes an estimate if a module was properly unlocked. + * It returns true if the first entry of the module (parsed as Latin1 + * byte sequence) is not empty and contains only printable characters. + * If that is the case, we can safely assume that a) the module was properly + * unlocked and b) no buffer overflows will occur, which can happen when + * Sword filters process garbage text which was not properly decrypted. +*/ +const bool CSwordModuleInfo::unlockKeyIsValid() { + + (*m_module) = sword::TOP; + + // This needs to use ::fromLatin1 because if the text is still locked, + // a lot of garbage will show up. It will also work with properly decrypted + // Unicode text, because all non-ASCII Unicode chars consist of bytes >127 + // and therefore contain no control (nonprintable) characters, which are all <127. + QString test = isUnicode() + ? QString::fromUtf8(m_module->getRawEntryBuf().c_str()) + : QString::fromLatin1( m_module->getRawEntryBuf().c_str() ); + + if (test.isEmpty()) { + qWarning("Unlock key of module %s is NOT valid", name().latin1()); + return false; + } + + for (unsigned int i = 0; i <= test.length(); i++) { + if ( !test[i].isPrint() && !test[i].isNull() ) { + qWarning("Unlock key of module %s is NOT valid", name().latin1()); + return false; + } + } + + qDebug("Unlock key of module %s is valid", name().latin1()); + return true; +} + +const QString CSwordModuleInfo::getGlobalBaseIndexLocation() { + return KGlobal::dirs()->saveLocation("data", "bibletime/indices"); +} + +const QString CSwordModuleInfo::getModuleBaseIndexLocation() const { + return getGlobalBaseIndexLocation() + QString("/") + name().ascii(); +} + +const QString CSwordModuleInfo::getModuleStandardIndexLocation() const { //this for now returns the location of the main index + return getModuleBaseIndexLocation() + QString("/standard"); +} + +const bool CSwordModuleInfo::hasIndex() { //this will return true only + //if the index exists and has correct version information for both index and module + + QDir d; + if (!d.exists( getModuleStandardIndexLocation() )) { + return false; + } + + //first check if the index version and module version are ok + util::scoped_ptr<KConfig> indexconfig( + new KConfig( getModuleBaseIndexLocation() + QString("/bibletime-index.conf") ) + ); + + if (hasVersion()) { + if (indexconfig->readEntry("module-version") != QString(config(CSwordModuleInfo::ModuleVersion)) ) { + return false; + } + } + if (indexconfig->readEntry("index-version") != QString::number( INDEX_VERSION )) { + qDebug("%s: INDEX_VERSION is not compatible with this version of BibleTime.", name().latin1()); + return false; + } + + //then check if the index is there + return lucene::index::IndexReader::indexExists(getModuleStandardIndexLocation().ascii()); +} + + +void CSwordModuleInfo::buildIndex() { + wchar_t wcharBuffer[BT_MAX_LUCENE_FIELD_LENGTH + 1]; + + //we don't want the linked entries indexed again + module()->setSkipConsecutiveLinks(true); + + //Without this we don't get strongs, lemmas, etc + backend()->setFilterOptions ( CBTConfig::getFilterOptionDefaults() ); + //make sure we reset all important filter options which influcence the plain filters. + backend()->setOption( CSwordModuleInfo::strongNumbers, false ); + backend()->setOption( CSwordModuleInfo::morphTags, false ); + backend()->setOption( CSwordModuleInfo::morphSegmentation, false ); + backend()->setOption( CSwordModuleInfo::footnotes, false ); + backend()->setOption( CSwordModuleInfo::headings, false ); + backend()->setOption( CSwordModuleInfo::scriptureReferences, false ); + backend()->setOption( CSwordModuleInfo::redLetterWords, false ); + + // do not use any stop words + const TCHAR* stop_words[] = { + NULL + }; + lucene::analysis::standard::StandardAnalyzer an( stop_words ); + QString index = getModuleStandardIndexLocation(); + + QDir dir; + dir.mkdir( getGlobalBaseIndexLocation(), true ); + dir.mkdir( getModuleBaseIndexLocation(), true ); + dir.mkdir( getModuleStandardIndexLocation(), true ); + + + if (lucene::index::IndexReader::indexExists(index.ascii())) { + if (lucene::index::IndexReader::isLocked(index.ascii()) ) { + lucene::index::IndexReader::unlock(index.ascii()); + } + } + + util::scoped_ptr<lucene::index::IndexWriter> writer( new lucene::index::IndexWriter(index.ascii(), &an, true) ); //always create a new index + writer->setMaxFieldLength(BT_MAX_LUCENE_FIELD_LENGTH); + writer->setUseCompoundFile(true); //merge segments into a single file + writer->setMinMergeDocs(1000); + + *m_module = sword::TOP; + unsigned long verseLowIndex = m_module->Index(); + *m_module = sword::BOTTOM; + unsigned long verseHighIndex = m_module->Index(); + + //verseLowIndex is not 0 in all cases (i.e. NT-only modules) + unsigned long verseIndex = verseLowIndex + 1; + + + const bool isVerseModule = (type() == CSwordModuleInfo::Bible) || (type() == CSwordModuleInfo::Commentary); + + m_indexingProgress.setValue( QVariant((int)0) ); + m_indexingProgress.activate(); + + SWKey* key = m_module->getKey(); + //VerseKey for bibles + VerseKey* vk = dynamic_cast<VerseKey*>(key); + + if (vk) { + // we have to be sure to insert the english key into the index, otherwise we'd be in trouble if the language changes + vk->setLocale("en_US"); + //If we have a verse based module, we want to include the pre-chapter etc. headings in the search + vk->Headings(1); + } + + //holds UTF-8 data and is faster than QString + QCString textBuffer; + + // we start with the first module entry, key is automatically updated + // because key is a pointer to the modules key + for (*m_module = sword::TOP; !(key->Error()); (*key)++) { + + //If it is a sword-heading, store in buffer and index later in Verse X:1 + if (vk) { + if (vk->Verse() == 0) { + //qWarning("key is %s", key->getText()); + //qWarning("text is %s", m_module->StripText()); + textBuffer.append( m_module->StripText() ); + continue; + } + } + + util::scoped_ptr<lucene::document::Document> doc(new lucene::document::Document()); + + //index the key + lucene_utf8towcs(wcharBuffer, key->getText(), BT_MAX_LUCENE_FIELD_LENGTH); + doc->add(*lucene::document::Field::UnIndexed(_T("key"), wcharBuffer)); + + // index the main text + //at this point we have to make sure we disabled the strongs and the other options + //so the plain filters won't include the numbers somehow. + lucene_utf8towcs(wcharBuffer, (const char*) textBuffer.append(m_module->StripText()), BT_MAX_LUCENE_FIELD_LENGTH); + doc->add(*lucene::document::Field::UnStored(_T("content"), wcharBuffer)); + textBuffer.resize(0); //clean up + + // index attributes + AttributeList::iterator attListI; + AttributeValue::iterator attValueI; + // Footnotes + for (attListI = m_module->getEntryAttributes()["Footnote"].begin(); + attListI != m_module->getEntryAttributes()["Footnote"].end(); + attListI++) { + lucene_utf8towcs(wcharBuffer, attListI->second["body"], BT_MAX_LUCENE_FIELD_LENGTH); + doc->add(*lucene::document::Field::UnStored(_T("footnote"), wcharBuffer)); + } // for attListI + + // Headings + for (attValueI = m_module->getEntryAttributes()["Heading"]["Preverse"].begin(); + attValueI != m_module->getEntryAttributes()["Heading"]["Preverse"].end(); + attValueI++) { + lucene_utf8towcs(wcharBuffer, attValueI->second, BT_MAX_LUCENE_FIELD_LENGTH); + doc->add(*lucene::document::Field::UnStored(_T("heading"), wcharBuffer)); + } // for attValueI + + // Strongs/Morphs + for (attListI = m_module->getEntryAttributes()["Word"].begin(); + attListI != m_module->getEntryAttributes()["Word"].end(); + attListI++) { + // for each attribute + if (attListI->second["LemmaClass"] == "strong") { + lucene_utf8towcs(wcharBuffer, attListI->second["Lemma"], BT_MAX_LUCENE_FIELD_LENGTH); + doc->add(*lucene::document::Field::UnStored(_T("strong"), wcharBuffer)); + //qWarning("Adding strong %s", attListI->second["Lemma"].c_str()); + } + if (attListI->second.find("Morph") != attListI->second.end()) { + lucene_utf8towcs(wcharBuffer, attListI->second["Morph"], BT_MAX_LUCENE_FIELD_LENGTH); + doc->add(*lucene::document::Field::UnStored(_T("morph"), wcharBuffer)); + } + } // for attListI + + writer->addDocument(doc); + verseIndex = m_module->Index(); + + if (verseIndex % 200 == 0) { + if (verseHighIndex == verseLowIndex) { //prevent division by zero + m_indexingProgress.setValue( QVariant(0) ); + } else { + m_indexingProgress.setValue( QVariant((int)((100*(verseIndex-verseLowIndex))/(verseHighIndex-verseLowIndex))) ); + } + m_indexingProgress.activate(); + } + } + + writer->optimize(); + writer->close(); + + QString configFilename = getModuleStandardIndexLocation() + QString("/../bibletime-index.conf"); + util::scoped_ptr<KConfig> indexconfig( new KConfig( configFilename ) ); + if (hasVersion()) { + indexconfig->writeEntry("module-version", config(CSwordModuleInfo::ModuleVersion) ); + } + indexconfig->writeEntry("index-version", INDEX_VERSION); +} + +void CSwordModuleInfo::deleteIndexForModule( QString name ) { + util::filesystem::DirectoryUtil::removeRecursive( getGlobalBaseIndexLocation() + "/" + name ); +} + +unsigned long CSwordModuleInfo::indexSize() const { + return util::filesystem::DirectoryUtil::getDirSizeRecursive( getModuleBaseIndexLocation() ); +} + + +const bool CSwordModuleInfo::searchIndexed(const QString& searchedText, sword::ListKey& scope) { + char utfBuffer[BT_MAX_LUCENE_FIELD_LENGTH + 1]; + wchar_t wcharBuffer[BT_MAX_LUCENE_FIELD_LENGTH + 1]; + + // work around Swords thread insafety for Bibles and Commentaries + util::scoped_ptr < CSwordKey > key(CSwordKey::createInstance(this)); + sword::SWKey* s = dynamic_cast < sword::SWKey * >(key.get()); + QPtrList<VerseKey> list; + list.setAutoDelete( true ); // the list owns the objects + + const bool isVerseModule = (type() == CSwordModuleInfo::Bible) || (type() == CSwordModuleInfo::Commentary); + + if (s) { + m_module->SetKey(*s); + } + + m_searchResult.ClearList(); + + try { + // do not use any stop words + const TCHAR* stop_words[] = { + NULL + }; + lucene::analysis::standard::StandardAnalyzer analyzer( stop_words ); + lucene::search::IndexSearcher searcher(getModuleStandardIndexLocation().ascii()); + lucene_utf8towcs(wcharBuffer, searchedText.utf8(), BT_MAX_LUCENE_FIELD_LENGTH); + util::scoped_ptr<lucene::search::Query> q( lucene::queryParser::QueryParser::parse(wcharBuffer, _T("content"), &analyzer) ); + + util::scoped_ptr<lucene::search::Hits> h( searcher.search(q, lucene::search::Sort::INDEXORDER) ); + + const bool useScope = (scope.Count() > 0); +// const bool isVerseModule = (type() == CSwordModuleInfo::Bible) || (type() == CSwordModuleInfo::Commentary); + + lucene::document::Document* doc = 0; + util::scoped_ptr<SWKey> swKey( module()->CreateKey() ); + + + for (int i = 0; i < h->length(); ++i) { + doc = &h->doc(i); + lucene_wcstoutf8(utfBuffer, doc->get(_T("key")), BT_MAX_LUCENE_FIELD_LENGTH); + + swKey->setText(utfBuffer); + + // limit results based on scope + //if (searchOptions & CSwordModuleSearch::useScope && scope.Count() > 0){ + if (useScope) { + for (int j = 0; j < scope.Count(); j++) { + VerseKey* vkey = dynamic_cast<VerseKey*>(scope.getElement(j)); + if (vkey->LowerBound().compare(*swKey) <= 0 && vkey->UpperBound().compare(*swKey) >= 0) { + m_searchResult.add(*swKey); + } + } + } else { // no scope, give me all buffers + m_searchResult.add(*swKey); + } + } + } catch (...) { + qWarning("CLucene exception"); + return false; + } + + list.clear(); + + return (m_searchResult.Count() > 0); +} + +void CSwordModuleInfo::connectIndexingFinished(QObject* receiver, const char* slot) { + m_indexingFinished.connect(receiver, slot); +} + +void CSwordModuleInfo::connectIndexingProgress(QObject* receiver, const char* slot) { + m_indexingProgress.connect(receiver, slot); +} + +void CSwordModuleInfo::disconnectIndexingSignals(QObject* receiver) { + m_indexingProgress.disconnect(receiver); + m_indexingFinished.disconnect(receiver); +} + +/** Returns the last search result for this module. */ +sword::ListKey & CSwordModuleInfo::searchResult(const sword::ListKey * newResult) { + if (newResult) { + m_searchResult.copyFrom(*newResult); + } + + return m_searchResult; +} + +/** Clears the last search result. */ +void CSwordModuleInfo::clearSearchResult() { + m_searchResult.ClearList(); +} + +/** Returns the required Sword version for this module. Returns -1 if no special Sword version is required. */ +const sword::SWVersion CSwordModuleInfo::minimumSwordVersion() { + return sword::SWVersion(config(CSwordModuleInfo::MinimumSwordVersion).latin1()); +} + +const QString CSwordModuleInfo::config(const CSwordModuleInfo::ConfigEntry entry) const { + switch (entry) { + + case AboutInformation: { + return getFormattedConfigEntry("About"); + } + + case CipherKey: { + if (CBTConfig::getModuleEncryptionKey(name()).isNull()) { //fall back! + return QString(m_module->getConfigEntry("CipherKey")); + } else { + return CBTConfig::getModuleEncryptionKey(name()); + }; + } + + case AbsoluteDataPath: { + QString path( getSimpleConfigEntry("AbsoluteDataPath") ); + path.replace(QRegExp("/./"), "/"); // make /abs/path/./modules/ looking better + //make sure we have a trailing slash! + + if (path.right(1) != "/") { + path.append('/'); + } + + return path; + } + + case DataPath: { //make sure we remove the dataFile part if it's a Lexicon + QString path(getSimpleConfigEntry("DataPath")); + + if ((type() == CSwordModuleInfo::GenericBook) || (type() == CSwordModuleInfo::Lexicon)) { + int pos = path.findRev("/"); //last slash in the string + + if (pos != -1) { + path = path.left(pos + 1); //include the slash + } + } + + return path; + } + + case Description: + return getFormattedConfigEntry("Description"); + + case ModuleVersion: { + QString version(getSimpleConfigEntry("Version")); + + if (version.isEmpty()) { + version = "1.0"; + } + + return version; + } + + case MinimumSwordVersion: { + const QString minimumVersion(getSimpleConfigEntry("MinimumVersion")); + return !minimumVersion.isEmpty()? minimumVersion : QString("0.0"); + } + + case TextDir: { + const QString dir(getSimpleConfigEntry("Direction")); + return !dir.isEmpty()? dir : QString("LtoR"); + } + + case DisplayLevel: { + const QString level(getSimpleConfigEntry("DisplayLevel")); + return !level.isEmpty()? level : QString("1"); + } + + case GlossaryFrom: { + if (!category() == Glossary) { + return QString::null; + }; + + const QString lang(getSimpleConfigEntry("GlossaryFrom")); + + return !lang.isEmpty()? lang : QString::null; + } + + case GlossaryTo: { + if (!category() == Glossary) { + return QString::null; + }; + + const QString lang(getSimpleConfigEntry("GlossaryTo")); + + return !lang.isEmpty()? lang : QString::null; + } + + case Markup: { + const QString markup(getSimpleConfigEntry("SourceType")); + return !markup.isEmpty()? markup : QString("Unknown"); + } + + case DistributionLicense: + return getSimpleConfigEntry("DistributionLicense"); + + case DistributionSource: + return getSimpleConfigEntry("DistributionSource"); + + case DistributionNotes: + return getSimpleConfigEntry("DistributionNotes"); + + case TextSource: + return getSimpleConfigEntry("TextSource"); + + case CopyrightNotes: + return getSimpleConfigEntry("CopyrightNotes"); + + case CopyrightHolder: + return getSimpleConfigEntry("CopyrightHolder"); + + case CopyrightDate: + return getSimpleConfigEntry("CopyrightDate"); + + case CopyrightContactName: + return getSimpleConfigEntry("CopyrightContactName"); + + case CopyrightContactAddress: + return getSimpleConfigEntry("CopyrightContactAddress"); + + case CopyrightContactEmail: + return getSimpleConfigEntry("CopyrightContactEmail"); + + default: + return QString::null; + } +} + +/** Returns true if the module supports the feature given as parameter. */ +const bool CSwordModuleInfo::has(const CSwordModuleInfo::Feature feature) const { + switch (feature) { + + // case StrongsNumbers: + // return m_module->getConfig().has("Feature", "StrongsNumber"); + + case GreekDef: + return m_module->getConfig().has("Feature", "GreekDef"); + + case HebrewDef: + return m_module->getConfig().has("Feature", "HebrewDef"); + + case GreekParse: + return m_module->getConfig().has("Feature", "GreekParse"); + + case HebrewParse: + return m_module->getConfig().has("Feature", "HebrewParse"); + } + + return false; +} + +const bool CSwordModuleInfo::has(const CSwordModuleInfo::FilterTypes option) const { + //BAD workaround to see if the filter is GBF, OSIS or ThML! + const QString name = backend()->configOptionName(option); + + if (m_module->getConfig().has("GlobalOptionFilter", QString("OSIS").append(name).latin1())) { + return true; + } + + if (m_module->getConfig().has("GlobalOptionFilter", QString("GBF").append(name).latin1())) { + return true; + } + + if (m_module->getConfig().has("GlobalOptionFilter", QString("ThML").append(name).latin1())) { + return true; + } + + if (m_module->getConfig().has("GlobalOptionFilter", QString("UTF8").append(name).latin1())) { + return true; + } + + if (m_module->getConfig().has("GlobalOptionFilter", name.latin1())) { + return true; + } + + return false; +} + +/** Returns the text direction of the module's text., */ +const CSwordModuleInfo::TextDirection CSwordModuleInfo::textDirection() { + if (config(TextDir) == "RtoL") { + return CSwordModuleInfo::RightToLeft; + } else { + return CSwordModuleInfo::LeftToRight; + } +} + +/** Writes the new text at the given position into the module. This does only work for writable modules. */ +void CSwordModuleInfo::write(CSwordKey * key, const QString & newText) { + module()->KeyText((const char *)key->key().utf8()); + + //don't store a pointer to the const char* value somewhere because QCString doesn't keep the value of it + module()->setEntry(isUnicode()? (const char *)newText.utf8() : (const char *)newText.local8Bit()); +} + +/** Deletes the current entry and removes it from the module. */ +const bool CSwordModuleInfo::deleteEntry(CSwordKey * const key) { + module()->KeyText(isUnicode()? (const char *)key->key().utf8() : (const char *)key->key().local8Bit()); + + if (module()) { + module()->deleteEntry(); + return true; + }; + + return false; +} + +/** Returns the category of this module. See CSwordModuleInfo::Category for possible values. */ +const CSwordModuleInfo::Category CSwordModuleInfo::category() const { + if (m_dataCache.category == CSwordModuleInfo::UnknownCategory) { + const QString cat(m_module->getConfigEntry("Category")); + + if (cat == "Cults / Unorthodox / Questionable Material") { + m_dataCache.category = Cult; + } else if (cat == "Daily Devotional" || m_module->getConfig().has("Feature", "DailyDevotion")) { + m_dataCache.category = DailyDevotional; + } else if (cat == "Glossaries" || m_module->getConfig().has("Feature", "Glossary")) { //alow both + m_dataCache.category = Glossary; + }; + } + + return m_dataCache.category; +} + +/** Returns the display object for this module. */ +Rendering::CEntryDisplay * const CSwordModuleInfo::getDisplay() const { + return dynamic_cast < Rendering::CEntryDisplay * >(m_module->Disp()); +} + +QString CSwordModuleInfo::aboutText() const { + QString text; + text += "<font size=\"-1\"><table>"; + + text += QString("<tr><td><b>%1</b></td><td>%2</td><tr>") + .arg(i18n("Version")) + .arg(hasVersion()? config(CSwordModuleInfo::ModuleVersion) : i18n("unknown")); + + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Markup")) + .arg(!QString(m_module->getConfigEntry("SourceType")).isEmpty()? m_module-> + getConfigEntry("SourceType") : i18n("unknown")); + + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Location")) + .arg(config(CSwordModuleInfo::AbsoluteDataPath)); + + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Language")) + .arg(language()->translatedName()); + + if (m_module->getConfigEntry("Category")) + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Category")) + .arg(m_module->getConfigEntry("Category")); + + if (m_module->getConfigEntry("LCSH")) + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("LCSH")) + .arg(m_module->getConfigEntry("LCSH")); + + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Writable")) + .arg(isWritable()? i18n("yes") : i18n("no")); + + if (isEncrypted()) + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Unlock key")) + .arg(config(CSwordModuleInfo::CipherKey)); + + QString options; + + unsigned int opts; + + for (opts = CSwordModuleInfo::filterTypesMIN; opts <= CSwordModuleInfo::filterTypesMAX; ++opts) { + if (has(static_cast < CSwordModuleInfo::FilterTypes > (opts))) { + if (!options.isEmpty()) { + options += QString::fromLatin1(", "); + } + + options += CSwordBackend::translatedOptionName(static_cast < CSwordModuleInfo::FilterTypes > (opts)); + } + } + + if (!options.isEmpty()) { + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(i18n("Features")) + .arg(options); + } + + text += "</table><hr>"; + + if (category() == Cult) //clearly say the module contains cult/questionable materials + text += QString("<br/><b>%1</b><br/><br/>") + .arg(i18n("Take care, this work contains cult / questionable material!")); + + text += QString("<b>%1:</b><br><font size=\"-1\">%2</font>") + .arg(i18n("About")) + .arg(config(AboutInformation)); + + typedef QValueList<CSwordModuleInfo::ConfigEntry> ListConfigEntry; + + ListConfigEntry entries; + + entries.append(DistributionLicense); + + entries.append(DistributionSource); + + entries.append(DistributionNotes); + + entries.append(TextSource); + + entries.append(CopyrightNotes); + + entries.append(CopyrightHolder); + + entries.append(CopyrightDate); + + entries.append(CopyrightContactName); + + entries.append(CopyrightContactAddress); + + entries.append(CopyrightContactEmail); + + typedef QMap<CSwordModuleInfo::ConfigEntry, QString> MapConfigEntry; + + MapConfigEntry entryMap; + + entryMap[DistributionLicense] = i18n("Distribution license"); + + entryMap[DistributionSource] = i18n("Distribution source"); + + entryMap[DistributionNotes] = i18n("Distribution notes"); + + entryMap[TextSource] = i18n("Text source"); + + entryMap[CopyrightNotes] = i18n("Copyright notes"); + + entryMap[CopyrightHolder] = i18n("Copyright holder"); + + entryMap[CopyrightDate] = i18n("Copyright date"); + + entryMap[CopyrightContactName] = i18n("Copyright contact name"); + + entryMap[CopyrightContactAddress] = i18n("Copyright contact address"); + + entryMap[CopyrightContactEmail] = i18n("Copyright contact email"); + + text += ("<hr><table>"); + + for (ListConfigEntry::iterator it(entries.begin()); it != entries.end(); ++it) { + QString t( config(*it) ); + + if (!t.isEmpty()) { + text += QString("<tr><td><b>%1</b></td><td>%2</td></tr>") + .arg(entryMap[*it]) + .arg(config(*it)); + } + + } + + + text += "</table></font>"; + + return text; +} + +/** Returns the language of the module. */ +const CLanguageMgr::Language * const CSwordModuleInfo::language() const { + if (!m_dataCache.language) { + if (module()) { + if (category() == Glossary) { + //special handling for glossaries, we use the "from language" as language for the module + m_dataCache.language = (CPointers::languageMgr())->languageForAbbrev(config(GlossaryFrom)); + } else { + m_dataCache.language = (CPointers::languageMgr())->languageForAbbrev(module()->Lang()); + } + } else { + m_dataCache.language = (CPointers::languageMgr())->defaultLanguage(); //default language + } + } + + return m_dataCache.language; +} + + +/*! + \fn CSwordModuleInfo::getSimpleConfigEntry(char* name) + */ +QString CSwordModuleInfo::getSimpleConfigEntry(const QString& name) const { + QString ret = isUnicode() + ? QString::fromUtf8(m_module->getConfigEntry(name.latin1())) + : QString::fromLatin1(m_module->getConfigEntry(name.latin1())); + + return ret.isEmpty() ? QString::null : ret; +} + +QString CSwordModuleInfo::getFormattedConfigEntry(const QString& name) const { + SWBuf RTF_Buffer(m_module->getConfigEntry(name.latin1())); + sword::RTFHTML RTF_Filter; + RTF_Filter.processText(RTF_Buffer, 0, 0); + QString ret = isUnicode() + ? QString::fromUtf8(RTF_Buffer.c_str()) + : QString::fromLatin1(RTF_Buffer.c_str()); + + return ret.isEmpty() ? QString::null : ret; +} diff --git a/bibletime/backend/cswordmoduleinfo.h b/bibletime/backend/cswordmoduleinfo.h new file mode 100644 index 0000000..40112ec --- /dev/null +++ b/bibletime/backend/cswordmoduleinfo.h @@ -0,0 +1,373 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDMODULEINFO_H +#define CSWORDMODULEINFO_H + +//BibleTime includes +#include "clanguagemgr.h" + +//Qt includes +#include <qstring.h> +#include <qvaluelist.h> +#include <qsignal.h> + +//Sword includes +#include <listkey.h> +#include <swsearchable.h> +#include <swmodule.h> +#include <swversion.h> +#include <swdisp.h> + + +class CSwordBackend; + +class CSwordKey; + +namespace Rendering { + + class CEntryDisplay; +} + +/** + * Base class for Sword modules. + * This is the base class for all Sword modules. Every class handling a special Sword module type + * does inherit from this class. + * + * @author The BibleTime team + * @version $Id: cswordmoduleinfo.h,v 1.83 2007/02/04 23:12:32 joachim Exp $ + */ + +class CSwordModuleInfo { + +public: + /** + * These are the options which could be supported by modules and by this backend. + * It's used in @ref CSwordBackend::isOptionEnabled and @ref CSwordBackend::setOption. + */ + enum FilterTypes { + footnotes, /**< Footnotes embedded in the module's text */ + strongNumbers, /**< strong numbers, usually in the text for the info display */ + headings, /**< additional section headings */ + morphTags, /**< morphology */ + lemmas, /**< lemma tags */ + hebrewPoints,/**< Hebrew vowel points */ + hebrewCantillation, /**<Hewbrew caantillation points */ + greekAccents, /**< Greek accents may be switched on and off */ + scriptureReferences, /**< scripture references may be switched on and off, just makes sense in Bibles */ + redLetterWords, /**< Jesus words in red, color is template specific */ + textualVariants, /**< variants */ + morphSegmentation, /**< morph word segmentation, supported by OSIS */ + filterTypesMIN = footnotes, /**< first entry of this enum */ + filterTypesMAX = morphSegmentation /**< last item in this enum */ + // transliteration /* The following are handled in a special way */ + }; + /** The text direction of a module */ + enum TextDirection { /* The text direction of the modules's text */ + LeftToRight, /**< Left to right text direction, the default setting */ + RightToLeft /**< Right to left text directin, e.g. for hebrew */ + }; + /** The module type. + */ + enum ModuleType { + Bible, /**< Bible module */ + Commentary, /**< Commentary module */ + Lexicon, /**< Lexicon module */ + GenericBook, /**< Generic book module */ + Unknown /**< Fall back type for unknown modules */ + }; + /** + * This enum is used to give + * back an error code after unlocking the module + * BibleTime stores the unlock key not in the module's config file but in BibleTime's + * configuration file. + */ + enum UnlockErrorCode { + noError, /**< No error occured, everything worked ok. The key was written to the BibleTime config */ + wrongUnlockKey, /**< The wrong key was used. Module is not unlocked */ + notLocked, /**< The module was not locked so it can't be unlocked */ + noPermission /**< The key was not written to config because we have no permissions */ + }; + enum ConfigEntry { + AboutInformation, /**< The about information of a module which is stored in the config file*/ + AbsoluteDataPath, /**< The absolute data path stored in the config object */ + CipherKey, /**< The cipher key which was used to unlock the module. Not necessarily set.*/ + DataPath, /**< The relative path. See AbsoluteDataPath*/ + Description, /**< The module description stored in the config file */ + ModuleVersion, /**< The module's version.*/ + MinimumSwordVersion, /**< The required Sword Version of this module. Otherwise some things may not work (compression etc.).*/ + TextDir, /**< The text direction */ + DisplayLevel, /**< Mostly used for books. Gives the level which should contain the connected entries.*/ + GlossaryFrom, /**< lamguage from which the Glosaary tramslates */ + GlossaryTo, /**< lamguages to which the glossary maps to */ + DistributionLicense, + DistributionSource, + DistributionNotes, + TextSource, + CopyrightNotes, + CopyrightHolder, + CopyrightDate, + CopyrightContactName, + CopyrightContactAddress, + CopyrightContactEmail, + Markup /**< The markup of this module */ + }; + enum Feature { + //StrongsNumbers, /**< Use for Bibles which have embedded strong numbers */ + GreekDef, + HebrewDef, + GreekParse, + HebrewParse, + featureMin = GreekDef, + featureMax = HebrewParse + }; + enum Category { + UnknownCategory = 0, /**< The category wasn't set or has an unknwon value */ + Cult, /**< The module is a cult / sect / questionable module */ + DailyDevotional, + Glossary + }; + + /** + * Returns the base directory for search indices + */ + static const QString getGlobalBaseIndexLocation(); + /** + * Removes search index for this module, even if the module is not there any more + */ + static void deleteIndexForModule( QString name ); + + + /** + * Returns the config entry which is pecified by the parameter. + */ + const QString config( const CSwordModuleInfo::ConfigEntry entry ) const; + + CSwordModuleInfo( sword::SWModule* module, CSwordBackend* const = 0 ); + /** Copy constructor to copy the passed parameter. + * @param m The module to be copied + */ + CSwordModuleInfo( const CSwordModuleInfo& m ); + /** Reimplementation to return a valid clone. + */ + virtual CSwordModuleInfo* clone(); + /** Destructor. + */ + virtual ~CSwordModuleInfo(); + + /** + * Returns the module object so all objects can access the original Sword module. + */ + inline sword::SWModule* const module() const; + /** + * Sets the unlock key of the modules and writes the key into the cofig file. + * @return True if the unlock process was succesful, if the key was wrong, or if the config file was write protected return false. + */ + const bool unlock( const QString& unlockKey ); + /** + * Returns the display object for this module. Normally every module should have a Display object. + * Please don't use module()->Display() because this function does return the Sword display and does + * render the text, too. + * This function performs some casts to return the correct display. If it returns 0 there's no valid + * display object. + */ + Rendering::CEntryDisplay* const getDisplay() const; + /** + * This function does return true if the data files of the module are encrypted by the module author + * (the on who made the module) no matter if it's locked or not. + * @return True if this module is encryped + */ + const bool isEncrypted() const; + /** + * This function returns true if this module is locked (encrypted + correct cipher key), + * otherwise return false. + * @return True if this module is locked, i.e. encrypted but without a key set + */ + const bool isLocked(); + + const bool unlockKeyIsValid(); + + /** The module version. + * @return true if this module has a version number and false if it doesn't have one. + */ + inline const bool hasVersion() const; + + /** + * Returns true if the module's index has been built. + */ + virtual const bool hasIndex(); + /** + * Returns the path to this module's index base dir + */ + virtual const QString getModuleBaseIndexLocation() const; + /** + * Returns the path to this module's standard index + */ + virtual const QString getModuleStandardIndexLocation() const; + /** + * Builds a search index for this module + */ + virtual void buildIndex(); + /** + * Returns index size + */ + virtual unsigned long indexSize() const; + + void connectIndexingFinished(QObject* receiver, const char* slot); + void connectIndexingProgress(QObject* receiver, const char* slot); + void disconnectIndexingSignals(QObject* receiver); + + /** + * Returns true if something was found, otherwise return false. + * This function uses CLucene to perform and index based search. It also + * overwrites the variable containing the last search result. + */ + virtual const bool searchIndexed(const QString& searchedText, sword::ListKey& scope); + /** + * Returns the last search result for this module. + * The last result is cleared by @ref search + */ + virtual sword::ListKey& searchResult( const sword::ListKey* newResult = 0 ); + /** + * Clears the last search result. + * This does immediately clean the last search result, + * no matter if search is in progress or not. + */ + void clearSearchResult(); + /** + * Returns the type of the module. + */ + virtual const CSwordModuleInfo::ModuleType type() const; + /** + * Returns the required Sword version for this module. + * Returns -1 if no special Sword version is required. + */ + const sword::SWVersion minimumSwordVersion(); + /** + * Returns the name of the module. + * @return The name of this module. + */ + inline const QString name() const; + /** + * Snaps to the closest entry in the module if the current key is + * not present in the data files. + */ + virtual const bool snap() { + return false; + }; + + const bool has( const CSwordModuleInfo::Feature ) const; + const bool has( const CSwordModuleInfo::FilterTypes ) const; + /** + * Returns the text direction of the module's text., + */ + virtual const CSwordModuleInfo::TextDirection textDirection(); + /** + * Writes the new text at the given position into the module. This does only work for writabe modules. + */ + virtual void write( CSwordKey* key, const QString& newText ); + /** + * Deletes the current entry and removes it from the module. + */ + const bool deleteEntry( CSwordKey* const key ); + /** + * Returns the language of the module. + */ + const CLanguageMgr::Language* const language() const; + /** + * Returns true if this module may be written by the write display windows. + */ + inline virtual const bool isWritable() const; + /** + * Returns the category of this module. See CSwordModuleInfo::Category for possible values. + */ + const CSwordModuleInfo::Category category() const; + /** + * The about text which belongs to this module. + */ + QString aboutText() const; + /** + * Returns true if this module is Unicode encoded. False if the charset is iso8859-1. + * Protected because it should not be used outside of the CSword*ModuleInfo classes. + */ + inline const bool isUnicode() const { + return m_dataCache.isUnicode; + } + +protected: + friend class CSwordBackend; + + inline CSwordBackend* backend() const { + return m_backend; + } + + inline void backend( CSwordBackend* newBackend ) { + if (newBackend) { + m_backend = newBackend; + } + } + + QString getSimpleConfigEntry(const QString& name) const; + QString getFormattedConfigEntry(const QString& name) const; + +private: + sword::SWModule* m_module; + sword::ListKey m_searchResult; + + mutable struct DataCache { + DataCache() { + language = 0; + } + + QString name; + bool isUnicode; + CSwordModuleInfo::Category category; + const CLanguageMgr::Language* language; + bool hasVersion; + } + + m_dataCache; + + CSwordBackend* m_backend; + + QSignal m_indexingFinished; + QSignal m_indexingProgress; +}; + +// typedef QPtrList<CSwordModuleInfo> ListCSwordModuleInfo; +typedef QValueList<CSwordModuleInfo*> ListCSwordModuleInfo; + +inline const CSwordModuleInfo::ModuleType CSwordModuleInfo::type() const { + return CSwordModuleInfo::Unknown; +} + +inline sword::SWModule* const CSwordModuleInfo::module() const { + return m_module; +} + +inline const bool CSwordModuleInfo::hasVersion() const { + return m_dataCache.hasVersion; +} + + +/** Returns the name of the module. */ +inline const QString CSwordModuleInfo::name() const { + return m_dataCache.name; +} + +/** Returns true if this module may be written by the write display windows. */ +inline const bool CSwordModuleInfo::isWritable() const { + return false; +} + +#include "util/cpointers.h" + +#endif diff --git a/bibletime/backend/cswordmodulesearch.cpp b/bibletime/backend/cswordmodulesearch.cpp new file mode 100644 index 0000000..3d00fd7 --- /dev/null +++ b/bibletime/backend/cswordmodulesearch.cpp @@ -0,0 +1,120 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordmodulesearch.h" +#include "cswordmoduleinfo.h" +#include "cswordbackend.h" +#include "../frontend/cbtconfig.h" + +//Sword includes +#include <swmodule.h> +#include <swkey.h> +#include <listkey.h> + + +CSwordModuleSearch* CSwordModuleSearch::searcher = 0; + +CSwordModuleSearch::CSwordModuleSearch() : +m_searchedText(QString::null), +m_searchOptions(0), +m_foundItems(false){ + searcher = this; +} + +CSwordModuleSearch::~CSwordModuleSearch() { + searcher = 0; +} + +/** This function sets the modules which should be searched. */ +void CSwordModuleSearch::setModules( const ListCSwordModuleInfo& list ) { + m_moduleList = list; +} + +/** Starts the search for the search text. */ +const bool CSwordModuleSearch::startSearch() { + backend()->setFilterOptions ( CBTConfig::getFilterOptionDefaults() ); + m_foundItems = false; + + bool foundItems = false; + + // for (m_moduleList.first(); m_moduleList.current() && !m_terminateSearch; m_moduleList.next()) { + ListCSwordModuleInfo::iterator end_it = m_moduleList.end(); + + for (ListCSwordModuleInfo::iterator it = m_moduleList.begin(); it != end_it; ++it) { + if ( (*it)->searchIndexed(m_searchedText/*, m_searchOptions*/, m_searchScope) ) { + foundItems = true; + } + } + + m_foundItems = foundItems; + + m_finishedSig.activate(); + return true; +} + +/** Sets the text which should be search in the modules. */ +void CSwordModuleSearch::setSearchedText( const QString& text ) { + m_searchedText = text; +} + +/** Sets the search scope. */ +void CSwordModuleSearch::setSearchScope( const sword::ListKey& scope ) { + m_searchScope.copyFrom( scope ); + + if (!strlen(scope.getRangeText())) { //we can't search with an empty search scope, would crash + //reset the scope + resetSearchScope(); + + //disable searching with a scope! + // if (m_searchOptions | useScope) { + // qWarning("using the scope!"); + //set back the scope flag + // } + } +} + +/** Sets the search scope back. */ +void CSwordModuleSearch::resetSearchScope() { + m_searchScope.ClearList(); +} + +/** Returns true if in the last search the searcher found items, if no items were found return false. */ +const bool CSwordModuleSearch::foundItems() const { + return m_foundItems; +} + +/** Returns a copy of the used search scope. */ +const sword::ListKey& CSwordModuleSearch::searchScope() const { + return m_searchScope; +} + +void CSwordModuleSearch::connectFinished( QObject *receiver, const char *member ) { + m_finishedSig.connect(receiver, member); +} + +/** Should be called when the search finished. */ +void CSwordModuleSearch::searchFinished() { + m_finishedSig.activate(); +} + +const bool CSwordModuleSearch::modulesHaveIndices( const ListCSwordModuleInfo& modules ) +{ + bool hasIndices = true; + ListCSwordModuleInfo::const_iterator end_it = modules.end(); + for( ListCSwordModuleInfo::const_iterator it = modules.begin(); it != end_it; ++it) { + if (!(*it)->hasIndex()) { + hasIndices = false; + break; + } + } + return hasIndices; +} diff --git a/bibletime/backend/cswordmodulesearch.h b/bibletime/backend/cswordmodulesearch.h new file mode 100644 index 0000000..8c65d1c --- /dev/null +++ b/bibletime/backend/cswordmodulesearch.h @@ -0,0 +1,99 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDMODULESEARCH_H +#define CSWORDMODULESEARCH_H + +//BibleTime - backend +#include "cswordmoduleinfo.h" + +//BibleTime - utils +#include "util/cpointers.h" + +//Qt includes +#include <qptrlist.h> +#include <qstring.h> +#include <qsignal.h> + +//System includes +#include <pthread.h> + +//Sword includes +#include <listkey.h> + +/** + * CSwordModuleSearch manages the search on Sword modules. It manages the thread(s) + * and manages the different modules. + * + * @author The BibleTime team + * @version $Id: cswordmodulesearch.h,v 1.34 2006/08/08 19:32:48 joachim Exp $ + */ + +class CSwordModuleSearch: public CPointers { + +public: + CSwordModuleSearch(); + /** + * The destructor of this class. It cleans uop memory before it's deleted. + */ + virtual ~CSwordModuleSearch(); + /** + * Sets the text which should be search in the modules. + */ + void setSearchedText( const QString& ); + /** + * Starts the search for the search text. + */ + const bool startSearch(); + /** + * This function sets the modules which should be searched. + */ + void setModules( const ListCSwordModuleInfo& ); + /** + * Sets the search scope. + */ + void setSearchScope( const sword::ListKey& scope ); + /** + * Sets the seaech scope back. + */ + void resetSearchScope(); + /** + * @return "true" if in the last search the searcher found items, if no items were found return "false" + */ + const bool foundItems() const; + /** + * Returns a copy of the used search scope. + */ + const sword::ListKey& searchScope() const; + + void connectFinished( QObject * receiver, const char * member ); + void searchFinished(); + + /** + * Returns true if all of the specified modules have indices already built. + */ + const bool modulesHaveIndices( const ListCSwordModuleInfo& ); + +protected: + QString m_searchedText; + sword::ListKey m_searchScope; + ListCSwordModuleInfo m_moduleList; + + int m_searchOptions; + + bool m_foundItems; + +private: + QSignal m_finishedSig; + static CSwordModuleSearch* searcher; +}; + +#endif diff --git a/bibletime/backend/cswordtreekey.cpp b/bibletime/backend/cswordtreekey.cpp new file mode 100644 index 0000000..0b17996 --- /dev/null +++ b/bibletime/backend/cswordtreekey.cpp @@ -0,0 +1,99 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2007 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#include "cswordtreekey.h" +#include "cswordbookmoduleinfo.h" + +#include <qtextcodec.h> + +CSwordTreeKey::CSwordTreeKey( const CSwordTreeKey& k ) : CSwordKey(k), TreeKeyIdx(k) {} + +CSwordTreeKey::CSwordTreeKey( const TreeKeyIdx *k, CSwordModuleInfo* module ) : CSwordKey(module), TreeKeyIdx(*k) {} + +CSwordTreeKey* CSwordTreeKey::copy() const { + return new CSwordTreeKey(*this); +} + +const QString CSwordTreeKey::getLocalNameUnicode() const +{ + Q_ASSERT(m_module); + CSwordTreeKey* nonconst_this = const_cast<CSwordTreeKey*>(this); + if (!m_module || m_module->isUnicode()) { + return QString::fromUtf8(nonconst_this->getLocalName()); + } else { + QTextCodec *codec = QTextCodec::codecForName("CP1252"); + return codec->toUnicode(nonconst_this->getLocalName()); + } +} + +/** Returns the key of this instance */ +const QString CSwordTreeKey::key() const { + Q_ASSERT(m_module); + if (!m_module || m_module->isUnicode()) { + return QString::fromUtf8(getText()); + } else { + QTextCodec *codec = QTextCodec::codecForName("CP1252"); + return codec->toUnicode(getText()); + } +} + +/** Returns the raw key for use by Sword */ +const char* CSwordTreeKey::rawKey() const { + return getText(); +} + +const bool CSwordTreeKey::key( const QString& newKey ) { + Q_ASSERT(m_module); + if (!m_module || m_module->isUnicode()) { + return key((const char*)newKey.utf8()); + } else { + QTextCodec *codec = QTextCodec::codecForName("CP1252"); + return key((const char*)codec->fromUnicode(newKey)); + } +} + +const bool CSwordTreeKey::key( const char* newKey ) { + Q_ASSERT(newKey); + + if (newKey) { + TreeKeyIdx::operator = (newKey); + } + else { + root(); + } + + return !Error(); +} + +CSwordModuleInfo* const CSwordTreeKey::module( CSwordModuleInfo* const newModule ) { + if (newModule && (newModule != m_module) && (newModule->type() == CSwordModuleInfo::GenericBook) ) { + m_module = newModule; + + const QString oldKey = key(); + + CSwordBookModuleInfo* newBook = dynamic_cast<CSwordBookModuleInfo*>(newModule); + copyFrom( *(newBook->tree()) ); + + key(oldKey); //try to restore our old key + + //set the key to the root node + root(); + firstChild(); + } + + return m_module; +} + +/** Assignment operator. */ +CSwordTreeKey& CSwordTreeKey::operator = (const QString& keyname ) { + key(keyname); + return *this; + } diff --git a/bibletime/backend/cswordtreekey.h b/bibletime/backend/cswordtreekey.h new file mode 100644 index 0000000..7ba563d --- /dev/null +++ b/bibletime/backend/cswordtreekey.h @@ -0,0 +1,74 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2007 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDTREEKEYIDX_H +#define CSWORDTREEKEYIDX_H + +//BibleTime includes +#include "cswordkey.h" + +//Sword includes +#include <treekeyidx.h> + +class CSwordModuleInfo; + +/** BibleTime's implementation of Sword's TreeKeyIdx class. + * @short CSwordKey implementation for Sword's TreeKey + * @author The BibleTime team + */ + +class CSwordTreeKey : public CSwordKey, public sword::TreeKeyIdx { + +public: + /** Constructor of this CSwordKey implementation. + * @param k The Sword tree key which belongs to this key + * @param module The module which belongs to this key + */ + CSwordTreeKey( const sword::TreeKeyIdx *k, CSwordModuleInfo* module ); + /** Copy constructor. + */ + CSwordTreeKey( const CSwordTreeKey& k ); + /** The module which belongs to this key. + * @return The module. + */ + virtual CSwordModuleInfo* const module( CSwordModuleInfo* const newModule ); + /** Copy method. + * @return A new copy of this object. + */ + virtual CSwordTreeKey* copy() const; + /** + * Returns the last part of the current key as unicode decoded QString. + * Use this instead of TreeKeyIdx::getLocalName() to avoid encoding problems. + */ + virtual const QString getLocalNameUnicode() const; + /** + * Returns the current key + */ + virtual const QString key() const; + /** + * Set the key. If the parameter is empty or null, the key will be set to "/" + */ + virtual const bool key( const QString& key ); + /** + * Set/get the key. If the parameter is not set (means equal to QString::null) + * the used key is returned. Otherwise the key is set and the new on ei returned. + */ + virtual const bool key( const char* key ); + /** + * Assignment operator. + */ + virtual CSwordTreeKey& operator = (const QString& keyname ); +protected: + /**Get the unencoded key for use by Sword.*/ + virtual const char * rawKey() const; +}; + +#endif diff --git a/bibletime/backend/cswordversekey.cpp b/bibletime/backend/cswordversekey.cpp new file mode 100644 index 0000000..550377b --- /dev/null +++ b/bibletime/backend/cswordversekey.cpp @@ -0,0 +1,320 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "cswordversekey.h" +#include "cswordbiblemoduleinfo.h" +#include "cswordcommentarymoduleinfo.h" + +//Qt includes +#include <qstringlist.h> + +//Sword includes +#include <swmodule.h> +#include <localemgr.h> + +// Boost includes +// TODO: Detect Boost in autoconf +#include <boost/scoped_ptr.hpp> + +// Needed for new Sword libraries +// TODO: Move this into autoconf +#define SWORD_MULTIVERSE + +CSwordVerseKey::CSwordVerseKey( CSwordModuleInfo* const module ) : CSwordKey(module) { + if ( CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module) ) { + key( bible->lowerBound().key() ); + } +} + +CSwordVerseKey::CSwordVerseKey( const CSwordVerseKey& k ) : CSwordKey(k), VerseKey(k) {} + +CSwordVerseKey::CSwordVerseKey( const VerseKey* const k, CSwordModuleInfo* const module ) : CSwordKey(module), VerseKey(*k) {} + +/** Clones this object. */ +CSwordKey* CSwordVerseKey::copy() const { + return new CSwordVerseKey(*this); +} + +/** Sets the module for this key */ +CSwordModuleInfo* const CSwordVerseKey::module( CSwordModuleInfo* const newModule ) { + if (newModule && ((newModule->type() == CSwordModuleInfo::Bible) || (newModule->type() == CSwordModuleInfo::Commentary) ) ) { + m_module = newModule; + + //check if the module contains the key we present + CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(newModule); + + if (_compare(bible->lowerBound()) < 0) { + key( bible->lowerBound() ); + } + + if (_compare(bible->upperBound()) > 0) { + key( bible->upperBound() ); + } + } + + return dynamic_cast<CSwordBibleModuleInfo*>(m_module); +} + +/** Returns the current book as Text, not as integer. */ +const QString CSwordVerseKey::book( const QString& newBook ) { + int min = 0; + int max = 1; + + if (CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module())) { + const bool hasOT = bible->hasTestament(CSwordBibleModuleInfo::OldTestament); + const bool hasNT = bible->hasTestament(CSwordBibleModuleInfo::NewTestament); + + if (hasOT && hasNT) { + min = 0; + max = 1; + } + else if (hasOT && !hasNT) { + min = 0; + max = 0; + } + else if (!hasOT && hasNT) { + min = 1; + max = 1; + } + else if (!hasOT && !hasNT) { + min = 0; + max = -1; //no loop + } + } + + if (!newBook.isEmpty()) { + +#ifdef SWORD_MULTIVERSE + setBookName(newBook.utf8().data()); +#else + + bool finished = false; + + for (int testament = min; testament <= max && !finished; ++testament) { + for (int book = 0; book < BMAX[testament] && !finished; ++book) { + if ( !strcmp(newBook.toUtf8().constData(), books[testament][book].name ) ) { + Testament(testament+1); + Book(book+1); + finished = true; + } + } + } +#endif + } + + if ( (Testament() >= min+1) && (Testament() <= max+1) && (Book() <= BMAX[min]) ) { + return QString::fromUtf8( getBookName() ); + } + + //return QString::fromUtf8( books[min][0].name ); //return the first book, i.e. Genesis + return QString::null; +} + +/** Sets the key we use to the parameter. */ +const QString CSwordVerseKey::key() const { + return QString::fromUtf8(getText()); +} + +const char * CSwordVerseKey::rawKey() const { + return getText(); +} + +const bool CSwordVerseKey::key( const QString& newKey ) { + return key( (const char*)newKey.utf8() ); +} + +const bool CSwordVerseKey::key( const char* newKey ) { + if (newKey && (strlen(newKey)>0) ) { + VerseKey::operator = (newKey); + } + else if (newKey && !strlen(newKey)) { + CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module()); + + if ( bible ) { + VerseKey::operator = ((const char*)bible->lowerBound().key().utf8()); + } + } + + return !Error(); +} + +const bool CSwordVerseKey::next( const JumpType type ) { + Error(); //clear Error status + bool ret = true; + + switch (type) { + + case UseBook: { + const int currentTestament = Testament(); + const int currentBook = Book(); + + if ((currentTestament == 2) && (currentBook >= BMAX[currentTestament-1])) { //Revelation, i.e. end of navigation + return false; + } + else if ((currentTestament == 1) && (currentBook >= BMAX[currentTestament-1])) { //Malachi, switch to the NT + Testament(currentTestament+1); + Book(1); + } + else { + Book(Book()+1); + } + break; + } + + case UseChapter: { + Chapter(Chapter()+1); + break; + } + + case UseVerse: { + if (m_module && m_module->module()) { + const bool oldStatus = m_module->module()->getSkipConsecutiveLinks(); + m_module->module()->setSkipConsecutiveLinks(true); + + //disable headings for next verse + const bool useHeaders = (Verse() == 0); + const bool oldHeadingsStatus = ((VerseKey*)(m_module->module()->getKey()))->Headings( useHeaders ); + //don't use setKey(), that would create a new key without Headings set + m_module->module()->getKey()->setText( (const char*)key().utf8() ); + + (*(m_module->module()) )++; + + ((VerseKey*)(m_module->module()->getKey()))->Headings(oldHeadingsStatus); + m_module->module()->setSkipConsecutiveLinks(oldStatus); + + if (!m_module->module()->Error()) { + key( QString::fromUtf8(m_module->module()->KeyText()) ); + } + else { + // Verse(Verse()+1); + //don't change the key, restore the module's position + m_module->module()->getKey()->setText( (const char*)key().utf8() ); + ret = false; + break; + } + + } + else { + Verse(Verse()+1); + } + + break; + } + + default: + return false; + } + + if ( CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module()) ) { + if (_compare(bible->lowerBound()) < 0 ) { + key( bible->lowerBound() ); + ret = false; + } + + if (_compare(bible->upperBound()) > 0 ) { + key( bible->upperBound() ); + ret = false; + } + + return ret; + } + else if (Error()) { //we have no module, so take care of VerseKey::Error() + return false; + } + + return ret; +} + +const bool CSwordVerseKey::previous( const JumpType type ) { + bool ret = true; + + switch (type) { + + case UseBook: { + if ( (Book() == 1) && (Testament() == 1) ) { //Genesis + return false; + } + else if ( (Book() == 1) && (Testament() == 2) ){ //Matthew + Testament(1); + Book(BMAX[0]); + } + else{ + Book( Book()-1 ); + } + + break; + } + + case UseChapter: { + Chapter(Chapter()-1); + break; + } + + case UseVerse: { + if (m_module && m_module->module()) { + const bool useHeaders = (Verse() == 0); + const bool oldHeadingsStatus = ((VerseKey*)(m_module->module()->getKey()))->Headings( useHeaders ); + + m_module->module()->getKey()->setText( (const char*)key().utf8() ); + + const bool oldStatus = m_module->module()->getSkipConsecutiveLinks(); + m_module->module()->setSkipConsecutiveLinks(true); + ( *( m_module->module() ) )--; + + ((VerseKey*)(m_module->module()->getKey()))->Headings( oldHeadingsStatus ); + m_module->module()->setSkipConsecutiveLinks(oldStatus); + + if (!m_module->module()->Error()) { + key( QString::fromUtf8(m_module->module()->KeyText()) );//don't use fromUtf8 + } + else { + ret = false; + // Verse(Verse()-1); + m_module->module()->getKey()->setText( (const char*)key().utf8() ); //restore module's key + } + } + else { + Verse(Verse()-1); + } + + break; + } + + default: + return false; + } + + if ( CSwordBibleModuleInfo* bible = dynamic_cast<CSwordBibleModuleInfo*>(module()) ) { + if (_compare(bible->lowerBound()) < 0 ) { + key( bible->lowerBound() ); + ret = false; + } + + if (_compare(bible->upperBound()) > 0 ) { + key( bible->upperBound() ); + ret = false; + } + + return ret; + } + else if (Error()) { + return false; + } + + return ret; +} + +/** Assignment operator for more ease of use. */ +CSwordVerseKey& CSwordVerseKey::operator = (const QString& keyname) { + key(keyname); + return *this; +} diff --git a/bibletime/backend/cswordversekey.h b/bibletime/backend/cswordversekey.h new file mode 100644 index 0000000..79c9fe3 --- /dev/null +++ b/bibletime/backend/cswordversekey.h @@ -0,0 +1,122 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDVERSEKEY_H +#define CSWORDVERSEKEY_H + +//own includes +#include "cswordkey.h" +#include "cswordmoduleinfo.h" + +//Qt includes +#include <qstring.h> + +//Sword includes +#include <versekey.h> + +/** + * The CSwordKey implementation for verse based modules (Bibles and Commentaries) + * + * This class is the implementation of CKey for verse based modules like + * Bibles and commentaries. + * This class provides the special functions to work with the verse based modules. + * + * Useful functions are + * @see NextBook() + * @see PreviousBook() + * @see NextChapter() + * @see PreviousChapter() + * @see NextVerse() + * @see PreviousVerse(). + * + * Call the constructor only with a valid verse based modules, otherwise this key will be invalid + * and the application will probably crash. + * + * @version $Id: cswordversekey.h,v 1.27 2007/10/26 18:26:23 jerickson314 Exp $ + * @short CSwordKey implementation for Sword's VerseKey. + * @author The BibleTime team + */ + +class CSwordVerseKey : public CSwordKey, public sword::VerseKey { + +public: + enum JumpType { + UseBook, + UseChapter, + UseVerse + }; + + /** + * Constructor of this class. + * + * This function will construct a versekey with the current module position + * and it will setup the m_module members. + * + */ + CSwordVerseKey( CSwordModuleInfo* const module ); + /** + * Copy constructor. + */ + CSwordVerseKey( const CSwordVerseKey& k ); + /** + * VerseKey based constructor. + */ + CSwordVerseKey( const sword::VerseKey* const k, CSwordModuleInfo* const module ); + /** + * Clones this object. + */ + virtual CSwordKey* copy() const; + /** + * Set/get the key. If the parameter is not set (means equal to QString::null) + * the used key is returned. Otherwise the key is set and the new on ei returned. + */ + virtual const QString key() const; + /** + * Set the current key. + */ + virtual const bool key( const QString& ); + /** + * Set/get the key. If the parameter is not set (means equal to QString::null) + * the used key is returned. Otherwise the key is set and the new on ei returned. + */ + virtual const bool key( const char* key ); + + /** + * Jumps to the next entry of the given type + */ + const bool next( const JumpType type ); + /** + * Jumps to the previous entry of the given type + */ + const bool previous ( const JumpType type ); + /** + * This functions returns the current book as localised text, not as book numer. + * + * Use "char Book()" to retrieve the book number of the current book. + * @return The name of the current book + */ + const QString book(const QString& newBook = QString::null); + /** + * Sets the module for this key + */ + virtual CSwordModuleInfo* const module( CSwordModuleInfo* const newModule = 0 ); + /** + * Assignment operator for more ease of use. + */ + virtual CSwordVerseKey& operator = (const QString& keyname); +protected: + /** + * Returns the raw key for use with Sword. + */ + virtual const char * rawKey() const; +}; + +#endif diff --git a/bibletime/backend/ctextrendering.cpp b/bibletime/backend/ctextrendering.cpp new file mode 100644 index 0000000..f3f5a9c --- /dev/null +++ b/bibletime/backend/ctextrendering.cpp @@ -0,0 +1,278 @@ +// +// C++ Implementation: ctextrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "ctextrendering.h" + +//BibleTime includes +#include "backend/cswordkey.h" +#include "backend/cswordversekey.h" +#include "backend/cswordmoduleinfo.h" +#include "backend/cdisplaytemplatemgr.h" +#include "backend/creferencemanager.h" + +#include "util/scoped_resource.h" +#include "util/ctoolclass.h" + +//Sword includes +#include <swkey.h> + +//Qt includes +#include <qregexp.h> + +//KDE includes +#include <klocale.h> +#include <kurl.h> + +using namespace Rendering; + +CTextRendering::KeyTreeItem::KeyTreeItem(const QString& key, CSwordModuleInfo const * mod, const Settings settings ) +: m_settings( settings ), +m_moduleList(), +m_key( key ), +m_childList( 0 ), +m_stopKey( QString::null ), +m_alternativeContent( QString::null ) { + m_moduleList.append( const_cast<CSwordModuleInfo*>(mod) ); //BAD CODE +} + +CTextRendering::KeyTreeItem::KeyTreeItem(const QString& content, const Settings settings ) +: m_settings( settings ), +m_moduleList(), +m_key( QString::null ), +m_childList( 0 ), +m_stopKey( QString::null ), +m_alternativeContent( content ) {} + +CTextRendering::KeyTreeItem::KeyTreeItem(const QString& key, const ListCSwordModuleInfo& mods, const Settings settings ) +: m_settings( settings ), +m_moduleList( mods ), +m_key( key ), +m_childList( 0 ), +m_stopKey( QString::null ), +m_alternativeContent( QString::null ) {} + +CTextRendering::KeyTreeItem::KeyTreeItem() +: m_settings(), +m_moduleList(), +m_key(QString::null), +m_childList(0), +m_stopKey(QString::null), +m_alternativeContent(QString::null) {} + +CTextRendering::KeyTreeItem::KeyTreeItem(const KeyTreeItem& i) +: m_settings( i.m_settings ), +m_moduleList( i.m_moduleList ), +m_key( i.m_key ), +m_childList( 0 ), +m_stopKey( i.m_stopKey ), +m_alternativeContent( i.m_alternativeContent ) { + if (i.hasChildItems()) { + m_childList = new KeyTree(); + *m_childList = *(i.childList()); //deep copy + } + +} + +CTextRendering::KeyTreeItem::~KeyTreeItem() { + delete m_childList; + m_childList = 0; +} + +CTextRendering::KeyTreeItem::KeyTreeItem(const QString& startKey, const QString& stopKey, CSwordModuleInfo* module, const Settings settings) +: m_settings( settings ), +m_moduleList(), +m_key( startKey ), +m_childList( 0 ), +m_stopKey( stopKey ), +m_alternativeContent( QString::null ) { + Q_ASSERT(module); + m_moduleList.append(module); + + //use the start and stop key to ceate our child items + + if (module->type() == CSwordModuleInfo::Bible) { + CSwordVerseKey start(module); + start = startKey; + + CSwordVerseKey stop(module); + stop = stopKey; + + if (!m_key.isEmpty() && !m_stopKey.isEmpty()) { //we have a range of keys + bool ok = true; + + while (ok && ((start < stop) || (start == stop)) ) { //range + childList()->append( + new KeyTreeItem(start.key(), module, KeyTreeItem::Settings(false, settings.keyRenderingFace)) + ); + + + ok = start.next(CSwordVerseKey::UseVerse); + } + } + else if (m_key.isEmpty()) { + childList()->append( new KeyTreeItem(startKey, module, KeyTreeItem::Settings(false, settings.keyRenderingFace)) ); + } + } + else if ((module->type() == CSwordModuleInfo::Lexicon) || (module->type() == CSwordModuleInfo::Commentary) ) { + childList()->append( new KeyTreeItem(startKey, module, KeyTreeItem::Settings(false, KeyTreeItem::Settings::NoKey)) ); + } + else if (module->type() == CSwordModuleInfo::GenericBook) { + childList()->append( new KeyTreeItem(startKey, module, KeyTreeItem::Settings(false, KeyTreeItem::Settings::NoKey)) ); + } + + //make it into "<simple|range> (modulename)" + + if (startKey == stopKey) { + m_alternativeContent = startKey; + } + else { + sword::VerseKey vk(startKey.utf8(), stopKey.utf8()); + + if (vk.LowerBound().Book() != vk.UpperBound().Book()) { + m_alternativeContent = QString::fromUtf8(vk.getRangeText()); + } + else if (vk.LowerBound().Chapter() != vk.UpperBound().Chapter()) { + m_alternativeContent = QString("%1 - %2:%3") + .arg(QString::fromUtf8(vk.LowerBound().getText())) + .arg(vk.UpperBound().Chapter()) + .arg(vk.UpperBound().Verse()); + } + else { //only verses differ (same book, same chapter) + m_alternativeContent = QString("%1 - %2") + .arg(QString::fromUtf8(vk.LowerBound().getText())) + .arg(vk.UpperBound().Verse()); + } + } + + m_alternativeContent.append(" (").append(module->name()).append(")"); + m_alternativeContent.prepend("<div class=\"rangeheading\" dir=\"ltr\">").append("</div>"); //insert the right tags +} + +const QString& CTextRendering::KeyTreeItem::getAlternativeContent() const { + return m_alternativeContent; +} + +ListCSwordModuleInfo CTextRendering::KeyTree::collectModules() const { + //collect all modules which are available and used by child items + ListCSwordModuleInfo modules; + + for (KeyTreeItem* c = first(); c; c = next()) { + Q_ASSERT(c); + + ListCSwordModuleInfo childMods = c->modules(); + + /*ToDo: Use the const iterators as soon as we use Qt > 3.1 + const ListCSwordModuleInfo::const_iterator c_end = childMods.end(); + for (ListCSwordModuleInfo::const_iterator c_it = childMods.constBegin(); c_it != c_end; ++c_it) { + if (!modules.contains(*c_it)) { + modules.append(*c_it); + } + }*/ + + // for (CSwordModuleInfo* m = childMods.first(); m; m = childMods.next()) { + ListCSwordModuleInfo::iterator end_it = childMods.end(); + + for (ListCSwordModuleInfo::iterator it(childMods.begin()); it != end_it; ++it) { + if (!modules.contains(*it)) { + modules.append(*it); + } + } + + } + + return modules; +} + +const QString CTextRendering::renderKeyTree( KeyTree& tree ) { + initRendering(); + + ListCSwordModuleInfo modules = tree.collectModules(); + QString t; + + //optimization for entries with the same key + util::scoped_ptr<CSwordKey> key( + (modules.count() == 1) ? CSwordKey::createInstance(modules.first()) : 0 + ); + + for (KeyTreeItem* c = tree.first(); c; c = tree.next()) { + if (modules.count() == 1) { //this optimizes the rendering, only one key created for all items + key->key( c->key() ); + t.append( renderEntry( *c, key) ); + } + else { + t.append( renderEntry( *c ) ); + } + } + + return finishText(t, tree); +} + +const QString CTextRendering::renderKeyRange( const QString& start, const QString& stop, const ListCSwordModuleInfo& modules, const QString& highlightKey, const KeyTreeItem::Settings& keySettings ) { + + CSwordModuleInfo* module = modules.first(); + //qWarning( "renderKeyRange start %s stop %s \n", start.latin1(), stop.latin1() ); + + util::scoped_ptr<CSwordKey> lowerBound( CSwordKey::createInstance(module) ); + lowerBound->key(start); + + util::scoped_ptr<CSwordKey> upperBound( CSwordKey::createInstance(module) ); + upperBound->key(stop); + + sword::SWKey* sw_start = dynamic_cast<sword::SWKey*>(lowerBound.get()); + sword::SWKey* sw_stop = dynamic_cast<sword::SWKey*>(upperBound.get()); + + Q_ASSERT((*sw_start == *sw_stop) || (*sw_start < *sw_stop)); + + if (*sw_start == *sw_stop) { //same key, render single key + return renderSingleKey(lowerBound->key(), modules); + } + else if (*sw_start < *sw_stop) { // Render range + KeyTree tree; + KeyTreeItem::Settings settings = keySettings; + + CSwordVerseKey* vk_start = dynamic_cast<CSwordVerseKey*>(lowerBound.get()); + Q_ASSERT(vk_start); + + CSwordVerseKey* vk_stop = dynamic_cast<CSwordVerseKey*>(upperBound.get()); + Q_ASSERT(vk_stop); + + bool ok = true; + while (ok && ((*vk_start < *vk_stop) || (*vk_start == *vk_stop))) { + //make sure the key given by highlightKey gets marked as current key + settings.highlight = (!highlightKey.isEmpty() ? (vk_start->key() == highlightKey) : false); + + /*TODO: We need to take care of linked verses if we render one or (esp) more modules + If the verses 2,3,4,5 are linked to 1, it should be displayed as one entry with the caption 1-5 */ + + if (vk_start->Chapter() == 0){ //range was 0:0-1:x, render 0:0 first and jump to 1:0 + vk_start->Verse(0); + tree.append( new KeyTreeItem(vk_start->key(), modules, settings) ); + vk_start->Chapter(1); + vk_start->Verse(0); + } + tree.append( new KeyTreeItem(vk_start->key(), modules, settings) ); + ok = vk_start->next(CSwordVerseKey::UseVerse); + } + + return renderKeyTree(tree); + } + + return QString::null; +} + +const QString CTextRendering::renderSingleKey( const QString& key, const ListCSwordModuleInfo& moduleList, const KeyTreeItem::Settings& settings ) { + KeyTree tree; + tree.append( new KeyTreeItem(key, moduleList, settings) ); + + return renderKeyTree(tree); +} + + diff --git a/bibletime/backend/ctextrendering.h b/bibletime/backend/ctextrendering.h new file mode 100644 index 0000000..d034959 --- /dev/null +++ b/bibletime/backend/ctextrendering.h @@ -0,0 +1,147 @@ +// +// C++ Interface: ctextrendering +// +// Description: +// +// +// Author: The BibleTime team <info@bibletime.info>, (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#ifndef CTEXTRENDERING_H +#define CTEXTRENDERING_H + +//BT includes +#include "backend/cswordmoduleinfo.h" + +#include "util/autoptrvector.h" + +//QT includes +#include <qstring.h> + +// class CSwordModuleInfo; + +class CSwordKey; + +/** + * CTextRendering is BibleTime's place where the actual rendering takes place. + * It provides several methods to convert an abstract tree of items + * into a string of html. + * + * See the implementations @ref CHTMLExportRendering and especially @ref CDisplayRendering. + * @short Text rendering based on trees + * @author The BibleTime team +*/ + +namespace Rendering { + + class CTextRendering { + +public: + + class KeyTreeItem; + + class KeyTree; + typedef util::AutoPtrVector<KeyTreeItem> KeyTreeItemList; + + class KeyTreeItem { + public: + + struct Settings { + enum KeyRenderingFace { + NoKey, //< means no key shown at all + SimpleKey, //< means only versenumber or only lexicon entry name + CompleteShort, //< means key like "Gen 1:1" + CompleteLong //< means "Genesis 1:1" + }; + + Settings(const bool highlight = false, KeyRenderingFace keyRendering = SimpleKey) : highlight(highlight), keyRenderingFace(keyRendering) {} + + bool highlight; + KeyRenderingFace keyRenderingFace; + }; + + KeyTreeItem(const QString& key, CSwordModuleInfo const * module, const Settings settings); + KeyTreeItem(const QString& key, const ListCSwordModuleInfo& modules, const Settings settings); + KeyTreeItem(const QString& startKey, const QString& stopKey, CSwordModuleInfo* module, const Settings settings); + KeyTreeItem(const QString& content, const Settings settings); + KeyTreeItem(const KeyTreeItem& i); + + virtual ~KeyTreeItem(); + + const QString& getAlternativeContent() const; + inline void setAlternativeContent(const QString& newContent) { + m_alternativeContent = newContent; + }; + + inline const bool hasAlternativeContent() const { + return !m_alternativeContent.isNull(); + }; + + inline const ListCSwordModuleInfo& modules() const { + return m_moduleList; + }; + + inline const QString& key() const { + return m_key; + }; + + inline const Settings& settings() const { + return m_settings; + }; + + inline KeyTree* const childList() const; + inline const bool hasChildItems() const; + + protected: + KeyTreeItem(); + + Settings m_settings; + ListCSwordModuleInfo m_moduleList; + QString m_key; + mutable KeyTree* m_childList; + + QString m_stopKey; + QString m_alternativeContent; + }; + + class KeyTree : public KeyTreeItemList { + public: + ListCSwordModuleInfo collectModules() const; + }; + + virtual ~CTextRendering() {} + + const QString renderKeyTree( KeyTree& ); + + const QString renderKeyRange( const QString& start, const QString& stop, const ListCSwordModuleInfo& modules, const QString& hightlightKey = QString::null, const KeyTreeItem::Settings& settings = KeyTreeItem::Settings() ); + + const QString renderSingleKey( const QString& key, const ListCSwordModuleInfo&, const KeyTreeItem::Settings& settings = KeyTreeItem::Settings() ); + +protected: + virtual const QString renderEntry( const KeyTreeItem&, CSwordKey* = 0 ) = 0; + virtual const QString finishText( const QString&, KeyTree& tree ) = 0; + virtual void initRendering() = 0; +}; + +inline CTextRendering::KeyTree* const CTextRendering::KeyTreeItem::childList() const { + if (!m_childList) { + m_childList = new KeyTree(); + } + + return m_childList; +} + +inline const bool CTextRendering::KeyTreeItem::hasChildItems() const { + if (!m_childList) { + return false; + } + + return !m_childList->isEmpty(); +} + +} + +#endif diff --git a/bibletime/backend/osismorphsegmentation.cpp b/bibletime/backend/osismorphsegmentation.cpp new file mode 100644 index 0000000..7aeb63c --- /dev/null +++ b/bibletime/backend/osismorphsegmentation.cpp @@ -0,0 +1,92 @@ +/****************************************************************************** + * + * osisfootnotes - SWFilter descendant to hide or show footnotes + * in an OSIS module. + */ + + +#include "osismorphsegmentation.h" + +#include <stdlib.h> +#include <swmodule.h> +#include <swbuf.h> +#include <versekey.h> +#include <utilxml.h> +#include <utilstr.h> + + + +namespace Filters { +const char OSISMorphSegmentation::oName[] = "Morph segmentation"; +const char OSISMorphSegmentation::oTip[] = "Toggles morph segmentation On and Off if they exist"; + +const SWBuf OSISMorphSegmentation::choices[3] = {"Off", "On", ""}; + +const StringList OSISMorphSegmentation::oValues(&choices[0], &choices[2]); + +OSISMorphSegmentation::OSISMorphSegmentation() : sword::SWOptionFilter(oName, oTip, &oValues) { + setOptionValue("Off"); + } + + + OSISMorphSegmentation::~OSISMorphSegmentation() {} + + + char OSISMorphSegmentation::processText(SWBuf &text, const SWKey */*key*/, const SWModule */*module*/) { + SWBuf token; + bool intoken = false; + bool hide = false; + + SWBuf orig( text ); + const char *from = orig.c_str(); + + XMLTag tag; + + for (text = ""; *from; ++from) { + if (*from == '<') { + intoken = true; + token = ""; + continue; + } + + if (*from == '>') { // process tokens + intoken = false; + + if (!strncmp(token.c_str(), "seg ", 4) || !strncmp(token.c_str(), "/seg", 4)) { + tag = token; + + if (!tag.isEndTag() && tag.getAttribute("type") && !strcmp("morph", tag.getAttribute("type"))) { //<seg type="morph"> start tag + hide = (option == 0); //only hide if option is Off + } + + if (hide) { //hides start and end tags as long as hide is set + + if (tag.isEndTag()) { //</seg> + hide = false; + } + + continue; //leave out the current token + } + } //end of seg tag handling + + text.append('<'); + text.append(token); + text.append('>'); + + // hide = false; //not right, because there may be child tags in seg. Only /seg may disable the seg hiding. + + continue; + } //end of intoken part + + if (intoken) { //copy token + token.append(*from); + } + else { //copy text which is not inside of a tag + text.append(*from); + } + } + + return 0; + } + +} diff --git a/bibletime/backend/osismorphsegmentation.h b/bibletime/backend/osismorphsegmentation.h new file mode 100644 index 0000000..bc4ea0f --- /dev/null +++ b/bibletime/backend/osismorphsegmentation.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * $Id: osismorphsegmentation.h,v 1.4 2006/08/08 19:32:48 joachim Exp $ + * + * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) + * CrossWire Bible Society + * P. O. Box 2528 + * Tempe, AZ 85280-2528 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef OSISMORPHSEGMENTATION_H +#define OSISMORPHSEGMENTATION_H + +#include <swoptfilter.h> + +using namespace sword; + +namespace Filters { + +/** This Filter shows/hides headings in a OSIS text. + * @author Martin Gruner + */ +class OSISMorphSegmentation : public SWOptionFilter { + static const char oName[]; + static const char oTip[]; + static const SWBuf choices[3]; + static const StringList oValues; + +public: + OSISMorphSegmentation(); + virtual ~OSISMorphSegmentation(); + + virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0); +}; + +} + +#endif diff --git a/bibletime/bibletime.cpp b/bibletime/bibletime.cpp new file mode 100644 index 0000000..32030ff --- /dev/null +++ b/bibletime/bibletime.cpp @@ -0,0 +1,329 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//local includes +#include "config.h" +#include "bibletime.h" + +//frontend includes +#include "frontend/cmdiarea.h" +#include "frontend/kstartuplogo.h" +#include "frontend/mainindex/cmainindex.h" +#include "frontend/displaywindow/cdisplaywindow.h" +#include "frontend/displaywindow/creadwindow.h" +#include "frontend/displaywindow/cwritewindow.h" +#include "frontend/keychooser/ckeychooser.h" +#include "frontend/cbtconfig.h" + +#include "util/ctoolclass.h" +#include "util/cpointers.h" + +//backend includes +#include "backend/cswordmoduleinfo.h" +#include "backend/cswordbiblemoduleinfo.h" +#include "backend/cswordcommentarymoduleinfo.h" +#include "backend/cswordlexiconmoduleinfo.h" +#include "backend/cswordbookmoduleinfo.h" +#include "backend/cswordversekey.h" +#include "backend/cswordldkey.h" + + +//Qt includes +#include <qsplitter.h> + +//KDE includes +#include <kdeversion.h> +#include <kaction.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kcmdlineargs.h> +#include <klocale.h> +#include <kaccel.h> +#include <kmenubar.h> +#include <ktoolbar.h> +#include <krandomsequence.h> + +using namespace Profile; + +BibleTime::BibleTime() +: BibleTimeInterface("BibleTimeInterface"), +#if KDE_VERSION >= 0x030200 +KMainWindow(KMainWindow::NoDCOPObject, 0,0, WType_TopLevel), +#else +KMainWindow(0,0, WType_TopLevel), +#endif +m_windowActionCollection(0), +m_initialized(false), +m_moduleList(0), +m_progress(0), +m_currentProfile(0), +m_mainSplitter(0), +m_leftPaneSplitter(0), +m_mdi(0), +m_profileMgr(), +m_backend(0), +m_mainIndex(0) { + setObjId("BibleTimeInterface"); + setHelpMenuEnabled(false); + + initBackends(); + initView(); + initActions(); + + createGUI("bibletimeui.rc"); + initMenubar(); + initConnections(); + + readSettings(); + + setPlainCaption("BibleTime " VERSION); + + // we don't save the geometry, it's stored in the startup profile + setAutoSaveSettings(QString("MainWindow"), false); +} + +BibleTime::~BibleTime() { + // delete m_dcopInterface; + // The backend is deleted by the BibleTimeApp instance +} + +/** Saves the properties of BibleTime to the application wide configfile */ +void BibleTime::saveSettings() { + if (m_mdi) { + m_mdi->saveSettings(); + } + + accel()->writeSettings(CBTConfig::getConfig()); + + CBTConfig::set + (CBTConfig::toolbar, m_viewToolbar_action->isChecked()); + CBTConfig::set + (CBTConfig::mainIndex, m_viewMainIndex_action->isChecked()); + CBTConfig::set + (CBTConfig::infoDisplay, m_viewInfoDisplay_action->isChecked()); + + CBTConfig::set + (CBTConfig::mainSplitterSizes, m_mainSplitter->sizes()); + CBTConfig::set + (CBTConfig::leftPaneSplitterSizes, m_leftPaneSplitter->sizes()); + + // set the default to false + /* CBTConfig::set(CBTConfig::autoTileVertical, false); + CBTConfig::set(CBTConfig::autoTileHorizontal, false); + CBTConfig::set(CBTConfig::autoCascade, false); + */ + CBTConfig::set + (CBTConfig::autoTileVertical, m_windowAutoTileVertical_action->isChecked()); + CBTConfig::set + (CBTConfig::autoTileHorizontal, m_windowAutoTileHorizontal_action->isChecked()); + CBTConfig::set + (CBTConfig::autoCascade, m_windowAutoCascade_action->isChecked()); + + + CProfile* p = m_profileMgr.startupProfile(); + if (p) { + saveProfile(p); + } +} + +/** Reads the settings from the configfile and sets the right properties. */ +void BibleTime::readSettings() { + // accel()->readSettings(CBTConfig::getConfig()); + CBTConfig::setupAccelSettings(CBTConfig::application, actionCollection()); + + m_viewToolbar_action->setChecked( CBTConfig::get + (CBTConfig::toolbar) ); + slotToggleToolbar(); + + m_viewMainIndex_action->setChecked( CBTConfig::get + (CBTConfig::mainIndex) ); + slotToggleMainIndex(); + + m_viewInfoDisplay_action->setChecked( CBTConfig::get + (CBTConfig::infoDisplay) ); + slotToggleInfoDisplay(); + + m_mainSplitter->setSizes( + CBTConfig::get + (CBTConfig::mainSplitterSizes) + ); + m_leftPaneSplitter->setSizes( + CBTConfig::get + (CBTConfig::leftPaneSplitterSizes) + ); + + if ( CBTConfig::get + (CBTConfig::autoTileVertical) ) { + m_windowAutoTileVertical_action->setChecked( true ); + m_windowManualMode_action->setChecked(false); + slotAutoTileVertical(); + } + else if ( CBTConfig::get + (CBTConfig::autoTileHorizontal) ) { + m_windowAutoTileHorizontal_action->setChecked( true ); + m_windowManualMode_action->setChecked(false); + slotAutoTileHorizontal(); + } + else if ( CBTConfig::get + (CBTConfig::autoCascade) ) { + m_windowAutoCascade_action->setChecked(true); + m_windowManualMode_action->setChecked(false); + slotAutoCascade(); + } + else { + m_windowManualMode_action->setChecked(true); + slotManualArrangementMode(); + } +} + +/** Creates a new presenter in the MDI area according to the type of the module. */ +CDisplayWindow* BibleTime::createReadDisplayWindow(ListCSwordModuleInfo modules, const QString& key) { + kapp->setOverrideCursor( waitCursor ); + + CDisplayWindow* displayWindow = CDisplayWindow::createReadInstance(modules, m_mdi); + if ( displayWindow ) { + displayWindow->init(); + displayWindow->show(); + // if (!key.isEmpty()) + displayWindow->lookup(key); + } + + kapp->restoreOverrideCursor(); + return displayWindow; +} + + +/** Creates a new presenter in the MDI area according to the type of the module. */ +CDisplayWindow* BibleTime::createReadDisplayWindow(CSwordModuleInfo* module, const QString& key) { + ListCSwordModuleInfo list; + list.append(module); + + return createReadDisplayWindow(list, key); +} + +CDisplayWindow* BibleTime::createWriteDisplayWindow(CSwordModuleInfo* module, const QString& key, const CDisplayWindow::WriteWindowType& type) { + kapp->setOverrideCursor( waitCursor ); + + ListCSwordModuleInfo modules; + modules.append(module); + + CDisplayWindow* displayWindow = CDisplayWindow::createWriteInstance(modules, m_mdi, type); + if ( displayWindow ) { + displayWindow->init(); + displayWindow->show(); + displayWindow->lookup(key); + } + + kapp->restoreOverrideCursor(); + return displayWindow; +} + +/** Refreshes all presenters.*/ +void BibleTime::refreshDisplayWindows() { + unsigned int index; + for ( index = 0; index < m_mdi->windowList().count(); index++) { + CDisplayWindow* window = dynamic_cast<CDisplayWindow*>(m_mdi->windowList().at(index)); + if (window) { + window->reload(); + } + } +} + +/** Called before quit. */ +bool BibleTime::queryExit() { + bool ret = false; + if (m_initialized) { + saveSettings(); + ret = true; + } + + return ret; +} + +/** Called before a window is closed */ +bool BibleTime::queryClose() { + bool ret = true; + + for ( unsigned int index = 0; index < m_mdi->windowList().count(); ++index) { + if (CDisplayWindow* window = dynamic_cast<CDisplayWindow*>(m_mdi->windowList().at(index)) + ) { + ret = ret && window->queryClose(); + } + } + + return ret; +} + +/** Reimplementation used for sessions management. */ +void BibleTime::saveProperties(KConfig* /*myConfig*/) {} + +/** Reimplementation used for session management. */ +void BibleTime::readProperties(KConfig* /*myConfig*/) {} + +/** Restores the workspace if the flag for this is set in the config. */ +void BibleTime::restoreWorkspace() { + if (CProfile* p = m_profileMgr.startupProfile()) { + loadProfile(p); + } +} + +/** Sets the caption of the mainwindow */ +void BibleTime::setCaption( const QString& ) { + KMainWindow::setPlainCaption( KApplication::kApplication()->makeStdCaption( m_mdi->currentApplicationCaption() ) ); +} + +/** Sets the plain caption of the main window */ +void BibleTime::setPlainCaption( const QString& ) { + KMainWindow::setPlainCaption( KApplication::kApplication()->makeStdCaption( m_mdi->currentApplicationCaption() ) ); +} + +/** Processes the commandline options given to BibleTime. */ +void BibleTime::processCommandline() { + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + // if (CBTConfig::get(CBTConfig::crashedLastTime)) { + if (!CBTConfig::get + (CBTConfig::crashedTwoTimes) && !args->isSet("ignore-session")) { //restore workspace if it crashed only once + restoreWorkspace(); + } + // } + + //open every time a module if the command line option was set. + if ( args->isSet("open-default-bible") && !CBTConfig::get + (CBTConfig::crashedLastTime) && !CBTConfig::get + (CBTConfig::crashedTwoTimes)) { //restore workspace if it crashed ony once + QString bibleKey = args->getOption("open-default-bible"); + CSwordModuleInfo* bible = CBTConfig::get + (CBTConfig::standardBible); + + if (bibleKey == "<random>") { + CSwordVerseKey vk(0); + const int maxIndex = 32400; + + KRandomSequence rs; + int newIndex = rs.getLong(maxIndex); + vk.setPosition(sword::TOP); + vk.Index(newIndex); + bibleKey = vk.key(); + } + createReadDisplayWindow(bible, bibleKey); + // if (isVisible()) + m_mdi->myTileVertical();//we are sure only one window is open, which should be displayed fullscreen in the working area + } +} + +void BibleTime::polish() { + m_initialized = true; + + KMainWindow::polish(); + applyMainWindowSettings(CBTConfig::getConfig(), QString::fromLatin1("MainWindow")); +} + diff --git a/bibletime/bibletime.h b/bibletime/bibletime.h new file mode 100644 index 0000000..ff661e9 --- /dev/null +++ b/bibletime/bibletime.h @@ -0,0 +1,421 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef BIBLETIME_H +#define BIBLETIME_H + +//Own includes +#include "bibletimeinterface.h" + +//Frontend includes +#include "frontend/cprofilemgr.h" +#include "frontend/cprofile.h" +#include "frontend/displaywindow/cdisplaywindow.h" + +//Backend includes +#include "backend/cswordmoduleinfo.h" + +//KDE includes +#include <kmainwindow.h> + +//forward: BT classes +class CMDIArea; +class CDisplayWindow; +class CMainIndex; + +namespace InfoDisplay { + class CInfoDisplay; +} + +//KDE classes +class KToggleAction; +class KAccel; +class KPopupMenu; +class KAction; +class KActionMenu; +class KActionCollection; + +//QT classes +class QPopupMenu; +class QProgressDialog; +class QSplitter; + +/** + * @page backend The structure of the backend + * <p> + * The backend implementation for Sword is called CSwordBackend, the classes we use + * to work with keys are called CSwordVerseKey and CSwordLDKey, both are derived from + * the class CSwordKey. + * The CSwordKey derived classes used for Sword do also inherit the classes + * VerseKey (CSwordVerseKey) + * and SWKey (CSwordLDKey). + * </p> + * <p> + * The classes used to handle all module based stuff are derived from CModuleInfo. + * The module classes are: CSwordModuleInfo (for Sword modules), + * CSwordBibleModuleInfo (for bibles), CSwordCommentaryModuleInfo (for commentaries) and + * CSwordLexiconModuleInfo (for lexicons). + * Have a look at the class documentation of the mentioned classes to learn how the + * structure of them looks like and which class inherits which other class. + * </p> + * <p> + * The first objects which should be created in the application is the backend + * (for Sword the class is called CSwordBackend). + * Then create all the different module classes for the correct Sword modules. + * Have a look at + * BibleTime::initBackens() to see how it's done in BibleTime.@br + * Later you can work with them for example by using the CSwordKey and + * CSwordModuleInfo derived class. + * </p> + */ + +/** + * @page frontend The structure of the frontend + * + * <p> + * The frontend contains the classes which interact with the user. For example the main index, + * the display windows, the searchdialog or the other parts. + * </p><p> + * The main index is implemented in the class CGroupManager, the items of the + * main index are implemented in the class CGroupManagerItem. + * Each CGroupManagerItem has a type() function which returns the type of + * the object (Module, Bookmark or Group).<BR> + * The display windows are all derived from the base class CPresenter. + * The display windows which handle Sword modules are all derived from the + * CSwordPresenter class. + * The display windows which provide functionality are CBiblePresenter for + * Bibles, CCommentaryPresenter for commentaries and CLexiconPresenter for + * lexicon and dictionaries. + * CSwordPresenter provides the essential base functions which are + * reimplemented in the derived classes (for example CSwordPresenter::lookup).<BR> + * </p><p> + * Another important part of the frontend are the keychoosers. + * They provide an interface to choose a key of a module. + * The interface for different module types is different. + * The base class is CKeyChooser which is the factory for the derived classes. + * Use the function CKeyChooser::createInstance to get the correct + * keychooser implementation for the desired module.<BR> + * </p> + */ + +/** @mainpage BibleTime - sourcecode documentation + * BibleTime main page. + * <p>This is the sourcecode documentation of BibleTime, a Bible study tool for KDE/Linux. + * BibleTime is devided in two major parts, the backend and the frontend. + * The backend is mainly a wrapper around Sword's classes to use Qt functionality + * to allow easy access to it's functionality and to have it in a (more or less :) + * object oriented structure.</p><BR> + * <p> + * -Introduction to the backend: @ref backend<BR> + * -Introduction to the frontend: @ref frontend.<BR> + * The main class of BibleTime is called @ref BibleTime, which is the main window + * and initializes all important parts at startup. The text display windows + * belong to the @ref frontend. + * </p> + */ + +/** BibleTime's main class. + * The main class of BibleTime. Here are the main widgets created. + * + * This is the main class of BibleTime! This class creates the GUI, the KAction objects + * and connects to some slots. Please insert the creation of actions in initActions, + * the creation of widgets into initView and the connect(...) calls into initConnections. + * Reading from a config file on creation time should go into readSettings(), saving into + * saveSettings(). + * This is the general way of all BibleTime classes. + */ +class BibleTime : public KMainWindow, virtual public BibleTimeInterface { + friend class CMDIArea; + Q_OBJECT +public: + /** + * construtor of BibleTime + */ + BibleTime(); + /** + * destrutor of BibleTime + */ + virtual ~BibleTime(); + + virtual void polish(); + /** + * Reads the settings from the configfile and sets the right properties. + */ + void readSettings(); + /** + * Saves the settings of this class + */ + void saveSettings(); + /** + * Restores the workspace if the flaf for this is set in the config. + */ + void restoreWorkspace(); + /** + * Apply the settings given by the profile p + */ + void applyProfileSettings( Profile::CProfile* p ); + /** + * Stores the settings of the mainwindow in the profile p + */ + void storeProfileSettings( Profile::CProfile* p ); + +public slots: + /** + * Shows the daily tip + */ + void slotHelpTipOfDay(); + /** + * Opens the optionsdialog of BibleTime. + */ + void slotSettingsOptions(); + /** + * Opens the optionsdialog of BibleTime. + */ + void slotSwordSetupDialog(); + /** + * Opens the handbook. + */ + void openOnlineHelp_Handbook(); + /** + * Opens the bible study howto. + */ + void openOnlineHelp_Howto(); + /** + * Sets the plain caption of the main window + */ + virtual void setPlainCaption( const QString& ); + /** + * Sets the caption of the mainwindow + */ + virtual void setCaption(const QString&); + /** + * Processes the commandline options given to BibleTime. + */ + void processCommandline(); + +protected: // Protected methods + /** + * Initializes the view of this widget + */ + void initView(); + /** + * Initializes the menubar of BibleTime. + */ + void initMenubar(); + /** + * Initializes the SIGNAL / SLOT connections + */ + void initConnections(); + /** + * Initializes the backend + */ + void initBackends(); + /** + * Initializes the action objects of the GUI + */ + void initActions(); + /** + * Refreshes all presenter supporting at least in of the features given as parameter. + */ + void refreshDisplayWindows(); + /** + * Called before a window is closed + */ + bool queryClose(); + /** + * Called before quit. + */ + bool queryExit(); + /** + * Reimplementation used for session management. + */ + void readProperties(KConfig* config); + /** + * Reimplementation used for sessions management. + */ + void saveProperties(KConfig* myConfig); + +protected slots: + /** + * Creates a new presenter in the MDI area according to the type of the module. + */ + CDisplayWindow* createReadDisplayWindow(ListCSwordModuleInfo modules, const QString& key); + CDisplayWindow* createReadDisplayWindow(CSwordModuleInfo* module, const QString& key); + CDisplayWindow* createWriteDisplayWindow(CSwordModuleInfo* module, const QString& key, const CDisplayWindow::WriteWindowType& type); + /** + * Is called when the window menu is about to show ;-) + */ + void slotWindowMenuAboutToShow(); + /** + * This slot is connected with the windowAutoTile_action object + */ + void slotAutoTileVertical(); + /** + * This slot is connected with the windowAutoTile_action object + */ + void slotAutoTileHorizontal(); + /** + * This slot is connected with the windowAutoCascade_action object + */ + void slotAutoCascade(); + void slotUpdateWindowArrangementActions( KAction* ); + + void slotCascade(); + void slotTileVertical(); + void slotTileHorizontal(); + + void slotManualArrangementMode(); + + /** + * Is called when a client was selected in the window menu + */ + void slotWindowMenuActivated(); + /** + * Shows/hides the toolbar + */ + void slotToggleToolbar(); + /** + * Opens a toolbar editor + */ + void slotSettingsToolbar(); + /** + * Shows or hides the main index part + */ + void slotToggleMainIndex(); + /** + * Shows or hides the info display part. + */ + void slotToggleInfoDisplay(); + /** + * Saves to the profile with the menu id ID + */ + void saveProfile(int ID); + /** + * Saves the current settings into the currently activatred profile. + */ + void saveProfile(Profile::CProfile* p); + /** + * Deletes the chosen session from the menu and from disk. + */ + void deleteProfile(int ID); + /** + * Loads the profile with the menu id ID + */ + void loadProfile(int ID); + /** + * Loads the profile with the menu ID id + */ + void loadProfile(Profile::CProfile* p); + /** + * Toggles between normal and fullscreen mode. + */ + void toggleFullscreen(); + /** + * Is called when settings in the optionsdialog have been + * changed (ok or apply) + */ + void slotSettingsChanged(); + /** + * Is called when settings in the sword setup dialog have been + * changed (ok or apply) + */ + void slotSwordSetupChanged(); + /** + * Called when search button is pressed + **/ + void slotSearchModules(); + /** + * Called for search default bible + **/ + void slotSearchDefaultBible(); + /** + Saves current settings into a new profile. + */ + void saveToNewProfile(); + /** + * Slot to refresh the save profile and load profile menus. + */ + void refreshProfileMenus(); + + +private: + QPopupMenu* m_windowMenu; + QPopupMenu* m_editMenu; + + /** VIEW menu actions */ + KToggleAction* m_viewToolbar_action; + KToggleAction* m_viewMainIndex_action; + KToggleAction* m_viewInfoDisplay_action; + + /** WINDOW menu actions */ + KAction* m_windowCascade_action; + KAction* m_windowTileHorizontal_action; + KAction* m_windowTileVertical_action; + KActionMenu* m_windowArrangementMode_action; + KToggleAction* m_windowManualMode_action; + KToggleAction* m_windowAutoCascade_action; + KToggleAction* m_windowAutoTileVertical_action; + KToggleAction* m_windowAutoTileHorizontal_action; + KAction* m_windowCloseAll_action; + + KActionCollection* m_windowActionCollection; + + KActionMenu* m_windowSaveProfile_action; + KAction* m_windowSaveToNewProfile_action; + KActionMenu* m_windowLoadProfile_action; + KActionMenu* m_windowDeleteProfile_action; + KToggleAction* m_windowFullscreen_action; + + QPtrList<KAction> m_windowOpenWindowsList; + + KHelpMenu* m_helpMenu; + + + bool m_initialized; + /** + * The list of installed SWORD modules + */ + ListCSwordModuleInfo* m_moduleList; + QProgressDialog* m_progress; + + Profile::CProfile* m_currentProfile; + QSplitter* m_mainSplitter; + QSplitter* m_leftPaneSplitter; + CMDIArea* m_mdi; + + Profile::CProfileMgr m_profileMgr; + CSwordBackend* m_backend; + + CMainIndex* m_mainIndex; + + InfoDisplay::CInfoDisplay* m_infoDisplay; + +protected: //DCOP interface implementation + //helper function + void syncAllModulesByType(const CSwordModuleInfo::ModuleType type, const QString& key); + + //see bibletimeinterface.h for a documentation of these functions + virtual void closeAllModuleWindows(); + virtual void syncAllBibles(const QString& key); + virtual void syncAllCommentaries(const QString& key); + virtual void syncAllLexicons(const QString& key); + virtual void syncAllVerseBasedModules(const QString& key); + virtual void openWindow(const QString& moduleName, const QString& key); + virtual void openDefaultBible(const QString& key); + virtual QString getCurrentReference(); + virtual QStringList searchInModule(const QString& module, const QString& searchText); + virtual QStringList searchInOpenModules(const QString& searchText); + virtual QStringList searchInDefaultBible(const QString& searchText); + virtual QStringList getModulesOfType(const QString& type); + virtual void reloadModules(); +}; + +#endif diff --git a/bibletime/bibletime_dcop.cpp b/bibletime/bibletime_dcop.cpp new file mode 100644 index 0000000..69113d4 --- /dev/null +++ b/bibletime/bibletime_dcop.cpp @@ -0,0 +1,220 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "bibletime.h" + +//frontend includes +#include "frontend/cmdiarea.h" +#include "frontend/cbtconfig.h" +#include "frontend/searchdialog/csearchdialog.h" + +//Sword includes +#include <versekey.h> +#include <listkey.h> + +//helper function +void BibleTime::syncAllModulesByType(const CSwordModuleInfo::ModuleType type, const QString& key) { + qDebug("Syncing modules by type to key %s", key.latin1()); + + QPtrList<QWidget> windows = m_mdi->usableWindowList(); + for (QWidget* w = windows.first(); w; w = windows.next()) { + CDisplayWindow* d = dynamic_cast<CDisplayWindow*>(w); + Q_ASSERT(d); + + if (d && d->modules().count() && d->modules().first()->type() == type) { + d->lookup(key); + } + } +} + +void BibleTime::closeAllModuleWindows() { + qDebug("DCOP: close all windows now..."); + + m_mdi->deleteAll(); +} + +void BibleTime::syncAllBibles(const QString& key) { + qDebug("DCOP: syncing all bibles ..."); + syncAllModulesByType(CSwordModuleInfo::Bible, key); +} + +void BibleTime::syncAllCommentaries(const QString& key) { + qDebug("DCOP: syncing all commentaries ..."); + syncAllModulesByType(CSwordModuleInfo::Commentary, key); +} + +void BibleTime::syncAllLexicons(const QString& key) { + qDebug("DCOP: syncing all lexicons ..."); + syncAllModulesByType(CSwordModuleInfo::Lexicon, key); +} + +void BibleTime::syncAllVerseBasedModules(const QString& key) { + qDebug("DCOP: syncing all verse based modules ..."); + syncAllModulesByType(CSwordModuleInfo::Bible, key); + syncAllModulesByType(CSwordModuleInfo::Commentary, key); +} + +void BibleTime::openWindow(const QString& moduleName, const QString& key) { + qDebug("DCOP: open window for module %s and key %s...", moduleName.latin1(), key.latin1()); + + CSwordModuleInfo* module = CPointers::backend()->findModuleByName(moduleName); + Q_ASSERT(module); + if (module) { + createReadDisplayWindow(module, key); + } +} + +void BibleTime::openDefaultBible(const QString& key) { + qDebug("DCOP: open default bible ..."); + CSwordModuleInfo* mod = CBTConfig::get + (CBTConfig::standardBible); + if (mod) { + openWindow(mod->name(), key); + } +} + +QStringList BibleTime::searchInModule(const QString& moduleName, const QString& searchText) { + qDebug("DCOP: searchInModule %s ...", moduleName.latin1()); + QStringList ret; + CSwordModuleInfo* mod = CPointers::backend()->findModuleByName(moduleName); + + //TODO: Check this + Q_ASSERT(mod); + if (mod) { + //mod->search(searchText, CSwordModuleSearch::multipleWords, sword::ListKey()); + sword::ListKey scope; + mod->searchIndexed( searchText, scope ); + + sword::ListKey result = mod->searchResult(); + const QString lead = QString("[%1] ").arg(moduleName); + ; + for ( int i = 0; i < result.Count(); ++i ) { + sword::SWKey* key = result.getElement(i); + Q_ASSERT(key); + + + if (mod->type() == CSwordModuleInfo::Bible || mod->type() == CSwordModuleInfo::Commentary) { + sword::VerseKey vk(key->getText()); + ret << lead + QString::fromUtf8( vk.getOSISRef() ); + } + else { + ret << lead + QString::fromUtf8( key->getText() ); + } + } + } + + return ret; + +} + +QStringList BibleTime::searchInOpenModules(const QString& searchText) { + qDebug("DCOP: search in open modules ..."); + QStringList ret; + + QWidgetList windows = m_mdi->windowList(); + for ( int i = 0; i < static_cast<int>(windows.count()); ++i ) { + CDisplayWindow* w = dynamic_cast<CDisplayWindow*>(windows.at(i)); + if (w) { + ListCSwordModuleInfo windowModules = w->modules(); + + ListCSwordModuleInfo::iterator end_it = windowModules.end(); + for (ListCSwordModuleInfo::iterator it(windowModules.begin()); it != end_it; ++it) { + ret += searchInModule((*it)->name(), searchText); + }; + }; + }; + + return ret; +} + +QStringList BibleTime::searchInDefaultBible(const QString& searchText) { + CSwordModuleInfo* bible = CBTConfig::get + (CBTConfig::standardBible); + return searchInModule(bible->name(), searchText); +} + +QString BibleTime::getCurrentReference() { + qDebug("BibleTime::getCurrentReference"); + QString ret = QString::null; + + CDisplayWindow* w = dynamic_cast<CDisplayWindow*>(m_mdi->activeWindow()); + Q_ASSERT(w); + + if (w) { + QString modType; + Q_ASSERT(w->modules().first()); + switch (w->modules().first()->type()) { + case CSwordModuleInfo::Bible: + modType = "BIBLE"; + break; + case CSwordModuleInfo::Commentary: + modType = "COMMENTARY"; + break; + case CSwordModuleInfo::GenericBook: + modType = "BOOK"; + break; + case CSwordModuleInfo::Lexicon: + modType = "LEXICON"; + break; + default: + modType = "UNSUPPORTED"; + break; + } + + ret.append("[").append(w->modules().first()->name()).append("] "); + ret.append("[").append(modType).append("] "); + + CSwordVerseKey* vk = dynamic_cast<CSwordVerseKey*>( w->key() ); + if (vk) { + ret.append( vk->getOSISRef() ); + } + else { + ret.append( w->key()->key() ); + } + } + + return ret; +} + +QStringList BibleTime::getModulesOfType(const QString& type) { + QStringList ret; + + CSwordModuleInfo::ModuleType modType = CSwordModuleInfo::Unknown; + if (type == "BIBLES") { + modType = CSwordModuleInfo::Bible; + } + else if (type == "COMMENTARIES") { + modType = CSwordModuleInfo::Commentary; + } + else if (type == "LEXICONS") { + modType = CSwordModuleInfo::Lexicon; + + } + else if (type == "BOOKS") { + modType = CSwordModuleInfo::GenericBook; + } + + ListCSwordModuleInfo modList = CPointers::backend()->moduleList(); + for (ListCSwordModuleInfo::iterator it( modList.begin() ); it != modList.end(); ++it) { + if ((*it)->type() == modType) { + ret.append( (*it)->name() ); + } + } + + return ret; +} + +void BibleTime::reloadModules() { + //m_backend->reloadModules(); + slotSwordSetupChanged(); +} + diff --git a/bibletime/bibletime_init.cpp b/bibletime/bibletime_init.cpp new file mode 100644 index 0000000..fb704bf --- /dev/null +++ b/bibletime/bibletime_init.cpp @@ -0,0 +1,609 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//BibleTime includes +#include "bibletime.h" + +#include "backend/btstringmgr.h" +#include "backend/cswordbackend.h" + +#include "frontend/mainindex/cmainindex.h" +#include "frontend/cprofilemgr.h" +#include "frontend/cprofile.h" +#include "frontend/cmdiarea.h" +#include "frontend/kstartuplogo.h" +#include "frontend/cswordsetupdialog.h" +#include "frontend/cprinter.h" +#include "frontend/cmanageindiceswidget.h" + +#include "backend/clanguagemgr.h" + + +#include "config.h" +#include "frontend/cbtconfig.h" +#include "frontend/cinfodisplay.h" + +#include "util/cpointers.h" +#include "util/cresmgr.h" + +//system includes +#include <stdlib.h> + +//QT includes +#include <qpopupmenu.h> +#include <qsplitter.h> +#include <qguardedptr.h> +#include <qlistview.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qvbox.h> + +//KDE includes +#include <kaboutdata.h> +#include <kaccel.h> +#include <kaction.h> +#include <kapplication.h> +#include <kconfigbase.h> +#include <kdeversion.h> +#include <kglobal.h> +#include <khelpmenu.h> +#include <kiconloader.h> +#include <kmenubar.h> +#include <kstddirs.h> +#include <kstdaction.h> +#include <ktoolbar.h> +#include <klocale.h> +#include <kpopupmenu.h> +#include <kdeversion.h> + +//Sword includes +#include <swlog.h> + +using namespace InfoDisplay; +using namespace Profile; + +/**Initializes the view of this widget*/ +void BibleTime::initView() { + KStartupLogo::setStatusMessage(i18n("Creating BibleTime's GUI") + QString("...")); + + m_mainSplitter = new QSplitter(this, "mainsplitter"); + m_mainSplitter->setChildrenCollapsible(false); + setCentralWidget(m_mainSplitter); + + m_leftPaneSplitter = new QSplitter(Qt::Vertical, m_mainSplitter); + m_leftPaneSplitter->setChildrenCollapsible(false); + + QVBox* vBox = new QVBox(m_leftPaneSplitter); + vBox->setMinimumSize(100, 100); + + QLabel* bookshelfLabel = new QLabel( i18n("Bookshelf"), vBox ); + bookshelfLabel->setMargin(5); + + m_mainIndex = new CMainIndex(vBox); + + m_infoDisplay = new CInfoDisplay(m_leftPaneSplitter); + CPointers::setInfoDisplay(m_infoDisplay); + + m_mdi = new CMDIArea(m_mainSplitter, "mdiarea" ); + m_mdi->setMinimumSize(100, 100); + m_mdi->setFocusPolicy(ClickFocus); + + m_helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true, actionCollection()); +} + +/** Initializes the action objects of the GUI */ +void BibleTime::initActions() { + KStartupLogo::setStatusMessage(i18n("Initializing menu- and toolbars") + QString("...")); + KAction* action = 0; + + action = KStdAction::quit(kapp, SLOT( quit() ), actionCollection()); + action->setToolTip( CResMgr::mainMenu::file::quit::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + action = new KAction(i18n("Search in &open work(s)"), + CResMgr::mainMenu::mainIndex::search::icon, + CResMgr::mainMenu::mainIndex::search::accel, + this, SLOT(slotSearchModules()), actionCollection(), + CResMgr::mainMenu::mainIndex::search::actionName + ); + action->setToolTip( CResMgr::mainMenu::mainIndex::search::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + action = new KAction(i18n("Search in standard &Bible"), + CResMgr::mainMenu::mainIndex::searchdefaultbible::icon, + CResMgr::mainMenu::mainIndex::searchdefaultbible::accel, + this, SLOT(slotSearchDefaultBible()), actionCollection(), + CResMgr::mainMenu::mainIndex::searchdefaultbible::actionName + ); + action->setToolTip( CResMgr::mainMenu::mainIndex::searchdefaultbible::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + m_viewToolbar_action = KStdAction::showToolbar(this, SLOT( slotToggleToolbar() ), actionCollection()); + m_viewToolbar_action->setToolTip( CResMgr::mainMenu::view::showToolBar::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + m_viewToolbar_action->plugAccel( accel() ); + #endif + + + m_viewMainIndex_action = new KToggleAction(i18n("&Show bookshelf"), + CResMgr::mainMenu::view::showMainIndex::icon, + CResMgr::mainMenu::view::showMainIndex::accel, + this, SLOT(slotToggleMainIndex()), actionCollection(), + CResMgr::mainMenu::view::showMainIndex::actionName); + m_viewMainIndex_action->setToolTip( CResMgr::mainMenu::view::showMainIndex::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + m_viewMainIndex_action->plugAccel( accel() ); + #endif + + m_viewInfoDisplay_action = new KToggleAction(i18n("Show &mag"), + CResMgr::mainMenu::view::showInfoDisplay::icon, + CResMgr::mainMenu::view::showInfoDisplay::accel, + this, SLOT(slotToggleInfoDisplay()), actionCollection(), + CResMgr::mainMenu::view::showInfoDisplay::actionName); + m_viewMainIndex_action->setToolTip( CResMgr::mainMenu::view::showInfoDisplay::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + m_viewInfoDisplay_action->plugAccel( accel() ); + #endif + + action = KStdAction::preferences(this, SLOT( slotSettingsOptions() ), actionCollection()); + action->setToolTip( CResMgr::mainMenu::settings::optionsDialog::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + action = new KAction(i18n("Bookshelf &Manager"), + CResMgr::mainMenu::settings::swordSetupDialog::icon, + CResMgr::mainMenu::settings::swordSetupDialog::accel, + this, SLOT( slotSwordSetupDialog() ), actionCollection(), + CResMgr::mainMenu::settings::swordSetupDialog::actionName + ); + action->setToolTip( CResMgr::mainMenu::settings::swordSetupDialog::tooltip ); + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + //delete help action if KDE created it + if ( actionCollection()->action( KStdAction::stdName(KStdAction::ConfigureToolbars) )) { + actionCollection()->remove + (actionCollection()->action( + KStdAction::stdName(KStdAction::ConfigureToolbars)) + ); + } + action = KStdAction::configureToolbars(this, SLOT( slotSettingsToolbar() ), actionCollection()); + action->setToolTip( CResMgr::mainMenu::settings::editToolBar::tooltip ); + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + m_windowArrangementMode_action = new KActionMenu(i18n("&Arrangement mode"), + CResMgr::mainMenu::window::arrangementMode::icon, + actionCollection(), + CResMgr::mainMenu::window::arrangementMode::actionName); + m_windowArrangementMode_action->setDelayed( false ); + + m_windowManualMode_action = new KToggleAction(i18n("&Manual mode"), + CResMgr::mainMenu::window::arrangementMode::manual::icon, + CResMgr::mainMenu::window::arrangementMode::manual::accel, + this, SLOT(slotManualArrangementMode()), actionCollection(), + CResMgr::mainMenu::window::arrangementMode::manual::actionName + ); + m_windowManualMode_action->setToolTip( + CResMgr::mainMenu::window::arrangementMode::manual::tooltip + ); + #if KDE_VERSION_MINOR < 1 + + m_windowManualMode_action->plugAccel( accel() ); + #endif + + m_windowArrangementMode_action->insert( m_windowManualMode_action ); + + + m_windowAutoTileVertical_action = new KToggleAction(i18n("Auto-tile &vertically"), + CResMgr::mainMenu::window::arrangementMode::autoTileVertical::icon, + CResMgr::mainMenu::window::arrangementMode::autoTileVertical::accel, + this, SLOT(slotAutoTileVertical()), actionCollection(), + CResMgr::mainMenu::window::arrangementMode::autoTileVertical::actionName + ); + m_windowAutoTileVertical_action->setToolTip( + CResMgr::mainMenu::window::arrangementMode::autoTileVertical::tooltip + ); + #if KDE_VERSION_MINOR < 1 + + m_windowAutoTileVertical_action->plugAccel( accel() ); + #endif + + m_windowArrangementMode_action->insert( m_windowAutoTileVertical_action ); + + + m_windowAutoTileHorizontal_action = new KToggleAction(i18n("Auto-tile &horizontally"), + CResMgr::mainMenu::window::arrangementMode::autoTileHorizontal::icon, + CResMgr::mainMenu::window::arrangementMode::autoTileHorizontal::accel, + this, SLOT(slotAutoTileHorizontal()), actionCollection(), + CResMgr::mainMenu::window::arrangementMode::autoTileHorizontal::actionName + ); + m_windowAutoTileHorizontal_action->setToolTip( + CResMgr::mainMenu::window::arrangementMode::autoTileHorizontal::tooltip + ); + #if KDE_VERSION_MINOR < 1 + + m_windowAutoTileHorizontal_action->plugAccel( accel() ); + #endif + + m_windowArrangementMode_action->insert( m_windowAutoTileHorizontal_action ); + + + m_windowAutoCascade_action = new KToggleAction(i18n("Auto-&cascade"), + CResMgr::mainMenu::window::arrangementMode::autoCascade::icon, + CResMgr::mainMenu::window::arrangementMode::autoCascade::accel, + this, SLOT(slotAutoCascade()), actionCollection(), + CResMgr::mainMenu::window::arrangementMode::autoCascade::actionName + ); + m_windowAutoCascade_action->setToolTip( + CResMgr::mainMenu::window::arrangementMode::autoCascade::tooltip + ); + #if KDE_VERSION_MINOR < 1 + // qWarning("Plug accel"); + m_windowAutoCascade_action->plugAccel( accel() ); + #endif + + m_windowArrangementMode_action->insert( m_windowAutoCascade_action ); + + m_windowCascade_action = new KAction(i18n("&Cascade"), + CResMgr::mainMenu::window::cascade::icon, + CResMgr::mainMenu::window::cascade::accel, + this, SLOT(slotCascade()), actionCollection(), + CResMgr::mainMenu::window::cascade::actionName + ); + m_windowCascade_action->setToolTip( CResMgr::mainMenu::window::cascade::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + m_windowCascade_action->plugAccel( accel() ); + #endif + + + m_windowTileVertical_action = new KAction(i18n("Tile &vertically"), + CResMgr::mainMenu::window::tileVertical::icon, + CResMgr::mainMenu::window::tileVertical::accel, + this, SLOT(slotTileVertical()), actionCollection(), + CResMgr::mainMenu::window::tileVertical::actionName + ); + m_windowTileVertical_action->setToolTip( CResMgr::mainMenu::window::tileVertical::tooltip ); + #if KDE_VERSION_MINOR < 1 + + m_windowTileVertical_action->plugAccel( accel() ); + #endif + + m_windowTileHorizontal_action = new KAction(i18n("Tile &horizontally"), + CResMgr::mainMenu::window::tileHorizontal::icon, + CResMgr::mainMenu::window::tileHorizontal::accel, + this, SLOT(slotTileHorizontal()), actionCollection(), + CResMgr::mainMenu::window::tileHorizontal::actionName + ); + m_windowTileHorizontal_action->setToolTip( CResMgr::mainMenu::window::tileHorizontal::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + m_windowTileHorizontal_action->plugAccel( accel() ); + #endif + + + m_windowCloseAll_action = new KAction(i18n("Cl&ose all"), + CResMgr::mainMenu::window::closeAll::icon, + CResMgr::mainMenu::window::closeAll::accel, + m_mdi, SLOT(deleteAll()), actionCollection(), + CResMgr::mainMenu::window::closeAll::actionName + ); + m_windowCloseAll_action->setToolTip( CResMgr::mainMenu::window::closeAll::tooltip ); + #if KDE_VERSION_MINOR < 1 + + m_windowCloseAll_action->plugAccel( accel() ); + #endif + + + m_windowSaveProfile_action = new KActionMenu(i18n("&Save session"), + CResMgr::mainMenu::window::saveProfile::icon, + actionCollection(), + CResMgr::mainMenu::window::saveProfile::actionName + ); + m_windowSaveProfile_action->setToolTip( CResMgr::mainMenu::window::saveProfile::tooltip ); + m_windowSaveProfile_action->setDelayed( false ); + #if KDE_VERSION_MINOR < 1 + + m_windowSaveProfile_action->plugAccel( accel() ); + #endif + + + m_windowSaveToNewProfile_action = new KAction(i18n("Save as &new session"), + CResMgr::mainMenu::window::saveToNewProfile::icon, + CResMgr::mainMenu::window::saveToNewProfile::accel, + this, SLOT(saveToNewProfile()), actionCollection(), + CResMgr::mainMenu::window::saveToNewProfile::actionName + ); + m_windowSaveToNewProfile_action->setToolTip( CResMgr::mainMenu::window::saveToNewProfile::tooltip ); + #if KDE_VERSION_MINOR < 1 + + m_windowSaveToNewProfile_action->plugAccel( accel() ); + #endif + + + m_windowLoadProfile_action = new KActionMenu(i18n("&Load session"), + CResMgr::mainMenu::window::loadProfile::icon, + actionCollection(), + CResMgr::mainMenu::window::loadProfile::actionName + ); + m_windowLoadProfile_action->setToolTip( CResMgr::mainMenu::window::loadProfile::tooltip ); + m_windowLoadProfile_action->setDelayed( false ); + #if KDE_VERSION_MINOR < 1 + + m_windowLoadProfile_action->plugAccel( accel() ); + #endif + + m_windowDeleteProfile_action = new KActionMenu(i18n("&Delete session"), + CResMgr::mainMenu::window::deleteProfile::icon, + actionCollection(), + CResMgr::mainMenu::window::deleteProfile::actionName + ); + m_windowLoadProfile_action->setToolTip( CResMgr::mainMenu::window::deleteProfile::tooltip ); + m_windowLoadProfile_action->setDelayed( false ); + #if KDE_VERSION_MINOR < 1 + + m_windowDeleteProfile_action->plugAccel( accel() ); + #endif + + m_windowFullscreen_action = new KToggleAction(i18n("&Fullscreen mode"), + CResMgr::mainMenu::window::showFullscreen::icon, + CResMgr::mainMenu::window::showFullscreen::accel, + this, SLOT(toggleFullscreen()), actionCollection(), + CResMgr::mainMenu::window::showFullscreen::actionName + ); + m_windowFullscreen_action->setToolTip( CResMgr::mainMenu::window::showFullscreen::tooltip ); + m_windowFullscreen_action->setShortcutConfigurable(true); + #if KDE_VERSION_MINOR < 1 + + m_windowFullscreen_action->plugAccel( accel() ); + #endif + + //connect the profile popups to the right slots + KPopupMenu* loadPopup = m_windowLoadProfile_action->popupMenu(); + KPopupMenu* savePopup = m_windowSaveProfile_action->popupMenu(); + KPopupMenu* deletePopup = m_windowDeleteProfile_action->popupMenu(); + + connect(loadPopup, SIGNAL(activated(int)), SLOT(loadProfile(int))); + connect(savePopup, SIGNAL(activated(int)), SLOT(saveProfile(int))); + connect(deletePopup, SIGNAL(activated(int)), SLOT(deleteProfile(int))); + + refreshProfileMenus(); + + if ( actionCollection()->action( KStdAction::stdName(KStdAction::HelpContents) )) { //delete help action if KDE created it + actionCollection()->remove + (actionCollection()->action(KStdAction::stdName(KStdAction::HelpContents)) ); + } + + action = new KAction(i18n("&Handbook"), + CResMgr::mainMenu::help::handbook::icon, + CResMgr::mainMenu::help::handbook::accel, + this, SLOT(openOnlineHelp_Handbook()), actionCollection(), + CResMgr::mainMenu::help::handbook::actionName + ); + action->setToolTip( CResMgr::mainMenu::help::handbook::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + action = new KAction(i18n("&Bible Study Howto"), + CResMgr::mainMenu::help::bibleStudyHowTo::icon, + CResMgr::mainMenu::help::bibleStudyHowTo::accel, + this, SLOT(openOnlineHelp_Howto()), actionCollection(), + CResMgr::mainMenu::help::bibleStudyHowTo::actionName + ); + action->setToolTip( CResMgr::mainMenu::help::bibleStudyHowTo::tooltip ); + + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + if ( actionCollection()->action( KStdAction::stdName( KStdAction::WhatsThis ) ) ) { //delete "What's this" action if KDE created it already + KAction* action = actionCollection()->action(KStdAction::stdName( KStdAction::WhatsThis )); + actionCollection()->remove + ( action ); + } + + + if ( actionCollection()->action( KStdAction::stdName( KStdAction::ReportBug ) ) ) { //delete Report Bug action if KDE created it + actionCollection()->remove + (actionCollection()->action(KStdAction::stdName( KStdAction::ReportBug ))); + } + action = KStdAction::reportBug(m_helpMenu, SLOT(reportBug()), actionCollection()); + action->setToolTip(CResMgr::mainMenu::help::bugreport::tooltip); + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + action = new KAction(i18n("&Daily tip"), + CResMgr::mainMenu::help::dailyTip::icon, + CResMgr::mainMenu::help::dailyTip::accel, + this, SLOT(slotHelpTipOfDay()), actionCollection(), + CResMgr::mainMenu::help::dailyTip::actionName + ); + action->setToolTip(CResMgr::mainMenu::help::dailyTip::tooltip); + #if KDE_VERSION_MINOR < 1 + + action->plugAccel( accel() ); + #endif + + if ( actionCollection()->action( KStdAction::stdName( KStdAction::AboutApp ) ) ) { //delete About KDE action if KDE created it + actionCollection()->remove + (actionCollection()->action(KStdAction::stdName( KStdAction::AboutApp ))); + } + action = KStdAction::aboutApp(m_helpMenu, SLOT(aboutApplication()), actionCollection()); + action->setToolTip(CResMgr::mainMenu::help::aboutBibleTime::tooltip); + + //delete About KDE action if KDE created it already + if ( actionCollection()->action( KStdAction::stdName( KStdAction::AboutKDE ) ) ) { //delete About KDE action if KDE created it + actionCollection()->remove + (actionCollection()->action(KStdAction::stdName( KStdAction::AboutKDE ))); + } + action = KStdAction::aboutKDE(m_helpMenu, SLOT(aboutKDE()), actionCollection()); + action->setToolTip(CResMgr::mainMenu::help::aboutKDE::tooltip); +} + +/** Initializes the menubar of BibleTime. */ +void BibleTime::initMenubar() { + //get the window and edit menus using the actions and their properties + m_windowMenu = dynamic_cast<QPopupMenu*>(m_windowCloseAll_action->container(0)); +} + +/** Initializes the SIGNAL / SLOT connections */ +void BibleTime::initConnections() { + connect(m_mdi, SIGNAL(sigSetToplevelCaption(const QString&)), + this, SLOT(setPlainCaption(const QString&))); + connect(m_mdi, SIGNAL(createReadDisplayWindow(ListCSwordModuleInfo, const QString&)), + this, SLOT(createReadDisplayWindow(ListCSwordModuleInfo, const QString&))); + + Q_ASSERT(m_windowMenu); + if (m_windowMenu) { + connect(m_windowMenu, SIGNAL(aboutToShow()), + this, SLOT(slotWindowMenuAboutToShow())); + } + else { + qWarning("Main window: can't find window menu"); + } + + + connect( + m_mainIndex, SIGNAL(createReadDisplayWindow(ListCSwordModuleInfo, const QString&)), + this, SLOT(createReadDisplayWindow(ListCSwordModuleInfo,const QString&)) + ); + connect( + m_mainIndex, SIGNAL(createWriteDisplayWindow(CSwordModuleInfo*, const QString&, const CDisplayWindow::WriteWindowType&)), + this, SLOT(createWriteDisplayWindow(CSwordModuleInfo*,const QString&, const CDisplayWindow::WriteWindowType&)) + ); + connect(m_mainIndex, SIGNAL(signalSwordSetupChanged()), this, SLOT(slotSwordSetupChanged())); +} + +/** Initializes the backend */ +void BibleTime::initBackends() { + KStartupLogo::setStatusMessage(i18n("Initializing Sword") + QString("...")); + + StringMgr::setSystemStringMgr( new BTStringMgr() ); + SWLog::getSystemLog()->setLogLevel(1); + + m_backend = new CSwordBackend(); + m_backend->booknameLanguage( CBTConfig::get + (CBTConfig::language) ); + + CPointers::setBackend(m_backend); + const CSwordBackend::LoadError errorCode = m_backend->initModules(); + + m_moduleList = 0; + if ( errorCode == CSwordBackend::NoError ) { //no error + m_moduleList = &(m_backend->moduleList()); + } + else { + m_moduleList = 0; + //show error message that initBackend failed + switch (errorCode) { + case CSwordBackend::NoSwordConfig: //mods.d or mods.conf missing + { + KStartupLogo::hideSplash(); + BookshelfManager::CSwordSetupDialog dlg; + dlg.showPart( BookshelfManager::CSwordSetupDialog::Sword ); + dlg.exec(); + break; + } + + case CSwordBackend::NoModules: //no modules installed, but config exists + { + KStartupLogo::hideSplash(); + BookshelfManager::CSwordSetupDialog dlg; + dlg.showPart( BookshelfManager::CSwordSetupDialog::Install ); + dlg.exec(); + break; + } + + default: //unknown error + { + KStartupLogo::hideSplash(); + BookshelfManager::CSwordSetupDialog dlg; + dlg.showPart( BookshelfManager::CSwordSetupDialog::Sword ); + dlg.exec(); + break; + } + } + } + + KStartupLogo::setStatusMessage(i18n("Checking indices") + QString("...")); + //This function will + // - delete all orphaned indexes (no module present) if autoDeleteOrphanedIndices is true + // - delete all indices of modules where hasIndex() returns false + BookshelfManager::CManageIndicesWidget::deleteOrphanedIndices(); + +} + +/** Apply the settings given by the profile p*/ +void BibleTime::applyProfileSettings( CProfile* p ) { + Q_ASSERT(p); + if (!p) return; + + if (m_initialized) { //on startup KDE sets the main geometry + //see polish(), where m_initialized is set and the KDE methods are called for window resize + + //first Main Window state + m_windowFullscreen_action->setChecked( p->fullscreen() ); //set the fullscreen button state + toggleFullscreen(); //either showFullscreen or showNormal + if (p->maximized()) KMainWindow::showMaximized(); //if maximized, then also call showMaximized + + //Then Main Window geometry + KMainWindow::resize( p->geometry().size() ); //Don't use KMainWindowInterface::resize + KMainWindow::move( p->geometry().topLeft() );//Don't use KMainWindowInterface::move +} +} + +/** Stores the settings of the mainwindow in the profile p */ +void BibleTime::storeProfileSettings( CProfile* p ) { + Q_ASSERT(p && m_windowFullscreen_action); + if (!p || !m_windowFullscreen_action) return; + + p->setFullscreen( m_windowFullscreen_action->isChecked() ); + p->setMaximized( this->KMainWindow::isMaximized() ); + + QRect geometry; + geometry.setTopLeft(pos()); + geometry.setSize(size()); + p->setGeometry(geometry); +} diff --git a/bibletime/bibletime_slots.cpp b/bibletime/bibletime_slots.cpp new file mode 100644 index 0000000..8d9ad89 --- /dev/null +++ b/bibletime/bibletime_slots.cpp @@ -0,0 +1,570 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +//own includes +#include "bibletime.h" +#include "config.h" + +#include "backend/cswordversekey.h" + +#include "util/ctoolclass.h" + +#include "frontend/cmdiarea.h" +#include "frontend/cprofilemgr.h" +#include "frontend/cprofile.h" +#include "frontend/cprofilewindow.h" +#include "frontend/coptionsdialog.h" +#include "frontend/cswordsetupdialog.h" +#include "frontend/cbtconfig.h" +#include "frontend/cinputdialog.h" +#include "frontend/cinfodisplay.h" +#include "frontend/mainindex/cmainindex.h" +#include "frontend/mainindex/cindexitem.h" +#include "frontend/displaywindow/cdisplaywindow.h" +#include "frontend/displaywindow/cbiblereadwindow.h" +#include "frontend/searchdialog/csearchdialog.h" + +#include <errno.h> + +//QT includes +#include <qprogressdialog.h> +#include <qlistview.h> +#include <qvaluelist.h> +#include <qclipboard.h> +#include <qinputdialog.h> + +//KDE includes +#include <kaction.h> +#include <kapplication.h> +#include <kaboutkde.h> +#include <kaboutdialog.h> +#include <kbugreport.h> +#include <kaboutapplication.h> +#include <kstandarddirs.h> +#include <kmenubar.h> +#include <kaboutdata.h> +#include <kglobal.h> +#include <klocale.h> +#include <kedittoolbar.h> +#include <kpopupmenu.h> +#include <khelpmenu.h> +#include <ktip.h> + +//Sword includes +#include <versekey.h> + +using namespace Profile; + +/* An action which stores a user defined pointer to a widget. + * @author Joachim Ansorg + */ +class KUserDataAction : public KToggleAction { +public: + KUserDataAction( QString caption, const KShortcut& shortcut, const QObject* receiver, const char* slot, KActionCollection* actionCollection) +: KToggleAction(caption, shortcut, receiver, slot, actionCollection), m_userData(0) { /* no impl */ + }; + + void setUserData(QWidget* const data) { + m_userData = data; + }; + QWidget* const getUserData() const { + return m_userData; + }; + +private: + QWidget* m_userData; +}; + +/** Opens the optionsdialog of BibleTime. */ +void BibleTime::slotSettingsOptions() { + COptionsDialog *dlg = new COptionsDialog(this, "COptionsDialog", actionCollection()); + connect(dlg, SIGNAL(signalSettingsChanged()), SLOT(slotSettingsChanged()) ); + + dlg->exec(); + dlg->delayedDestruct(); +} + +/** Is called when settings in the optionsdialog were changed (ok or apply) */ +void BibleTime::slotSettingsChanged() { + const QString language = CBTConfig::get + (CBTConfig::language); + m_backend->booknameLanguage(language); + + QListViewItemIterator it( m_mainIndex ); + CItemBase* item = 0; + for ( ; it.current(); ++it ) { + if ( (item = dynamic_cast<CItemBase*>(it.current())) ) { + item->update(); + } + } + + refreshDisplayWindows(); + refreshProfileMenus(); +} + +/** Opens the sword setup dialog of BibleTime. */ +void BibleTime::slotSwordSetupDialog() { + BookshelfManager::CSwordSetupDialog *dlg = new BookshelfManager::CSwordSetupDialog(this, "CSwordSetupDialog"); + connect(dlg, SIGNAL(signalSwordSetupChanged()), SLOT(slotSwordSetupChanged()) ); + + dlg->exec(); + dlg->delayedDestruct(); +} + +/** Is called when settings in the sword setup dialog were changed (ok or apply) */ +void BibleTime::slotSwordSetupChanged() { + /* + Refresh everything here what might have changed + these are the mainindex, the searchdialog, the displaywindows + But at first we have to reset the Sword backend to reload the modules + */ + m_mainIndex->saveBookmarks(); + + CPointers::deleteBackend(); + m_backend = new CSwordBackend(); + CPointers::setBackend(m_backend); + m_backend->initModules(); + + m_mainIndex->reloadSword(); + + // refresh display windows + refreshDisplayWindows(); +} + +/** Shows the daily tip */ +void BibleTime::slotHelpTipOfDay() { + KTipDialog::setShowOnStart( CBTConfig::get + (CBTConfig::tips) ); + KTipDialog::showTip(this, "bibletime/tips", true); +} + +/** Is called just before the window menu is ahown. */ +void BibleTime::slotWindowMenuAboutToShow() { + Q_ASSERT(m_windowMenu); + if (!m_windowMenu) { + return; + } + + if ( m_mdi->windowList().isEmpty() ) { + m_windowCascade_action->setEnabled(false); + m_windowTileVertical_action->setEnabled(false); + m_windowTileHorizontal_action->setEnabled(false); + m_windowCloseAll_action->setEnabled(false); + } + else if (m_mdi->windowList().count() == 1) { + m_windowTileVertical_action->setEnabled( false ); + m_windowTileHorizontal_action->setEnabled( false ); + m_windowCascade_action->setEnabled( false ); + m_windowCloseAll_action->setEnabled( true ); + // m_windowMenu->insertSeparator(); + } + else { + slotUpdateWindowArrangementActions(0); //update the window tile/cascade states + m_windowCloseAll_action->setEnabled( true ); + } + +#if QT_VERSION >= 0x030200 + QPtrList<KAction>::iterator end = m_windowOpenWindowsList.end(); + for (QPtrList<KAction>::iterator it = m_windowOpenWindowsList.begin(); it != end; ++it ) { + (*it)->unplugAll(); + } +#else + QPtrListIterator<KAction> it(m_windowOpenWindowsList); + while (it.current() != 0){ + it.current()->unplugAll(); + ++it; + } +#endif + m_windowOpenWindowsList.setAutoDelete(true); + m_windowOpenWindowsList.clear(); + + if (!m_windowActionCollection) { + m_windowActionCollection = new KActionCollection(this); + } + + QWidgetList windows = m_mdi->windowList(); + const int count = windows.count(); + for ( int i = 0; i < count; ++i ) { + QWidget* w = windows.at(i); + Q_ASSERT(w); + + KUserDataAction* action = new KUserDataAction(w->caption(), KShortcut(), this, SLOT(slotWindowMenuActivated()), m_windowActionCollection); + Q_ASSERT(action); + action->setUserData(w); + + m_windowOpenWindowsList.append(action); + action->setChecked( w == m_mdi->activeWindow() ); + action->plug(m_windowMenu); + } +} + +/** This slot is connected with the windowAutoTile_action object */ +void BibleTime::slotUpdateWindowArrangementActions( KAction* clickedAction ) { + /* If a toggle action was clicked we see if it checked ot unchecked and + * enable/disable the simple cascade and tile options accordingly + */ + m_windowTileVertical_action->setEnabled( m_windowManualMode_action->isChecked() ); + m_windowTileHorizontal_action->setEnabled( m_windowManualMode_action->isChecked() ); + m_windowCascade_action->setEnabled( m_windowManualMode_action->isChecked() ); + + if (clickedAction) { + m_windowManualMode_action->setEnabled( + m_windowManualMode_action != clickedAction + && m_windowTileHorizontal_action != clickedAction + && m_windowTileVertical_action != clickedAction + && m_windowCascade_action != clickedAction + ); + m_windowAutoTileVertical_action->setEnabled( m_windowAutoTileVertical_action != clickedAction ); + m_windowAutoTileHorizontal_action->setEnabled( m_windowAutoTileHorizontal_action != clickedAction ); + m_windowAutoCascade_action->setEnabled( m_windowAutoCascade_action != clickedAction ); + } + + if (clickedAction == m_windowManualMode_action) { + m_windowAutoTileVertical_action->setChecked(false); + m_windowAutoTileHorizontal_action->setChecked(false); + m_windowAutoCascade_action->setChecked(false); + + m_mdi->setGUIOption( CMDIArea::Nothing ); + } + else if (clickedAction == m_windowAutoTileVertical_action) { + m_windowManualMode_action->setChecked(false); + m_windowAutoTileHorizontal_action->setChecked(false); + m_windowAutoCascade_action->setChecked(false); + + m_mdi->setGUIOption( CMDIArea::autoTileVertical ); + } + else if (clickedAction == m_windowAutoTileHorizontal_action) { + m_windowManualMode_action->setChecked(false); + m_windowAutoTileVertical_action->setChecked(false); + m_windowAutoCascade_action->setChecked(false); + + m_mdi->setGUIOption( CMDIArea::autoTileHorizontal ); + } + else if (clickedAction == m_windowAutoCascade_action) { + m_windowManualMode_action->setChecked(false); + m_windowAutoTileHorizontal_action->setChecked(false); + m_windowAutoTileVertical_action->setChecked(false); + + m_mdi->setGUIOption( CMDIArea::autoCascade ); + } + else if (clickedAction == m_windowCascade_action) { + m_mdi->setGUIOption( CMDIArea::Nothing ); + m_mdi->myCascade(); + } + else if (clickedAction == m_windowTileVertical_action) { + m_mdi->setGUIOption( CMDIArea::Nothing ); + m_mdi->myTileVertical(); + } + else if (clickedAction == m_windowTileHorizontal_action) { + m_mdi->setGUIOption( CMDIArea::Nothing ); + m_mdi->myTileHorizontal(); + } +} + +void BibleTime::slotManualArrangementMode() { + slotUpdateWindowArrangementActions( m_windowManualMode_action ); +} + +/** This slot is connected with the windowAutoTile_action object */ +void BibleTime::slotAutoTileHorizontal() { + slotUpdateWindowArrangementActions( m_windowAutoTileHorizontal_action ); +} + +/** This slot is connected with the windowAutoTile_action object */ +void BibleTime::slotAutoTileVertical() { + slotUpdateWindowArrangementActions( m_windowAutoTileVertical_action ); +} + +void BibleTime::slotCascade() { + slotUpdateWindowArrangementActions( m_windowCascade_action ); +} + +void BibleTime::slotTileVertical() { + slotUpdateWindowArrangementActions( m_windowTileVertical_action ); +} + +void BibleTime::slotTileHorizontal() { + slotUpdateWindowArrangementActions( m_windowTileHorizontal_action ); +} + +/** This slot is connected with the windowAutoCascade_action object */ +void BibleTime::slotAutoCascade() { + slotUpdateWindowArrangementActions( m_windowAutoCascade_action ); +} + +void BibleTime::slotWindowMenuActivated() { + if (!m_windowMenu) { + return; + } + + const KUserDataAction* action = dynamic_cast<const KUserDataAction*>(sender()); + Q_ASSERT(action); + if (action) { + QWidget* const window = action->getUserData(); + Q_ASSERT(window); + if ( window ) { + window->setFocus(); + } + } +} + + +/** Shows/hides the toolbar */ +void BibleTime::slotToggleToolbar() { + Q_ASSERT(toolBar("mainToolBar")); + + if (m_viewToolbar_action->isChecked()) { + toolBar("mainToolBar")->show(); + } + else { + toolBar("mainToolBar")->hide(); + } +} + +/** Shows or hides the groupmanager. +*/ +void BibleTime::slotToggleMainIndex() { + //we use the parent widget because the main index is enclosed in a layout which adds the label at the top + if (m_viewMainIndex_action->isChecked()) { + m_mainIndex->parentWidget()->show(); + } + else { + m_mainIndex->parentWidget()->hide(); + } +} + +/** Shows or hides the groupmanager. */ +void BibleTime::slotToggleInfoDisplay() { + if (m_viewInfoDisplay_action->isChecked()) { + m_infoDisplay->show(); + } + else { + m_infoDisplay->hide(); + } +} + +/** Opens a toolbar editor */ +void BibleTime::slotSettingsToolbar() { + KEditToolbar dlg(actionCollection()); + if (dlg.exec()) { + createGUI(); + } +} + +void BibleTime::slotSearchModules() { + //get the modules of the open windows + ListCSwordModuleInfo modules; + + QWidgetList windows = m_mdi->windowList(); + for ( int i = 0; i < static_cast<int>(windows.count()); ++i ) { + if (CDisplayWindow* w = dynamic_cast<CDisplayWindow*>(windows.at(i))) { + ListCSwordModuleInfo windowModules = w->modules(); + + ListCSwordModuleInfo::iterator end_it = windowModules.end(); + for (ListCSwordModuleInfo::iterator it(windowModules.begin()); it != end_it; ++it) { + modules.append(*it); + }; + }; + }; + + Search::CSearchDialog::openDialog(modules, QString::null); +} + +/* Search default Bible slot + * Call CSearchDialog::openDialog with only the default bible module + */ +void BibleTime::slotSearchDefaultBible() { + ListCSwordModuleInfo module; + CSwordModuleInfo* bible = CBTConfig::get + (CBTConfig::standardBible); + if (bible) { + module.append(bible); + } + + Search::CSearchDialog::openDialog(module, QString::null); +} + +void BibleTime::openOnlineHelp_Handbook() { + kapp->invokeHelp("", "bibletime/handbook/"); +} + +void BibleTime::openOnlineHelp_Howto() { + kapp->invokeHelp("", "bibletime/howto/"); +} + +/** Saves the current settings into the currently activatred profile. */ +void BibleTime::saveProfile(int ID) { + m_mdi->setUpdatesEnabled(false); + + KPopupMenu* popup = m_windowSaveProfile_action->popupMenu(); + const QString profileName = popup->text(ID).remove("&"); + CProfile* p = m_profileMgr.profile( profileName ); + Q_ASSERT(p); + if ( p ) { + saveProfile(p); + } + + m_mdi->setUpdatesEnabled(true); +} + +void BibleTime::saveProfile(CProfile* profile) { + if (!profile) { + return; + } + + //save mainwindow settings + storeProfileSettings(profile); + + QWidgetList windows = m_mdi->windowList(); + QPtrList<CProfileWindow> profileWindows; + for (QWidget* w = windows.first(); w; w = windows.next()) { + CDisplayWindow* displayWindow = dynamic_cast<CDisplayWindow*>(w); + if (!displayWindow) { + continue; + } + + CProfileWindow* profileWindow = new CProfileWindow(); + displayWindow->storeProfileSettings(profileWindow); + profileWindows.append(profileWindow); + } + profile->save(profileWindows); + + //clean up memory - delete all created profile windows + profileWindows.setAutoDelete(true); + profileWindows.clear(); +} + +void BibleTime::loadProfile(int ID) { + KPopupMenu* popup = m_windowLoadProfile_action->popupMenu(); + //HACK: workaround the inserted & char by KPopupMenu + const QString profileName = popup->text(ID).remove("&"); + CProfile* p = m_profileMgr.profile( profileName ); + // qWarning("requesting popup: %s", popup->text(ID).latin1()); + Q_ASSERT(p); + + if ( p ) { + m_mdi->deleteAll(); + loadProfile(p); + } +} + +void BibleTime::loadProfile(CProfile* p) { + Q_ASSERT(p); + if (!p) { + return; + } + + QPtrList<CProfileWindow> windows = p->load(); + Q_ASSERT(windows.count()); + + //load mainwindow setttings + applyProfileSettings(p); + + m_mdi->setUpdatesEnabled(false);//don't auto tile or auto cascade, this would mess up everything!! + + QWidget* focusWindow = 0; + + // for (CProfileWindow* w = windows.last(); w; w = windows.prev()) { //from the last one to make sure the order is right in the mdi area + for (CProfileWindow* w = windows.first(); w; w = windows.next()) { + const QString key = w->key(); + QStringList usedModules = w->modules(); + + ListCSwordModuleInfo modules; + for ( QStringList::Iterator it = usedModules.begin(); it != usedModules.end(); ++it ) { + if (CSwordModuleInfo* m = m_backend->findModuleByName(*it)) { + modules.append(m); + } + } + if (!modules.count()) { //are the modules still installed? If not continue wih next session window + continue; + } + + //is w->isWriteWindow is false we create a write window, otherwise a read window + CDisplayWindow* displayWindow = 0; + if (w->writeWindowType() > 0) { //create a write window + displayWindow = createWriteDisplayWindow(modules.first(), key, CDisplayWindow::WriteWindowType(w->writeWindowType()) ); + } + else { //create a read window + displayWindow = createReadDisplayWindow(modules, key); + } + + if (displayWindow) { //if a window was created initialize it. + if (w->hasFocus()) { + focusWindow = displayWindow; + } + + displayWindow->applyProfileSettings(w); + }; + } + + m_mdi->setUpdatesEnabled(true); + + if (focusWindow) { + focusWindow->setFocus(); + } +} + +void BibleTime::deleteProfile(int ID) { + KPopupMenu* popup = m_windowDeleteProfile_action->popupMenu(); + //HACK: work around the inserted & char by KPopupMenu + const QString profileName = popup->text(ID).remove("&"); + CProfile* p = m_profileMgr.profile( profileName ); + Q_ASSERT(p); + + if ( p ) { + m_profileMgr.remove(p); + } + refreshProfileMenus(); +} + +void BibleTime::toggleFullscreen() { + m_windowFullscreen_action->isChecked() ? showFullScreen() : showNormal(); + m_mdi->triggerWindowUpdate(); +} + +/** Saves current settings into a new profile. */ +void BibleTime::saveToNewProfile() { + bool ok = false; + const QString name = QInputDialog::getText(i18n("Session name:"), i18n("Please enter a name for the new session."), QLineEdit::Normal, QString::null, &ok, this); + if (ok && !name.isEmpty()) { + CProfile* profile = m_profileMgr.create(name); + saveProfile(profile); + }; + + refreshProfileMenus(); +} + +/** Slot to refresh the save profile and load profile menus. */ +void BibleTime::refreshProfileMenus() { + KPopupMenu* savePopup = m_windowSaveProfile_action->popupMenu(); + savePopup->clear(); + + KPopupMenu* loadPopup = m_windowLoadProfile_action->popupMenu(); + loadPopup->clear(); + + KPopupMenu* deletePopup = m_windowDeleteProfile_action->popupMenu(); + deletePopup->clear(); + + //refresh the load, save and delete profile menus + m_profileMgr.refresh(); + QPtrList<CProfile> profiles = m_profileMgr.profiles(); + + const bool enableActions = bool(profiles.count() != 0); + m_windowSaveProfile_action->setEnabled(enableActions); + m_windowLoadProfile_action->setEnabled(enableActions); + m_windowDeleteProfile_action->setEnabled(enableActions); + + for (CProfile* p = profiles.first(); p; p = profiles.next()) { + savePopup->insertItem(p->name()); + loadPopup->insertItem(p->name()); + deletePopup->insertItem(p->name()); + } +} diff --git a/bibletime/bibletimeapp.cpp b/bibletime/bibletimeapp.cpp new file mode 100644 index 0000000..1a962f9 --- /dev/null +++ b/bibletime/bibletimeapp.cpp @@ -0,0 +1,46 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#include "bibletimeapp.h" + +#include "frontend/cbtconfig.h" + +#include "util/cresmgr.h" + +//KDE includes +#include <dcopclient.h> + +BibleTimeApp::BibleTimeApp() { + initDCOP(); + + CResMgr::init_i18n(); +} + +BibleTimeApp::~BibleTimeApp() { + + //we can set this safely now because we close now (hopyfully without crash) + CBTConfig::set(CBTConfig::crashedLastTime, false); + CBTConfig::set(CBTConfig::crashedTwoTimes, false); + + deleteDisplayTemplateMgr(); + deleteLanguageMgr(); + deleteBackend(); +} + +void BibleTimeApp::initDCOP() { + const bool dcopOk = dcopClient()->attach(); + Q_ASSERT(dcopOk); + + if (dcopOk) { + const QCString appId = dcopClient()->registerAs(kapp->name(), false); + // dcopClient()->setDefaultObject("BibleTimeInterface"); + } +} diff --git a/bibletime/bibletimeapp.h b/bibletime/bibletimeapp.h new file mode 100644 index 0000000..b1ed010 --- /dev/null +++ b/bibletime/bibletimeapp.h @@ -0,0 +1,33 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef BIBLETIMEAPP_H +#define BIBLETIMEAPP_H + +//BibleTime +#include "util/cpointers.h" + +//KDE +#include <kapplication.h> + +/** The BibleTimeApp class is used to clean up all instances of the backend and to delete all created module objects. + * @author The BibleTime team + */ +class BibleTimeApp : public KApplication, public CPointers { +public: + BibleTimeApp(); + virtual ~BibleTimeApp(); + +protected: + void initDCOP(); +}; + +#endif diff --git a/bibletime/bibletimeinterface.h b/bibletime/bibletimeinterface.h new file mode 100644 index 0000000..0bab1f6 --- /dev/null +++ b/bibletime/bibletimeinterface.h @@ -0,0 +1,111 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2006 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef BIBLETIME_INTERFACE_H +#define BIBLETIME_INTERFACE_H + +//Qt includes +#include <qstring.h> +#include <qstringlist.h> + +//KDE includes +#include <dcopobject.h> +#include <kmainwindowiface.h> + +/** DCOP interface definition for BibleTime. +* This is the interface definition for BibleTime's DCOP client interface. The main window class "BibleTime" +* inherits from this class and re-implements these pure virtual functions. +* It uses virtual inheritance so that a widget which inherits twice from DCOPObject does not get mixed up. +* This file is turned into bibletimeinterface_skel.cpp by the KDE automake system. +* +* @author Joachim Ansorg +*/ +class BibleTimeInterface : virtual public DCOPObject { + //This K_DCOP line is required so that the k_dcop: and void are processed. + K_DCOP + +public: +BibleTimeInterface(QCString id) : DCOPObject(id) {} + +k_dcop: + /** Sync all open Bible windows to the key. + * @param key The key which is set to all Bible windows. + */ + virtual void syncAllBibles(const QString& key) = 0; + /** Sync all open commentary windows to the key. + * @param key The key which is set to all Commentary windows. + */ + virtual void syncAllCommentaries(const QString& key) = 0; + /** Sync all open lexicon windows to the key. + * @param key The key which is set to all Lexicon windows. + */ + virtual void syncAllLexicons(const QString& key) = 0; + /** Sync all open verse based (i.e. Bibles and commentaries) windows to the key. + * @param key The key which is set to all Bible and Commentary windows. + */ + virtual void syncAllVerseBasedModules(const QString& key) = 0; + /** Reload all modules + */ + virtual void reloadModules() = 0; + /** Open a new read window for the module moduleName using the given key + * @param moduleName The name of the module which is opened in a new module window. + * @param key The key to set to the newly opened window. + */ + virtual void openWindow(const QString& moduleName, const QString& key) = 0; + /** Open a new read window for the default Bible module using the given key + * @param key The key to set to the newly opened window. + */ + virtual void openDefaultBible(const QString& key) = 0; + /** Close all open windows. + */ + virtual void closeAllModuleWindows() = 0; + /** Returns the reference used in the current window. + * The format of the returned reference is + * [Module] [Type] OSIS_Reference, + * wtih type one of BIBLE/COMMENTARY/BOOK/LEXICON/UNSUPPORTED + * If the type is BIBLE or COMMENTARY the reference is an OSIS ref + * in the other cases it's the key name, for books /Chapter/Subsection + * for Lexicons just the plain key, e.g. "ADAM". + * e.g. + * [KJV] [BIBLE] Gen.1.1 + * [MHC] [COMMENTARY] Gen.1.1 + * [ISBE] [LEXICON] REDEMPTION + * @return The reference displayed in the currently active module window. Empty if none is active. + */ + virtual QString getCurrentReference() = 0; + /** Seach the searchText in the specified module. + * @param moduleName The module to search in + * @param searchText Search for this in the modules + * @return The search result. It's in the format [modulename] osis_ref_of_the_found_key. For example "[KJV] Gen.1.1". + */ + virtual QStringList searchInModule(const QString& moduleName, const QString& searchText) = 0; + /** Search in all open modules and return the search result. + * The result is in the same format as searchInModule + * @param searchText Search for this in the modules + * @return The search result for a searchin all opened module windows + * @see searchInModule For the search result format. + */ + virtual QStringList searchInOpenModules(const QString& searchText) = 0; + /** Search in the default Bible module and return the search result. + * The result is in the same format as searchInModule + * @param searchText Search for this in the modules + * @return The search result for a search in the default Bible + * @see searchInModule + */ + virtual QStringList searchInDefaultBible(const QString& searchText) = 0; + /** Return a list of modules of the given type. + * @param type One of BIBLES, COMMENTARIES, LEXICONS, BOOKS + * @return The list of modules of the given type, may be empty + */ + virtual QStringList getModulesOfType(const QString& type) = 0; +}; + +#endif diff --git a/bibletime/bibletimeinterface_skel.cpp b/bibletime/bibletimeinterface_skel.cpp new file mode 100644 index 0000000..7d956d6 --- /dev/null +++ b/bibletime/bibletimeinterface_skel.cpp @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** DCOP Skeleton generated by dcopidl2cpp from bibletimeinterface.kidl +** +** WARNING! All changes made in this file will be lost! +** +*****************************************************************************/ + +#include "./bibletimeinterface.h" + +#include <kdatastream.h> +#include <qasciidict.h> + + +static const int BibleTimeInterface_fhash = 17; +static const char* const BibleTimeInterface_ftable[14][3] = { + { "void", "syncAllBibles(QString)", "syncAllBibles(QString key)" }, + { "void", "syncAllCommentaries(QString)", "syncAllCommentaries(QString key)" }, + { "void", "syncAllLexicons(QString)", "syncAllLexicons(QString key)" }, + { "void", "syncAllVerseBasedModules(QString)", "syncAllVerseBasedModules(QString key)" }, + { "void", "reloadModules()", "reloadModules()" }, + { "void", "openWindow(QString,QString)", "openWindow(QString moduleName,QString key)" }, + { "void", "openDefaultBible(QString)", "openDefaultBible(QString key)" }, + { "void", "closeAllModuleWindows()", "closeAllModuleWindows()" }, + { "QString", "getCurrentReference()", "getCurrentReference()" }, + { "QStringList", "searchInModule(QString,QString)", "searchInModule(QString moduleName,QString searchText)" }, + { "QStringList", "searchInOpenModules(QString)", "searchInOpenModules(QString searchText)" }, + { "QStringList", "searchInDefaultBible(QString)", "searchInDefaultBible(QString searchText)" }, + { "QStringList", "getModulesOfType(QString)", "getModulesOfType(QString type)" }, + { 0, 0, 0 } +}; +static const int BibleTimeInterface_ftable_hiddens[13] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +bool BibleTimeInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData) +{ + static QAsciiDict<int>* fdict = 0; + if ( !fdict ) { + fdict = new QAsciiDict<int>( BibleTimeInterface_fhash, true, false ); + for ( int i = 0; BibleTimeInterface_ftable[i][1]; i++ ) + fdict->insert( BibleTimeInterface_ftable[i][1], new int( i ) ); + } + int* fp = fdict->find( fun ); + switch ( fp?*fp:-1) { + case 0: { // void syncAllBibles(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[0][0]; + syncAllBibles(arg0 ); + } break; + case 1: { // void syncAllCommentaries(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[1][0]; + syncAllCommentaries(arg0 ); + } break; + case 2: { // void syncAllLexicons(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[2][0]; + syncAllLexicons(arg0 ); + } break; + case 3: { // void syncAllVerseBasedModules(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[3][0]; + syncAllVerseBasedModules(arg0 ); + } break; + case 4: { // void reloadModules() + replyType = BibleTimeInterface_ftable[4][0]; + reloadModules( ); + } break; + case 5: { // void openWindow(QString,QString) + QString arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = BibleTimeInterface_ftable[5][0]; + openWindow(arg0, arg1 ); + } break; + case 6: { // void openDefaultBible(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[6][0]; + openDefaultBible(arg0 ); + } break; + case 7: { // void closeAllModuleWindows() + replyType = BibleTimeInterface_ftable[7][0]; + closeAllModuleWindows( ); + } break; + case 8: { // QString getCurrentReference() + replyType = BibleTimeInterface_ftable[8][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << getCurrentReference( ); + } break; + case 9: { // QStringList searchInModule(QString,QString) + QString arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = BibleTimeInterface_ftable[9][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << searchInModule(arg0, arg1 ); + } break; + case 10: { // QStringList searchInOpenModules(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[10][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << searchInOpenModules(arg0 ); + } break; + case 11: { // QStringList searchInDefaultBible(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[11][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << searchInDefaultBible(arg0 ); + } break; + case 12: { // QStringList getModulesOfType(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = BibleTimeInterface_ftable[12][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << getModulesOfType(arg0 ); + } break; + default: + return DCOPObject::process( fun, data, replyType, replyData ); + } + return true; +} + +QCStringList BibleTimeInterface::interfaces() +{ + QCStringList ifaces = DCOPObject::interfaces(); + ifaces += "BibleTimeInterface"; + return ifaces; +} + +QCStringList BibleTimeInterface::functions() +{ + QCStringList funcs = DCOPObject::functions(); + for ( int i = 0; BibleTimeInterface_ftable[i][2]; i++ ) { + if (BibleTimeInterface_ftable_hiddens[i]) + continue; + QCString func = BibleTimeInterface_ftable[i][0]; + func += ' '; + func += BibleTimeInterface_ftable[i][2]; + funcs << func; + } + return funcs; +} + + diff --git a/bibletime/display-templates/Blue.tmpl b/bibletime/display-templates/Blue.tmpl new file mode 100644 index 0000000..f415b4c --- /dev/null +++ b/bibletime/display-templates/Blue.tmpl @@ -0,0 +1,349 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>#TITLE# + + + + + + + + +

#CONTENT#
+ + \ No newline at end of file diff --git a/bibletime/display-templates/Crazy.tmpl b/bibletime/display-templates/Crazy.tmpl new file mode 100644 index 0000000..84121b6 --- /dev/null +++ b/bibletime/display-templates/Crazy.tmpl @@ -0,0 +1,326 @@ + + + + + + #TITLE# + + + + + + + + + +
#CONTENT#
+ + \ No newline at end of file diff --git a/bibletime/display-templates/Green.tmpl b/bibletime/display-templates/Green.tmpl new file mode 100644 index 0000000..0bf4c3d --- /dev/null +++ b/bibletime/display-templates/Green.tmpl @@ -0,0 +1,328 @@ + + + + + #TITLE# + + + + + + + + +
#CONTENT#
+ + \ No newline at end of file diff --git a/bibletime/display-templates/HighContrast.tmpl b/bibletime/display-templates/HighContrast.tmpl new file mode 100644 index 0000000..408dbf5 --- /dev/null +++ b/bibletime/display-templates/HighContrast.tmpl @@ -0,0 +1,339 @@ + + + + + #TITLE# + + + + + + + + +
#CONTENT#
+ + diff --git a/bibletime/display-templates/Makefile.am b/bibletime/display-templates/Makefile.am new file mode 100644 index 0000000..276c1a4 --- /dev/null +++ b/bibletime/display-templates/Makefile.am @@ -0,0 +1,13 @@ +#TEMPLATES = Default.tmpl Simple.tmpl +templdir = $(top_srcdir)/bibletime/display-templates +TEMPLATES = $(templdir)/*.tmpl + +EXTRA_DIST = template-init.cpp create_code.pl names.conf $(TEMPLATES) + +all: + perl $(templdir)/create_code.pl $(TEMPLATES) + +template-init.cpp: + perl $(templdir)/create_code.pl $(TEMPLATES) + +CLEANFILES = template-init.cpp diff --git a/bibletime/display-templates/Simple.tmpl b/bibletime/display-templates/Simple.tmpl new file mode 100644 index 0000000..28e260e --- /dev/null +++ b/bibletime/display-templates/Simple.tmpl @@ -0,0 +1,134 @@ + + + + + #TITLE# + + + + + + + + +
#CONTENT#
+ + \ No newline at end of file diff --git a/bibletime/display-templates/basic_template.txt b/bibletime/display-templates/basic_template.txt new file mode 100644 index 0000000..77c88cd --- /dev/null +++ b/bibletime/display-templates/basic_template.txt @@ -0,0 +1,203 @@ + + + + + #TITLE# + + + + + + + + + +
#CONTENT#
+ \ No newline at end of file diff --git a/bibletime/display-templates/create_code.pl b/bibletime/display-templates/create_code.pl new file mode 100755 index 0000000..f1912fa --- /dev/null +++ b/bibletime/display-templates/create_code.pl @@ -0,0 +1,79 @@ +#!/usr/bin/perl + +use strict; +use File::Compare; +use File::Copy; +use FindBin qw($RealBin); + +my %names; + +sub read_names() { + open(IN, "< " . $RealBin . "/names.conf"); + + while () { + my $line = $_; + chomp $line; + + my ($filename, $description) = split("\t", $line); + $names{ $filename } = $description; + } + + close(IN); +} + +sub extract_data { + my $file = shift || die; + + my $name; + my $html; + + $file =~ /(?:.+\/)?(.+\..+)/; + my $tmpl_name = $1 || $file; + $name = $names{ $tmpl_name }; + + open(IN, "< $file"); + while( ) { + my $line = $_; + chomp($line); + $line .= "\\\n"; + + + $line =~ s/"/\\"/g; + $line =~ s/\s{2,}|\t/ /g; #replace spaces and tabs by space + + $html .= $line; + } + close(INT); + + + print "Found $name\n" if ($name); + return ($name, $html); +} + +my $dir = $RealBin; +#print $dir."\n"; + +&read_names; +my $code = ""; +foreach my $f (@ARGV) { + my ($name, $html) = &extract_data( $f ); + + if ($name) { + $code .= "\tm_templateMap[ i18n(\"$name\") ] = \"$html\";\n" + } +} + + +open(OUT, "> $RealBin/template-init.cpp-new"); +print OUT "void CDisplayTemplateMgr::init() {\n$code\n}\n"; +close(OUT); + +if (-e "$RealBin/template-init.cpp" && compare("$RealBin/template-init.cpp","$RealBin/template-init.cpp-new")) { #differ + move("$RealBin/template-init.cpp-new","$RealBin/template-init.cpp"); +} +elsif (!-e "$RealBin/template-init.cpp") { + move ("$RealBin/template-init.cpp-new","$RealBin/template-init.cpp"); +} +else { #make sure to remove the -new file + unlink("$RealBin/template-init.cpp-new"); +} \ No newline at end of file diff --git a/bibletime/display-templates/names.conf b/bibletime/display-templates/names.conf new file mode 100644 index 0000000..e49d742 --- /dev/null +++ b/bibletime/display-templates/names.conf @@ -0,0 +1,5 @@ +Blue.tmpl Default +Simple.tmpl Simple +Crazy.tmpl Crazy +HighContrast.tmpl High contrast +Green.tmpl Green diff --git a/bibletime/display-templates/template-init.cpp b/bibletime/display-templates/template-init.cpp new file mode 100644 index 0000000..7d72274 --- /dev/null +++ b/bibletime/display-templates/template-init.cpp @@ -0,0 +1,1484 @@ +void CDisplayTemplateMgr::init() { + m_templateMap[ i18n("Default") ] = "\ +\ +\ +\ + #TITLE#\ + \ + \ + \ + \ + \ +\ +\ +\ +
#CONTENT#
\ +\ +\ +"; + m_templateMap[ i18n("Crazy") ] = "\ +\ +\ +\ + \ + #TITLE#\ + \ + \ + \ +\ + \ +\ +\ +\ +\ +
#CONTENT#
\ +\ +\ +"; + m_templateMap[ i18n("Green") ] = "\ +\ +\ +\ + #TITLE#\ + \ + \ + \ + \ +