configure.com 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. $!
  2. $! This file configures the bfd library for use with openVMS.
  3. $!
  4. $! We do not use the configure script, since we do not have /bin/sh
  5. $! to execute it.
  6. $!
  7. $! Written by Klaus K"ampf (kkaempf@rmi.de)
  8. $! Rewritten by Tristan Gingold (gingold@adacore.com)
  9. $!
  10. $! Copyright (C) 2012-2022 Free Software Foundation, Inc.
  11. $!
  12. $! This file is free software; you can redistribute it and/or modify
  13. $! it under the terms of the GNU General Public License as published by
  14. $! the Free Software Foundation; either version 3 of the License, or
  15. $! (at your option) any later version.
  16. $!
  17. $! This program is distributed in the hope that it will be useful,
  18. $! but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. $! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. $! GNU General Public License for more details.
  21. $!
  22. $! You should have received a copy of the GNU General Public License
  23. $! along with this program; see the file COPYING3. If not see
  24. $! <http://www.gnu.org/licenses/>.
  25. $!
  26. $ arch=F$GETSYI("ARCH_NAME")
  27. $ arch=F$EDIT(arch,"LOWERCASE")
  28. $if arch .eqs. "alpha" then target = "alpha"
  29. $if arch .eqs. "ia64" then target = "ia64"
  30. $!
  31. $if (arch .eqs. "alpha") .or. (arch .eqs. "ia64")
  32. $then
  33. $!
  34. $ write sys$output "Configuring BFD for ''target' target"
  35. $!
  36. $!
  37. $! copy bfd-in2.h to bfd.h, replacing @ macros
  38. $!
  39. $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
  40. []bfd-in2.h /output=[]bfd.h
  41. $DECK
  42. !
  43. ! Copy file, changing lines with macros (@@)
  44. !
  45. !
  46. set (success,off);
  47. file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
  48. rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
  49. match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
  50. IF match_pos <> 0 THEN;
  51. POSITION(BEGINNING_OF(match_pos));
  52. ERASE(match_pos);
  53. COPY_TEXT('64');
  54. ENDIF;
  55. match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
  56. IF match_pos <> 0 THEN;
  57. POSITION(BEGINNING_OF(match_pos));
  58. ERASE(match_pos);
  59. COPY_TEXT('64');
  60. ENDIF;
  61. match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
  62. IF match_pos <> 0 THEN;
  63. POSITION(BEGINNING_OF(match_pos));
  64. ERASE(match_pos);
  65. COPY_TEXT('0');
  66. ENDIF;
  67. match_pos := SEARCH_QUIETLY('@BFD_HOST_LONG_LONG@', FORWARD, EXACT, rang);
  68. IF match_pos <> 0 THEN;
  69. POSITION(BEGINNING_OF(match_pos));
  70. ERASE(match_pos);
  71. COPY_TEXT('1');
  72. ENDIF;
  73. match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG_LONG@', FORWARD, EXACT, rang);
  74. IF match_pos <> 0 THEN;
  75. POSITION(BEGINNING_OF(match_pos));
  76. ERASE(match_pos);
  77. COPY_TEXT('1');
  78. ENDIF;
  79. match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
  80. IF match_pos <> 0 THEN;
  81. POSITION(BEGINNING_OF(match_pos));
  82. ERASE(match_pos);
  83. COPY_TEXT('1');
  84. ENDIF;
  85. match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
  86. IF match_pos <> 0 THEN;
  87. POSITION(BEGINNING_OF(match_pos));
  88. ERASE(match_pos);
  89. COPY_TEXT('__int64');
  90. ENDIF;
  91. match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
  92. IF match_pos <> 0 THEN;
  93. POSITION(BEGINNING_OF(match_pos));
  94. ERASE(match_pos);
  95. COPY_TEXT('unsigned __int64');
  96. ENDIF;
  97. match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
  98. IF match_pos <> 0 THEN;
  99. POSITION(BEGINNING_OF(match_pos));
  100. ERASE(match_pos);
  101. COPY_TEXT('unsigned __int64');
  102. ENDIF;
  103. match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
  104. IF match_pos <> 0 THEN;
  105. POSITION(BEGINNING_OF(match_pos));
  106. ERASE(match_pos);
  107. COPY_TEXT('bfd_signed_vma');
  108. ENDIF;
  109. match_pos := SEARCH_QUIETLY('unsigned @bfd_file_ptr@ ufile_ptr', FORWARD, EXACT, rang);
  110. IF match_pos <> 0 THEN;
  111. POSITION(BEGINNING_OF(match_pos));
  112. ERASE(match_pos);
  113. COPY_TEXT('bfd_vma ufile_ptr');
  114. ENDIF;
  115. match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
  116. IF match_pos <> 0 THEN;
  117. POSITION(BEGINNING_OF(match_pos));
  118. ERASE(match_pos);
  119. COPY_TEXT('0');
  120. ENDIF;
  121. WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
  122. QUIT
  123. $ EOD
  124. $
  125. $else
  126. $
  127. $ write sys$output "Configuring for Vax target"
  128. $ target = "vax"
  129. $!
  130. $! copy bfd-in2.h to bfd.h, replacing @ macros
  131. $!
  132. $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
  133. $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
  134. []bfd-in2.h /output=[]bfd.h
  135. $DECK
  136. !
  137. ! Copy file, changing lines with macros (@@)
  138. !
  139. !
  140. set (success,off);
  141. file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
  142. rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
  143. match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
  144. IF match_pos <> 0 THEN;
  145. POSITION(BEGINNING_OF(match_pos));
  146. ERASE(match_pos);
  147. COPY_TEXT('32');
  148. ENDIF;
  149. match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
  150. IF match_pos <> 0 THEN;
  151. POSITION(BEGINNING_OF(match_pos));
  152. ERASE(match_pos);
  153. COPY_TEXT('0');
  154. ENDIF;
  155. match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
  156. IF match_pos <> 0 THEN;
  157. POSITION(BEGINNING_OF(match_pos));
  158. ERASE(match_pos);
  159. COPY_TEXT('__DECC');
  160. SPLIT_LINE;
  161. COPY_TEXT('#include <ints.h>');
  162. ENDIF;
  163. match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
  164. IF match_pos <> 0 THEN;
  165. POSITION(BEGINNING_OF(match_pos));
  166. ERASE(match_pos);
  167. COPY_TEXT('int64');
  168. ENDIF;
  169. match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
  170. IF match_pos <> 0 THEN;
  171. POSITION(BEGINNING_OF(match_pos));
  172. ERASE(match_pos);
  173. COPY_TEXT('uint64');
  174. ENDIF;
  175. WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
  176. QUIT
  177. $ EOD
  178. $endif
  179. $
  180. $!
  181. $! create bfdver.h
  182. $!
  183. $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
  184. $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
  185. []version.h /output=[]bfdver.h
  186. $DECK
  187. !
  188. ! Copy file, changing lines with macros (@@)
  189. !
  190. !
  191. set (success,off);
  192. vfile := CREATE_BUFFER("vfile", "configure.in");
  193. rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
  194. match_pos := SEARCH_QUIETLY('AC_INIT([bfd], [', FORWARD, EXACT, rang);
  195. IF match_pos <> 0 THEN;
  196. POSITION(BEGINNING_OF(match_pos));
  197. ERASE(match_pos);
  198. vers := CURRENT_LINE-"])";
  199. ELSE;
  200. vers := "unknown";
  201. ENDIF;
  202. versnum := vers - "." - ".";
  203. file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
  204. rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
  205. match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
  206. IF match_pos <> 0 THEN;
  207. POSITION(BEGINNING_OF(match_pos));
  208. ERASE(match_pos);
  209. COPY_TEXT(versnum);
  210. ENDIF;
  211. match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
  212. IF match_pos <> 0 THEN;
  213. POSITION(BEGINNING_OF(match_pos));
  214. ERASE(match_pos);
  215. COPY_TEXT('"');
  216. COPY_TEXT(vers);
  217. COPY_TEXT('"');
  218. ENDIF;
  219. match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
  220. IF match_pos <> 0 THEN;
  221. POSITION(BEGINNING_OF(match_pos));
  222. ERASE(match_pos);
  223. COPY_TEXT('"(GNU Binutils) "');
  224. ENDIF;
  225. match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
  226. IF match_pos <> 0 THEN;
  227. POSITION(BEGINNING_OF(match_pos));
  228. ERASE(match_pos);
  229. COPY_TEXT('"<https://www.sourceware.org/bugzilla/>"');
  230. ENDIF;
  231. WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
  232. QUIT
  233. $ EOD
  234. $!
  235. $!
  236. $! create targmatch.h
  237. $!
  238. $ write sys$output "Generate `targmatch.h'"
  239. $ open/write tfile []targmatch.h
  240. $ write tfile "{ """ + target + "-*-*vms*""" + ","
  241. $ write tfile "#if defined (SELECT_VECS)"
  242. $ write tfile "SELECT_VECS"
  243. $ write tfile "#else"
  244. $ write tfile "UNSUPPORTED_TARGET"
  245. $ write tfile "#endif"
  246. $ write tfile "},"
  247. $ close tfile
  248. $!
  249. $!
  250. $! create config.h
  251. $!
  252. $ write sys$output "Generate `config.h'"
  253. $ create []config.h
  254. /* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
  255. /* config.in. Generated automatically from configure.in by autoheader. */
  256. /* Whether malloc must be declared even if <stdlib.h> is included. */
  257. /* #undef NEED_DECLARATION_MALLOC */
  258. /* Whether free must be declared even if <stdlib.h> is included. */
  259. /* #undef NEED_DECLARATION_FREE */
  260. /* Define if you have a working `mmap' system call. */
  261. /* #define HAVE_MMAP 1 */
  262. /* Do we need to use the b modifier when opening binary files? */
  263. /* #undef USE_BINARY_FOPEN */
  264. /* Name of host specific header file to include in trad-core.c. */
  265. /* #undef TRAD_HEADER */
  266. /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
  267. /* #undef HAVE_SYS_PROCFS_H */
  268. /* Do we really want to use mmap if it's available? */
  269. /* #undef USE_MMAP */
  270. /* Define if you have the fcntl function. */
  271. #define HAVE_FCNTL 1
  272. /* Define if you have the getpagesize function. */
  273. #define HAVE_GETPAGESIZE 1
  274. /* Define if you have the madvise function. */
  275. #define HAVE_MADVISE 1
  276. /* Define if you have the mprotect function. */
  277. #define HAVE_MPROTECT 1
  278. /* Define if you have the <fcntl.h> header file. */
  279. #define HAVE_FCNTL_H 1
  280. /* Define if you have the <stddef.h> header file. */
  281. #define HAVE_STDDEF_H 1
  282. /* Define if you have the <stdlib.h> header file. */
  283. #define HAVE_STDLIB_H 1
  284. /* Define if you have the <string.h> header file. */
  285. #define HAVE_STRING_H 1
  286. /* Define if you have the <strings.h> header file. */
  287. #define HAVE_STRINGS_H 1
  288. /* Define if you have the <sys/file.h> header file. */
  289. #define HAVE_SYS_FILE_H 1
  290. /* Define if you have the <time.h> header file. */
  291. #define HAVE_TIME_H 1
  292. /* Define if you have the <unistd.h> header file. */
  293. #define HAVE_UNISTD_H 1
  294. /* Disable NLS */
  295. #undef ENABLE_NLS
  296. /* Name of package */
  297. #define PACKAGE "bfd"
  298. /* Define to the address where bug reports for this package should be sent. */
  299. #define PACKAGE_BUGREPORT ""
  300. /* Define to the full name of this package. */
  301. #define PACKAGE_NAME "bfd"
  302. /* Define to the full name and version of this package. */
  303. #define PACKAGE_STRING "bfd"
  304. /* Define to the one symbol short name of this package. */
  305. #define PACKAGE_TARNAME "bfd"
  306. /* Define to the home page for this package. */
  307. #define PACKAGE_URL ""
  308. /* Define to the version of this package. */
  309. #define PACKAGE_VERSION "(package version)"
  310. $!
  311. $ write sys$output "Copy sysdep.h"
  312. $ copy [.hosts]alphavms.h sysdep.h
  313. $
  314. $ write sys$output "Generate build.com"
  315. $!
  316. $ if ARCH.eqs."alpha"
  317. $ then
  318. $ create build.com
  319. $DECK
  320. $ DEFS="""SELECT_VECS=&alpha_vms_vec"","+-
  321. """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
  322. $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
  323. $EOD
  324. $ endif
  325. $ if ARCH.eqs."ia64"
  326. $ then
  327. $ create build.com
  328. $DECK
  329. $ DEFS="""SELECT_VECS=&ia64_elf64_vms_vec"","+-
  330. """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
  331. $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
  332. "elflink,elf-attrs,dwarf1,elf64,"
  333. $EOD
  334. $ create substxx.tpu
  335. $DECK
  336. set (success,off);
  337. file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
  338. found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
  339. LOOP
  340. rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
  341. match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
  342. EXITIF match_pos = 0;
  343. POSITION(BEGINNING_OF(match_pos));
  344. ERASE(match_pos);
  345. COPY_TEXT('64');
  346. ENDLOOP;
  347. WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
  348. QUIT
  349. $ EOD
  350. $ write sys$output "Generate elf64-target.h from elfxx-target.h"
  351. $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
  352. []elfXX-target.h /output=[]elf64-target.h
  353. $ del substxx.tpu;*
  354. $ endif
  355. $ append sys$input build.com
  356. $DECK
  357. $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
  358. $ OPT="/noopt/debug"
  359. $ CFLAGS="/name=(as_is,shortened)" + -
  360. "/include=([],""../"",""../include"")" + -
  361. "/define=(" + DEFS + ")" + OPT
  362. $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
  363. "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
  364. "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
  365. $ write sys$output "CFLAGS=",CFLAGS
  366. $ cflags_libbfd="/warning=(disable=missingreturn)"
  367. $ cflags_nil=""
  368. $ NUM = 0
  369. $ OBJS=""
  370. $ LOOP:
  371. $ F = F$ELEMENT(NUM,",",FILES)
  372. $ IF F.EQS."," THEN GOTO END
  373. $ eflags_name="cflags_''f'"
  374. $ name_len=f$length(eflags_name)
  375. $ dash_pos=f$locate("-",eflags_name)
  376. $ if dash_pos.ne.name_len
  377. $ then
  378. $ eflags_name['dash_pos,1]:="_"
  379. $ dash_pos=f$locate("-",eflags_name)
  380. $ if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
  381. $ endif
  382. $ if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
  383. $ eflags='eflags_name
  384. $ write sys$output "Compiling ", F, ".c", eflags
  385. $ cc 'CFLAGS 'eflags 'F.c
  386. $ IF OBJS.NES."" THEN OBJS=OBJS + ","
  387. $ OBJS=OBJS + F + ".obj"
  388. $ NUM = NUM + 1
  389. $ GOTO LOOP
  390. $ END:
  391. $ purge
  392. $ lib/create libbfd 'OBJS
  393. $EOD