File: configure.ac

package info (click to toggle)
gp2c 0.0.9pl2-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,444 kB
  • ctags: 1,361
  • sloc: ansic: 8,120; sh: 1,427; lex: 336; yacc: 214; makefile: 143
file content (206 lines) | stat: -rw-r--r-- 6,426 bytes parent folder | download
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
dnl Process this file with autoconf to produce a configure script.
AC_INIT([gp2c], [0.0.9pl2])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR([src/gp2c.c])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE dnl Be nice with packagers.
AM_CONFIG_HEADER(src/config.h)
dnl Checks for programs.
AC_PROG_CC
AM_PROG_LEX
AC_PROG_YACC

dnl look for perl
AC_ARG_WITH(perl,
[  --with-perl[=FILE]  Perl is needed to compile the description files. But gp2c
               comes with precompiled descriptions for PARI 2.7, so can be
               used without perl.  Default is to use perl if we find it.
	       You can specify the path to perl with --with-perl=PATH.])
if test "$with_perl" = "no"; then
  PERL_PATH=/bin/false
elif test -x "$with_perl"; then
  PERL_PATH="$with_perl"
else
  AC_PATH_PROG(PERL_PATH,perl,/bin/false)
fi

dnl check for PARI configuration
AC_ARG_WITH(paricfg,
[  --with-paricfg[=FILE]  Details about PARI configuration are needed to build
               plug-ins. Without them, gp2c itself can be compiled,
               but gp2c-run and 'make check' will not work.
	       You must specify the path to the 'pari.cfg' file  with 
               --with-paricfg=PATH.])

AC_MSG_CHECKING(for multiarch system)
multiarch=`$CC $CFLAGS -print-multiarch 2>/dev/null`
AC_MSG_RESULT($multiarch)

if test "$with_paricfg" = "no" ; then
  PARI_CONFIG=
else
  AC_MSG_CHECKING(for PARI configuration)
  if test "$with_paricfg" = "yes" || test "x$with_paricfg" = "x" ; then
    for i in /usr/lib/pari/pari.cfg \
             "/usr/lib/$multiarch/pari/pari.cfg" \
             /usr/local/lib/pari/pari.cfg \
             "$srcdir/../pari.cfg" \
             "$srcdir/pari.cfg"
    do
      if test -f "$i"; then PARI_CONFIG="$i"; fi;
    done;
  else
    test -f "$with_paricfg" && PARI_CONFIG="$with_paricfg"
  fi
  if test "x$with_paricfg" != "x" && test "x$PARI_CONFIG" = "x" ; then
    AC_MSG_ERROR([pari.cfg file not found. Please use 
--with-paricfg=PATH where PATH is the path to pari.cfg or 
dft.Config.in file.])
  fi
  if test "x$PARI_CONFIG" = "x"; then
    AC_MSG_RESULT("not found")
  else
    AC_MSG_RESULT($PARI_CONFIG)
  fi
fi

AC_ARG_WITH(paricfg-dbg,
[  --with-paricfg-dbg[=FILE] gp2c-dbg is more useful with the debugging version
               of PARI. You can specify the path to the 'pari.cfg' file of a
               debugging version with --with-paricfg-dbg=PATH while still using
               the optimised version with gp2c-run. ])

if test "$with_paricfg_dbg" = "no" ; then
  PARI_CONFIG_DBG=
else
  AC_MSG_CHECKING([for PARI configuration (debugging)])
  if test "$with_paricfg_dbg" = "yes" || test "x$with_paricfg_dbg" = "x" ; then
    for i in /usr/lib/pari/pari.cfg \
             "/usr/lib/$multiarch/pari/pari.cfg" \
             /usr/local/lib/pari/pari.cfg \
             "$srcdir/../pari.cfg" \
             "$srcdir/pari.cfg"
    do
      if test -f "$i.dbg"; then PARI_CONFIG_DBG="$i.dbg"; fi;
    done;
  else
    test -f "$with_paricfg_dbg" && PARI_CONFIG_DBG="$with_paricfg_dbg"
  fi
  if test "x$with_paricfg_dbg" != "x" && test "x$PARI_CONFIG_DBG" = "x" ; then
    AC_MSG_ERROR([pari.cfg[.dbg] file not found. Please use 
--with-paricfg-dbg=PATH where PATH is the path to pari.cfg[.dbg] or 
dft.Config.in file.])
  fi
  if test "x$PARI_CONFIG_DBG" = "x"; then
    AC_MSG_RESULT("not found")
  else
    AC_MSG_RESULT($PARI_CONFIG_DBG)
  fi
fi

if test "x$PARI_CONFIG" !=  "x" ; then 
  AC_MSG_CHECKING(for PARI version)
  PARI_VERSION=`$srcdir/config/pari-version $PARI_CONFIG`
  AC_MSG_RESULT($PARI_VERSION)
  
  AC_MSG_CHECKING(for PARI module build)
  PARI_MODULE_BUILD=`$srcdir/config/module-build $PARI_CONFIG`
  AC_MSG_RESULT($PARI_MODULE_BUILD)

  AC_MSG_CHECKING(for GP path)
  GP_PATH=`$srcdir/config/pari-conf $PARI_CONFIG bindir`/gp
  AC_MSG_RESULT($GP_PATH)
  
  AC_MSG_CHECKING(for PARI data directory)
  PARI_DATADIR=`$srcdir/config/pari-conf $PARI_CONFIG datadir`
  AC_MSG_RESULT($PARI_DATADIR)
  
  AC_MSG_CHECKING(for PARI description database)
  PARI_DESC="$PARI_DATADIR/pari.desc";
  test -f "$PARI_DESC" || PARI_DESC="missing"
  AC_MSG_RESULT($PARI_DESC)
else
  PARI_VERSION='2.5.x (released)'
  PARI_MODULE_BUILD="`pwd`/$srcdir/config/missing $PARI_CONF";
  GP_PATH="gp"
fi

if test "x$PARI_CONFIG_DBG" !=  "x" ; then 
  AC_MSG_CHECKING([for PARI module build (debugging)])
  PARI_MODULE_DEBUG=`$srcdir/config/module-build $PARI_CONFIG_DBG`
  AC_MSG_RESULT($PARI_MODULE_DEBUG)

  AC_MSG_CHECKING([for GP path (debugging)])
  GP_PATH_DBG=`$srcdir/config/pari-conf $PARI_CONFIG_DBG bindir`/gp
  AC_MSG_RESULT($GP_PATH_DBG)
  GP2C_DBG="gp2c-dbg"
  GP2C_DBG1="gp2c-dbg.1"
else
  PARI_MODULE_DEBUG=$PARI_MODULE_BUILD
  GP_PATH_DBG=$GP_PATH
  GP2C_DBG=""
  GP2C_DBG1=""
fi


AC_DEFINE_UNQUOTED(PARI_VERSION,"$PARI_VERSION",[target PARI version])
AC_DEFINE_UNQUOTED(PARI_MODULE_BUILD,"$PARI_MODULE_BUILD",[target PARI module build])
AC_SUBST(PARI_VERSION)
AC_SUBST(PARI_MODULE_BUILD)
AC_SUBST(GP_PATH)
AC_SUBST(PARI_DATADIR)
AC_SUBST(PARI_DESC)
AC_SUBST(PARI_MODULE_DEBUG)
AC_SUBST(GP_PATH_DBG)
AC_SUBST(GP2C_DBG)
AC_SUBST(GP2C_DBG1)

dnl RUNTEST

AC_MSG_CHECKING([for RUNTEST (if needed)])
if test "x$RUNTEST" =  "x" && test "x$PARI_CONFIG" !=  "x" ; then
  PARI_RUNTEST=`$srcdir/config/pari-conf $PARI_CONFIG RUNTEST`
else
  PARI_RUNTEST="$RUNTEST"
fi
AC_MSG_RESULT($PARI_RUNTEST)
AC_SUBST(PARI_RUNTEST)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM

dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strdup strtol getopt strcmp memccpy strrchr)

dnl How to use echo
ECHON=${ECHO_N-"$ac_n"}
ECHOC=${ECHO_C-"$ac_c"}
ECHOT=${ECHO_T-"$ac_t"}

AC_SUBST(ECHON)
AC_SUBST(ECHOC)
AC_SUBST(ECHOT)

if  test "$bindir" = '${exec_prefix}/bin'; then
  if test "x${exec_prefix}" != xNONE; then
    mybindir=${exec_prefix}/bin
  elif test "x${prefix}" != xNONE; then
    mybindir=${prefix}/bin
  else
    mybindir=${ac_default_prefix}/bin
  fi
else
  mybindir=$bindir
fi

AC_SUBST(mybindir)

AC_OUTPUT([Makefile src/Makefile desc/Makefile doc/Makefile test/Makefile test2/Makefile test3/Makefile scripts/Makefile scripts/822_desc.pl scripts/runtest scripts/dotest scripts/gp2c-run scripts/gp2c-dbg doc/gp2c-run.1 doc/gp2c-dbg.1],[chmod a+x scripts/822_desc.pl scripts/runtest scripts/dotest scripts/gp2c-run scripts/gp2c-dbg])