File: configure.in

package info (click to toggle)
gap 4r8p6-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 33,476 kB
  • ctags: 7,663
  • sloc: ansic: 108,841; xml: 47,807; sh: 3,628; perl: 2,342; makefile: 796; asm: 62; awk: 6
file content (184 lines) | stat: -rw-r--r-- 5,260 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
AC_INIT(configure)

#if test "x$CFLAGS" = "x" ;  then
#  CFLAGS=${COPTS}
#fi
AC_SUBST(COPTS)

AC_CHECK_SIZEOF(void *, 4)

AC_ARG_VAR(ABI, [Set this equal to 32 or 64 to build GAP (and GMP provided you
 		 do not deselect it) in 32- or 64-bit mode. The default value
		 for this option is determined by testing the behaviour of your
		 compiler, so should be 32 on a 32-bit system and 64 on one
		 which is 64-bit. If this is unset, the build system will set
		 a value of 64 or 32 depending of the pointer size of the host.])

AC_MSG_CHECKING([ABI bit size])
if test "x$ABI" = "x" ;  then
  if test $ac_cv_sizeof_void_p = 8; then
    ABI="64"
  else
    ABI="32"
  fi
  ABI_CFLAGS=""
elif test "$ABI" = "64"; then
  if test $ac_cv_sizeof_void_p = 4; then
    AC_MSG_ERROR([ ABI=64 cannot be used on a 32-bit system.
                   Please replace this value with 32 and retry configure.
                   If you think this error is wrong, email
                   support@gap-system.org with full details.])
  else
    ABI_CFLAGS="-m64"
  fi
elif test "$ABI" = "32"; then
  ABI_CFLAGS="-m32"
else
  AC_MSG_WARN([ $ABI is not a supported value for ABI. The supported values are ABI=64
                 or 32.])
fi

AC_MSG_RESULT([$ABI])

AC_SUBST(ABI)
AC_SUBST(ABI_CFLAGS)

gp_configure_options=$ac_configure_args
AC_SUBST(gp_configure_options)
AC_CONFIG_AUX_DIR(cnf)
AC_CANONICAL_TARGET
AC_PROG_CC
BASECC=gcc
AC_SUBST(BASECC)
AC_PROG_MAKE_SET
AC_SUBST(gapdir)
gapdir=/usr/share/gap

case $target_os in
  cygwin*)
    AC_SUBST(wingapdir)
    wingapdir=$(cygpath -w $(pwd))
    AC_SUBST(wincygbin)
    wincygbin=$(cygpath -w /bin)
    gapdir=$(echo /proc/cygdrive/"$(cygpath -am $(pwd))" | sed -e 's/:\//\//g')
esac

AC_ARG_VAR(CONFIGNAME,[Supply a (meaningful) name for the configuration you are building.
    This name will be appended to the architecture-dependent named
    sub-directory of bin/. Allows for multiple configurations side by
    side. Default value is "defaultXX" where "XX" is 32 or 64.])

AC_MSG_CHECKING([GAP config name])
if test "x$CONFIGNAME" = "x"; then
  CONFIGNAME="default${ABI}"
fi
AC_MSG_RESULT([$CONFIGNAME])
AC_SUBST(CONFIGNAME)

GAPARCH=$GAPHOST-$BASECC-${CONFIGNAME}
AC_SUBST(GAPARCH)

AC_ARG_WITH(gmp,
  AC_HELP_STRING( [--with-gmp],
    [ Use GMP library.
      If the argument you supply is "yes" or <empty>, then the version of GMP bundled with this GAP will be used (default).
      If the argument is "system" that means the library is reachable with the standard
      search path "/usr" or "/usr/local".
      Otherwise you give the <path> to the directory which contains the library.
      If the argument is no, use original GAP large integers instead of GMP.
      [[default=yes]]
    ]),
  [ ],
  [ with_gmp=yes ]
)

USE_GMP=yes
case "$with_gmp" in
  no)
    GMP_CFLAGS=""
    GMP_LIBS=""
    MAKE_GMP=""
    USE_GMP=no
    ;;
  yes | 6.0.0a | 5.0.5 | 5.0.4)
    if test "$with_gmp" = "yes" ; then
      with_gmp="6.0.0a"
    fi;
    GMP_HOME="`pwd`/bin/$GAPARCH/extern/gmp"
    GMP_CFLAGS="-I${GMP_HOME}/include"
    GMP_LIBS="${GMP_HOME}/lib/libgmp.a"
    MAKE_GMP="gmp"
    GMP_VER="$with_gmp"
    ;;
  system)
    GMP_CFLAGS="${ABI_CFLAGS}"
    GMP_LIBS="-lgmp"
    MAKE_GMP=""
    ;;
  *)
    # user specified directory
    GMP_HOME="$with_gmp"
	if test -d ${GMP_HOME}/include && test -f ${GMP_HOME}/lib/libgmp.a ; then
      GMP_CFLAGS="-I${GMP_HOME}/include"
      GMP_LIBS="${GMP_HOME}/lib/libgmp.a"
    else
      AC_MSG_ERROR([Could not locate GMP in the specified location])
    fi;
    MAKE_GMP=""
    ;;
esac

if test "$MAKE_GMP" = "gmp" ; then
  if ! test $ac_cv_sizeof_void_p = 4; then
    if test "$ac_cv_prog_ac_ct_CC" = gcc ; then
      if test `gcc -dumpversion` = "4.3.2" ; then
        AC_MSG_ERROR([The version of gcc found on your system is known to
                       miscompile GMP on 64-bit machines. Please use another
                       compiler or build GAP without GMP.])
      fi
    fi
  fi
  AC_CHECK_PROG(m4_PRESENT,m4,yes,no)
  if test "$m4_PRESENT" = "no"; then
    AC_MSG_ERROR([You have requested that GAP be built with GMP but this
                   requires m4, which has not been detected on your system.
                   Please install m4 or build without GMP.])
  fi
  case "$host" in
    arm*)
      ABI="standard"
      ABI_CFLAGS=""
      ;;
  esac
fi

# Enabling/disabling readline is handled by the "inner" configure
# script in cnf/, so we do nothing here (the command line flag
# is automatically passed on to the "inner" configure script anyway.
AC_ARG_WITH(readline,[ --with-readline=yes|no|<path>
   Use readline library for command line editing.
 ],[],[])

AC_SUBST(GMP_CFLAGS)
AC_SUBST(GMP_LIBS)
AC_SUBST(MAKE_GMP)
AC_SUBST(USE_GMP)
AC_SUBST(GMP_VER)

mkdir -p bin
AC_CONFIG_FILES([Makefile-${CONFIGNAME}:Makefile.in
                 sysinfo.gap-${CONFIGNAME}:sysinfo.in
                 bin/gap-${CONFIGNAME}.sh:gap.shi])

case $target_os in
  cygwin*)
    AC_CONFIG_FILES([bin/gap.bat:cnf/gap.bai
                     bin/gapcmd.bat:cnf/gapcmd.bai
                     bin/gaprxvt.bat:cnf/gaprxvt.bai])
esac

AC_OUTPUT

ln -sf gap-${CONFIGNAME}.sh bin/gap.sh
ln -sf Makefile-${CONFIGNAME} Makefile
ln -sf sysinfo.gap-${CONFIGNAME} sysinfo.gap