llvm.org GIT mirror llvm / 7a73b80
Merged in autoconf branch. This provides configuration via the autoconf system. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8 John Criswell 16 years ago
125 changed file(s) with 27270 addition(s) and 526 deletion(s). Raw diff Collapse all Expand all
2929 # are in, if they are not in the current directory. This should include a
3030 # trailing / character.
3131 #
32 # 6. PROJ_COMPILE - If set to 1, then this makefile can also be used to
33 # compile other projects using llvm. Note if this option is set then the
34 # following *must* hold
35 # PROJLEVEL should be set to the top of the source directory for the
36 # project files
37 # LEVEL should be set to the top of LLVM source tree
38 # LLVM_LIB_DIR should be set to the top of the LLVM build tree
39 #
32 # 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
33 #
34 # 7. LLVM_OBJ_ROOT - If specified, points to the top directory where LLVM
35 # object files are placed.
36 #
37 # 8. BUILD_SRC_DIR - The directory which contains the current set of Makefiles
38 # and usually the source code too (unless SourceDir is set).
39 #
40 # 9. BUILD_SRC_ROOT - The root directory of the source code being compiled.
41 #
42 # 10. BUILD_OBJ_DIR - The directory where object code should be placed.
43 #
44 # 11. BUILD_OBJ_ROOT - The root directory for where object code should be
45 # placed.
46 #
47 # For building,
48 # LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT, and
49 # LLVM_OBJ_ROOT = BUILD_OBJ_ROOT.
4050 #===-----------------------------------------------------------------------====
4151
4252 #
7585 endif
7686
7787 #
88 # Determine the path of the source tree relative from $HOME (the mythical
89 # home directory).
90 #
91 HOME_OBJ_ROOT := $(OBJ_ROOT)/$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT))
92
93 #
7894 # Set the object build directory. Its location depends upon the source path
7995 # and where object files should go.
8096 #
8197 ifndef BUILD_OBJ_DIR
8298 ifeq ($(OBJ_ROOT),.)
83 BUILD_OBJ_DIR = $(shell pwd)
99 BUILD_OBJ_DIR = $(BUILD_SRC_DIR)
84100 else
85 BUILD_OBJ_DIR := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_DIR); pwd))
101 BUILD_OBJ_DIR := $(HOME_OBJ_ROOT)$(patsubst $(BUILD_SRC_ROOT)%,%,$(BUILD_SRC_DIR))
86102 endif
87103 endif
88104
91107 #
92108 ifndef BUILD_OBJ_ROOT
93109 ifeq ($(OBJ_ROOT),.)
94 BUILD_OBJ_ROOT = $(shell cd $(LEVEL); pwd)
110 BUILD_OBJ_ROOT = $(BUILD_SRC_ROOT)
95111 else
96 BUILD_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_ROOT); pwd))
112 BUILD_OBJ_ROOT := $(HOME_OBJ_ROOT)
97113 endif
98114 endif
99115
112128 LLVM_OBJ_ROOT = $(BUILD_OBJ_ROOT)
113129 endif
114130
115 # Figure out how to do platform specific stuff on this platform. This is really
116 # gross and should be autoconfiscated (automake actually), but should hopefully
117 # work on Linux and solaris (SunOS).
118 #
119 UNAME := $(shell uname)
120 include $(LLVM_SRC_ROOT)/Makefile.$(UNAME)
131 ###########################################################################
132 # Default Targets:
133 # The following targets are the standard top level targets for
134 # building.
135 ###########################################################################
121136
122137 ifdef SHARED_LIBRARY
123138 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
124 dynamic ::
139 all:: dynamic
125140 endif
126141
127142 # Default Rule: Make sure it's also a :: rule
132147
133148 # Default rule for test. It ensures everything has a test rule
134149 test::
150
151 # Print out the directories used for building
152 prdirs::
153 echo "Home Offset : " $(HOME_OBJ_ROOT);
154 echo "Build Source Root: " $(BUILD_SRC_ROOT);
155 echo "Build Source Dir : " $(BUILD_SRC_DIR);
156 echo "Build Object Root: " $(BUILD_OBJ_ROOT);
157 echo "Build Object Dir : " $(BUILD_OBJ_DIR);
158 echo "LLVM Source Root: " $(LLVM_SRC_ROOT);
159 echo "LLVM Object Root: " $(LLVM_OBJ_ROOT);
160
161 ###########################################################################
162 # Miscellaneous paths and commands:
163 # This section defines various configuration macros, such as where
164 # to find burg, tblgen, and libtool.
165 ###########################################################################
135166
136167 #--------------------------------------------------------------------
137168 # Variables derived from configuration options...
156187 endif
157188 endif
158189
159 ###########################################################################
160 # Library Locations
190 #
191 # Enable this for profiling support with 'gprof'
192 # This automatically enables optimized builds.
193 #
194 ifdef ENABLE_PROFILING
195 PROFILE = -pg
196 endif
197
198 #
199 # Suffixes for library compilation rules
200 #
201 .SUFFIXES: .so
202
203 ###########################################################################
204 # Library Locations:
161205 # These variables describe various library locations:
162206 #
163207 # DEST* = Location of where libraries that are built will be placed.
207251 PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile
208252 PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
209253
254 #
255 # Libtool is found in the current directory.
256 #
257 ifdef VERBOSE
258 LIBTOOL=$(LLVM_SRC_ROOT)/libtool
259 else
260 LIBTOOL=$(LLVM_SRC_ROOT)/libtool --silent
261 endif
262
263 #
210264 # Verbosity levels
265 #
211266 ifndef VERBOSE
212267 VERB := @
213268 endif
214269
215 #---------------------------------------------------------
216 # Compilation options...
217 #---------------------------------------------------------
218
219 ###########################################################################
220 # Special tools used while building the LLVM tree. Burg is built as part of the
221 # utils directory.
222 ###########################################################################
270 ###########################################################################
271 # Miscellaneous paths and commands (part deux):
272 # This section defines various configuration macros, such as where
273 # to find burg, tblgen, and libtool.
274 ###########################################################################
275
276 #--------------------------------------------------------------------------
277 # Special tools used while building the LLVM tree. Burg is built as part
278 # of the utils directory.
279 #--------------------------------------------------------------------------
223280 BURG := $(LLVMTOOLCURRENT)/burg
224281 RunBurg := $(BURG) $(BURG_OPTS)
225282
226283 TBLGEN := $(LLVMTOOLCURRENT)/tblgen
227284
228 # Enable this for profiling support with 'gprof'
229 # This automatically enables optimized builds.
230 ifdef ENABLE_PROFILING
231 PROFILE = -pg
232 endif
233285
234286 ###########################################################################
235287 # Compile Time Flags
236288 ###########################################################################
237289
238290 #
239 # Include both the project headers and the LLVM headers for compilation
291 # Include both the project headers and the LLVM headers for compilation and
292 # dependency computation.
240293 #
241294 CPPFLAGS += -I$(BUILD_SRC_ROOT)/include -I$(LLVM_SRC_ROOT)/include
242295
253306 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include
254307 CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions -fshort-enums
255308
309 #
310 # Compile commands with libtool.
311 #
312 Compile := $(LIBTOOL) --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
313 CompileC := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
314
315 #
316 # Add the LLVM specific "-only-static" option so that we only compile .o files
317 # once when not building a shared library.
318 #
319 # For shared libraries, we will end up building twice, but that doesn't happen
320 # very often, so we'll let it go.
321 #
322 ifndef SHARED_LIBRARY
323 Compile := $(Compile) -only-static
324 CompileC := $(CompileC) -only-static
325 endif
326
256327 # Compile a cpp file, don't link...
257 Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
258328 CompileG := $(Compile) -g -D_DEBUG
259329 CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors -fomit-frame-pointer
260330 CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE)
261331
262332 # Compile a c file, don't link...
263 CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
264333 CompileCG := $(CompileC) -g -D_DEBUG
265334 CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer
266335 CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE)
267336
268
337 ###########################################################################
338 # Link Time Options
339 ###########################################################################
340
341 #
269342 # Link final executable
270
343 # (Note that we always link with the C++ compiler).
344 #
271345 ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1'
272 Link := $(PURIFY) $(CXX) -static
346 Link := $(PURIFY) $(LIBTOOL) --mode=link $(CXX) -static
273347 else
274 Link := $(CXX)
275 endif
276
277 ifdef PROJ_COMPILE
278 # include both projlib source and llvmlib source
348 Link := $(LIBTOOL) --mode=link $(CXX)
349 endif
350
351 # link both projlib and llvmlib libraries
279352 LinkG := $(Link) -g -L$(PROJLIBDEBUGSOURCE) -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
280353 LinkO := $(Link) -O3 -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE)
281354 LinkP := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
282 else
283 LinkG := $(Link) -g -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
284 LinkO := $(Link) -O3 -L$(LLVMLIBRELEASESOURCE)
285 LinkP := $(Link) -O3 -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
286 endif
287
288
289355
290356 # Create one .o file from a bunch of .o files...
291 Relink = ${LD} -r
357 Relink = ${LIBTOOL} --mode=link $(CXX)
292358
293359 # MakeSO - Create a .so file from a .o files...
294 MakeSO := $(CXX) $(MakeSharedObjectOption)
295 MakeSOO := $(MakeSO) -O3
296 MakeSOP := $(MakeSOO) $(PROFILE)
360 #MakeSO := $(LIBTOOL) --mode=link $(CXX) $(MakeSharedObjectOption)
361 #MakeSOO := $(MakeSO) -O3
362 #MakeSOP := $(MakeSOO) $(PROFILE)
363
364 #
365 # Configure where the item being compiled should go.
366 #
367 ifdef SHARED_LIBRARY
368 Link := $(Link) -rpath $(DESTLIBCURRENT)
369 endif
370
371 ifdef TOOLNAME
372 Link := $(Link) -rpath $(DESTTOOLCURRENT)
373 endif
297374
298375 # Create dependancy file from CPP file, send to stdout.
299376 Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS)
312389 Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
313390 endif
314391
315 Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
316 ObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(Objs))
317 ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs))
318 ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs))
319
392 LObjs := $(sort $(patsubst Debug/%.lo, %.lo, $(addsuffix .lo,$(notdir $(basename $(Source))))))
393 LObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(LObjs))
394 LObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(LObjs))
395 LObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(LObjs))
320396
321397 #---------------------------------------------------------
322398 # Handle the DIRS and PARALLEL_DIRS options
340416 $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
341417 endif
342418
419 # Handle directories that may or may not exist
343420 ifdef OPTIONAL_DIRS
344421 all install clean test ::
345422 $(VERB) for dir in ${OPTIONAL_DIRS}; do \
350427 done
351428 endif
352429
430 ###########################################################################
431 # Library Build Rules:
432 #
353433 #---------------------------------------------------------
354434 # Handle the LIBRARYNAME option - used when building libs...
355435 #---------------------------------------------------------
366446 # it's built as a .o file, then all of the constituent .o files in it will be
367447 # linked into tools (for example gccas) even if they only use one of the parts
368448 # of it. For this reason, sometimes it's useful to use libraries as .a files.
449 ###########################################################################
369450
370451 ifdef LIBRARYNAME
371452
382463 LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o
383464 LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o
384465
466 #--------------------------------------------------------------------
467 # Library Targets
468 # Modify the top level targets to build the desired libraries.
469 #--------------------------------------------------------------------
470
385471 # dynamic target builds a shared object version of the library...
386472 dynamic:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).so
387473
395481 all:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a
396482 endif
397483
398 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
399 @echo ======= Linking $(LIBRARYNAME) release library =======
400 $(VERB) $(MakeSOO) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
401
402 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
403 @echo ======= Linking $(LIBRARYNAME) profile library =======
404 $(VERB) $(MakeSOP) -o $@ $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
405
406 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
407 @echo ======= Linking $(LIBRARYNAME) debug library =======
408 $(VERB) $(MakeSO) -g -o $@ $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
409
410 $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
411 @echo ======= Linking $(LIBRARYNAME) release library =======
412 @rm -f $@
413 $(VERB) $(AR) $@ $(ObjectsO) $(LibSubDirs)
414
415 $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
416 @echo ======= Linking $(LIBRARYNAME) profile library =======
417 @rm -f $@
418 $(VERB) $(AR) $@ $(ObjectsP) $(LibSubDirs)
419
420 $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
421 @echo ======= Linking $(LIBRARYNAME) debug library =======
422 @rm -f $@
423 $(VERB) $(AR) $@ $(ObjectsG) $(LibSubDirs)
424
425 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
484 #--------------------------------------------------------------------
485 # Rules for building libraries
486 #--------------------------------------------------------------------
487
488 #
489 # Rules for building dynamically linked libraries.
490 #
491 $(LIBNAME_O): $(LObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
492 @echo ======= Linking $(LIBRARYNAME) dynamic release library =======
493 $(VERB) $(Link) -o $*.la $(LObjectsO) $(LibSubDirs) $(LibLinkOpts);
494 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
495
496 $(LIBNAME_P): $(LObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
497 @echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
498 $(VERB) $(Link) -o $*.la $(LObjectsP) $(LibSubDirs) $(LibLinkOpts);
499 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
500
501 $(LIBNAME_G): $(LObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
502 @echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
503 $(VERB) $(Link) -o $*.la $(LObjectsG) $(LibSubDirs) $(LibLinkOpts);
504 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
505
506 #
507 # Rules for building static archive libraries.
508 #
509 $(LIBNAME_AO): $(LObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
510 @echo ======= Linking $(LIBRARYNAME) archive release library =======
511 @$(RM) -f $@
512 $(VERB) $(Link) -03 -o $@ $(LObjectsO) $(LibSubDirs) -static
513
514 $(LIBNAME_AP): $(LObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
515 @echo ======= Linking $(LIBRARYNAME) archive profile library =======
516 @$(RM) -f $@
517 $(VERB) $(Link) -03 $(PROFILE) -o $@ $(LObjectsP) $(LibSubDirs) -static
518
519 $(LIBNAME_AG): $(LObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
520 @echo ======= Linking $(LIBRARYNAME) archive debug library =======
521 @$(RM) -f $@
522 $(VERB) $(Link) -g $(STRIP) -o $@ $(LObjectsG) $(LibSubDirs) -static
523
524 #
525 # Rules for building .o libraries.
526 #
527 $(LIBNAME_OBJO): $(LObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
426528 @echo "Linking $@"
427 $(VERB) $(Relink) -o $@ $(ObjectsO) $(LibSubDirs)
428
429 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
529 $(VERB) $(Relink) -o $@ $(LObjectsO) $(LibSubDirs)
530
531 $(LIBNAME_OBJP): $(LObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
430532 @echo "Linking $@"
431 $(VERB) $(Relink) -o $@ $(ObjectsP) $(LibSubDirs)
432
433 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
533 $(VERB) $(Relink) -o $@ $(LObjectsP) $(LibSubDirs)
534
535 $(LIBNAME_OBJG): $(LObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
434536 @echo "Linking $@"
435 $(VERB) $(Relink) -o $@ $(ObjectsG) $(LibSubDirs)
537 $(VERB) $(Relink) -o $@ $(LObjectsG) $(LibSubDirs)
436538
437539 endif
438540
440542 # Create a TAGS database for emacs
441543 #------------------------------------------------------------------------
442544
545 ifdef ETAGS
443546 ifeq ($(LEVEL), .)
444547 tags:
445 etags -l c++ `find include lib tools -name '*.cpp' -o -name '*.h'`
548 $(ETAGS) -l c++ `find include lib tools -name '*.cpp' -o -name '*.h'`
446549 all:: tags
550 endif
551 else
552 tags:
553 ${ECHO} "Cannot build $@: The program etags is not installed"
447554 endif
448555
449556 #------------------------------------------------------------------------
486593 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
487594 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
488595 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
489 LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
490
596 #LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
597
598 #
599 # Libtool link options:
600 # Ensure that all binaries have their symbols exported so that they can
601 # by dlsym'ed.
602 #
603 LINK_OPTS := -export-dynamic $(TOOLLINKOPTS)
491604
492605
493606
501614 all:: $(TOOLEXENAMES)
502615
503616 clean::
504 $(VERB) rm -f $(TOOLEXENAMES)
505
506 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
617 $(VERB) $(RM) -f $(TOOLEXENAMES)
618
619 $(TOOLEXENAME_G): $(LObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
507620 @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)=======
508 $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS)
509
510 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
621 $(VERB) $(LinkG) -o $@ $(LObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS)
622
623 $(TOOLEXENAME_O): $(LObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
511624 @echo ======= Linking $(TOOLNAME) release executable =======
512 $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS)
513
514 $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir
625 $(VERB) $(LinkO) -o $@ $(LObjectsO) $(LIB_OPTS_O) $(LINK_OPTS) $(LIBS)
626
627 $(TOOLEXENAME_P): $(LObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir
515628 @echo ======= Linking $(TOOLNAME) profile executable =======
516 $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS)
629 $(VERB) $(LinkP) -o $@ $(LObjectsP) $(LIB_OPTS_P) $(LINK_OPTS) $(LIBS)
517630
518631 endif
519632
524637 .PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir
525638
526639 # Create .o files in the ObjectFiles directory from the .cpp and .c files...
527 $(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
640 #$(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
641 #@echo "Compiling $<"
642 #$(VERB) $(CompileO) $< -o $@
643
644 #$(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
645 #$(VERB) $(CompileCO) $< -o $@
646
647 #$(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
648 #@echo "Compiling $<"
649 #$(VERB) $(CompileP) $< -o $@
650
651 #$(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
652 #@echo "Compiling $<"
653 #$(VERB) $(CompileCP) $< -o $@
654
655 #$(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
656 #@echo "Compiling $<"
657 #$(VERB) $(CompileG) $< -o $@
658
659 #$(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
660 #$(VERB) $(CompileCG) $< -o $@
661
662 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
663 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
528664 @echo "Compiling $<"
529665 $(VERB) $(CompileO) $< -o $@
530666
531 $(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
667 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
668 @echo "Compiling $<"
532669 $(VERB) $(CompileCO) $< -o $@
533670
534 $(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
671 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
535672 @echo "Compiling $<"
536673 $(VERB) $(CompileP) $< -o $@
537674
538 $(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
675 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
539676 @echo "Compiling $<"
540677 $(VERB) $(CompileCP) $< -o $@
541678
542 $(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
679 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
543680 @echo "Compiling $<"
544681 $(VERB) $(CompileG) $< -o $@
545682
546 $(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
683 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
684 @echo "Compiling $<"
685 $(VERB) $(CompileCG) $< -o $@
686
687 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
688 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
689 @echo "Compiling $<"
690 $(VERB) $(CompileO) $< -o $@
691
692 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
693 $(VERB) $(CompileCO) $< -o $@
694
695 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
696 @echo "Compiling $<"
697 $(VERB) $(CompileP) $< -o $@
698
699 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
700 @echo "Compiling $<"
701 $(VERB) $(CompileCP) $< -o $@
702
703 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
704 @echo "Compiling $<"
705 $(VERB) $(CompileG) $< -o $@
706
707 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
547708 $(VERB) $(CompileCG) $< -o $@
548709
549710 #
564725 # FIXME. (f.e. char Buffer[10000]; )
565726 #
566727 %.cpp: %.l
567 $(FLEX) -t $< | sed '/^find_rule/d' | \
568 sed 's/void yyunput/inline void yyunput/' | \
569 sed 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
570 sed 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@
728 $(FLEX) -t $< | $(SED) '/^find_rule/d' | \
729 $(SED) 's/void yyunput/inline void yyunput/' | \
730 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
731 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@
571732
572733 # Rule for building the bison parsers...
573734 %.c: %.y # Cancel built-in rules for yacc
575736 %.cpp %.h : %.y
576737 @echo Bison\'ing $<...
577738 $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $*.y
578 $(VERB) mv -f $*.tab.c $*.cpp
579 $(VERB) mv -f $*.tab.h $*.h
739 $(VERB) ${MV} -f $*.tab.c $*.cpp
740 $(VERB) ${MV} -f $*.tab.h $*.h
580741
581742 # To create the directories...
582743 %/.dir:
583 $(VERB) mkdir -p $*
584 @date > $@
744 $(VERB) ${MKDIR} $* > /dev/null
745 @$(DATE) > $@
585746
586747 # To create postscript files from dot files...
748 ifdef DOT
587749 %.ps: %.dot
588 dot -Tps < $< > $@
750 ${DOT} -Tps < $< > $@
751 else
752 %.ps: %.dot
753 ${ECHO} "Cannot build $@: The program dot is not installed"
754 endif
589755
590756 # 'make clean' nukes the tree
591757 clean::
592 $(VERB) rm -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend
593 $(VERB) rm -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
594 $(VERB) rm -f $(LEX_OUTPUT) $(YACC_OUTPUT)
758 $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend
759 $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
760 $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT)
761
762 distclean:: clean
763 $(VERB) (cd $(LLVM_SRC_ROOT); $(RM) -rf $(LEVEL)/Makefile.config \
764 $(LEVEL)/include/Config/config.h \
765 $(LEVEL)/autom4te.cache \
766 $(LEVEL)/config.log)
767
768 ###########################################################################
769 # C/C++ Dependencies
770 # Define variables and rules that generate header file dependencies
771 # from C/C++ source files.
772 ###########################################################################
595773
596774 # If dependencies were generated for the file that included this file,
597775 # include the dependancies now...
598776 #
599777 SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
600778 SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d)
779
780 #
781 # Depend target:
782 # This allows a user to manually ask for an update in the dependencies
783 #
784 depend: $(SourceDepend)
785
601786
602787 # Create dependencies for the *.cpp files...
603788 #$(SourceDepend): \x
604789 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
605 $(VERB) $(Depend) $< | sed 's|$*\.o *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
790 $(VERB) $(Depend) $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
606791
607792 # Create dependencies for the *.c files...
608793 #$(SourceDepend): \x
609794 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Depend/.dir
610 $(VERB) $(DependC) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@
611
795 $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
796
797 #
798 # Include dependencies generated from C/C++ source files, but not if we
799 # are cleaning (this example taken from the GNU Make Manual).
800 #
801 ifneq ($(MAKECMDGOALS),clean)
612802 ifneq ($(SourceDepend),)
613803 -include $(SourceDepend)
614804 endif
805 endif
22 # This file is included by Makefile.common. It defines paths and other
33 # values specific to a particular installation of LLVM.
44 #===-----------------------------------------------------------------------====
5
6 #
7 # Target operating system for which LLVM will be compiled.
8 #
9 OS=Linux
510
611 # Path to the C++ compiler to use. This is an optional setting, which defaults
712 # to whatever your gmake defaults to.
1015 # find the system assembler, which breaks if the LLVM assembler is in our path.
1116 # Hack it to use the assembler in /usr/bin directly.
1217 #
13 CXX = PATH=/usr/bin /usr/dcs/software/evaluation/bin/g++
18 CXX = /home/vadve/criswell/local/Linux/bin/g++
1419
1520 # We have the same problem with the CC binary, which use used by testcases for
1621 # native builds.
1722 #
18 CC := PATH=/usr/bin /usr/dcs/software/evaluation/bin/gcc
23 CC := /home/vadve/criswell/local/Linux/bin/gcc
1924
2025 #
21 # Path to the linker.
26 # Compilation flags for the C and C++ compilers.
2227 #
23 LD = ld
28 CPPFLAGS=-DHAVE_CONFIG_H
29 CCFLAGS=-DHAVE_CONFIG_H
30 LDFLAGS=
31 LIBS=-ldl
32
33 #
34 # Libraries needed by tools
35 #
36 TOOLLINKOPTS=-ldl
2437
2538 #
2639 # Path to the archiver program.
2740 #
28 AR_PATH = ar
41 AR_PATH = /usr/bin/ar
2942
3043 #
3144 # The pathnames of the Flex and Bison programs, respectively.
3447 FLEX = flex
3548
3649 #
37 # Path OBJ_ROOT to the directory where object files should be stored during a
38 # build. Set to "." if you do not want to use a separate place for object
39 # files.
50 # Paths to miscellaneous programs.
51 #
52 SED = /bin/sed
53 RM = /bin/rm
54 ECHO = /bin/echo
55 MKDIR = /home/vadve/criswell/box/mainline/llvm/mkinstalldirs
56 DATE = /bin/date
57 MV = /bin/mv
58 INSTALL = /usr/dcs/software/supported/bin/ginstall -c
59 DOT = /home/vadve/lattner/local/x86/bin/dot
60 ETAGS = /usr/dcs/software/supported/bin/etags
61
62 #
63 # Determine the target for which LLVM should generate code.
64 #
65 LLVMGCCARCH := i686-pc-linux-gnu/3.4-llvm
66
67 # Path to directory where object files should be stored during a build.
68 # Set OBJ_ROOT to "." if you do not want to use a separate place for
69 # object files.
4070 #
4171 #OBJ_ROOT = .
42 OBJ_ROOT := /localhome/$(USER)
72 OBJ_ROOT := /localhome/criswell
4373
4474 # Path to location for LLVM front-end this should only be specified here if you
4575 # want to override the value set in Makefile.$(uname)
4676 #
47 #LLVMGCCDIR := /home/vadve/lattner/local/x86/llvm-gcc/
77 LLVMGCCDIR := /home/vadve/lattner/local/x86/llvm-gcc/
4878
4979 # When this setting is set to true, programs in the llvm/test/Programs hierarchy
5080 # are not recompiled from source code. Instead, the bytecode for the file is
5383 # frontend.
5484 #
5585 #USE_PRECOMPILED_BYTECODE := 1
86
5687
5788 # This path specifies the cannonical location of bytecode files for compiled
5889 # versions of the test/Programs/* programs. This is used as the bytecode source
6495 # Path to location for purify, this is only needed if you build with
6596 # ENABLE_PURIFY=1
6697 #
67 PURIFY = /usr/dcs/applications/purify/bin/purify
98 PURIFY =
6899
69100 #
70101 # SPEC benchmarks:
71 # Set this variable to enable the use of the SPEC benchmarks. You must
72 # provide the SPEC benchmarks on your own.
102 # Set the USE_SPEC variable to enable the use of the SPEC benchmarks.
103 # You must provide the SPEC benchmarks on your own.
73104 #
74 USE_SPEC := 1
105
75106
76107 #
77108 # Path to the SPEC benchmarks. If you have the SPEC benchmarks, place the
78109 # path here.
79110 #
111 #SPEC_ROOT := /home/vadve/shared/benchmarks/speccpu2000/benchspec
80112 SPEC_ROOT := /home/vadve/shared/benchmarks/speccpu2000/benchspec
81113
82114 #
83115 # Path to the PAPI code. This is used by the reoptimizer only.
84116 #
117 #PAPIDIR := /home/vadve/shared/papi-2.3.4.1
85118 PAPIDIR := /home/vadve/shared/papi-2.3.4.1
86119
87120 # These are options that can either be enabled here, or can be enabled on the
93126 #
94127 #ENABLE_OPTIMIZED = 1
95128
129
96130 # When ENABLE_PROFILING is enabled, the llvm source base is built with profile
97131 # information to allow gprof to be used to get execution frequencies.
98132 #
99133 #ENABLE_PROFILING = 1
134
100135
101136 #
102137 # This open tells the Makefiles to produce verbose output.
104139 #
105140 #VERBOSE = 1
106141
107 # When ENABLE_PURIFY is enabled, the LLVM tools are linked with purify (which
142
143 # When ENABLE_PURIFY is set to 1, the LLVM tools are linked with purify (which
108144 # must be locally installed) to allow for some automated memory error debugging.
109145 #
110 #ENABLE_PURIFY = 1
146 #ENABLE_PURIFY = 1
111147
148
149 #
150 # Enable JIT for this platform
151 #
152
153
154 #
155 # Disable LLC diffs for testing.
156 #
157 DISABLE_LLC_DIFFS:=1
158
0 #===-- Makefile.config - Local configuration for LLVM ------*- makefile -*--====
1 #
2 # This file is included by Makefile.common. It defines paths and other
3 # values specific to a particular installation of LLVM.
4 #===-----------------------------------------------------------------------====
5
6 #
7 # Target operating system for which LLVM will be compiled.
8 #
9 OS=@OS@
10
11 # Path to the C++ compiler to use. This is an optional setting, which defaults
12 # to whatever your gmake defaults to.
13 #
14 # Under Linux, for some reason the compiler driver wants to search the PATH to
15 # find the system assembler, which breaks if the LLVM assembler is in our path.
16 # Hack it to use the assembler in /usr/bin directly.
17 #
18 CXX = @CXX@
19
20 # We have the same problem with the CC binary, which use used by testcases for
21 # native builds.
22 #
23 CC := @CC@
24
25 #
26 # Compilation flags for the C and C++ compilers.
27 #
28 CPPFLAGS=@DEFS@
29 CCFLAGS=@DEFS@
30 LDFLAGS=@LDFLAGS@
31 LIBS=@LIBS@
32
33 #
34 # Libraries needed by tools
35 #
36 TOOLLINKOPTS=@LIBS@
37
38 #
39 # Path to the archiver program.
40 #
41 AR_PATH = @AR@
42
43 #
44 # The pathnames of the Flex and Bison programs, respectively.
45 #
46 BISON = @YACC@
47 FLEX = @LEX@
48
49 #
50 # Paths to miscellaneous programs.
51 #
52 SED = @SED@
53 RM = @RM@
54 ECHO = @ECHO@
55 MKDIR = @abs_top_srcdir@/mkinstalldirs
56 DATE = @DATE@
57 MV = @MV@
58 INSTALL = @INSTALL@
59 DOT = @DOT@
60 ETAGS = @ETAGS@
61
62 #
63 # Determine the target for which LLVM should generate code.
64 #
65 LLVMGCCARCH := @target@/3.4-llvm
66
67 # Path to directory where object files should be stored during a build.
68 # Set OBJ_ROOT to "." if you do not want to use a separate place for
69 # object files.
70 #
71 #OBJ_ROOT = .
72 OBJ_ROOT := @OBJROOT@
73
74 # Path to location for LLVM front-end this should only be specified here if you
75 # want to override the value set in Makefile.$(uname)
76 #
77 LLVMGCCDIR := @LLVMGCCDIR@
78
79 # When this setting is set to true, programs in the llvm/test/Programs hierarchy
80 # are not recompiled from source code. Instead, the bytecode for the file is
81 # pulled from the BYTECODE_REPOSITORY directory. This can be useful when disk
82 # space is limited or when you just don't want to spend time running the C
83 # frontend.
84 #
85 #USE_PRECOMPILED_BYTECODE := 1
86 @UPB@
87
88 # This path specifies the cannonical location of bytecode files for compiled
89 # versions of the test/Programs/* programs. This is used as the bytecode source
90 # when USE_PRECOMPILED_BYTECODE is specified or when source code is not
91 # available for the program (such as SPEC).
92 #
93 BYTECODE_REPOSITORY := @BCR@
94
95 # Path to location for purify, this is only needed if you build with
96 # ENABLE_PURIFY=1
97 #
98 PURIFY = @PURIFY@
99
100 #
101 # SPEC benchmarks:
102 # Set the USE_SPEC variable to enable the use of the SPEC benchmarks.
103 # You must provide the SPEC benchmarks on your own.
104 #
105 @USE_SPEC@
106
107 #
108 # Path to the SPEC benchmarks. If you have the SPEC benchmarks, place the
109 # path here.
110 #
111 #SPEC_ROOT := /home/vadve/shared/benchmarks/speccpu2000/benchspec
112 SPEC_ROOT := @SPEC_ROOT@
113
114 #
115 # Path to the PAPI code. This is used by the reoptimizer only.
116 #
117 #PAPIDIR := /home/vadve/shared/papi-2.3.4.1
118 PAPIDIR := @PAPIDIR@
119
120 # These are options that can either be enabled here, or can be enabled on the
121 # make command line (ie, make ENABLE_PROFILING=1)
122 #
123
124 # When ENABLE_OPTIMIZED is enabled, Release builds of all of the LLVM code are
125 # turned on, and Debug builds are turned off.
126 #
127 #ENABLE_OPTIMIZED = 1
128 @ENABLE_OPTIMIZED@
129
130 # When ENABLE_PROFILING is enabled, the llvm source base is built with profile
131 # information to allow gprof to be used to get execution frequencies.
132 #
133 #ENABLE_PROFILING = 1
134 @ENABLE_PROFILING@
135
136 #
137 # This open tells the Makefiles to produce verbose output.
138 # It essentially prints the commands that make is executing
139 #
140 #VERBOSE = 1
141 @ENABLE_VERBOSE@
142
143 # When ENABLE_PURIFY is set to 1, the LLVM tools are linked with purify (which
144 # must be locally installed) to allow for some automated memory error debugging.
145 #
146 #ENABLE_PURIFY = 1
147 @ENABLE_PURIFY@
148
149 #
150 # Enable JIT for this platform
151 #
152 @JIT@
153
154 #
155 # Disable LLC diffs for testing.
156 #
157 @DISABLE_LLC_DIFFS@
158
2929 # are in, if they are not in the current directory. This should include a
3030 # trailing / character.
3131 #
32 # 6. PROJ_COMPILE - If set to 1, then this makefile can also be used to
33 # compile other projects using llvm. Note if this option is set then the
34 # following *must* hold
35 # PROJLEVEL should be set to the top of the source directory for the
36 # project files
37 # LEVEL should be set to the top of LLVM source tree
38 # LLVM_LIB_DIR should be set to the top of the LLVM build tree
39 #
32 # 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
33 #
34 # 7. LLVM_OBJ_ROOT - If specified, points to the top directory where LLVM
35 # object files are placed.
36 #
37 # 8. BUILD_SRC_DIR - The directory which contains the current set of Makefiles
38 # and usually the source code too (unless SourceDir is set).
39 #
40 # 9. BUILD_SRC_ROOT - The root directory of the source code being compiled.
41 #
42 # 10. BUILD_OBJ_DIR - The directory where object code should be placed.
43 #
44 # 11. BUILD_OBJ_ROOT - The root directory for where object code should be
45 # placed.
46 #
47 # For building,
48 # LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT, and
49 # LLVM_OBJ_ROOT = BUILD_OBJ_ROOT.
4050 #===-----------------------------------------------------------------------====
4151
4252 #
7585 endif
7686
7787 #
88 # Determine the path of the source tree relative from $HOME (the mythical
89 # home directory).
90 #
91 HOME_OBJ_ROOT := $(OBJ_ROOT)/$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT))
92
93 #
7894 # Set the object build directory. Its location depends upon the source path
7995 # and where object files should go.
8096 #
8197 ifndef BUILD_OBJ_DIR
8298 ifeq ($(OBJ_ROOT),.)
83 BUILD_OBJ_DIR = $(shell pwd)
99 BUILD_OBJ_DIR = $(BUILD_SRC_DIR)
84100 else
85 BUILD_OBJ_DIR := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_DIR); pwd))
101 BUILD_OBJ_DIR := $(HOME_OBJ_ROOT)$(patsubst $(BUILD_SRC_ROOT)%,%,$(BUILD_SRC_DIR))
86102 endif
87103 endif
88104
91107 #
92108 ifndef BUILD_OBJ_ROOT
93109 ifeq ($(OBJ_ROOT),.)
94 BUILD_OBJ_ROOT = $(shell cd $(LEVEL); pwd)
110 BUILD_OBJ_ROOT = $(BUILD_SRC_ROOT)
95111 else
96 BUILD_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_ROOT); pwd))
112 BUILD_OBJ_ROOT := $(HOME_OBJ_ROOT)
97113 endif
98114 endif
99115
112128 LLVM_OBJ_ROOT = $(BUILD_OBJ_ROOT)
113129 endif
114130
115 # Figure out how to do platform specific stuff on this platform. This is really
116 # gross and should be autoconfiscated (automake actually), but should hopefully
117 # work on Linux and solaris (SunOS).
118 #
119 UNAME := $(shell uname)
120 include $(LLVM_SRC_ROOT)/Makefile.$(UNAME)
131 ###########################################################################
132 # Default Targets:
133 # The following targets are the standard top level targets for
134 # building.
135 ###########################################################################
121136
122137 ifdef SHARED_LIBRARY
123138 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
124 dynamic ::
139 all:: dynamic
125140 endif
126141
127142 # Default Rule: Make sure it's also a :: rule
132147
133148 # Default rule for test. It ensures everything has a test rule
134149 test::
150
151 # Print out the directories used for building
152 prdirs::
153 echo "Home Offset : " $(HOME_OBJ_ROOT);
154 echo "Build Source Root: " $(BUILD_SRC_ROOT);
155 echo "Build Source Dir : " $(BUILD_SRC_DIR);
156 echo "Build Object Root: " $(BUILD_OBJ_ROOT);
157 echo "Build Object Dir : " $(BUILD_OBJ_DIR);
158 echo "LLVM Source Root: " $(LLVM_SRC_ROOT);
159 echo "LLVM Object Root: " $(LLVM_OBJ_ROOT);
160
161 ###########################################################################
162 # Miscellaneous paths and commands:
163 # This section defines various configuration macros, such as where
164 # to find burg, tblgen, and libtool.
165 ###########################################################################
135166
136167 #--------------------------------------------------------------------
137168 # Variables derived from configuration options...
156187 endif
157188 endif
158189
159 ###########################################################################
160 # Library Locations
190 #
191 # Enable this for profiling support with 'gprof'
192 # This automatically enables optimized builds.
193 #
194 ifdef ENABLE_PROFILING
195 PROFILE = -pg
196 endif
197
198 #
199 # Suffixes for library compilation rules
200 #
201 .SUFFIXES: .so
202
203 ###########################################################################
204 # Library Locations:
161205 # These variables describe various library locations:
162206 #
163207 # DEST* = Location of where libraries that are built will be placed.
207251 PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile
208252 PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
209253
254 #
255 # Libtool is found in the current directory.
256 #
257 ifdef VERBOSE
258 LIBTOOL=$(LLVM_SRC_ROOT)/libtool
259 else
260 LIBTOOL=$(LLVM_SRC_ROOT)/libtool --silent
261 endif
262
263 #
210264 # Verbosity levels
265 #
211266 ifndef VERBOSE
212267 VERB := @
213268 endif
214269
215 #---------------------------------------------------------
216 # Compilation options...
217 #---------------------------------------------------------
218
219 ###########################################################################
220 # Special tools used while building the LLVM tree. Burg is built as part of the
221 # utils directory.
222 ###########################################################################
270 ###########################################################################
271 # Miscellaneous paths and commands (part deux):
272 # This section defines various configuration macros, such as where
273 # to find burg, tblgen, and libtool.
274 ###########################################################################
275
276 #--------------------------------------------------------------------------
277 # Special tools used while building the LLVM tree. Burg is built as part
278 # of the utils directory.
279 #--------------------------------------------------------------------------
223280 BURG := $(LLVMTOOLCURRENT)/burg
224281 RunBurg := $(BURG) $(BURG_OPTS)
225282
226283 TBLGEN := $(LLVMTOOLCURRENT)/tblgen
227284
228 # Enable this for profiling support with 'gprof'
229 # This automatically enables optimized builds.
230 ifdef ENABLE_PROFILING
231 PROFILE = -pg
232 endif
233285
234286 ###########################################################################
235287 # Compile Time Flags
236288 ###########################################################################
237289
238290 #
239 # Include both the project headers and the LLVM headers for compilation
291 # Include both the project headers and the LLVM headers for compilation and
292 # dependency computation.
240293 #
241294 CPPFLAGS += -I$(BUILD_SRC_ROOT)/include -I$(LLVM_SRC_ROOT)/include
242295
253306 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include
254307 CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions -fshort-enums
255308
309 #
310 # Compile commands with libtool.
311 #
312 Compile := $(LIBTOOL) --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
313 CompileC := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
314
315 #
316 # Add the LLVM specific "-only-static" option so that we only compile .o files
317 # once when not building a shared library.
318 #
319 # For shared libraries, we will end up building twice, but that doesn't happen
320 # very often, so we'll let it go.
321 #
322 ifndef SHARED_LIBRARY
323 Compile := $(Compile) -only-static
324 CompileC := $(CompileC) -only-static
325 endif
326
256327 # Compile a cpp file, don't link...
257 Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
258328 CompileG := $(Compile) -g -D_DEBUG
259329 CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors -fomit-frame-pointer
260330 CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE)
261331
262332 # Compile a c file, don't link...
263 CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
264333 CompileCG := $(CompileC) -g -D_DEBUG
265334 CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer
266335 CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE)
267336
268
337 ###########################################################################
338 # Link Time Options
339 ###########################################################################
340
341 #
269342 # Link final executable
270
343 # (Note that we always link with the C++ compiler).
344 #
271345 ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1'
272 Link := $(PURIFY) $(CXX) -static
346 Link := $(PURIFY) $(LIBTOOL) --mode=link $(CXX) -static
273347 else
274 Link := $(CXX)
275 endif
276
277 ifdef PROJ_COMPILE
278 # include both projlib source and llvmlib source
348 Link := $(LIBTOOL) --mode=link $(CXX)
349 endif
350
351 # link both projlib and llvmlib libraries
279352 LinkG := $(Link) -g -L$(PROJLIBDEBUGSOURCE) -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
280353 LinkO := $(Link) -O3 -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE)
281354 LinkP := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
282 else
283 LinkG := $(Link) -g -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
284 LinkO := $(Link) -O3 -L$(LLVMLIBRELEASESOURCE)
285 LinkP := $(Link) -O3 -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
286 endif
287
288
289355
290356 # Create one .o file from a bunch of .o files...
291 Relink = ${LD} -r
357 Relink = ${LIBTOOL} --mode=link $(CXX)
292358
293359 # MakeSO - Create a .so file from a .o files...
294 MakeSO := $(CXX) $(MakeSharedObjectOption)
295 MakeSOO := $(MakeSO) -O3
296 MakeSOP := $(MakeSOO) $(PROFILE)
360 #MakeSO := $(LIBTOOL) --mode=link $(CXX) $(MakeSharedObjectOption)
361 #MakeSOO := $(MakeSO) -O3
362 #MakeSOP := $(MakeSOO) $(PROFILE)
363
364 #
365 # Configure where the item being compiled should go.
366 #
367 ifdef SHARED_LIBRARY
368 Link := $(Link) -rpath $(DESTLIBCURRENT)
369 endif
370
371 ifdef TOOLNAME
372 Link := $(Link) -rpath $(DESTTOOLCURRENT)
373 endif
297374
298375 # Create dependancy file from CPP file, send to stdout.
299376 Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS)
312389 Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
313390 endif
314391
315 Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
316 ObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(Objs))
317 ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs))
318 ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs))
319
392 LObjs := $(sort $(patsubst Debug/%.lo, %.lo, $(addsuffix .lo,$(notdir $(basename $(Source))))))
393 LObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(LObjs))
394 LObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(LObjs))
395 LObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(LObjs))
320396
321397 #---------------------------------------------------------
322398 # Handle the DIRS and PARALLEL_DIRS options
340416 $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
341417 endif
342418
419 # Handle directories that may or may not exist
343420 ifdef OPTIONAL_DIRS
344421 all install clean test ::
345422 $(VERB) for dir in ${OPTIONAL_DIRS}; do \
350427 done
351428 endif
352429
430 ###########################################################################
431 # Library Build Rules:
432 #
353433 #---------------------------------------------------------
354434 # Handle the LIBRARYNAME option - used when building libs...
355435 #---------------------------------------------------------
366446 # it's built as a .o file, then all of the constituent .o files in it will be
367447 # linked into tools (for example gccas) even if they only use one of the parts
368448 # of it. For this reason, sometimes it's useful to use libraries as .a files.
449 ###########################################################################
369450
370451 ifdef LIBRARYNAME
371452
382463 LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o
383464 LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o
384465
466 #--------------------------------------------------------------------
467 # Library Targets
468 # Modify the top level targets to build the desired libraries.
469 #--------------------------------------------------------------------
470
385471 # dynamic target builds a shared object version of the library...
386472 dynamic:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).so
387473
395481 all:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a
396482 endif
397483
398 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
399 @echo ======= Linking $(LIBRARYNAME) release library =======
400 $(VERB) $(MakeSOO) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
401
402 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
403 @echo ======= Linking $(LIBRARYNAME) profile library =======
404 $(VERB) $(MakeSOP) -o $@ $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
405
406 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
407 @echo ======= Linking $(LIBRARYNAME) debug library =======
408 $(VERB) $(MakeSO) -g -o $@ $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
409
410 $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
411 @echo ======= Linking $(LIBRARYNAME) release library =======
412 @rm -f $@
413 $(VERB) $(AR) $@ $(ObjectsO) $(LibSubDirs)
414
415 $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
416 @echo ======= Linking $(LIBRARYNAME) profile library =======
417 @rm -f $@
418 $(VERB) $(AR) $@ $(ObjectsP) $(LibSubDirs)
419
420 $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
421 @echo ======= Linking $(LIBRARYNAME) debug library =======
422 @rm -f $@
423 $(VERB) $(AR) $@ $(ObjectsG) $(LibSubDirs)
424
425 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
484 #--------------------------------------------------------------------
485 # Rules for building libraries
486 #--------------------------------------------------------------------
487
488 #
489 # Rules for building dynamically linked libraries.
490 #
491 $(LIBNAME_O): $(LObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
492 @echo ======= Linking $(LIBRARYNAME) dynamic release library =======
493 $(VERB) $(Link) -o $*.la $(LObjectsO) $(LibSubDirs) $(LibLinkOpts);
494 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
495
496 $(LIBNAME_P): $(LObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
497 @echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
498 $(VERB) $(Link) -o $*.la $(LObjectsP) $(LibSubDirs) $(LibLinkOpts);
499 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
500
501 $(LIBNAME_G): $(LObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
502 @echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
503 $(VERB) $(Link) -o $*.la $(LObjectsG) $(LibSubDirs) $(LibLinkOpts);
504 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
505
506 #
507 # Rules for building static archive libraries.
508 #
509 $(LIBNAME_AO): $(LObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
510 @echo ======= Linking $(LIBRARYNAME) archive release library =======
511 @$(RM) -f $@
512 $(VERB) $(Link) -03 -o $@ $(LObjectsO) $(LibSubDirs) -static
513
514 $(LIBNAME_AP): $(LObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
515 @echo ======= Linking $(LIBRARYNAME) archive profile library =======
516 @$(RM) -f $@
517 $(VERB) $(Link) -03 $(PROFILE) -o $@ $(LObjectsP) $(LibSubDirs) -static
518
519 $(LIBNAME_AG): $(LObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
520 @echo ======= Linking $(LIBRARYNAME) archive debug library =======
521 @$(RM) -f $@
522 $(VERB) $(Link) -g $(STRIP) -o $@ $(LObjectsG) $(LibSubDirs) -static
523
524 #
525 # Rules for building .o libraries.
526 #
527 $(LIBNAME_OBJO): $(LObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
426528 @echo "Linking $@"
427 $(VERB) $(Relink) -o $@ $(ObjectsO) $(LibSubDirs)
428
429 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
529 $(VERB) $(Relink) -o $@ $(LObjectsO) $(LibSubDirs)
530
531 $(LIBNAME_OBJP): $(LObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
430532 @echo "Linking $@"
431 $(VERB) $(Relink) -o $@ $(ObjectsP) $(LibSubDirs)
432
433 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
533 $(VERB) $(Relink) -o $@ $(LObjectsP) $(LibSubDirs)
534
535 $(LIBNAME_OBJG): $(LObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
434536 @echo "Linking $@"
435 $(VERB) $(Relink) -o $@ $(ObjectsG) $(LibSubDirs)
537 $(VERB) $(Relink) -o $@ $(LObjectsG) $(LibSubDirs)
436538
437539 endif
438540
440542 # Create a TAGS database for emacs
441543 #------------------------------------------------------------------------
442544
545 ifdef ETAGS
443546 ifeq ($(LEVEL), .)
444547 tags:
445 etags -l c++ `find include lib tools -name '*.cpp' -o -name '*.h'`
548 $(ETAGS) -l c++ `find include lib tools -name '*.cpp' -o -name '*.h'`
446549 all:: tags
550 endif
551 else
552 tags:
553 ${ECHO} "Cannot build $@: The program etags is not installed"
447554 endif
448555
449556 #------------------------------------------------------------------------
486593 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
487594 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
488595 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
489 LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
490
596 #LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
597
598 #
599 # Libtool link options:
600 # Ensure that all binaries have their symbols exported so that they can
601 # by dlsym'ed.
602 #
603 LINK_OPTS := -export-dynamic $(TOOLLINKOPTS)
491604
492605
493606
501614 all:: $(TOOLEXENAMES)
502615
503616 clean::
504 $(VERB) rm -f $(TOOLEXENAMES)
505
506 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
617 $(VERB) $(RM) -f $(TOOLEXENAMES)
618
619 $(TOOLEXENAME_G): $(LObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
507620 @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)=======
508 $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS)
509
510 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
621 $(VERB) $(LinkG) -o $@ $(LObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS)
622
623 $(TOOLEXENAME_O): $(LObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
511624 @echo ======= Linking $(TOOLNAME) release executable =======
512 $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS)
513
514 $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir
625 $(VERB) $(LinkO) -o $@ $(LObjectsO) $(LIB_OPTS_O) $(LINK_OPTS) $(LIBS)
626
627 $(TOOLEXENAME_P): $(LObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir
515628 @echo ======= Linking $(TOOLNAME) profile executable =======
516 $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS)
629 $(VERB) $(LinkP) -o $@ $(LObjectsP) $(LIB_OPTS_P) $(LINK_OPTS) $(LIBS)
517630
518631 endif
519632
524637 .PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir
525638
526639 # Create .o files in the ObjectFiles directory from the .cpp and .c files...
527 $(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
640 #$(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
641 #@echo "Compiling $<"
642 #$(VERB) $(CompileO) $< -o $@
643
644 #$(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
645 #$(VERB) $(CompileCO) $< -o $@
646
647 #$(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
648 #@echo "Compiling $<"
649 #$(VERB) $(CompileP) $< -o $@
650
651 #$(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
652 #@echo "Compiling $<"
653 #$(VERB) $(CompileCP) $< -o $@
654
655 #$(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
656 #@echo "Compiling $<"
657 #$(VERB) $(CompileG) $< -o $@
658
659 #$(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
660 #$(VERB) $(CompileCG) $< -o $@
661
662 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
663 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
528664 @echo "Compiling $<"
529665 $(VERB) $(CompileO) $< -o $@
530666
531 $(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
667 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
668 @echo "Compiling $<"
532669 $(VERB) $(CompileCO) $< -o $@
533670
534 $(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
671 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
535672 @echo "Compiling $<"
536673 $(VERB) $(CompileP) $< -o $@
537674
538 $(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
675 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
539676 @echo "Compiling $<"
540677 $(VERB) $(CompileCP) $< -o $@
541678
542 $(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
679 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
543680 @echo "Compiling $<"
544681 $(VERB) $(CompileG) $< -o $@
545682
546 $(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
683 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
684 @echo "Compiling $<"
685 $(VERB) $(CompileCG) $< -o $@
686
687 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
688 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
689 @echo "Compiling $<"
690 $(VERB) $(CompileO) $< -o $@
691
692 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
693 $(VERB) $(CompileCO) $< -o $@
694
695 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
696 @echo "Compiling $<"
697 $(VERB) $(CompileP) $< -o $@
698
699 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
700 @echo "Compiling $<"
701 $(VERB) $(CompileCP) $< -o $@
702
703 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
704 @echo "Compiling $<"
705 $(VERB) $(CompileG) $< -o $@
706
707 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
547708 $(VERB) $(CompileCG) $< -o $@
548709
549710 #
564725 # FIXME. (f.e. char Buffer[10000]; )
565726 #
566727 %.cpp: %.l
567 $(FLEX) -t $< | sed '/^find_rule/d' | \
568 sed 's/void yyunput/inline void yyunput/' | \
569 sed 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
570 sed 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@
728 $(FLEX) -t $< | $(SED) '/^find_rule/d' | \
729 $(SED) 's/void yyunput/inline void yyunput/' | \
730 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
731 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@
571732
572733 # Rule for building the bison parsers...
573734 %.c: %.y # Cancel built-in rules for yacc
575736 %.cpp %.h : %.y
576737 @echo Bison\'ing $<...
577738 $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $*.y
578 $(VERB) mv -f $*.tab.c $*.cpp
579 $(VERB) mv -f $*.tab.h $*.h
739 $(VERB) ${MV} -f $*.tab.c $*.cpp
740 $(VERB) ${MV} -f $*.tab.h $*.h
580741
581742 # To create the directories...
582743 %/.dir:
583 $(VERB) mkdir -p $*
584 @date > $@
744 $(VERB) ${MKDIR} $* > /dev/null
745 @$(DATE) > $@
585746
586747 # To create postscript files from dot files...
748 ifdef DOT
587749 %.ps: %.dot
588 dot -Tps < $< > $@
750 ${DOT} -Tps < $< > $@
751 else
752 %.ps: %.dot
753 ${ECHO} "Cannot build $@: The program dot is not installed"
754 endif
589755
590756 # 'make clean' nukes the tree
591757 clean::
592 $(VERB) rm -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend
593 $(VERB) rm -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
594 $(VERB) rm -f $(LEX_OUTPUT) $(YACC_OUTPUT)
758 $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend
759 $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
760 $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT)
761
762 distclean:: clean
763 $(VERB) (cd $(LLVM_SRC_ROOT); $(RM) -rf $(LEVEL)/Makefile.config \
764 $(LEVEL)/include/Config/config.h \
765 $(LEVEL)/autom4te.cache \
766 $(LEVEL)/config.log)
767
768 ###########################################################################
769 # C/C++ Dependencies
770 # Define variables and rules that generate header file dependencies
771 # from C/C++ source files.
772 ###########################################################################
595773
596774 # If dependencies were generated for the file that included this file,
597775 # include the dependancies now...
598776 #
599777 SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
600778 SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d)
779
780 #
781 # Depend target:
782 # This allows a user to manually ask for an update in the dependencies
783 #
784 depend: $(SourceDepend)
785
601786
602787 # Create dependencies for the *.cpp files...
603788 #$(SourceDepend): \x
604789 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
605 $(VERB) $(Depend) $< | sed 's|$*\.o *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
790 $(VERB) $(Depend) $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
606791
607792 # Create dependencies for the *.c files...
608793 #$(SourceDepend): \x
609794 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Depend/.dir
610 $(VERB) $(DependC) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@
611
795 $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
796
797 #
798 # Include dependencies generated from C/C++ source files, but not if we
799 # are cleaning (this example taken from the GNU Make Manual).
800 #
801 ifneq ($(MAKECMDGOALS),clean)
612802 ifneq ($(SourceDepend),)
613803 -include $(SourceDepend)
614804 endif
805 endif
0 # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
1 ## Copyright 1996, 1997, 1998, 1999, 2000, 2001
2 ## Free Software Foundation, Inc.
3 ## Originally by Gordon Matzigkeit , 1996
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 ##
19 ## As a special exception to the GNU General Public License, if you
20 ## distribute this file as part of a program that contains a
21 ## configuration script generated by Autoconf, you may include it under
22 ## the same distribution terms that you use for the rest of that program.
23
24 # serial 46 AC_PROG_LIBTOOL
25
26 AC_DEFUN([AC_PROG_LIBTOOL],
27 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
28
29 # This can be used to rebuild libtool when needed
30 LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
31
32 # Always use our own libtool.
33 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
34 AC_SUBST(LIBTOOL)dnl
35
36 # Prevent multiple expansion
37 define([AC_PROG_LIBTOOL], [])
38 ])
39
40 AC_DEFUN([AC_LIBTOOL_SETUP],
41 [AC_PREREQ(2.13)dnl
42 AC_REQUIRE([AC_ENABLE_SHARED])dnl
43 AC_REQUIRE([AC_ENABLE_STATIC])dnl
44 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
45 AC_REQUIRE([AC_CANONICAL_HOST])dnl
46 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
47 AC_REQUIRE([AC_PROG_CC])dnl
48 AC_REQUIRE([AC_PROG_LD])dnl
49 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
50 AC_REQUIRE([AC_PROG_NM])dnl
51 AC_REQUIRE([AC_PROG_LN_S])dnl
52 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
53 AC_REQUIRE([AC_OBJEXT])dnl
54 AC_REQUIRE([AC_EXEEXT])dnl
55 dnl
56
57 _LT_AC_PROG_ECHO_BACKSLASH
58 # Only perform the check for file, if the check method requires it
59 case $deplibs_check_method in
60 file_magic*)
61 if test "$file_magic_cmd" = '$MAGIC_CMD'; then
62 AC_PATH_MAGIC
63 fi
64 ;;
65 esac
66
67 AC_CHECK_TOOL(RANLIB, ranlib, :)
68 AC_CHECK_TOOL(STRIP, strip, :)
69
70 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
71 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
72 enable_win32_dll=yes, enable_win32_dll=no)
73
74 AC_ARG_ENABLE(libtool-lock,
75 [ --disable-libtool-lock avoid locking (might break parallel builds)])
76 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
77
78 # Some flags need to be propagated to the compiler or linker for good
79 # libtool support.
80 case $host in
81 *-*-irix6*)
82 # Find out which ABI we are using.
83 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
84 if AC_TRY_EVAL(ac_compile); then
85 case `/usr/bin/file conftest.$ac_objext` in
86 *32-bit*)
87 LD="${LD-ld} -32"
88 ;;
89 *N32*)
90 LD="${LD-ld} -n32"
91 ;;
92 *64-bit*)
93 LD="${LD-ld} -64"
94 ;;
95 esac
96 fi
97 rm -rf conftest*
98 ;;
99
100 *-*-sco3.2v5*)
101 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
102 SAVE_CFLAGS="$CFLAGS"
103 CFLAGS="$CFLAGS -belf"
104 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
105 [AC_LANG_SAVE
106 AC_LANG_C
107 AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
108 AC_LANG_RESTORE])
109 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
110 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
111 CFLAGS="$SAVE_CFLAGS"
112 fi
113 ;;
114
115 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
116 [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
117 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
118 AC_CHECK_TOOL(AS, as, false)
119 AC_CHECK_TOOL(OBJDUMP, objdump, false)
120
121 # recent cygwin and mingw systems supply a stub DllMain which the user
122 # can override, but on older systems we have to supply one
123 AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
124 [AC_TRY_LINK([],
125 [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
126 DllMain (0, 0, 0);],
127 [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
128
129 case $host/$CC in
130 *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
131 # old mingw systems require "-dll" to link a DLL, while more recent ones
132 # require "-mdll"
133 SAVE_CFLAGS="$CFLAGS"
134 CFLAGS="$CFLAGS -mdll"
135 AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
136 [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
137 CFLAGS="$SAVE_CFLAGS" ;;
138 *-*-cygwin* | *-*-pw32*)
139 # cygwin systems need to pass --dll to the linker, and not link
140 # crt.o which will require a WinMain@16 definition.
141 lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
142 esac
143 ;;
144 ])
145 esac
146
147 _LT_AC_LTCONFIG_HACK
148
149 ])
150
151 # AC_LIBTOOL_HEADER_ASSERT
152 # ------------------------
153 AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
154 [AC_CACHE_CHECK([whether $CC supports assert without backlinking],
155 [lt_cv_func_assert_works],
156 [case $host in
157 *-*-solaris*)
158 if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
159 case `$CC --version 2>/dev/null` in
160 [[12]].*) lt_cv_func_assert_works=no ;;
161 *) lt_cv_func_assert_works=yes ;;
162 esac
163 fi
164 ;;
165 esac])
166
167 if test "x$lt_cv_func_assert_works" = xyes; then
168 AC_CHECK_HEADERS(assert.h)
169 fi
170 ])# AC_LIBTOOL_HEADER_ASSERT
171
172 # _LT_AC_CHECK_DLFCN
173 # --------------------
174 AC_DEFUN([_LT_AC_CHECK_DLFCN],
175 [AC_CHECK_HEADERS(dlfcn.h)
176 ])# _LT_AC_CHECK_DLFCN
177
178 # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
179 # ---------------------------------
180 AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
181 [AC_REQUIRE([AC_CANONICAL_HOST])
182 AC_REQUIRE([AC_PROG_NM])
183 AC_REQUIRE([AC_OBJEXT])
184 # Check for command to grab the raw symbol name followed by C symbol from nm.
185 AC_MSG_CHECKING([command to parse $NM output])
186 AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
187
188 # These are sane defaults that work on at least a few old systems.
189 # [They come from Ultrix. What could be older than Ultrix?!! ;)]
190
191 # Character class describing NM global symbol codes.
192 symcode='[[BCDEGRST]]'
193
194 # Regexp to match symbols that can be accessed directly from C.
195 sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
196
197 # Transform the above into a raw symbol and a C symbol.
198 symxfrm='\1 \2\3 \3'
199
200 # Transform an extracted symbol line into a proper C declaration
201 lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
202
203 # Transform an extracted symbol line into symbol name and symbol address
204 lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
205
206 # Define system-specific variables.
207 case $host_os in
208 aix*)
209 symcode='[[BCDT]]'
210 ;;
211 cygwin* | mingw* | pw32*)
212 symcode='[[ABCDGISTW]]'
213 ;;
214 hpux*) # Its linker distinguishes data from code symbols
215 lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
216 lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
217 ;;
218 irix*)
219 symcode='[[BCDEGRST]]'
220 ;;
221 solaris* | sysv5*)
222 symcode='[[BDT]]'
223 ;;
224 sysv4)
225 symcode='[[DFNSTU]]'
226 ;;
227 esac
228
229 # Handle CRLF in mingw tool chain
230 opt_cr=
231 case $host_os in
232 mingw*)
233 opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
234 ;;
235 esac
236
237 # If we're using GNU nm, then use its standard symbol codes.
238 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
239 symcode='[[ABCDGISTW]]'
240 fi
241
242 # Try without a prefix undercore, then with it.
243 for ac_symprfx in "" "_"; do
244
245 # Write the raw and C identifiers.
246 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
247
248 # Check to see that the pipe works correctly.
249 pipe_works=no
250 rm -f conftest*
251 cat > conftest.$ac_ext <
252 #ifdef __cplusplus
253 extern "C" {
254 #endif
255 char nm_test_var;
256 void nm_test_func(){}
257 #ifdef __cplusplus
258 }
259 #endif
260 int main(){nm_test_var='a';nm_test_func();return(0);}
261 EOF
262
263 if AC_TRY_EVAL(ac_compile); then
264 # Now try to grab the symbols.
265 nlist=conftest.nm
266 if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
267 # Try sorting and uniquifying the output.
268 if sort "$nlist" | uniq > "$nlist"T; then
269 mv -f "$nlist"T "$nlist"
270 else
271 rm -f "$nlist"T
272 fi
273
274 # Make sure that we snagged all the symbols we need.
275 if egrep ' nm_test_var$' "$nlist" >/dev/null; then
276 if egrep ' nm_test_func$' "$nlist" >/dev/null; then
277 cat < conftest.$ac_ext
278 #ifdef __cplusplus
279 extern "C" {
280 #endif
281
282 EOF
283 # Now generate the symbol file.
284 eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
285
286 cat <> conftest.$ac_ext
287 #if defined (__STDC__) && __STDC__
288 # define lt_ptr void *
289 #else
290 # define lt_ptr char *
291 # define const
292 #endif
293
294 /* The mapping between symbol names and symbols. */
295 const struct {
296 const char *name;
297 lt_ptr address;
298 }
299 lt_preloaded_symbols[[]] =
300 {
301 EOF
302 sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
303 cat <<\EOF >> conftest.$ac_ext
304 {0, (lt_ptr) 0}
305 };
306
307 #ifdef __cplusplus
308 }
309 #endif
310 EOF
311 # Now try linking the two files.
312 mv conftest.$ac_objext conftstm.$ac_objext
313 save_LIBS="$LIBS"
314 save_CFLAGS="$CFLAGS"
315 LIBS="conftstm.$ac_objext"
316 CFLAGS="$CFLAGS$no_builtin_flag"
317 if AC_TRY_EVAL(ac_link) && test -s conftest; then
318 pipe_works=yes
319 fi
320 LIBS="$save_LIBS"
321 CFLAGS="$save_CFLAGS"
322 else
323 echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
324 fi
325 else
326 echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
327 fi
328 else
329 echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
330 fi
331 else
332 echo "$progname: failed program was:" >&AC_FD_CC
333 cat conftest.$ac_ext >&5
334 fi
335 rm -f conftest* conftst*
336
337 # Do not use the global_symbol_pipe unless it works.
338 if test "$pipe_works" = yes; then
339 break
340 else
341 lt_cv_sys_global_symbol_pipe=
342 fi
343 done
344 ])
345 global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
346 if test -z "$lt_cv_sys_global_symbol_pipe"; then
347 global_symbol_to_cdecl=
348 global_symbol_to_c_name_address=
349 else
350 global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
351 global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
352 fi
353 if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
354 then
355 AC_MSG_RESULT(failed)
356 else
357 AC_MSG_RESULT(ok)
358 fi
359 ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
360
361 # _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
362 # ---------------------------------
363 AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
364 [# Find the correct PATH separator. Usually this is `:', but
365 # DJGPP uses `;' like DOS.
366 if test "X${PATH_SEPARATOR+set}" != Xset; then
367 UNAME=${UNAME-`uname 2>/dev/null`}
368 case X$UNAME in
369 *-DOS) lt_cv_sys_path_separator=';' ;;
370 *) lt_cv_sys_path_separator=':' ;;
371 esac
372 PATH_SEPARATOR=$lt_cv_sys_path_separator
373 fi
374 ])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
375
376 # _LT_AC_PROG_ECHO_BACKSLASH
377 # --------------------------
378 # Add some code to the start of the generated configure script which
379 # will find an echo command which doesn't interpret backslashes.
380 AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
381 [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
382 [AC_DIVERT_PUSH(NOTICE)])
383 _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
384
385 # Check that we are running under the correct shell.
386 SHELL=${CONFIG_SHELL-/bin/sh}
387
388 case X$ECHO in
389 X*--fallback-echo)
390 # Remove one level of quotation (which was required for Make).
391 ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
392 ;;
393 esac
394
395 echo=${ECHO-echo}
396 if test "X[$]1" = X--no-reexec; then
397 # Discard the --no-reexec flag, and continue.
398 shift
399 elif test "X[$]1" = X--fallback-echo; then
400 # Avoid inline document here, it may be left over
401 :
402 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
403 # Yippee, $echo works!
404 :
405 else
406 # Restart under the correct shell.
407 exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
408 fi
409
410 if test "X[$]1" = X--fallback-echo; then
411 # used as fallback echo
412 shift
413 cat <
414 $*
415 EOF
416 exit 0
417 fi
418
419 # The HP-UX ksh and POSIX shell print the target directory to stdout
420 # if CDPATH is set.
421 if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
422
423 if test -z "$ECHO"; then
424 if test "X${echo_test_string+set}" != Xset; then
425 # find a string as large as possible, as long as the shell can cope with it
426 for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
427 # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
428 if (echo_test_string="`eval $cmd`") 2>/dev/null &&
429 echo_test_string="`eval $cmd`" &&
430 (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
431 then
432 break
433 fi
434 done
435 fi
436
437 if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
438 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
439 test "X$echo_testing_string" = "X$echo_test_string"; then
440 :
441 else
442 # The Solaris, AIX, and Digital Unix default echo programs unquote
443 # backslashes. This makes it impossible to quote backslashes using
444 # echo "$something" | sed 's/\\/\\\\/g'
445 #
446 # So, first we look for a working echo in the user's PATH.
447
448 IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
449 for dir in $PATH /usr/ucb; do
450 if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
451 test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
452 echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
453 test "X$echo_testing_string" = "X$echo_test_string"; then
454 echo="$dir/echo"
455 break
456 fi
457 done
458 IFS="$save_ifs"
459
460 if test "X$echo" = Xecho; then
461 # We didn't find a better echo, so look for alternatives.
462 if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
463 echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
464 test "X$echo_testing_string" = "X$echo_test_string"; then
465 # This shell has a builtin print -r that does the trick.
466 echo='print -r'
467 elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
468 test "X$CONFIG_SHELL" != X/bin/ksh; then
469 # If we have ksh, try running configure again with it.
470 ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
471 export ORIGINAL_CONFIG_SHELL
472 CONFIG_SHELL=/bin/ksh
473 export CONFIG_SHELL
474 exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
475 else
476 # Try using printf.
477 echo='printf %s\n'
478 if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
479 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
480 test "X$echo_testing_string" = "X$echo_test_string"; then
481 # Cool, printf works
482 :
483 elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
484 test "X$echo_testing_string" = 'X\t' &&
485 echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
486 test "X$echo_testing_string" = "X$echo_test_string"; then
487 CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
488 export CONFIG_SHELL
489 SHELL="$CONFIG_SHELL"
490 export SHELL
491 echo="$CONFIG_SHELL [$]0 --fallback-echo"
492 elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
493 test "X$echo_testing_string" = 'X\t' &&
494 echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
495 test "X$echo_testing_string" = "X$echo_test_string"; then
496 echo="$CONFIG_SHELL [$]0 --fallback-echo"
497 else
498 # maybe with a smaller string...
499 prev=:
500
501 for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
502 if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
503 then
504 break
505 fi
506 prev="$cmd"
507 done
508
509 if test "$prev" != 'sed 50q "[$]0"'; then
510 echo_test_string=`eval $prev`
511 export echo_test_string
512 exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
513 else
514 # Oops. We lost completely, so just stick with echo.
515 echo=echo
516 fi
517 fi
518 fi
519 fi
520 fi
521 fi
522
523 # Copy echo and quote the copy suitably for passing to libtool from
524 # the Makefile, instead of quoting the original, which is used later.
525 ECHO=$echo
526 if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
527 ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
528 fi
529
530 AC_SUBST(ECHO)
531 AC_DIVERT_POP
532 ])# _LT_AC_PROG_ECHO_BACKSLASH
533
534 # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
535 # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
536 # ------------------------------------------------------------------
537 AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
538 [if test "$cross_compiling" = yes; then :
539 [$4]
540 else
541 AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
542 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
543 lt_status=$lt_dlunknown
544 cat > conftest.$ac_ext <
545 [#line __oline__ "configure"
546 #include "confdefs.h"
547
548 #if HAVE_DLFCN_H
549 #include
550 #endif
551
552 #include
553
554 #ifdef RTLD_GLOBAL
555 # define LT_DLGLOBAL RTLD_GLOBAL
556 #else
557 # ifdef DL_GLOBAL
558 # define LT_DLGLOBAL DL_GLOBAL
559 # else
560 # define LT_DLGLOBAL 0
561 # endif
562 #endif
563
564 /* We may have to define LT_DLLAZY_OR_NOW in the command line if we
565 find out it does not work in some platform. */
566 #ifndef LT_DLLAZY_OR_NOW
567 # ifdef RTLD_LAZY
568 # define LT_DLLAZY_OR_NOW RTLD_LAZY
569 # else
570 # ifdef DL_LAZY
571 # define LT_DLLAZY_OR_NOW DL_LAZY
572 # else
573 # ifdef RTLD_NOW
574 # define LT_DLLAZY_OR_NOW RTLD_NOW
575 # else
576 # ifdef DL_NOW
577 # define LT_DLLAZY_OR_NOW DL_NOW
578 # else
579 # define LT_DLLAZY_OR_NOW 0
580 # endif
581 # endif
582 # endif
583 # endif
584 #endif
585
586 #ifdef __cplusplus
587 extern "C" void exit (int);
588 #endif
589
590 void fnord() { int i=42;}
591 int main ()
592 {
593 void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
594 int status = $lt_dlunknown;
595
596 if (self)
597 {
598 if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
599 else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
600 /* dlclose (self); */
601 }
602
603 exit (status);
604 }]
605 EOF
606 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
607 (./conftest; exit; ) 2>/dev/null
608 lt_status=$?
609 case x$lt_status in
610 x$lt_dlno_uscore) $1 ;;
611 x$lt_dlneed_uscore) $2 ;;
612 x$lt_unknown|x*) $3 ;;
613 esac
614 else :
615 # compilation failed
616 $3
617 fi
618 fi
619 rm -fr conftest*
620 ])# _LT_AC_TRY_DLOPEN_SELF
621
622 # AC_LIBTOOL_DLOPEN_SELF
623 # -------------------
624 AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
625 [if test "x$enable_dlopen" != xyes; then
626 enable_dlopen=unknown
627 enable_dlopen_self=unknown
628 enable_dlopen_self_static=unknown
629 else
630 lt_cv_dlopen=no
631 lt_cv_dlopen_libs=
632
633 case $host_os in
634 beos*)
635 lt_cv_dlopen="load_add_on"
636 lt_cv_dlopen_libs=
637 lt_cv_dlopen_self=yes
638 ;;
639
640 cygwin* | mingw* | pw32*)
641 lt_cv_dlopen="LoadLibrary"
642 lt_cv_dlopen_libs=
643 ;;
644
645 *)
646 AC_CHECK_FUNC([shl_load],
647 [lt_cv_dlopen="shl_load"],
648 [AC_CHECK_LIB([dld], [shl_load],
649 [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
650 [AC_CHECK_FUNC([dlopen],
651 [lt_cv_dlopen="dlopen"],
652 [AC_CHECK_LIB([dl], [dlopen],
653 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
654 [AC_CHECK_LIB([svld], [dlopen],
655 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
656 [AC_CHECK_LIB([dld], [dld_link],
657 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
658 ])
659 ])
660 ])
661 ])
662 ])
663 ;;
664 esac
665
666 if test "x$lt_cv_dlopen" != xno; then
667 enable_dlopen=yes
668 else
669 enable_dlopen=no
670 fi
671
672 case $lt_cv_dlopen in
673 dlopen)
674 save_CPPFLAGS="$CPPFLAGS"
675 AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
676 test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
677
678 save_LDFLAGS="$LDFLAGS"
679 eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
680
681 save_LIBS="$LIBS"
682 LIBS="$lt_cv_dlopen_libs $LIBS"
683
684 AC_CACHE_CHECK([whether a program can dlopen itself],
685 lt_cv_dlopen_self, [dnl
686 _LT_AC_TRY_DLOPEN_SELF(
687 lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
688 lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
689 ])
690
691 if test "x$lt_cv_dlopen_self" = xyes; then
692 LDFLAGS="$LDFLAGS $link_static_flag"
693 AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
694 lt_cv_dlopen_self_static, [dnl
695 _LT_AC_TRY_DLOPEN_SELF(
696 lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
697 lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
698 ])
699 fi
700
701 CPPFLAGS="$save_CPPFLAGS"
702 LDFLAGS="$save_LDFLAGS"
703 LIBS="$save_LIBS"
704 ;;
705 esac
706
707 case $lt_cv_dlopen_self in
708 yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
709 *) enable_dlopen_self=unknown ;;
710 esac
711
712 case $lt_cv_dlopen_self_static in
713 yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
714 *) enable_dlopen_self_static=unknown ;;
715 esac
716 fi
717 ])# AC_LIBTOOL_DLOPEN_SELF
718
719 AC_DEFUN([_LT_AC_LTCONFIG_HACK],
720 [AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
721 # Sed substitution that helps us do robust quoting. It backslashifies
722 # metacharacters that are still active within double-quoted strings.
723 Xsed='sed -e s/^X//'
724 sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g'
725
726 # Same as above, but do not quote variable references.
727 double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g'
728
729 # Sed substitution to delay expansion of an escaped shell variable in a
730 # double_quote_subst'ed string.
731 delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
732
733 # Constants:
734 rm="rm -f"
735
736 # Global variables:
737 default_ofile=libtool
738 can_build_shared=yes
739
740 # All known linkers require a `.a' archive for static linking (except M$VC,
741 # which needs '.lib').
742 libext=a
743 ltmain="$ac_aux_dir/ltmain.sh"
744 ofile="$default_ofile"
745 with_gnu_ld="$lt_cv_prog_gnu_ld"
746 need_locks="$enable_libtool_lock"
747
748 old_CC="$CC"
749 old_CFLAGS="$CFLAGS"
750
751 # Set sane defaults for various variables
752 test -z "$AR" && AR=ar
753 test -z "$AR_FLAGS" && AR_FLAGS=cru
754 test -z "$AS" && AS=as
755 test -z "$CC" && CC=cc
756 test -z "$DLLTOOL" && DLLTOOL=dlltool
757 test -z "$LD" && LD=ld
758 test -z "$LN_S" && LN_S="ln -s"
759 test -z "$MAGIC_CMD" && MAGIC_CMD=file
760 test -z "$NM" && NM=nm
761 test -z "$OBJDUMP" && OBJDUMP=objdump
762 test -z "$RANLIB" && RANLIB=:
763 test -z "$STRIP" && STRIP=:
764 test -z "$ac_objext" && ac_objext=o
765
766 if test x"$host" != x"$build"; then
767 ac_tool_prefix=${host_alias}-
768 else
769 ac_tool_prefix=
770 fi
771
772 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
773 case $host_os in
774 linux-gnu*) ;;
775 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
776 esac
777
778 case $host_os in
779 aix3*)
780 # AIX sometimes has problems with the GCC collect2 program. For some
781 # reason, if we set the COLLECT_NAMES environment variable, the problems
782 # vanish in a puff of smoke.
783 if test "X${COLLECT_NAMES+set}" != Xset; then
784 COLLECT_NAMES=
785 export COLLECT_NAMES
786 fi
787 ;;
788 esac
789
790 # Determine commands to create old-style static archives.
791 old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
792 old_postinstall_cmds='chmod 644 $oldlib'
793 old_postuninstall_cmds=
794
795 if test -n "$RANLIB"; then
796 case $host_os in
797 openbsd*)
798 old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
799 ;;
800 *)
801 old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
802 ;;
803 esac
804 old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
805 fi
806
807 # Allow CC to be a program name with arguments.
808 set dummy $CC
809 compiler="[$]2"
810
811 ## FIXME: this should be a separate macro
812 ##
813 AC_MSG_CHECKING([for objdir])
814 rm -f .libs 2>/dev/null
815 mkdir .libs 2>/dev/null
816 if test -d .libs; then
817 objdir=.libs
818 else
819 # MS-DOS does not allow filenames that begin with a dot.
820 objdir=_libs
821 fi
822 rmdir .libs 2>/dev/null
823 AC_MSG_RESULT($objdir)
824 ##
825 ## END FIXME
826
827
828 ## FIXME: this should be a separate macro
829 ##
830 AC_ARG_WITH(pic,
831 [ --with-pic try to use only PIC/non-PIC objects [default=use both]],
832 pic_mode="$withval", pic_mode=default)
833 test -z "$pic_mode" && pic_mode=default
834
835 # We assume here that the value for lt_cv_prog_cc_pic will not be cached
836 # in isolation, and that seeing it set (from the cache) indicates that
837 # the associated values are set (in the cache) correctly too.
838 AC_MSG_CHECKING([for $compiler option to produce PIC])
839 AC_CACHE_VAL(lt_cv_prog_cc_pic,
840 [ lt_cv_prog_cc_pic=
841 lt_cv_prog_cc_shlib=
842 lt_cv_prog_cc_wl=
843 lt_cv_prog_cc_static=
844 lt_cv_prog_cc_no_builtin=
845 lt_cv_prog_cc_can_build_shared=$can_build_shared
846
847 if test "$GCC" = yes; then
848 lt_cv_prog_cc_wl='-Wl,'
849 lt_cv_prog_cc_static='-static'
850
851 case $host_os in
852 aix*)
853 # Below there is a dirty hack to force normal static linking with -ldl
854 # The problem is because libdl dynamically linked with both libc and
855 # libC (AIX C++ library), which obviously doesn't included in libraries
856 # list by gcc. This cause undefined symbols with -static flags.
857 # This hack allows C programs to be linked with "-static -ldl", but
858 # not sure about C++ programs.
859 lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
860 ;;
861 amigaos*)
862 # FIXME: we need at least 68020 code to build shared libraries, but
863 # adding the `-m68020' flag to GCC prevents building anything better,
864 # like `-m68040'.
865 lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
866 ;;
867 beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
868 # PIC is the default for these OSes.
869 ;;
870 darwin* | rhapsody*)
871 # PIC is the default on this platform
872 # Common symbols not allowed in MH_DYLIB files
873 lt_cv_prog_cc_pic='-fno-common'
874 ;;
875 cygwin* | mingw* | pw32* | os2*)
876 # This hack is so that the source file can tell whether it is being
877 # built for inclusion in a dll (and should export symbols for example).
878 lt_cv_prog_cc_pic='-DDLL_EXPORT'
879 ;;
880 sysv4*MP*)
881 if test -d /usr/nec; then
882 lt_cv_prog_cc_pic=-Kconform_pic
883 fi
884 ;;
885 *)
886 lt_cv_prog_cc_pic='-fPIC'
887 ;;
888 esac
889 else
890 # PORTME Check for PIC flags for the system compiler.
891 case $host_os in
892 aix3* | aix4* | aix5*)
893 lt_cv_prog_cc_wl='-Wl,'
894 # All AIX code is PIC.
895 if test "$host_cpu" = ia64; then
896 # AIX 5 now supports IA64 processor
897 lt_cv_prog_cc_static='-Bstatic'
898 else
899 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
900 fi
901 ;;
902
903 hpux9* | hpux10* | hpux11*)
904 # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
905 lt_cv_prog_cc_wl='-Wl,'
906 lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
907 lt_cv_prog_cc_pic='+Z'
908 ;;
909
910 irix5* | irix6*)
911 lt_cv_prog_cc_wl='-Wl,'
912 lt_cv_prog_cc_static='-non_shared'
913 # PIC (with -KPIC) is the default.
914 ;;
915
916 cygwin* | mingw* | pw32* | os2*)
917 # This hack is so that the source file can tell whether it is being
918 # built for inclusion in a dll (and should export symbols for example).
919 lt_cv_prog_cc_pic='-DDLL_EXPORT'
920 ;;
921
922 newsos6)
923 lt_cv_prog_cc_pic='-KPIC'
924 lt_cv_prog_cc_static='-Bstatic'
925 ;;
926
927 osf3* | osf4* | osf5*)
928 # All OSF/1 code is PIC.
929 lt_cv_prog_cc_wl='-Wl,'
930 lt_cv_prog_cc_static='-non_shared'
931 ;;
932
933 sco3.2v5*)
934 lt_cv_prog_cc_pic='-Kpic'
935 lt_cv_prog_cc_static='-dn'
936 lt_cv_prog_cc_shlib='-belf'
937 ;;
938
939 solaris*)
940 lt_cv_prog_cc_pic='-KPIC'
941 lt_cv_prog_cc_static='-Bstatic'
942 lt_cv_prog_cc_wl='-Wl,'
943 ;;
944
945 sunos4*)
946 lt_cv_prog_cc_pic='-PIC'
947 lt_cv_prog_cc_static='-Bstatic'
948 lt_cv_prog_cc_wl='-Qoption ld '
949 ;;
950
951 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
952 lt_cv_prog_cc_pic='-KPIC'
953 lt_cv_prog_cc_static='-Bstatic'
954 if test "x$host_vendor" = xsni; then
955 lt_cv_prog_cc_wl='-LD'
956 else
957 lt_cv_prog_cc_wl='-Wl,'
958 fi
959 ;;
960
961 uts4*)
962 lt_cv_prog_cc_pic='-pic'
963 lt_cv_prog_cc_static='-Bstatic'
964 ;;
965
966 sysv4*MP*)
967 if test -d /usr/nec ;then
968 lt_cv_prog_cc_pic='-Kconform_pic'
969 lt_cv_prog_cc_static='-Bstatic'
970 fi
971 ;;
972
973 *)
974 lt_cv_prog_cc_can_build_shared=no
975 ;;
976 esac
977 fi
978 ])
979 if test -z "$lt_cv_prog_cc_pic"; then
980 AC_MSG_RESULT([none])
981 else
982 AC_MSG_RESULT([$lt_cv_prog_cc_pic])
983
984 # Check to make sure the pic_flag actually works.
985 AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
986 AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
987 save_CFLAGS="$CFLAGS"
988 CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
989 AC_TRY_COMPILE([], [], [dnl
990 case $host_os in
991 hpux9* | hpux10* | hpux11*)
992 # On HP-UX, both CC and GCC only warn that PIC is supported... then
993 # they create non-PIC objects. So, if there were any warnings, we
994 # assume that PIC is not supported.
995 if test -s conftest.err; then
996 lt_cv_prog_cc_pic_works=no
997 else
998 lt_cv_prog_cc_pic_works=yes
999 fi
1000 ;;
1001 *)
1002 lt_cv_prog_cc_pic_works=yes
1003 ;;
1004 esac
1005 ], [dnl
1006 lt_cv_prog_cc_pic_works=no
1007 ])
1008 CFLAGS="$save_CFLAGS"
1009 ])
1010
1011 if test "X$lt_cv_prog_cc_pic_works" = Xno; then
1012 lt_cv_prog_cc_pic=
1013 lt_cv_prog_cc_can_build_shared=no
1014 else
1015 lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
1016 fi
1017
1018 AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
1019 fi
1020 ##
1021 ## END FIXME
1022
1023 # Check for any special shared library compilation flags.
1024 if test -n "$lt_cv_prog_cc_shlib"; then
1025 AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
1026 if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then :
1027 else
1028 AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
1029 lt_cv_prog_cc_can_build_shared=no
1030 fi
1031 fi
1032
1033 ## FIXME: this should be a separate macro
1034 ##
1035 AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
1036 AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
1037 lt_cv_prog_cc_static_works=no
1038 save_LDFLAGS="$LDFLAGS"
1039 LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
1040 AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
1041 LDFLAGS="$save_LDFLAGS"
1042 ])
1043
1044 # Belt *and* braces to stop my trousers falling down:
1045 test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
1046 AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
1047
1048 pic_flag="$lt_cv_prog_cc_pic"
1049 special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
1050 wl="$lt_cv_prog_cc_wl"
1051 link_static_flag="$lt_cv_prog_cc_static"
1052 no_builtin_flag="$lt_cv_prog_cc_no_builtin"
1053 can_build_shared="$lt_cv_prog_cc_can_build_shared"
1054 ##
1055 ## END FIXME
1056
1057
1058 ## FIXME: this should be a separate macro
1059 ##
1060 # Check to see if options -o and -c are simultaneously supported by compiler
1061 AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
1062 AC_CACHE_VAL([lt_cv_compiler_c_o], [
1063 $rm -r conftest 2>/dev/null
1064 mkdir conftest
1065 cd conftest
1066 echo "int some_variable = 0;" > conftest.$ac_ext
1067 mkdir out
1068 # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
1069 # that will create temporary files in the current directory regardless of
1070 # the output directory. Thus, making CWD read-only will cause this test
1071 # to fail, enabling locking or at least warning the user not to do parallel
1072 # builds.
1073 chmod -w .
1074 save_CFLAGS="$CFLAGS"
1075 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
1076 compiler_c_o=no
1077 if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
1078 # The compiler can only warn and ignore the option if not recognized
1079 # So say no if there are warnings
1080 if test -s out/conftest.err; then
1081 lt_cv_compiler_c_o=no
1082 else
1083 lt_cv_compiler_c_o=yes
1084 fi
1085 else
1086 # Append any errors to the config.log.
1087 cat out/conftest.err 1>&AC_FD_CC
1088 lt_cv_compiler_c_o=no
1089 fi
1090 CFLAGS="$save_CFLAGS"
1091 chmod u+w .
1092 $rm conftest* out/*
1093 rmdir out
1094 cd ..
1095 rmdir conftest
1096 $rm -r conftest 2>/dev/null
1097 ])
1098 compiler_c_o=$lt_cv_compiler_c_o
1099 AC_MSG_RESULT([$compiler_c_o])
1100
1101 if test x"$compiler_c_o" = x"yes"; then
1102 # Check to see if we can write to a .lo
1103 AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
1104 AC_CACHE_VAL([lt_cv_compiler_o_lo], [
1105 lt_cv_compiler_o_lo=no
1106 save_CFLAGS="$CFLAGS"
1107 CFLAGS="$CFLAGS -c -o conftest.lo"
1108 save_objext="$ac_objext"
1109 ac_objext=lo
1110 AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
1111 # The compiler can only warn and ignore the option if not recognized
1112 # So say no if there are warnings
1113 if test -s conftest.err; then
1114 lt_cv_compiler_o_lo=no
1115 else
1116 lt_cv_compiler_o_lo=yes
1117 fi
1118 ])
1119 ac_objext="$save_objext"
1120 CFLAGS="$save_CFLAGS"
1121 ])
1122 compiler_o_lo=$lt_cv_compiler_o_lo
1123 AC_MSG_RESULT([$compiler_o_lo])
1124 else
1125 compiler_o_lo=no
1126 fi
1127 ##
1128 ## END FIXME
1129
1130 ## FIXME: this should be a separate macro
1131 ##
1132 # Check to see if we can do hard links to lock some files if needed
1133 hard_links="nottested"
1134 if test "$compiler_c_o" = no && test "$need_locks" != no; then
1135 # do not overwrite the value of need_locks provided by the user
1136 AC_MSG_CHECKING([if we can lock with hard links])
1137 hard_links=yes
1138 $rm conftest*
1139 ln conftest.a conftest.b 2>/dev/null && hard_links=no
1140 touch conftest.a
1141 ln conftest.a conftest.b 2>&5 || hard_links=no
1142 ln conftest.a conftest.b 2>/dev/null && hard_links=no
1143 AC_MSG_RESULT([$hard_links])
1144 if test "$hard_links" = no; then
1145 AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
1146 need_locks=warn
1147 fi
1148 else
1149 need_locks=no
1150 fi
1151 ##
1152 ## END FIXME
1153
1154 ## FIXME: this should be a separate macro
1155 ##
1156 if test "$GCC" = yes; then
1157 # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
1158 AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
1159 echo "int some_variable = 0;" > conftest.$ac_ext
1160 save_CFLAGS="$CFLAGS"
1161 CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
1162 compiler_rtti_exceptions=no
1163 AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
1164 # The compiler can only warn and ignore the option if not recognized
1165 # So say no if there are warnings
1166 if test -s conftest.err; then
1167 compiler_rtti_exceptions=no
1168 else
1169 compiler_rtti_exceptions=yes
1170 fi
1171 ])
1172 CFLAGS="$save_CFLAGS"
1173 AC_MSG_RESULT([$compiler_rtti_exceptions])
1174
1175 if test "$compiler_rtti_exceptions" = "yes"; then
1176 no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
1177 else
1178 no_builtin_flag=' -fno-builtin'
1179 fi
1180 fi
1181 ##
1182 ## END FIXME
1183
1184 ## FIXME: this should be a separate macro
1185 ##
1186 # See if the linker supports building shared libraries.
1187 AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
1188
1189 allow_undefined_flag=
1190 no_undefined_flag=
1191 need_lib_prefix=unknown
1192 need_version=unknown
1193 # when you set need_version to no, make sure it does not cause -set_version
1194 # flags to be left without arguments
1195 archive_cmds=
1196 archive_expsym_cmds=
1197 old_archive_from_new_cmds=
1198 old_archive_from_expsyms_cmds=
1199 export_dynamic_flag_spec=
1200 whole_archive_flag_spec=
1201 thread_safe_flag_spec=
1202 hardcode_into_libs=no
1203 hardcode_libdir_flag_spec=
1204 hardcode_libdir_separator=
1205 hardcode_direct=no
1206 hardcode_minus_L=no
1207 hardcode_shlibpath_var=unsupported
1208 runpath_var=
1209 link_all_deplibs=unknown
1210 always_export_symbols=no
1211 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
1212 # include_expsyms should be a list of space-separated symbols to be *always*
1213 # included in the symbol list
1214 include_expsyms=
1215 # exclude_expsyms can be an egrep regular expression of symbols to exclude
1216 # it will be wrapped by ` (' and `)$', so one must not match beginning or
1217 # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
1218 # as well as any symbol that contains `d'.
1219 exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
1220 # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
1221 # platforms (ab)use it in PIC code, but their linkers get confused if
1222 # the symbol is explicitly referenced. Since portable code cannot
1223 # rely on this symbol name, it's probably fine to never include it in
1224 # preloaded symbol tables.
1225 extract_expsyms_cmds=
1226
1227 case $host_os in
1228 cygwin* | mingw* | pw32*)
1229 # FIXME: the MSVC++ port hasn't been tested in a loooong time
1230 # When not using gcc, we currently assume that we are using
1231 # Microsoft Visual C++.
1232 if test "$GCC" != yes; then
1233 with_gnu_ld=no
1234 fi
1235 ;;
1236 openbsd*)
1237 with_gnu_ld=no
1238 ;;
1239 esac
1240
1241 ld_shlibs=yes
1242 if test "$with_gnu_ld" = yes; then
1243 # If archive_cmds runs LD, not CC, wlarc should be empty
1244 wlarc='${wl}'
1245
1246 # See if GNU ld supports shared libraries.
1247 case $host_os in
1248 aix3* | aix4* | aix5*)
1249 # On AIX, the GNU linker is very broken
1250 # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
1251 ld_shlibs=no
1252 cat <&2
1253
1254 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
1255 *** to be unable to reliably create shared libraries on AIX.
1256 *** Therefore, libtool is disabling shared libraries support. If you
1257 *** really care for shared libraries, you may want to modify your PATH
1258 *** so that a non-GNU linker is found, and then restart.
1259
1260 EOF
1261 ;;
1262
1263 amigaos*)
1264 archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
1265 hardcode_libdir_flag_spec='-L$libdir'
1266 hardcode_minus_L=yes
1267
1268 # Samuel A. Falvo II reports
1269 # that the semantics of dynamic libraries on AmigaOS, at least up
1270 # to version 4, is to share data among multiple programs linked
1271 # with the same dynamic library. Since this doesn't match the
1272 # behavior of shared libraries on other platforms, we can use
1273 # them.
1274 ld_shlibs=no
1275 ;;
1276
1277 beos*)
1278 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
1279 allow_undefined_flag=unsupported
1280 # Joseph Beckenbach says some releases of gcc
1281 # support --undefined. This deserves some investigation. FIXME
1282 archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1283 else
1284 ld_shlibs=no
1285 fi
1286 ;;
1287
1288 cygwin* | mingw* | pw32*)
1289 # hardcode_libdir_flag_spec is actually meaningless, as there is
1290 # no search path for DLLs.
1291 hardcode_libdir_flag_spec='-L$libdir'
1292 allow_undefined_flag=unsupported
1293 always_export_symbols=yes
1294
1295 extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
1296 sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
1297 test -f $output_objdir/impgen.exe || (cd $output_objdir && \
1298 if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
1299 else $CC -o impgen impgen.c ; fi)~
1300 $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
1301
1302 old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
1303
1304 # cygwin and mingw dlls have different entry points and sets of symbols
1305 # to exclude.
1306 # FIXME: what about values for MSVC?
1307 dll_entry=__cygwin_dll_entry@12
1308 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
1309 case $host_os in
1310 mingw*)
1311 # mingw values
1312 dll_entry=_DllMainCRTStartup@12
1313 dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
1314 ;;
1315 esac
1316
1317 # mingw and cygwin differ, and it's simplest to just exclude the union
1318 # of the two symbol sets.
1319 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
1320
1321 # recent cygwin and mingw systems supply a stub DllMain which the user
1322 # can override, but on older systems we have to supply one (in ltdll.c)
1323 if test "x$lt_cv_need_dllmain" = "xyes"; then
1324 ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
1325 ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
1326 test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
1327 else
1328 ltdll_obj=
1329 ltdll_cmds=
1330 fi
1331
1332 # Extract the symbol export list from an `--export-all' def file,
1333 # then regenerate the def file from the symbol export list, so that
1334 # the compiled dll only exports the symbol export list.
1335 # Be careful not to strip the DATA tag left be newer dlltools.
1336 export_symbols_cmds="$ltdll_cmds"'
1337 $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
1338 sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
1339
1340 # If the export-symbols file already is a .def file (1st line
1341 # is EXPORTS), use it as is.
1342 # If DATA tags from a recent dlltool are present, honour them!
1343 archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
1344 cp $export_symbols $output_objdir/$soname-def;
1345 else
1346 echo EXPORTS > $output_objdir/$soname-def;
1347 _lt_hint=1;
1348 cat $export_symbols | while read symbol; do
1349 set dummy \$symbol;
1350 case \[$]# in
1351 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
1352 *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
1353 esac;
1354 _lt_hint=`expr 1 + \$_lt_hint`;
1355 done;
1356 fi~
1357 '"$ltdll_cmds"'
1358 $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
1359 $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
1360 $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
1361 $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
1362 $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
1363 ;;
1364
1365 netbsd*)
1366 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
1367 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
1368 wlarc=
1369 else
1370 archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1371 archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
1372 fi
1373 ;;
1374
1375 solaris* | sysv5*)
1376 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
1377 ld_shlibs=no
1378 cat <&2
1379
1380 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
1381 *** create shared libraries on Solaris systems. Therefore, libtool
1382 *** is disabling shared libraries support. We urge you to upgrade GNU
1383 *** binutils to release 2.9.1 or newer. Another option is to modify
1384 *** your PATH or compiler configuration so that the native linker is
1385 *** used, and then restart.
1386
1387 EOF
1388 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
1389 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1390 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
1391 else
1392 ld_shlibs=no
1393 fi
1394 ;;
1395
1396 sunos4*)
1397 archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
1398 wlarc=
1399 hardcode_direct=yes
1400 hardcode_shlibpath_var=no
1401 ;;
1402
1403 *)
1404 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
1405 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1406 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
1407 else
1408 ld_shlibs=no
1409 fi
1410 ;;
1411 esac
1412
1413 if test "$ld_shlibs" = yes; then
1414 runpath_var=LD_RUN_PATH
1415 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
1416 export_dynamic_flag_spec='${wl}--export-dynamic'
1417 case $host_os in
1418 cygwin* | mingw* | pw32*)
1419 # dlltool doesn't understand --whole-archive et. al.
1420 whole_archive_flag_spec=
1421 ;;
1422 *)
1423 # ancient GNU ld didn't support --whole-archive et. al.
1424 if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
1425 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
1426 else
1427 whole_archive_flag_spec=
1428 fi
1429 ;;
1430 esac
1431 fi
1432 else
1433 # PORTME fill in a description of your system's linker (not GNU ld)
1434 case $host_os in
1435 aix3*)
1436 allow_undefined_flag=unsupported
1437 always_export_symbols=yes
1438 archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
1439 # Note: this linker hardcodes the directories in LIBPATH if there
1440 # are no directories specified by -L.
1441 hardcode_minus_L=yes
1442 if test "$GCC" = yes && test -z "$link_static_flag"; then
1443 # Neither direct hardcoding nor static linking is supported with a
1444 # broken collect2.
1445 hardcode_direct=unsupported
1446 fi
1447 ;;
1448
1449 aix4* | aix5*)
1450 if test "$host_cpu" = ia64; then
1451 # On IA64, the linker does run time linking by default, so we don't
1452 # have to do anything special.
1453 aix_use_runtimelinking=no
1454 exp_sym_flag='-Bexport'
1455 no_entry_flag=""
1456 else
1457 aix_use_runtimelinking=no
1458
1459 # Test if we are trying to use run time linking or normal
1460 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
1461 # need to do runtime linking.
1462 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
1463 for ld_flag in $LDFLAGS; do
1464 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
1465 aix_use_runtimelinking=yes
1466 break
1467 fi
1468 done
1469 esac
1470
1471 exp_sym_flag='-bexport'
1472 no_entry_flag='-bnoentry'
1473 fi
1474
1475 # When large executables or shared objects are built, AIX ld can
1476 # have problems creating the table of contents. If linking a library
1477 # or program results in "error TOC overflow" add -mminimal-toc to
1478 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
1479 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
1480
1481 hardcode_direct=yes
1482 archive_cmds=''
1483 hardcode_libdir_separator=':'
1484 if test "$GCC" = yes; then
1485 case $host_os in aix4.[[012]]|aix4.[[012]].*)
1486 collect2name=`${CC} -print-prog-name=collect2`
1487 if test -f "$collect2name" && \
1488 strings "$collect2name" | grep resolve_lib_name >/dev/null
1489 then
1490 # We have reworked collect2
1491 hardcode_direct=yes
1492 else
1493 # We have old collect2
1494 hardcode_direct=unsupported
1495 # It fails to find uninstalled libraries when the uninstalled
1496 # path is not listed in the libpath. Setting hardcode_minus_L
1497 # to unsupported forces relinking
1498 hardcode_minus_L=yes
1499 hardcode_libdir_flag_spec='-L$libdir'
1500 hardcode_libdir_separator=
1501 fi
1502 esac
1503
1504 shared_flag='-shared'
1505 else
1506 # not using gcc
1507 if test "$host_cpu" = ia64; then
1508 shared_flag='${wl}-G'
1509 else
1510 if test "$aix_use_runtimelinking" = yes; then
1511 shared_flag='${wl}-G'
1512 else
1513 shared_flag='${wl}-bM:SRE'
1514 fi
1515 fi
1516 fi
1517
1518 # It seems that -bexpall can do strange things, so it is better to
1519 # generate a list of symbols to export.
1520 always_export_symbols=yes
1521 if test "$aix_use_runtimelinking" = yes; then
1522 # Warning - without using the other runtime loading flags (-brtl),
1523 # -berok will link without error, but may produce a broken library.
1524 allow_undefined_flag='-berok'
1525 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
1526 archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
1527 else
1528 if test "$host_cpu" = ia64; then
1529 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
1530 allow_undefined_flag="-z nodefs"
1531 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
1532 else
1533 hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
1534 # Warning - without using the other run time loading flags,
1535 # -berok will link without error, but may produce a broken library.
1536 allow_undefined_flag='${wl}-berok'
1537 # This is a bit strange, but is similar to how AIX traditionally builds
1538 # it's shared libraries.
1539 archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
1540 fi
1541 fi
1542 ;;
1543
1544 amigaos*)
1545 archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
1546 hardcode_libdir_flag_spec='-L$libdir'
1547 hardcode_minus_L=yes
1548 # see comment about different semantics on the GNU ld section
1549 ld_shlibs=no
1550 ;;
1551
1552 cygwin* | mingw* | pw32*)
1553 # When not using gcc, we currently assume that we are using
1554 # Microsoft Visual C++.
1555 # hardcode_libdir_flag_spec is actually meaningless, as there is
1556 # no search path for DLLs.
1557 hardcode_libdir_flag_spec=' '
1558 allow_undefined_flag=unsupported
1559 # Tell ltmain to make .lib files, not .a files.
1560 libext=lib
1561 # FIXME: Setting linknames here is a bad hack.
1562 archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
1563 # The linker will automatically build a .lib file if we build a DLL.
1564 old_archive_from_new_cmds='true'
1565 # FIXME: Should let the user specify the lib program.
1566 old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
1567 fix_srcfile_path='`cygpath -w "$srcfile"`'
1568 ;;
1569
1570 darwin* | rhapsody*)
1571 case "$host_os" in
1572 rhapsody* | darwin1.[[012]])
1573 allow_undefined_flag='-undefined suppress'
1574 ;;
1575 *) # Darwin 1.3 on
1576 allow_undefined_flag='-flat_namespace -undefined suppress'
1577 ;;
1578 esac
1579 # FIXME: Relying on posixy $() will cause problems for
1580 # cross-compilation, but unfortunately the echo tests do not
1581 # yet detect zsh echo's removal of \ escapes.
1582 archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring'
1583 # We need to add '_' to the symbols in $export_symbols first
1584 #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
1585 hardcode_direct=yes
1586 hardcode_shlibpath_var=no
1587 whole_archive_flag_spec='-all_load $convenience'
1588 ;;
1589
1590 freebsd1*)
1591 ld_shlibs=no
1592 ;;
1593
1594 # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
1595 # support. Future versions do this automatically, but an explicit c++rt0.o
1596 # does not break anything, and helps significantly (at the cost of a little
1597 # extra space).
1598 freebsd2.2*)
1599 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
1600 hardcode_libdir_flag_spec='-R$libdir'
1601 hardcode_direct=yes
1602 hardcode_shlibpath_var=no
1603 ;;
1604
1605 # Unfortunately, older versions of FreeBSD 2 do not have this feature.
1606 freebsd2*)
1607 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
1608 hardcode_direct=yes
1609 hardcode_minus_L=yes
1610 hardcode_shlibpath_var=no
1611 ;;
1612
1613 # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
1614 freebsd*)
1615 archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
1616 hardcode_libdir_flag_spec='-R$libdir'
1617 hardcode_direct=yes
1618 hardcode_shlibpath_var=no
1619 ;;
1620
1621 hpux9* | hpux10* | hpux11*)
1622 case $host_os in
1623 hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
1624 *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
1625 esac
1626 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
1627 hardcode_libdir_separator=:
1628 hardcode_direct=yes
1629 hardcode_minus_L=yes # Not in the search PATH, but as the default
1630 # location of the library.
1631 export_dynamic_flag_spec='${wl}-E'
1632 ;;
1633
1634 irix5* | irix6*)
1635 if test "$GCC" = yes; then
1636 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1637 else
1638 archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
1639 fi
1640 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1641 hardcode_libdir_separator=:
1642 link_all_deplibs=yes
1643 ;;
1644
1645 netbsd*)
1646 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
1647 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
1648 else
1649 archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
1650 fi
1651 hardcode_libdir_flag_spec='-R$libdir'
1652 hardcode_direct=yes
1653 hardcode_shlibpath_var=no
1654 ;;
1655
1656 newsos6)
1657 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
1658 hardcode_direct=yes
1659 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1660 hardcode_libdir_separator=:
1661 hardcode_shlibpath_var=no
1662 ;;
1663
1664 openbsd*)
1665 hardcode_direct=yes
1666 hardcode_shlibpath_var=no
1667 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
1668 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
1669 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
1670 export_dynamic_flag_spec='${wl}-E'
1671 else
1672 case "$host_os" in
1673 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
1674 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
1675 hardcode_libdir_flag_spec='-R$libdir'
1676 ;;
1677 *)
1678 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
1679 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
1680 ;;
1681 esac
1682 fi
1683 ;;
1684
1685 os2*)
1686 hardcode_libdir_flag_spec='-L$libdir'
1687 hardcode_minus_L=yes
1688 allow_undefined_flag=unsupported
1689 archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
1690 old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
1691 ;;
1692
1693 osf3*)
1694 if test "$GCC" = yes; then
1695 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
1696 archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1697 else
1698 allow_undefined_flag=' -expect_unresolved \*'
1699 archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
1700 fi
1701 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1702 hardcode_libdir_separator=:
1703 ;;
1704
1705 osf4* | osf5*) # as osf3* with the addition of -msym flag
1706 if test "$GCC" = yes; then
1707 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
1708 archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
1709 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1710 else
1711 allow_undefined_flag=' -expect_unresolved \*'
1712 archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
1713 archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
1714 $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
1715
1716 #Both c and cxx compiler support -rpath directly
1717 hardcode_libdir_flag_spec='-rpath $libdir'
1718 fi
1719 hardcode_libdir_separator=:
1720 ;;
1721
1722 sco3.2v5*)
1723 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
1724 hardcode_shlibpath_var=no
1725 runpath_var=LD_RUN_PATH
1726 hardcode_runpath_var=yes
1727 export_dynamic_flag_spec='${wl}-Bexport'
1728 ;;
1729
1730 solaris*)
1731 # gcc --version < 3.0 without binutils cannot create self contained
1732 # shared libraries reliably, requiring libgcc.a to resolve some of
1733 # the object symbols generated in some cases. Libraries that use
1734 # assert need libgcc.a to resolve __eprintf, for example. Linking
1735 # a copy of libgcc.a into every shared library to guarantee resolving
1736 # such symbols causes other problems: According to Tim Van Holder
1737 # , C++ libraries end up with a separate
1738 # (to the application) exception stack for one thing.
1739 no_undefined_flag=' -z defs'
1740 if test "$GCC" = yes; then
1741 case `$CC --version 2>/dev/null` in
1742 [[12]].*)
1743 cat <&2
1744
1745 *** Warning: Releases of GCC earlier than version 3.0 cannot reliably
1746 *** create self contained shared libraries on Solaris systems, without
1747 *** introducing a dependency on libgcc.a. Therefore, libtool is disabling
1748 *** -no-undefined support, which will at least allow you to build shared
1749 *** libraries. However, you may find that when you link such libraries
1750 *** into an application without using GCC, you have to manually add
1751 *** \`gcc --print-libgcc-file-name\` to the link command. We urge you to
1752 *** upgrade to a newer version of GCC. Another option is to rebuild your
1753 *** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
1754
1755 EOF
1756 no_undefined_flag=
1757 ;;
1758 esac
1759 fi
1760 # $CC -shared without GNU ld will not create a library from C++
1761 # object files and a static libstdc++, better avoid it by now
1762 archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
1763 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
1764 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
1765 hardcode_libdir_flag_spec='-R$libdir'
1766 hardcode_shlibpath_var=no
1767 case $host_os in
1768 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
1769 *) # Supported since Solaris 2.6 (maybe 2.5.1?)
1770 whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
1771 esac
1772 link_all_deplibs=yes
1773 ;;
1774
1775 sunos4*)
1776 if test "x$host_vendor" = xsequent; then
1777 # Use $CC to link under sequent, because it throws in some extra .o
1778 # files that make .init and .fini sections work.
1779 archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
1780 else
1781 archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
1782 fi
1783 hardcode_libdir_flag_spec='-L$libdir'
1784 hardcode_direct=yes
1785 hardcode_minus_L=yes
1786 hardcode_shlibpath_var=no
1787 ;;
1788
1789 sysv4)
1790 if test "x$host_vendor" = xsno; then
1791 archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags'
1792 hardcode_direct=yes # is this really true???
1793 else
1794 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
1795 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
1796 fi