home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / configure.cmd < prev    next >
OS/2 REXX Batch file  |  1998-04-23  |  11KB  |  230 lines

  1. /* OS/2 REXX : The top level configure.cmd; Don't delete this comment. */
  2. call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  3. call SysLoadFuncs
  4. parse arg option
  5. select
  6.   when option='--with-gnu-gettext'
  7.     then intl='yes'
  8.   when option='--disable-nls'
  9.     then intl='no'
  10. otherwise
  11.     intl='yes'    /* ??? */
  12. end
  13.  
  14. env='OS2ENVIRONMENT'
  15. X11ROOT=value('X11ROOT',,env)
  16. /* Figure out how GNU patch program is called here */
  17. /* If run without arguments,
  18.    GNU patch emits "usage" into stderr and none into stdout, and
  19.    IBM patch emits nothing into stderr and an error message "SYS1575..." into stdout
  20. */
  21.  
  22. /* I don't think I know how to substitute all the occurences   *
  23.  * of a substring to something else with REXX.        */
  24. curdir=directory()
  25. do until pos('\',curdir)=0
  26.   parse var curdir tmp1 '\' tmp2
  27.   curdir=tmp1'#/'tmp2
  28. end
  29. curdir=translate(curdir,'\','#')
  30.  
  31. os2config.1='@prefix@ 'X11ROOT'\/XFree86'
  32. os2config.2='@exec_prefix@ 'subword(os2config.1,2)
  33. os2config.3='@srcdir@ 'curdir
  34. os2config.4='@top_srcdir@ 'subword(os2config.3,2)
  35. os2config.5='@bindir@ 'subword(os2config.2,2)'\/bin'
  36. os2config.6='@libdir@ 'subword(os2config.2,2)'\/lib'
  37. os2config.7='@datadir@ 'subword(os2config.2,2)'\/lib'
  38. os2config.8='@mandir@ 'subword(os2config.1,2)'\/man'
  39. os2config.9='@CPPIMPLFLAGS@ -I'subword(os2config.1,2)'\/include'
  40. os2config.10='@program_suffix@'
  41. os2config.11='@lyx_devel_version@ $(lyx_devel_version)'
  42. os2config.12='@PACKAGE@ lyx'
  43. os2config.13='@DATADIRNAME@ lib'
  44.  
  45. contains=0
  46. do until contains > 0
  47.   testversion=linein('src/version.h')
  48.   contains=pos('#define LYX_VERSION', testversion)
  49. end
  50. os2config.14='@LYX_VERSION@ 'substr(subword(testversion,3,1),2)
  51. os2config.15='@VERSION@ 'subword(os2config.14,2)
  52. if subword(translate(testversion,' ','.'),4,1)//2=1 then
  53.   do
  54.     devel='yes'
  55.     os2config.16='@CXXFLAGS@ -g -m486 -O -fno-strength-reduce -Zmtd -Zsysv-signals -D__ST_MT_ERRNO__ -Wall -Wno-unused'
  56.     os2config.17='@CFLAGS@ 'subword(os2config.16,2)
  57.   end
  58. else
  59.   do
  60.     os2config.16='@CXXFLAGS@ -g -m486 -O2 -fno-strength-reduce -Zmtd -Zsysv-signals -D__ST_MT_ERRNO__ -Wall -Wno-unused'
  61.     os2config.17='@CFLAGS@ 'subword(os2config.16,2)
  62.    /* Actually no need to distinguish, since on OS/2, *
  63.     * -O runs faster than -O2 in general ;-)    */
  64.   end
  65.  
  66. os2config.18='@CC@ gcc'
  67. os2config.19='@CXX@ gcc'   /* os2config.12='@CXX@ g++' */
  68. os2config.20='@RANLIB@ ar s'
  69. os2config.21='@LIBS@ -lSM -lICE -lXpm -lforms -lX11'
  70. os2config.22='@LDFLAGS@ -Zmtd -Zsysv-signals -Zbin-files -L'subword(os2config.6,2)
  71. os2config.23='@CPPFLAGS@ -I'subword(os2config.1,2)'\/include -I..\/intl'
  72. os2config.24='@SET_MAKE@'  /* ??? */
  73. os2config.25='@CXX_COMMAND@ $(CXX)'
  74.  
  75. /* Full path is given in order to distinguish it from IBM install. */
  76. os2config.26='@INSTALL@ 'subword(os2config.5,2)'\/install'
  77. os2config.27='@INSTALL_DATA@ 'subword(os2config.5,2)'\/install'
  78. os2config.28='@INSTALL_PROGRAM@ 'subword(os2config.5,2)'\/install'
  79. os2config.29='@INSTALL_TARGET@ install-os2'
  80. os2config.30='@LIBOBJS@'
  81. if intl='yes' then
  82.   do
  83.     os2config.31='@INTLLIBS@ ..\/intl\/libintl.a'
  84.     os2config.32='@INTLSUB@ intl'
  85.     os2config.33='@POSUB@'    /* os2config.27='@POSUB@ po' */
  86.     os2config.34='@USE_INCLUDED_LIBINTL@ yes'
  87.   end
  88. else
  89.   do
  90.     os2config.31='@INTLLIBS@'
  91.     os2config.32='@INTLSUB@'
  92.     os2config.33='@POSUB@'
  93.     os2config.34='@USE_INCLUDED_LIBINTL@'
  94.   end
  95. os2config.35='@INTLOBJS@'
  96. os2config.36='@DEFS@'
  97. os2config.37='@program_transform_name@'
  98. os2config.38='@l@'
  99. os2config.39='@PROGEXT@ .exe'
  100. os2config.0=39
  101.  
  102. rc=SysFileDelete('os2config.sed')
  103. do i=1 to os2config.0
  104.   parse var os2config.i from_string to_string
  105.   rc=lineout('os2config.sed','s/'from_string'/'to_string'/g')
  106. end
  107. if devel='no' then
  108.   rc=lineout('os2config.sed','s/lyx_devel_version = yes/lyx_devel_version = no/')
  109. rc=lineout('os2config.sed','s/#undef HAVE_ALLOCA$/#define HAVE_ALLOCA 1/')
  110. rc=lineout('os2config.sed','s/#undef HAVE_ALLOCA_H/#define HAVE_ALLOCA_H 1/')
  111. rc=lineout('os2config.sed','s/#undef STDC_HEADERS/#define STDC_HEADERS 1/')
  112. rc=lineout('os2config.sed','s/#undef PACKAGE/#define PACKAGE \"lyx\"/')
  113. rc=lineout('os2config.sed','s/#undef VERSION/#define VERSION \"'subword(os2config.14,2)'\"/')
  114. rc=lineout('os2config.sed','s/#undef HAVE_GETCWD/#define HAVE_GETCWD 1/')
  115. rc=lineout('os2config.sed','s/#undef HAVE_GETPAGESIZE/#define HAVE_GETPAGESIZE 1/')
  116. rc=lineout('os2config.sed','s/#undef HAVE_MEMMOVE/#define HAVE_MEMMOVE 1/')
  117. rc=lineout('os2config.sed','s/#undef HAVE_MEMSET/#define HAVE_MEMSET 1/')
  118. rc=lineout('os2config.sed','s/#undef HAVE_PUTENV/#define HAVE_PUTENV 1/')
  119. rc=lineout('os2config.sed','s/#undef HAVE_SETLOCALE/#define HAVE_SETLOCALE 1/')
  120. rc=lineout('os2config.sed','s/#undef HAVE_STRCASECMP/#define HAVE_STRCASECMP 1/')
  121. rc=lineout('os2config.sed','s/#undef HAVE_STRCHR/#define HAVE_STRCHR 1/')
  122. rc=lineout('os2config.sed','s/#undef HAVE_STRERROR/#define HAVE_STRERROR 1/')
  123. rc=lineout('os2config.sed','s/#undef HAVE_DIRENT_H/#define HAVE_DIRENT_H 1/')
  124. rc=lineout('os2config.sed','s/#undef HAVE_ERRNO_H/#define HAVE_ERRNO_H 1/')
  125. rc=lineout('os2config.sed','s/#undef HAVE_LIMITS_H/#define HAVE_LIMITS_H 1/')
  126. rc=lineout('os2config.sed','s/#undef HAVE_LOCALE_H/#define HAVE_LOCALE_H 1/')
  127. rc=lineout('os2config.sed','s/#undef HAVE_MALLOC_H/#define HAVE_MALLOC_H 1/')
  128. rc=lineout('os2config.sed','s/#undef HAVE_STRING_H/#define HAVE_STRING_H 1/')
  129. rc=lineout('os2config.sed','s/#undef HAVE_SYS_DIR_H/#define HAVE_SYS_DIR_H 1/')
  130. rc=lineout('os2config.sed','s/#undef HAVE_SYS_TIME_H/#define HAVE_SYS_TIME_H 1/')
  131. rc=lineout('os2config.sed','s/#undef HAVE_UNISTD_H/#define HAVE_UNISTD_H 1/')
  132. rc=lineout('os2config.sed','s/#undef XPM_H_LOCATION/#define XPM_H_LOCATION <X11\/xpm.h>/')
  133. rc=lineout('os2config.sed','s/#undef FORMS_H_LOCATION/#define FORMS_H_LOCATION <forms.h>/')
  134. rc=lineout('os2config.sed','s/#undef SIZEOF_INT/#define SIZEOF_INT 4/')
  135. rc=lineout('os2config.sed','s/#undef SIZEOF_VOID_P/#define SIZEOF_VOID_P 4/')
  136. rc=lineout('os2config.sed','s/#undef HAVE_bool/#define HAVE_bool 1/')
  137. rc=lineout('os2config.sed','s/#undef WITH_WARNINGS/#define WITH_WARNINGS 1/')
  138. if devel='yes' then
  139. rc=lineout('os2config.sed','s/#undef DEVEL_VERSION/#define DEVEL_VERSION 1/')
  140. rc=lineout('os2config.sed','s/SHELL/#SHELL/')
  141. rc=lineout('os2config.sed','s/SCRIPT_SUFFIX=/SCRIPT_SUFFIX=.cmd/')
  142. rc=lineout('os2config.sed','s/^DEFS = -DLOCALEDIR/DEFS = -DHAVE_CONFIG_H=1 -DLOCALEDIR/')
  143. if intl='yes' then
  144. rc=lineout('os2config.sed','s/#undef ENABLE_NLS/#define ENABLE_NLS 1/')
  145. /*
  146. rc=lineout('os2config.sed','s/  for [^ ]* in / -for %1 in (/')
  147. rc=lineout('os2config.sed','s/; do /) do /')
  148. */
  149. rc=lineout('os2config.sed','s/(cd lib && $(MAKE) install)/(cd lib && $(MAKE) os2install)/')
  150. rc=lineout('os2config.sed','s/ln -s/cp/g')
  151. rc=lineout('os2config.sed','s/-o lyx /-o lyx.exe /')
  152. rc=lineout('os2config.sed')   /* Close the file */
  153.  
  154. /* Test if xforms and Xpm are available. */
  155. rc=SysFileTree(X11ROOT'\XFree86\lib\forms.a',found,'F')
  156. if found.0 = 0 then
  157.   say "Can't find forms.a. Please check that the xforms library is correctly installed on your system."
  158. rc=SysFileTree(X11ROOT'\XFree86\lib\Xpm.a',found,'F')
  159. if found.0 = 0 then
  160.   say "Can't find Xpm.a. Please check that the Xpm library is correctly installed on your system."
  161.  
  162. 'touch config.status'
  163. 'touch config/stamp-h.in'
  164. 'sed -f os2config.sed Makefile.in > Makefile'
  165. 'sed -f os2config.sed lib/Makefile.in > lib\Makefile'
  166. 'sed -f os2config.sed src/Makefile.in > src\Makefile'
  167. 'sed -f os2config.sed src/config.h.in > src\config.h'
  168. if intl='yes' then
  169.   call SysFileTree 'intl\intlh.inst','patched','F'
  170.   if patched.0 = 0 then
  171.   do
  172.     do
  173.     '@patch 2>&1 | grep SYS1575 >nul'
  174.     if rc=0 then
  175.       do
  176.         say 'configure tries to run GNU patch with the command "patch"'
  177.         say 'and detects IBM patch instead.  Please type the collect'
  178.         say 'name to invoke GNU patch:'
  179.         parse pull patch
  180.       end
  181.     else patch='patch'
  182.         patch' -d intl<development\OS2\gnugettext.diff'
  183.         'touch intl/intlh.inst'
  184.         'cp intl/libgettext.h intl/libintl.h'
  185.     'sed -f os2config.sed intl/Makefile.in > intl\Makefile'
  186.     end
  187.   end
  188. 'cd lib'
  189. /* Check if perl 5.002 or later is available */
  190. PERL=SysSearchPath('PATH', 'perl.exe')
  191. if PERL='' then PERL=SysSearchPath('PATH', 'perl_.exe')
  192. if PERL='' then PERL=SysSearchPath('PATH', 'perl__.exe')
  193. if PERL='' then PERL=SysSearchPath('PATH', 'perl___.exe')
  194. PERL ' -e "require 5.002"'
  195. if rc=0 then
  196.   do
  197.     call SysFileDelete 'reLyX\reLyX.cmd'
  198.     rc=charout('reLyX\reLyX.cmd','/')
  199.     rc=charout('reLyX\reLyX.cmd','* OS/2 REXX: reLyX wrapper *')
  200.     rc=charout('reLyX\reLyX.cmd','/'D2C(13)D2C(10))
  201.     rc=lineout('reLyX\reLyX.cmd','call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"')
  202.     rc=lineout('reLyX\reLyX.cmd','call SysLoadFuncs')
  203.     rc=lineout('reLyX\reLyX.cmd','parse arg option1 "-f" option2')
  204.     rc=lineout('reLyX\reLyX.cmd','select')
  205.     rc=lineout('reLyX\reLyX.cmd','  if option2="" then do')
  206.     rc=lineout('reLyX\reLyX.cmd','    args=option1')
  207.     rc=lineout('reLyX\reLyX.cmd','    path=""')
  208.     rc=lineout('reLyX\reLyX.cmd','  end')
  209.     rc=lineout('reLyX\reLyX.cmd','  else do')
  210.     rc=lineout('reLyX\reLyX.cmd','    args=option2')
  211.     rc=lineout('reLyX\reLyX.cmd','    path=option1')
  212.     rc=lineout('reLyX\reLyX.cmd','  end')
  213.     rc=lineout('reLyX\reLyX.cmd','end')
  214.     rc=lineout('reLyX\reLyX.cmd','curdir=directory()')
  215.     rc=lineout('reLyX\reLyX.cmd','env="OS2ENVIRONMENT"')
  216.     rc=lineout('reLyX\reLyX.cmd','PERLLIB_PREFIX=value("PERLLIB_PREFIX",,env)')
  217.     rc=lineout('reLyX\reLyX.cmd','LYX_DIR_12=value("LYX_DIR_12",,env)')
  218.     rc=lineout('reLyX\reLyX.cmd','X11ROOT=value("X11ROOT",,env)')
  219.     rc=lineout('reLyX\reLyX.cmd','PERL=SysSearchPath("PATH", "perl.exe")')
  220.     rc=lineout('reLyX\reLyX.cmd','if PERL="" then PERL=SysSearchPath("PATH", "perl_.exe")')
  221.     rc=lineout('reLyX\reLyX.cmd','if PERL="" then PERL=SysSearchPath("PATH", "perl__.exe")')
  222.     rc=lineout('reLyX\reLyX.cmd','if PERL="" then PERL=SysSearchPath("PATH", "perl___.exe")')
  223.     rc=lineout('reLyX\reLyX.cmd','path=". "path" "LYX_DIR_12"/reLyX "X11ROOT"/XFree86/lib/X11/lyx/reLyX "curdir" "curdir"../lib/X11/lyx/reLyX"')
  224.     rc=lineout('reLyX\reLyX.cmd','PERLLIB_PREFIX=value("PERLLIB_PREFIX",PERLLIB_PREFIX" "path,env)')
  225.     rc=lineout('reLyX\reLyX.cmd','PERL " reLyXmain.pl "args')
  226.     rc=lineout('reLyX\reLyX.cmd')
  227.   end
  228. /* The extension ".cmd" is added to distinguish it from sh-script */
  229. 'cmd /c configure.cmd'
  230.