@@ -272,6 +272,10 @@ set(
272
272
273
273
set (PCRE2_EBCDIC_NL25 OFF CACHE BOOL "Use 0x25 as EBCDIC NL character instead of 0x15; implies EBCDIC." )
274
274
275
+ set (PCRE2_EBCDIC_IGNORING_COMPILER OFF CACHE BOOL "Force EBCDIC 1047 using numeric literals rather than C character literals; implies EBCDIC." )
276
+
277
+ option (PCRE2_REBUILD_CHARTABLES "Rebuild char tables" OFF )
278
+
275
279
set (
276
280
PCRE2_LINK_SIZE
277
281
"2"
@@ -579,13 +583,42 @@ if(NEWLINE_DEFAULT STREQUAL "")
579
583
)
580
584
endif ()
581
585
586
+ set (REBUILD_CHARTABLES OFF )
587
+ if (PCRE2_REBUILD_CHARTABLES)
588
+ set (REBUILD_CHARTABLES ON )
589
+ endif ()
590
+
591
+ set (EBCDIC OFF )
582
592
if (PCRE2_EBCDIC)
583
- set (EBCDIC 1 )
593
+ set (EBCDIC ON )
584
594
endif ()
585
595
586
596
if (PCRE2_EBCDIC_NL25)
587
- set (EBCDIC 1)
588
- set (EBCDIC_NL25 1)
597
+ set (EBCDIC ON )
598
+ set (EBCDIC_NL25 ON )
599
+ endif ()
600
+
601
+ if (PCRE2_EBCDIC_IGNORING_COMPILER)
602
+ set (EBCDIC ON )
603
+ set (EBCDIC_IGNORING_COMPILER ON )
604
+ endif ()
605
+
606
+ # Make sure that if EBCDIC is set (without EBCDIC_IGNORING_COMPILER), then
607
+ # REBUILD_CHARTABLES is also enabled.
608
+ # Also check that UTF support is not requested, because PCRE2 cannot handle
609
+ # EBCDIC and UTF in the same build. To do so it would need to use different
610
+ # character constants depending on the mode.
611
+ # Also, EBCDIC cannot be used with 16-bit and 32-bit libraries.
612
+ if (EBCDIC)
613
+ if (NOT EBCDIC_IGNORING_COMPILER)
614
+ set (REBUILD_CHARTABLES ON )
615
+ endif ()
616
+ if (PCRE2_SUPPORT_UNICODE)
617
+ message (FATAL_ERROR "Support for EBCDIC and Unicode cannot be enabled at the same time" )
618
+ endif ()
619
+ if (PCRE2_BUILD_PCRE2_16 OR PCRE2_BUILD_PCRE2_32)
620
+ message (FATAL_ERROR "EBCDIC support is available only for the 8-bit library" )
621
+ endif ()
589
622
endif ()
590
623
591
624
# Output files
@@ -659,8 +692,7 @@ endif()
659
692
660
693
# Character table generation
661
694
662
- option (PCRE2_REBUILD_CHARTABLES "Rebuild char tables" OFF )
663
- if (PCRE2_REBUILD_CHARTABLES)
695
+ if (REBUILD_CHARTABLES)
664
696
add_executable (pcre2_dftables src/pcre2_dftables.c)
665
697
add_custom_command (
666
698
OUTPUT ${PROJECT_BINARY_DIR} /pcre2_chartables.c
@@ -670,8 +702,12 @@ if(PCRE2_REBUILD_CHARTABLES)
670
702
COMMENT "Generating character tables (pcre2_chartables.c) for current locale"
671
703
VERBATIM
672
704
)
673
- else ( )
705
+ elseif ( NOT PCRE2_EBCDIC )
674
706
configure_file (${PROJECT_SOURCE_DIR} /src/pcre2_chartables.c.dist ${PROJECT_BINARY_DIR} /pcre2_chartables.c COPYONLY )
707
+ elseif (PCRE2_EBCDIC_NL25)
708
+ configure_file (${PROJECT_SOURCE_DIR} /src/pcre2_chartables.c.ebcdic-1047-nl25 ${PROJECT_BINARY_DIR} /pcre2_chartables.c COPYONLY )
709
+ else ()
710
+ configure_file (${PROJECT_SOURCE_DIR} /src/pcre2_chartables.c.ebcdic-1047-nl15 ${PROJECT_BINARY_DIR} /pcre2_chartables.c COPYONLY )
675
711
endif ()
676
712
677
713
# Source code
@@ -1345,9 +1381,19 @@ if(PCRE2_SHOW_REPORT)
1345
1381
message (STATUS " Newline char/sequence ............. : ${PCRE2_NEWLINE} " )
1346
1382
message (STATUS " \\ R matches only ANYCRLF ........... : ${PCRE2_SUPPORT_BSR_ANYCRLF} " )
1347
1383
message (STATUS " \\ C is disabled .................... : ${PCRE2_NEVER_BACKSLASH_C} " )
1348
- message (STATUS " EBCDIC coding ..................... : ${PCRE2_EBCDIC} " )
1349
- message (STATUS " EBCDIC coding with NL=0x25 ........ : ${PCRE2_EBCDIC_NL25} " )
1350
- message (STATUS " Rebuild char tables ............... : ${PCRE2_REBUILD_CHARTABLES} " )
1384
+
1385
+ if (NOT EBCDIC)
1386
+ set (EBCDIC_NL_CODE "n/a" )
1387
+ elseif (EBCDIC_NL25)
1388
+ set (EBCDIC_NL_CODE "0x25" )
1389
+ else ()
1390
+ set (EBCDIC_NL_CODE "0x15" )
1391
+ endif ()
1392
+ message (STATUS " EBCDIC coding ..................... : ${EBCDIC} " )
1393
+ message (STATUS " EBCDIC code for NL ................ : ${EBCDIC_NL_CODE} " )
1394
+ message (STATUS " EBCDIC coding ignoring compiler ... : ${PCRE2_EBCDIC_IGNORING_COMPILER} " )
1395
+ message (STATUS " Rebuild char tables ............... : ${REBUILD_CHARTABLES} " )
1396
+
1351
1397
message (STATUS " Internal link size ................ : ${PCRE2_LINK_SIZE} " )
1352
1398
message (STATUS " Maximum variable lookbehind ....... : ${PCRE2_MAX_VARLOOKBEHIND} " )
1353
1399
message (STATUS " Parentheses nest limit ............ : ${PCRE2_PARENS_NEST_LIMIT} " )
0 commit comments