xref: /openbsd/gnu/usr.bin/perl/hints/cygwin.sh (revision f2a19305)
1#! /bin/sh
2# cygwin.sh - hints for building perl using the Cygwin environment for Win32
3#
4
5# not otherwise settable
6exe_ext='.exe'
7firstmakefile='GNUmakefile'
8case "$ldlibpthname" in
9'') ldlibpthname=PATH ;;
10esac
11archobjs='cygwin.o'
12
13# mandatory (overrides incorrect defaults)
14test -z "$cc" && cc='gcc'
15if test -z "$plibpth"
16then
17    plibpth=`gcc -print-file-name=libc.a`
18    plibpth=`dirname $plibpth`
19    plibpth=`cd $plibpth && pwd`
20fi
21so='dll'
22# - eliminate -lc, implied by gcc and a symlink to libcygwin.a
23libswanted=`echo " $libswanted " | sed -e 's/ c / /g'`
24# - eliminate -lm, symlink to libcygwin.a
25libswanted=`echo " $libswanted " | sed -e 's/ m / /g'`
26# - eliminate -lutil, symbols are all in libcygwin.a
27libswanted=`echo " $libswanted " | sed -e 's/ util / /g'`
28test -z "$ignore_versioned_solibs" && ignore_versioned_solibs='y'
29test -z "$usenm" && usenm='no'
30test -z "$libc" && libc='/usr/lib/libcygwin.a'
31test -z "$loclibpth" && loclibpth=' '
32test -z "$glibpth" && glibpth=' '
33test -z "$plibpth" && plibpth=' '
34test -z "$libpth" && libpth=' '
35PATH='.:/usr/bin/'
36# - add libgdbm_compat $libswanted
37libswanted="$libswanted gdbm_compat"
38test -z "$optimize" && optimize='-O3'
39man3ext='3pm'
40test -z "$use64bitint" && use64bitint='define'
41test -z "$useithreads" && useithreads='define'
42test -z "$usemymalloc" && usemymalloc='undef'
43ccflags="$ccflags -U__STRICT_ANSI__ -D_GNU_SOURCE"
44# - otherwise i686-cygwin
45archname='cygwin'
46
47# dynamic loading
48# - otherwise -fpic
49cccdlflags=' '
50lddlflags=' --shared'
51test -z "$ld" && ld='g++'
52
53case "$osvers" in
54    # Configure gets these wrong if the IPC server isn't yet running:
55    # only use for 1.5.7 and onwards
56    [2-9]*|1.[6-9]*|1.[1-5][0-9]*|1.5.[7-9]*|1.5.[1-6][0-9]*)
57        d_semctl_semid_ds='define'
58        d_semctl_semun='define'
59        ;;
60esac
61
62case "$osvers" in
63    [2-9]*|1.[6-9]*)
64        # IPv6 only since 1.7
65        d_inetntop='define'
66        d_inetpton='define'
67        ;;
68    *)
69        # IPv6 not implemented before cygwin-1.7
70        d_inetntop='undef'
71        d_inetpton='undef'
72esac
73
74# compile Win32CORE "module" as static. try to avoid the space.
75if test -z "$static_ext"; then
76  static_ext="Win32CORE"
77else
78  static_ext="$static_ext Win32CORE"
79fi
80
81# Win9x problem with non-blocking read from a closed pipe
82d_eofnblk='define'
83
84# suppress auto-import warnings
85ldflags="$ldflags -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base"
86lddlflags="$lddlflags $ldflags"
87
88# strip exe's and dll's, better do it afterwards
89#ldflags="$ldflags -s"
90#ccdlflags="$ccdlflags -s"
91#lddlflags="$lddlflags -s"
92
93# Seems that exporting _Thread_local doesn't work on cygwin. This 6 year old
94# gcc bug suggests that maybe the problem really is binutils, but either way
95# it still doesn't work, despite our probes looking good:
96# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697
97d_thread_local=undef
98
99# Broken: https://sourceware.org/pipermail/cygwin/2022-August/252043.html */
100d_newlocale=undef
101