[go: up one dir, main page]

File: configure.ac

package info (click to toggle)
dime 0.20030921-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,480 kB
  • ctags: 1,750
  • sloc: cpp: 14,865; sh: 7,621; makefile: 658; ansic: 93
file content (349 lines) | stat: -rw-r--r-- 10,737 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

m4_define([DIME_MAJOR], [0])
m4_define([DIME_MINOR], [9])
m4_define([DIME_MICRO], [1])
m4_define([DIME_BETA], [])
m4_define([DIME_VERSION_STRING], [DIME_MAJOR.DIME_MINOR.DIME_MICRO[]DIME_BETA])

m4_define([DIME_ABI_VERSION], [0])
m4_define([DIME_ABI_AGE], [0])
m4_define([DIME_ABI_REVISION], [0])

# **************************************************************************

AC_INIT([dime], [DIME_VERSION_STRING], [dime-support@coin3d.org])

AC_CONFIG_SRCDIR([include/dime/Base.h])
AC_CONFIG_AUX_DIR([cfg])

AC_CANONICAL_SYSTEM

AC_SUBST([DIME_MAJOR_VERSION], [DIME_MAJOR])
AC_SUBST([DIME_MINOR_VERSION], [DIME_MINOR])
AC_SUBST([DIME_MICRO_VERSION], [DIME_MICRO])
AC_SUBST([DIME_BETA_VERSION], [DIME_MICRO])
AC_SUBST([DIME_VERSION], [DIME_VERSION_STRING])

VERSION=$DIME_VERSION

AC_SUBST(DIME_INTERFACE_AGE, 0)
AC_SUBST(DIME_BINARY_AGE, 0)

SIM_AC_MSVC_DSP_ENABLE_OPTION

SIM_AC_SETUP_MSVCPP_IFELSE
if $BUILD_WITH_MSVC; then
  SIM_AC_SETUP_MSVCRT([
    CPPFLAGS="$CPPFLAGS $sim_ac_msvcrt_CPPFLAGS"
    CFLAGS="$CFLAGS $sim_ac_msvcrt_CFLAGS"
    CXXFLAGS="$CXXFLAGS $sim_ac_msvcrt_CXXFLAGS"
    LDFLAGS="$LDFLAGS $sim_ac_msvcrt_LDFLAGS"
    LIBS="$LIBS $sim_ac_msvcrt_LIBS"
    # sim_ac_msvcrt_LIBLIBS is set up at the end
    # sim_ac_msvcrt_LIBLDFLAGS is set up at the end
    AC_SUBST([DIME_MSVC_LIBC], [$sim_ac_msvcrt])
  ])
fi

dnl  Locate C++ compiler and set C++ as the default compiler to run
dnl  in tests.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG([C++])

dnl *******************************************************************
dnl * Library version control.
dnl *******************************************************************

dnl  Making releases:
dnl    DIME_MICRO_VERSION += 1;
dnl    DIME_INTERFACE_AGE += 1;
dnl    DIME_BINARY_AGE += 1;
dnl  if any functions have been added, set DIME_INTERFACE_AGE to 0.
dnl  if backwards compatibility has been broken,
dnl  set DIME_BINARY_AGE _and_ DIME_INTERFACE_AGE to 0.
dnl 

dnl  libtool versioning
LT_RELEASE=$DIME_MAJOR_VERSION.$DIME_MINOR_VERSION
LT_CURRENT=`expr $DIME_MICRO_VERSION - $DIME_INTERFACE_AGE`
LT_REVISION=$DIME_INTERFACE_AGE
LT_AGE=`expr $DIME_BINARY_AGE - $DIME_INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

AC_SUBST([SUFFIX], [])

#  These are used for constructing the dime-config file.
AC_SUBST([DIME_EXTRA_CPPFLAGS], [$CPPFLAGS])
AC_SUBST([DIME_EXTRA_CFLAGS], [$CFLAGS])
AC_SUBST([DIME_EXTRA_CXXFLAGS], [$CXXFLAGS])
AC_SUBST([DIME_EXTRA_LDFLAGS], [$LDFLAGS])
AC_SUBST([DIME_EXTRA_LIBS], [$LIBS])

dnl *******************************************************************
dnl * Miscellaneous options and initializations.
dnl *******************************************************************

AM_INIT_AUTOMAKE(libdime, $VERSION)

dnl  Default to not building a static library.
dnl  Can be overridden by the user with --enable-static.
AM_DISABLE_STATIC

dnl  Turn off default maintainer make-rules -- use ./autogen.sh instead.
AM_MAINTAINER_MODE

if $BUILD_WITH_MSVC; then
  RANLIB=:
  export RANLIB
fi

dnl  Initialize libtool
AC_PROG_LIBTOOL

CPPFLAGS="$CPPFLAGS -DDIME_INTERNAL"

sim_ac_build_library=true

dime_build_dir=`pwd`
dime_src_dir=`cd "$srcdir"; pwd`


dnl *******************************************************************
dnl * Enable/disable compilation with debug information.
dnl *******************************************************************

AC_ARG_ENABLE(debug,
  [  --enable-debug          turn on Dime debugging [default=yes]],
  [case "${enableval}" in
    yes) enable_debug=yes ;;
    no)  enable_debug=no ;;
    *) AC_MSG_ERROR(bad value "${enableval}" for --enable-debug) ;;
  esac],
  enable_debug=yes)

if test "x$enable_debug" = "xno"; then
  CXXFLAGS="$CXXFLAGS -DNDEBUG"
fi


dnl *******************************************************************
dnl * Enable/disable compilation with symbol information.
dnl *******************************************************************

if test "x$ac_cv_prog_cxx_g" = "xyes"; then
  AC_ARG_ENABLE(symbols,
    [  --enable-symbols        turn on symbol debug information [default=yes]],
    [case "${enableval}" in
      yes) enable_symbols=yes ;;
      no)  enable_symbols=no ;;
      *) AC_MSG_ERROR(bad value "${enableval}" for --enable-symbols) ;;
    esac],
    enable_symbols=yes)

  if test "x$enable_symbols" = "xno"; then
    CXXFLAGS="`echo $CXXFLAGS | sed 's/-g//'`"
  fi
fi


dnl *******************************************************************
dnl * Enable/disable compilation with profiling information
dnl * for parsing by gprof (this is a g++ only option).
dnl *******************************************************************

if test "x$ac_cv_prog_cxx_g" = "xyes"; then
  AC_ARG_ENABLE(profile,
    [  --enable-profile        turn on inclusion of profiling code [default=no]],
    [case "${enableval}" in
      yes) enable_profile=yes ;;
      no)  enable_profile=no ;;
      *) AC_MSG_ERROR(bad value "${enableval}" for --enable-profile) ;;
    esac],
    enable_profile=no)

  if test "x$enable_profile" = "xyes"; then
    CXXFLAGS="$CXXFLAGS -pg"
    LDFLAGS="$LDFLAGS -pg"
  fi
fi

dnl *******************************************************************
dnl * Enable/disable compilation with warnings turned on (g++ only).
dnl *******************************************************************

if test "x$ac_cv_prog_gxx" = "xyes"; then
  AC_ARG_ENABLE(warnings,
    [  --enable-warnings       turn on warnings when compiling [default=no]],
    [case "${enableval}" in
      yes) enable_warnings=yes ;;
      no)  enable_warnings=no ;;
      *) AC_MSG_ERROR(bad value "${enableval}" for --enable-warnings) ;;
    esac],
    enable_warnings=no)

  if test "x$enable_warnings" = "xyes"; then
    CXXFLAGS="$CXXFLAGS -W -Wall"
  fi
fi

# **************************************************************************

SIM_AC_UNIQIFY_LIST(DIME_EXTRA_CPPFLAGS, -I$includedir $DIME_EXTRA_CPPFLAGS)
SIM_AC_UNIQIFY_LIST(DIME_EXTRA_LDFLAGS, -L$libdir $DIME_EXTRA_LDFLAGS)
SIM_AC_UNIQIFY_LIST(DIME_EXTRA_LIBS, $DIME_EXTRA_LIBS)
SIM_AC_UNIQIFY_LIST(CPPFLAGS, $CPPFLAGS)
SIM_AC_UNIQIFY_LIST(LDFLAGS, $LDFLAGS)
SIM_AC_UNIQIFY_LIST(LIBS, $LIBS)

# **************************************************************************

# no DLL setup yet
case $enable_static in
yes | true)  DIME_STATIC=true ;;
*)           DIME_STATIC=false ;;
esac

case $enable_shared in
yes | true)  DIME_STATIC=false ;;
*)           DIME_STATIC=true ;;
esac

AC_SUBST([LIBFLAGS], [])

# **************************************************************************

AM_CONDITIONAL([BUILD_WITH_MSVC], [$BUILD_WITH_MSVC])

if $sim_ac_build_library; then
  if $BUILD_WITH_MSVC; then
    rm -f vc60.pdb
    LIBS="$LIBS $sim_ac_msvcrt_LIBLIBS"
    LIBFLAGS="$LIBFLAGS" # $sim_ac_msvcrt_LIBLDFLAGS
    if $DIME_STATIC; then
      DIME_EXTRA_CPPFLAGS="$DIME_EXTRA_CPPFLAGS -DDIME_NOT_DLL"
    else
      CPPFLAGS="-DDIME_MAKE_DLL $CPPFLAGS"
      DIME_EXTRA_CPPFLAGS="$DIME_EXTRA_CPPFLAGS -DDIME_DLL"
    fi
  
    debugfile="`pwd`/src/dime${DIME_MAJOR_VERSION}${SUFFIX}.pdb"
    debugfile=`cygpath -w "$debugfile" | sed 's,\\\\,\\\\\\\\,g'`
  
    if $DIME_STATIC; then
      SIM_AC_CONFIGURATION_SETTING([Dime build type], [static .lib])
      LIBFLAGS="-LIB $LIBFLAGS"
      LIBFLAGS="$LIBFLAGS /OUT:dime$DIME_MAJOR_VERSION$SUFFIX.lib"
    else
      LIBFLAGS="-DLL /INCREMENTAL:NO $LIBFLAGS"
      case $enable_symbols in
      no | false)
        SIM_AC_CONFIGURATION_SETTING([Dime build type],
                                     [dynamic .dll, no symbols])
        LIBFLAGS="$LIBFLAGS /RELEASE"
        ;;
      *)
        SIM_AC_CONFIGURATION_SETTING([Dime build type],
                                     [dynamic .dll + .pdb])
        CFLAGS="/Fd$debugfile -g $CFLAGS"
        CXXFLAGS="/Fd$debugfile -g $CXXFLAGS"
        LIBFLAGS="$LIBFLAGS /DEBUG /PDB:dime$DIME_MAJOR_VERSION$SUFFIX.pdb"
        ;;
      esac
      LIBFLAGS="$LIBFLAGS /OUT:dime$DIME_MAJOR_VERSION$SUFFIX.dll"
    fi
    SIM_AC_CONFIGURATION_SETTING([C library linkage], [$sim_ac_msvcrt])

    # We use a version suffix on the .dll-file, so several incompatible
    # (major) versions can be installed on a system.
    #
    # BTW, when linking DLLs, the 3rd-party .lib files will be
    # linked into the .dll file. I believe it is still advisable to
    # list all libs used upon `dime-config --libs`, as we can then
    # also use them from "parent" code (remember that their interfaces
    # is not exposed from the DLL) without any fuss.
    if test -n "$DIME_EXTRA_LIBS"; then
      DIME_EXTRA_LIBS="-ldime${DIME_MAJOR_VERSION}${SUFFIX} $DIME_EXTRA_LIBS"
    else
      DIME_EXTRA_LIBS="-ldime${DIME_MAJOR_VERSION}${SUFFIX}"
    fi
  else
    if test -n "$DIME_EXTRA_LIBS"; then
      DIME_EXTRA_LIBS="-ldime${SUFFIX} $DIME_EXTRA_LIBS"
    else
      DIME_EXTRA_LIBS="-ldime${SUFFIX}"
    fi
  fi

  DIME_COMPILER="$CXX"

  if $BUILD_WITH_MSVC; then
    # we'll use the installed wrapper when we use the dime-config script later
    # so we can remove the source code hierarchy
    DIME_COMPILER="wrapmsvc"
  fi
  AC_SUBST(DIME_COMPILER)

  sim_ac_path_problem=true # until proven otherwise
  if test -d "${bindir}"; then
    # search by inode seems safer than strings because of noncanonical paths
    ( findinode=`ls -id "$prefix/bin" 2>/dev/null | sed 's/^\([ ]*\)\([0-9]*\).*/\2/g'`
      IFS=:; for dir in $PATH; do
        inode=`ls -id "$dir" 2>/dev/null | sed 's/^\([ ]*\)\([0-9]*\).*/\2/g'`;
        test x"$inode" = x"$findinode" && exit 0
      done; exit 1 ) && sim_ac_path_problem=false
  fi
  if $sim_ac_path_problem; then
    ( IFS=:; for dir in $PATH; do
        test x"$dir" = x"${bindir}" && exit 0
      done; exit 1 ) && sim_ac_path_problem=false
  fi
  if $sim_ac_path_problem; then
    SIM_AC_CONFIGURATION_WARNING([Your \$PATH variable does not appear to include \"$prefix/bin\"])
  fi

else
  SIM_AC_CONFIGURATION_SETTING([Dime build type], [build disabled])
fi

# **************************************************************************

SIM_AC_MSVC_DSP_SETUP([DIME], [Dime], [dime], [-I$dime_build_dir -I$dime_build_dir/include -I$dime_src_dir/include])

# **************************************************************************

AM_CONFIG_HEADER([include/config.h])

AC_CONFIG_FILES([
	Makefile
	bin/Makefile
	src/Makefile
	src/classes/Makefile
	src/entities/Makefile
	src/objects/Makefile
	src/records/Makefile
	src/sections/Makefile
	src/tables/Makefile
	src/util/Makefile
	src/convert/Makefile
	dxf2vrml/Makefile
	dxfsphere/Makefile
])

AC_OUTPUT

# SIM_AC_CONFIGURATION_SUMMARY

if $sim_ac_build_library; then
  echo ""
  echo "Now, run 'make install' to build and install Dime."
  echo ""
else
  echo ""
fi