xref: /openbsd/gnu/usr.bin/perl/hints/cygwin.sh (revision d415bd75)
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'`
28# - add libgdbm_compat $libswanted
29libswanted="$libswanted gdbm_compat"
30test -z "$optimize" && optimize='-O3'
31man3ext='3pm'
32test -z "$use64bitint" && use64bitint='define'
33test -z "$useithreads" && useithreads='define'
34ccflags="$ccflags -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE"
35# - otherwise i686-cygwin
36archname='cygwin'
37
38# dynamic loading
39# - otherwise -fpic
40cccdlflags=' '
41lddlflags=' --shared'
42test -z "$ld" && ld='g++'
43
44case "$osvers" in
45    # Configure gets these wrong if the IPC server isn't yet running:
46    # only use for 1.5.7 and onwards
47    [2-9]*|1.[6-9]*|1.[1-5][0-9]*|1.5.[7-9]*|1.5.[1-6][0-9]*)
48        d_semctl_semid_ds='define'
49        d_semctl_semun='define'
50        ;;
51esac
52
53case "$osvers" in
54    [2-9]*|1.[6-9]*)
55        # IPv6 only since 1.7
56        d_inetntop='define'
57        d_inetpton='define'
58        ;;
59    *)
60        # IPv6 not implemented before cygwin-1.7
61        d_inetntop='undef'
62        d_inetpton='undef'
63esac
64
65# compile Win32CORE "module" as static. try to avoid the space.
66if test -z "$static_ext"; then
67  static_ext="Win32CORE"
68else
69  static_ext="$static_ext Win32CORE"
70fi
71
72# Win9x problem with non-blocking read from a closed pipe
73d_eofnblk='define'
74
75# suppress auto-import warnings
76ldflags="$ldflags -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base"
77lddlflags="$lddlflags $ldflags"
78
79# strip exe's and dll's, better do it afterwards
80#ldflags="$ldflags -s"
81#ccdlflags="$ccdlflags -s"
82#lddlflags="$lddlflags -s"
83
84# Seems that exporting _Thread_local doesn't work on cygwin. This 6 year old
85# gcc bug suggests that maybe the problem really is binutils, but either way
86# it still doesn't work, despite our probes looking good:
87# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697
88d_thread_local=undef
89