xref: /openbsd-src/gnu/usr.bin/perl/hints/cygwin.sh (revision 4c1e55dc91edd6e69ccc60ce855900fbc12cf34f)
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
29# - libcygipc doesn't work much at all with
30#   the Perl SysV IPC tests so not adding it --jhi 2003-08-09
31#   (with cygwin 1.5.7, cygipc is deprecated in favor of the builtin cygserver)
32libswanted="$libswanted gdbm_compat"
33test -z "$optimize" && optimize='-O3'
34man3ext='3pm'
35test -z "$use64bitint" && use64bitint='define'
36test -z "$usethreads" && usethreads='define'
37test -z "$usemymalloc" && usemymalloc='define'
38ccflags="$ccflags -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__"
39# - otherwise i686-cygwin
40archname='cygwin'
41
42# dynamic loading
43# - otherwise -fpic
44cccdlflags=' '
45lddlflags=' --shared'
46test -z "$ld" && ld='g++'
47
48case "$osvers" in
49    # Configure gets these wrong if the IPC server isn't yet running:
50    # only use for 1.5.7 and onwards
51    [2-9]*|1.[6-9]*|1.[1-5][0-9]*|1.5.[7-9]*|1.5.[1-6][0-9]*)
52        d_semctl_semid_ds='define'
53        d_semctl_semun='define'
54        ;;
55esac
56
57case "$osvers" in
58    [2-9]*|1.[6-9]*)
59        # IPv6 only since 1.7
60        d_inetntop='define'
61        d_inetpton='define'
62        ;;
63    *)
64        # IPv6 not implemented before cygwin-1.7
65        d_inetntop='undef'
66        d_inetpton='undef'
67esac
68
69# compile Win32CORE "module" as static. try to avoid the space.
70if test -z "$static_ext"; then
71  static_ext="Win32CORE"
72else
73  static_ext="$static_ext Win32CORE"
74fi
75
76# Win9x problem with non-blocking read from a closed pipe
77d_eofnblk='define'
78
79# suppress auto-import warnings
80ldflags="$ldflags -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--stack,8388608 -Wl,--enable-auto-image-base"
81lddlflags="$lddlflags $ldflags"
82
83# strip exe's and dll's, better do it afterwards
84#ldflags="$ldflags -s"
85#ccdlflags="$ccdlflags -s"
86#lddlflags="$lddlflags -s"
87